All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com>
To: Jerome Brunet <jbrunet@baylibre.com>
Cc: Mark Brown <broonie@kernel.org>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Hsin-Yi Wang <hsinyi@google.com>
Subject: Re: [PATCH] ASoC: hdmi-codec: fix missing report for jack initial status
Date: Tue, 19 Dec 2023 13:28:18 +0800	[thread overview]
Message-ID: <CADYyEwT0vba5+JQdTESi8xh4vKtB+1rPfnnRyuDn=V_OMUPFMQ@mail.gmail.com> (raw)
In-Reply-To: <20231218145655.134929-1-jbrunet@baylibre.com>

Tested-by: Zhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com>

On Mon, Dec 18, 2023 at 10:57 PM Jerome Brunet <jbrunet@baylibre.com> wrote:

> This fixes a problem introduced while fixing ELD reporting with no jack
> set.
>
> Most driver using the hdmi-codec will call the 'plugged_cb' callback
> directly when registered to report the initial state of the HDMI connector.
>
> With the commit mentionned, this occurs before jack is ready and the
> initial report is lost for platforms actually providing a jack for HDMI.
>
> Fix this by storing the hdmi connector status regardless of jack being set
> or not and report the last status when jack gets set.
>
> With this, the initial state is reported correctly even if it is
> disconnected. This was not done initially and is also a fix.
>
> Fixes: 15be353d55f9 ("ASoC: hdmi-codec: register hpd callback on component
> probe")
> Reported-by: Zhengqiao Xia <xiazhengqiao@huaqin.corp-partner.google.com>
> Closes:
> https://lore.kernel.org/alsa-devel/CADYyEwTNyY+fR9SgfDa-g6iiDwkU3MUdPVCYexs2_3wbcM8_vg@mail.gmail.com/
> Cc: Hsin-Yi Wang <hsinyi@google.com>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> ---
>  sound/soc/codecs/hdmi-codec.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
> index 20da1eaa4f1c..0938671700c6 100644
> --- a/sound/soc/codecs/hdmi-codec.c
> +++ b/sound/soc/codecs/hdmi-codec.c
> @@ -850,8 +850,9 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai)
>  static void hdmi_codec_jack_report(struct hdmi_codec_priv *hcp,
>                                    unsigned int jack_status)
>  {
> -       if (hcp->jack && jack_status != hcp->jack_status) {
> -               snd_soc_jack_report(hcp->jack, jack_status,
> SND_JACK_LINEOUT);
> +       if (jack_status != hcp->jack_status) {
> +               if (hcp->jack)
> +                       snd_soc_jack_report(hcp->jack, jack_status,
> SND_JACK_LINEOUT);
>                 hcp->jack_status = jack_status;
>         }
>  }
> @@ -880,6 +881,13 @@ static int hdmi_codec_set_jack(struct
> snd_soc_component *component,
>
>         if (hcp->hcd.ops->hook_plugged_cb) {
>                 hcp->jack = jack;
> +
> +               /*
> +                * Report the initial jack status which may have been
> provided
> +                * by the parent hdmi driver while the hpd hook was
> registered.
> +                */
> +               snd_soc_jack_report(jack, hcp->jack_status,
> SND_JACK_LINEOUT);
> +
>                 return 0;
>         }
>
> --
> 2.42.0
>
>

  reply	other threads:[~2024-01-02 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 14:56 [PATCH] ASoC: hdmi-codec: fix missing report for jack initial status Jerome Brunet
2023-12-19  5:28 ` Zhengqiao Xia [this message]
2023-12-19 16:05 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADYyEwT0vba5+JQdTESi8xh4vKtB+1rPfnnRyuDn=V_OMUPFMQ@mail.gmail.com' \
    --to=xiazhengqiao@huaqin.corp-partner.google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hsinyi@google.com \
    --cc=jbrunet@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.