Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <rf@opensource.cirrus.com>
Fixes: 1cad8725f2b9 ("ASoC: cs-amp-lib: Add helpers for factory calibration data")
Link: https://patch.msgid.link/20240822133544.304421-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Richard Fitzgerald and committed by
Mark Brown
bb448556 bff980d8

+6 -1
+6 -1
sound/soc/codecs/cs-amp-lib.c
··· 182 182 for (i = 0; i < efi_data->count; ++i) { 183 183 u64 cal_target = cs_amp_cal_target_u64(&efi_data->data[i]); 184 184 185 + /* Skip empty entries */ 186 + if (!efi_data->data[i].calTime[0] && !efi_data->data[i].calTime[1]) 187 + continue; 188 + 185 189 /* Skip entries with unpopulated silicon ID */ 186 190 if (cal_target == 0) 187 191 continue; ··· 197 193 } 198 194 } 199 195 200 - if (!cal && (amp_index >= 0) && (amp_index < efi_data->count)) { 196 + if (!cal && (amp_index >= 0) && (amp_index < efi_data->count) && 197 + (efi_data->data[amp_index].calTime[0] || efi_data->data[amp_index].calTime[1])) { 201 198 u64 cal_target = cs_amp_cal_target_u64(&efi_data->data[amp_index]); 202 199 203 200 /*