alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] drm/bridge: dw-hdmi-i2s: set insert_pcuv bit if hardware supports it
       [not found] ` <YwOEPpO0gux+njQe@sirena.org.uk>
@ 2022-08-22 14:35   ` Geraldo Nascimento
  2022-08-23 14:46   ` Geraldo Nascimento
  1 sibling, 0 replies; 3+ messages in thread
From: Geraldo Nascimento @ 2022-08-22 14:35 UTC (permalink / raw)
  To: Mark Brown; +Cc: Sugar Zhang, ALSA-devel, Kuninori Morimoto

On Mon, Aug 22, 2022 at 02:27:26PM +0100, Mark Brown wrote:
> On Sat, Aug 20, 2022 at 09:36:53PM -0300, Geraldo Nascimento wrote:
> 
> > +	/*
> > +	 * dw-hdmi introduced insert_pcuv bit in version 2.10a.
> > +	 * When set (1'b1), this bit enables the insertion of the PCUV
> > +	 * (Parity, Channel Status, User bit and Validity) bits on the
> > +	 * incoming audio stream (support limited to Linear PCM audio)
> > +	 */
> > +
> > +	if (hdmi_read(audio, HDMI_DESIGN_ID) >= 0x21)
> > +		conf2 |= HDMI_AUD_CONF2_INSERT_PCUV;
> 
> So what if we're not handlign linear PCM?

Good question, Mark. For HBR and NL-PCM there are different bits that
need to be set in aud_conf2 Sample Register, and then insert_pcuv bit
needs to be dropped.

I don't have a sink handy however to test the other modes. Do you have
a suggestion on how to make this the default for L-PCM specifically?

Thanks,
Geraldo Nascimento

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

* Re: [PATCH] drm/bridge: dw-hdmi-i2s: set insert_pcuv bit if hardware supports it
       [not found] ` <YwOEPpO0gux+njQe@sirena.org.uk>
  2022-08-22 14:35   ` [PATCH] drm/bridge: dw-hdmi-i2s: set insert_pcuv bit if hardware supports it Geraldo Nascimento
@ 2022-08-23 14:46   ` Geraldo Nascimento
  2022-08-23 16:20     ` Mark Brown
  1 sibling, 1 reply; 3+ messages in thread
From: Geraldo Nascimento @ 2022-08-23 14:46 UTC (permalink / raw)
  To: Mark Brown; +Cc: Sugar Zhang, ALSA-devel, Kuninori Morimoto

On Mon, Aug 22, 2022 at 02:27:26PM +0100, Mark Brown wrote:
> On Sat, Aug 20, 2022 at 09:36:53PM -0300, Geraldo Nascimento wrote:
> 
> > +	/*
> > +	 * dw-hdmi introduced insert_pcuv bit in version 2.10a.
> > +	 * When set (1'b1), this bit enables the insertion of the PCUV
> > +	 * (Parity, Channel Status, User bit and Validity) bits on the
> > +	 * incoming audio stream (support limited to Linear PCM audio)
> > +	 */
> > +
> > +	if (hdmi_read(audio, HDMI_DESIGN_ID) >= 0x21)
> > +		conf2 |= HDMI_AUD_CONF2_INSERT_PCUV;
> 
> So what if we're not handlign linear PCM?

Hi Mark,

I think we may be able to restrict the fix for L-PCM only by checking
byte 0 of iec.status, specifically bit 1. Our define is called
IEC958_AES0_NONAUDIO but https://tech.ebu.ch/docs/tech/tech3250.pdf
calls it the "Linear PCM identification" bit. There's also a
supplement to AES/EBU 3250 in https://tech.ebu.ch/docs/n/n009_1.pdf

Let me know if the following is OK. I'll be happy to submit V2 if
it is.

Thanks,
Geraldo Nascimento

--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
@@ -42,6 +42,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
 	struct dw_hdmi *hdmi = audio->hdmi;
 	u8 conf0 = 0;
 	u8 conf1 = 0;
+	u8 conf2 = 0;
 	u8 inputclkfs = 0;
 
 	/* it cares I2S only */
@@ -101,6 +102,18 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
 		return -EINVAL;
 	}
 
+	/*
+	 * dw-hdmi introduced insert_pcuv bit in version 2.10a.
+	 * When set (1'b1), this bit enables the insertion of the PCUV
+	 * (Parity, Channel Status, User bit and Validity) bits on the
+	 * incoming audio stream (support limited to Linear PCM audio)
+	 */
+
+	if (hdmi_read(audio, HDMI_DESIGN_ID) >= 0x21 &&
+			!(hparms->iec.status[0] & IEC958_AES0_NONAUDIO))
+		conf2 = HDMI_AUD_CONF2_INSERT_PCUV;
+
 	dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate);
 	dw_hdmi_set_channel_status(hdmi, hparms->iec.status);
 	dw_hdmi_set_channel_count(hdmi, hparms->channels);
@@ -109,6 +122,7 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
 	hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS);
 	hdmi_write(audio, conf0, HDMI_AUD_CONF0);
 	hdmi_write(audio, conf1, HDMI_AUD_CONF1);
+	hdmi_write(audio, conf2, HDMI_AUD_CONF2);
 
 	return 0;
 }

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

* Re: [PATCH] drm/bridge: dw-hdmi-i2s: set insert_pcuv bit if hardware supports it
  2022-08-23 14:46   ` Geraldo Nascimento
@ 2022-08-23 16:20     ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-08-23 16:20 UTC (permalink / raw)
  To: Geraldo Nascimento; +Cc: Sugar Zhang, ALSA-devel, Kuninori Morimoto

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

On Tue, Aug 23, 2022 at 11:46:38AM -0300, Geraldo Nascimento wrote:

> I think we may be able to restrict the fix for L-PCM only by checking
> byte 0 of iec.status, specifically bit 1. Our define is called
> IEC958_AES0_NONAUDIO but https://tech.ebu.ch/docs/tech/tech3250.pdf
> calls it the "Linear PCM identification" bit. There's also a
> supplement to AES/EBU 3250 in https://tech.ebu.ch/docs/n/n009_1.pdf

> Let me know if the following is OK. I'll be happy to submit V2 if
> it is.

LGTM, though I don't really know anything about the hardware
specifically.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-08-23 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <YwF+JYR5DxLBnE8F@geday>
     [not found] ` <YwOEPpO0gux+njQe@sirena.org.uk>
2022-08-22 14:35   ` [PATCH] drm/bridge: dw-hdmi-i2s: set insert_pcuv bit if hardware supports it Geraldo Nascimento
2022-08-23 14:46   ` Geraldo Nascimento
2022-08-23 16:20     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).