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

ASoC: sun8i-codec: Fix build with CONFIG_SND_JACK_INPUT_DEV disabled

When CONFIG_SND_JACK_INPUT_DEV is disabled, struct snd_jack doesn't
have 'type' field. We can't rely on this field being always present,
so store the jack_type in the codec driver itself.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403261243.kcXCPAYs-lkp@intel.com/
Link: https://msgid.link/r/20240327080542.3649840-1-megi@xff.cz
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Ondrej Jirman and committed by
Mark Brown
559aebe4 cc983803

+7 -7
+7 -7
sound/soc/sunxi/sun8i-codec.c
··· 232 232 struct delayed_work jack_work; 233 233 int jack_irq; 234 234 int jack_status; 235 + int jack_type; 235 236 int jack_last_sample; 236 237 ktime_t jack_hbias_ready; 237 238 struct mutex jack_mutex; ··· 1353 1352 struct sun8i_codec *scodec = container_of(work, struct sun8i_codec, 1354 1353 jack_work.work); 1355 1354 unsigned int mdata; 1356 - int type_mask = scodec->jack->jack->type; 1357 1355 int type; 1358 1356 1359 1357 guard(mutex)(&scodec->jack_mutex); ··· 1363 1363 1364 1364 scodec->jack_last_sample = -1; 1365 1365 1366 - if (type_mask & SND_JACK_MICROPHONE) { 1366 + if (scodec->jack_type & SND_JACK_MICROPHONE) { 1367 1367 /* 1368 1368 * If we were in disconnected state, we enable HBIAS and 1369 1369 * wait 600ms before reading initial HDATA value. ··· 1376 1376 scodec->jack_status = SUN8I_JACK_STATUS_WAITING_HBIAS; 1377 1377 } else { 1378 1378 snd_soc_jack_report(scodec->jack, SND_JACK_HEADPHONE, 1379 - type_mask); 1379 + scodec->jack_type); 1380 1380 scodec->jack_status = SUN8I_JACK_STATUS_CONNECTED; 1381 1381 } 1382 1382 } else if (scodec->jack_status == SUN8I_JACK_STATUS_WAITING_HBIAS) { ··· 1417 1417 if (type == SND_JACK_HEADPHONE) 1418 1418 sun8i_codec_set_hmic_bias(scodec, false); 1419 1419 1420 - snd_soc_jack_report(scodec->jack, type, type_mask); 1420 + snd_soc_jack_report(scodec->jack, type, scodec->jack_type); 1421 1421 scodec->jack_status = SUN8I_JACK_STATUS_CONNECTED; 1422 1422 } else if (scodec->jack_status == SUN8I_JACK_STATUS_CONNECTED) { 1423 1423 if (scodec->last_hmic_irq != SUN8I_HMIC_STS_JACK_OUT_IRQ_ST) 1424 1424 return; 1425 1425 1426 1426 scodec->jack_status = SUN8I_JACK_STATUS_DISCONNECTED; 1427 - if (type_mask & SND_JACK_MICROPHONE) 1427 + if (scodec->jack_type & SND_JACK_MICROPHONE) 1428 1428 sun8i_codec_set_hmic_bias(scodec, false); 1429 1429 1430 - snd_soc_jack_report(scodec->jack, 0, type_mask); 1430 + snd_soc_jack_report(scodec->jack, 0, scodec->jack_type); 1431 1431 } 1432 1432 } 1433 1433 ··· 1491 1491 if (scodec->jack_last_sample >= 0 && 1492 1492 scodec->jack_last_sample == value) 1493 1493 snd_soc_jack_report(scodec->jack, type, 1494 - scodec->jack->jack->type); 1494 + scodec->jack_type); 1495 1495 1496 1496 scodec->jack_last_sample = value; 1497 1497 }