All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda/hdmi: Enable HBR capability
@ 2026-10-19  2:16 ` Aaron Kling
  0 siblings, 0 replies; 4+ messages in thread
From: Aaron Kling via B4 Relay @ 2026-10-19  2:16 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Thierry Reding, Jonathan Hunter
  Cc: linux-sound, linux-tegra, linux-kernel, Aaron Kling

From: Aaron Kling <webgeek1234@gmail.com>

Tegra HDA does not set the HBR capability bit, however every SoC since
Tegra114 does support HBR. Override the hbr setup function for these
SoCs to unconditionally enable the feature. Since Tegra30 does not
support HBR, this function will report invalid on that SoC.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
Before this, any attempt to open an hbr stream resulted in a rejection
on Tegra hardware. Looking at the downstream support, that just bypassed
the capbility check for all supported Tegra hardware in the common code.
This replicates that in a driver specific hook.

This has been tested on a SHIELD TV 2019 Pro trying to bitstream an
Atmos demo video. It attempts to play, but mostly just underruns the
entire time, with a few spurts of correct noise. My expectation is that
issue is userspace, since that is a WIP android audio hal. But even if
there are more kernel problems, this should be correct as a standalone
change.
---
 sound/hda/codecs/hdmi/tegrahdmi.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/sound/hda/codecs/hdmi/tegrahdmi.c b/sound/hda/codecs/hdmi/tegrahdmi.c
index ebb6410a48313..c4d8d8a570542 100644
--- a/sound/hda/codecs/hdmi/tegrahdmi.c
+++ b/sound/hda/codecs/hdmi/tegrahdmi.c
@@ -227,6 +227,41 @@ static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
 	return 0;
 }
 
+static int tegrahdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
+				   int dev_id, bool hbr)
+{
+	int pinctl, new_pinctl;
+
+	// Tegra 3 does not support HBR
+	if (codec->core.vendor_id == 0x10de0020)
+		return -EINVAL;
+
+	snd_hda_set_dev_select(codec, pin_nid, dev_id);
+	pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+
+	if (pinctl < 0)
+		return hbr ? -EINVAL : 0;
+
+	new_pinctl = pinctl & ~AC_PINCTL_EPT;
+	if (hbr)
+		new_pinctl |= AC_PINCTL_EPT_HBR;
+	else
+		new_pinctl |= AC_PINCTL_EPT_NATIVE;
+
+	codec_dbg(codec, "%s: NID=0x%x, %spinctl=0x%x\n",
+		    __func__, pin_nid,
+		    pinctl == new_pinctl ? "" : "new-",
+		    new_pinctl);
+
+	if (pinctl != new_pinctl)
+		snd_hda_codec_write(codec, pin_nid, 0,
+				    AC_VERB_SET_PIN_WIDGET_CONTROL,
+				    new_pinctl);
+
+	return 0;
+}
+
 static int tegra_hdmi_init(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
@@ -255,6 +290,8 @@ static int tegra_hdmi_init(struct hda_codec *codec)
 	spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
 	spec->nv_dp_workaround = true;
 
+	spec->ops.pin_hbr_setup = tegrahdmi_pin_hbr_setup;
+
 	return 0;
 }
 

---
base-commit: 2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261018-tegra-hda-hbr-35107238b629

Best regards,
-- 
Aaron Kling <webgeek1234@gmail.com>



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ALSA: hda/hdmi: Enable HBR capability
@ 2026-10-19  2:16 ` Aaron Kling
  0 siblings, 0 replies; 4+ messages in thread
From: Aaron Kling @ 2026-10-19  2:16 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Thierry Reding, Jonathan Hunter
  Cc: linux-sound, linux-tegra, linux-kernel, Aaron Kling

Tegra HDA does not set the HBR capability bit, however every SoC since
Tegra114 does support HBR. Override the hbr setup function for these
SoCs to unconditionally enable the feature. Since Tegra30 does not
support HBR, this function will report invalid on that SoC.

Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
---
Before this, any attempt to open an hbr stream resulted in a rejection
on Tegra hardware. Looking at the downstream support, that just bypassed
the capbility check for all supported Tegra hardware in the common code.
This replicates that in a driver specific hook.

This has been tested on a SHIELD TV 2019 Pro trying to bitstream an
Atmos demo video. It attempts to play, but mostly just underruns the
entire time, with a few spurts of correct noise. My expectation is that
issue is userspace, since that is a WIP android audio hal. But even if
there are more kernel problems, this should be correct as a standalone
change.
---
 sound/hda/codecs/hdmi/tegrahdmi.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/sound/hda/codecs/hdmi/tegrahdmi.c b/sound/hda/codecs/hdmi/tegrahdmi.c
index ebb6410a48313..c4d8d8a570542 100644
--- a/sound/hda/codecs/hdmi/tegrahdmi.c
+++ b/sound/hda/codecs/hdmi/tegrahdmi.c
@@ -227,6 +227,41 @@ static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
 	return 0;
 }
 
+static int tegrahdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
+				   int dev_id, bool hbr)
+{
+	int pinctl, new_pinctl;
+
+	// Tegra 3 does not support HBR
+	if (codec->core.vendor_id == 0x10de0020)
+		return -EINVAL;
+
+	snd_hda_set_dev_select(codec, pin_nid, dev_id);
+	pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+				    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+
+	if (pinctl < 0)
+		return hbr ? -EINVAL : 0;
+
+	new_pinctl = pinctl & ~AC_PINCTL_EPT;
+	if (hbr)
+		new_pinctl |= AC_PINCTL_EPT_HBR;
+	else
+		new_pinctl |= AC_PINCTL_EPT_NATIVE;
+
+	codec_dbg(codec, "%s: NID=0x%x, %spinctl=0x%x\n",
+		    __func__, pin_nid,
+		    pinctl == new_pinctl ? "" : "new-",
+		    new_pinctl);
+
+	if (pinctl != new_pinctl)
+		snd_hda_codec_write(codec, pin_nid, 0,
+				    AC_VERB_SET_PIN_WIDGET_CONTROL,
+				    new_pinctl);
+
+	return 0;
+}
+
 static int tegra_hdmi_init(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
@@ -255,6 +290,8 @@ static int tegra_hdmi_init(struct hda_codec *codec)
 	spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
 	spec->nv_dp_workaround = true;
 
+	spec->ops.pin_hbr_setup = tegrahdmi_pin_hbr_setup;
+
 	return 0;
 }
 

---
base-commit: 2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261018-tegra-hda-hbr-35107238b629

Best regards,
-- 
Aaron Kling <webgeek1234@gmail.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda/hdmi: Enable HBR capability
  2026-10-19  2:16 ` Aaron Kling
  (?)
@ 2026-10-19  8:47 ` Takashi Iwai
  2026-10-19 17:29   ` Aaron Kling
  -1 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2026-10-19  8:47 UTC (permalink / raw)
  To: webgeek1234
  Cc: Jaroslav Kysela, Takashi Iwai, Thierry Reding, Jonathan Hunter,
	linux-sound, linux-tegra, linux-kernel

On Mon, 19 Oct 2026 04:16:31 +0200,
Aaron Kling via B4 Relay wrote:
> 
> From: Aaron Kling <webgeek1234@gmail.com>
> 
> Tegra HDA does not set the HBR capability bit, however every SoC since
> Tegra114 does support HBR. Override the hbr setup function for these
> SoCs to unconditionally enable the feature. Since Tegra30 does not
> support HBR, this function will report invalid on that SoC.
> 
> Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> ---
> Before this, any attempt to open an hbr stream resulted in a rejection
> on Tegra hardware. Looking at the downstream support, that just bypassed
> the capbility check for all supported Tegra hardware in the common code.
> This replicates that in a driver specific hook.
> 
> This has been tested on a SHIELD TV 2019 Pro trying to bitstream an
> Atmos demo video. It attempts to play, but mostly just underruns the
> entire time, with a few spurts of correct noise. My expectation is that
> issue is userspace, since that is a WIP android audio hal. But even if
> there are more kernel problems, this should be correct as a standalone
> change.
> ---
>  sound/hda/codecs/hdmi/tegrahdmi.c | 37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/sound/hda/codecs/hdmi/tegrahdmi.c b/sound/hda/codecs/hdmi/tegrahdmi.c
> index ebb6410a48313..c4d8d8a570542 100644
> --- a/sound/hda/codecs/hdmi/tegrahdmi.c
> +++ b/sound/hda/codecs/hdmi/tegrahdmi.c
> @@ -227,6 +227,41 @@ static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
>  	return 0;
>  }
>  
> +static int tegrahdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
> +				   int dev_id, bool hbr)
> +{
> +	int pinctl, new_pinctl;
> +
> +	// Tegra 3 does not support HBR
> +	if (codec->core.vendor_id == 0x10de0020)
> +		return -EINVAL;

I guess this will break the HDMI on old Tegra.

Better to enable pin_hbr_setup conditionally for newer chips below, so
that the older chip continues to work without HBR.

> +	spec->ops.pin_hbr_setup = tegrahdmi_pin_hbr_setup;


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: hda/hdmi: Enable HBR capability
  2026-10-19  8:47 ` Takashi Iwai
@ 2026-10-19 17:29   ` Aaron Kling
  0 siblings, 0 replies; 4+ messages in thread
From: Aaron Kling @ 2026-10-19 17:29 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Jaroslav Kysela, Takashi Iwai, Thierry Reding, Jonathan Hunter,
	linux-sound, linux-tegra, linux-kernel

On Mon, Oct 19, 2026 at 3:47 AM Takashi Iwai <tiwai@suse.de> wrote:
>
> On Mon, 19 Oct 2026 04:16:31 +0200,
> Aaron Kling via B4 Relay wrote:
> >
> > From: Aaron Kling <webgeek1234@gmail.com>
> >
> > Tegra HDA does not set the HBR capability bit, however every SoC since
> > Tegra114 does support HBR. Override the hbr setup function for these
> > SoCs to unconditionally enable the feature. Since Tegra30 does not
> > support HBR, this function will report invalid on that SoC.
> >
> > Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
> > ---
> > Before this, any attempt to open an hbr stream resulted in a rejection
> > on Tegra hardware. Looking at the downstream support, that just bypassed
> > the capbility check for all supported Tegra hardware in the common code.
> > This replicates that in a driver specific hook.
> >
> > This has been tested on a SHIELD TV 2019 Pro trying to bitstream an
> > Atmos demo video. It attempts to play, but mostly just underruns the
> > entire time, with a few spurts of correct noise. My expectation is that
> > issue is userspace, since that is a WIP android audio hal. But even if
> > there are more kernel problems, this should be correct as a standalone
> > change.
> > ---
> >  sound/hda/codecs/hdmi/tegrahdmi.c | 37 +++++++++++++++++++++++++++++++++++++
> >  1 file changed, 37 insertions(+)
> >
> > diff --git a/sound/hda/codecs/hdmi/tegrahdmi.c b/sound/hda/codecs/hdmi/tegrahdmi.c
> > index ebb6410a48313..c4d8d8a570542 100644
> > --- a/sound/hda/codecs/hdmi/tegrahdmi.c
> > +++ b/sound/hda/codecs/hdmi/tegrahdmi.c
> > @@ -227,6 +227,41 @@ static int nvhdmi_chmap_validate(struct hdac_chmap *chmap,
> >       return 0;
> >  }
> >
> > +static int tegrahdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
> > +                                int dev_id, bool hbr)
> > +{
> > +     int pinctl, new_pinctl;
> > +
> > +     // Tegra 3 does not support HBR
> > +     if (codec->core.vendor_id == 0x10de0020)
> > +             return -EINVAL;
>
> I guess this will break the HDMI on old Tegra.
>
> Better to enable pin_hbr_setup conditionally for newer chips below, so
> that the older chip continues to work without HBR.

Mmm. I was trying to replicate what the default version of this
function does when hbr isn't supported, but it does look like I missed
part of it. Blocking the override entirely is simpler, will do in a
new revision.

Aaron

>
> > +     spec->ops.pin_hbr_setup = tegrahdmi_pin_hbr_setup;
>
>
> thanks,
>
> Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-19 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19  2:16 [PATCH] ALSA: hda/hdmi: Enable HBR capability Aaron Kling via B4 Relay
2026-10-19  2:16 ` Aaron Kling
2026-10-19  8:47 ` Takashi Iwai
2026-10-19 17:29   ` Aaron Kling

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.