Re: [PATCH v2 1/3] ASoC: SOF: Intel: hda: Resume codec to do jack detection

From: Kai Vehmanen
Date: Tue Jan 05 2021 - 08:02:46 EST


Hi,

On Mon, 4 Jan 2021, Kai-Heng Feng wrote:

> Instead of queueing jackpoll_work, runtime resume the codec to let it
> use different jack detection methods based on jackpoll_interval.

hmm, but jackpoll_work() does the same thing, right? So end result should
be the same.

> This matches SOF driver's behavior with commit a6e7d0a4bdb0 ("ALSA: hda:
> fix jack detection with Realtek codecs when in D3"). Since SOF only uses
> Realtek codec, we don't need any additional check for the resume.

This is not quite correct. First, SOF does support any HDA codec, not just
Realteks (see e.g. https://github.com/thesofproject/linux/issues/1807),
and second, this doesn't really match the hda_intel.c patch you mention.
SOF implements a more conservative approach where we basicly assume
codec->forced_resume=1 to always apply, and do not implement support for
codec->relaxed_resume. So the above patch doesn't fully apply to SOF as
the design is not same.

> diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
> index 6875fa570c2c..df59c79cfdfc 100644
> --- a/sound/soc/sof/intel/hda-codec.c
> +++ b/sound/soc/sof/intel/hda-codec.c
> @@ -93,8 +93,7 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev)
> * has been recorded in STATESTS
> */
> if (codec->jacktbl.used)
> - schedule_delayed_work(&codec->jackpoll_work,
> - codec->jackpoll_interval);
> + pm_request_resume(&codec->core.dev);

I think this change is still good. Just drop the but about Realtek
codecs from commit message and maybe s/matches/aligns/.

Br, Kai