Skip to content

Commit bb44855

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: cs-amp-lib: Ignore empty UEFI calibration entries
If the timestamp of a calibration entry is 0 it is an unused entry and must be ignored. Some end-products reserve EFI space for calibration entries by shipping with a zero-filled EFI file. When searching the file for calibration data the driver must skip the empty entries. The timestamp of a valid entry is always non-zero. Signed-off-by: Richard Fitzgerald <[email protected]> Fixes: 1cad872 ("ASoC: cs-amp-lib: Add helpers for factory calibration data") Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent bff980d commit bb44855

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sound/soc/codecs/cs-amp-lib.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ static int _cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid,
182182
for (i = 0; i < efi_data->count; ++i) {
183183
u64 cal_target = cs_amp_cal_target_u64(&efi_data->data[i]);
184184

185+
/* Skip empty entries */
186+
if (!efi_data->data[i].calTime[0] && !efi_data->data[i].calTime[1])
187+
continue;
188+
185189
/* Skip entries with unpopulated silicon ID */
186190
if (cal_target == 0)
187191
continue;
@@ -193,7 +197,8 @@ static int _cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid,
193197
}
194198
}
195199

196-
if (!cal && (amp_index >= 0) && (amp_index < efi_data->count)) {
200+
if (!cal && (amp_index >= 0) && (amp_index < efi_data->count) &&
201+
(efi_data->data[amp_index].calTime[0] || efi_data->data[amp_index].calTime[1])) {
197202
u64 cal_target = cs_amp_cal_target_u64(&efi_data->data[amp_index]);
198203

199204
/*

0 commit comments

Comments
 (0)