diff mbox series

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

Message ID 20210104140853.228448-1-kai.heng.feng@canonical.com (mailing list archive)
State Superseded
Headers show
Series [v2,1/3] ASoC: SOF: Intel: hda: Resume codec to do jack detection | expand

Commit Message

Kai-Heng Feng Jan. 4, 2021, 2:08 p.m. UTC
Instead of queueing jackpoll_work, runtime resume the codec to let it
use different jack detection methods based on jackpoll_interval.

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.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v2:
 No change.

 sound/soc/sof/intel/hda-codec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Kai Vehmanen Jan. 5, 2021, 12:57 p.m. UTC | #1
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
Kai-Heng Feng Jan. 7, 2021, 4 a.m. UTC | #2
On Tue, Jan 5, 2021 at 9:00 PM Kai Vehmanen
<kai.vehmanen@linux.intel.com> wrote:
>
> 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.

It depends on the jackpoll_interval value. But yes the 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.

OK, I assumed SOF always use Realtek codec, so codec->forced_resume=1
is always applied like the other patch.
I'll remove this section.

>
> > 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/.

OK, will do.

Kai-Heng

>
> Br, Kai
diff mbox series

Patch

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);
 }
 #else
 void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev) {}