Skip to contentSkip to conversation

OMAPDSS: HDMI audio compliance fixes

PATCH In review Jyri Sarha 3 participants 9 messages Apr 22, 2015 – Jun 3, 2015

Subsystems (4)
lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

cover OMAPDSS: HDMI audio compliance fixes

I have rebased these patches from ti-linux-3.14.y on top of Linux 4.0.0. I tested them briefly on OMAP4 and OMAP5 in my environment, but I could not test any channel count beyond stereo. However, there were no conflicts in the rebase and each fix makes sense when looking at the chip TRM and the relevant HDMI specs.

All the changes are really minor, but most of them apply to OMAPDSS side, so it is probably best to merge them trough there.

Best regards,
Jyri

Misael Lopez Cruz (5):
OMAPDSS: HDMI4: Set correct CC for 8-channels layout
OMAPDSS: HDMI5: Set valid sample order
OMAPDSS: HDMI5: Fix AUDICONF3 bitfield offsets
ASoC: omap-hdmi-audio: Force channel allocation only for OMAP4
ASoC: omap-hdmi-audio: Fix invalid combination of DM_INH and CA

 drivers/video/fbdev/omap2/dss/hdmi4_core.c | 12 +++++++++++-
 drivers/video/fbdev/omap2/dss/hdmi5_core.c |  5 ++++-
 sound/soc/omap/omap-hdmi-audio.c           | 12 +++++++-----
 3 files changed, 22 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/5 OMAPDSS: HDMI4: Set correct CC for 8-channels layout

From: Misael Lopez Cruz <[email protected]>

OMAP4 HDMI IP uses the 8-channel layout with 8-channel speaker allocation mask when transmitting more than two channels. But the channel count field (CC) of the Audio InfoFrame's DB1 is not updated for 8-channels.

As per HDMI Compliance Test 7.31 "Audio InfoFrame", CC = 7 is required for 8-channels CA masks (0x13 and 0x1F).

---
 drivers/video/fbdev/omap2/dss/hdmi4_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/video/fbdev/omap2/dss/hdmi4_core.c +4 -1
index 7eafea5..2b8bd22 100644
@@ -795,7 +795,9 @@ int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
 
 	/*
 	 * the HDMI IP needs to enable four stereo channels when transmitting
-	 * more than 2 audio channels
+	 * more than 2 audio channels.  Similarly, the channel count in the
+	 * Audio InfoFrame has to match the sample_present bits (some channels
+	 * are padded with zeroes)
 	 */
 	if (channel_count == 2) {
 		audio_format.stereo_channels = HDMI_AUDIO_STEREO_ONECHANNEL;
@@ -807,6 +809,7 @@ int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
 				HDMI_AUDIO_I2S_SD1_EN | HDMI_AUDIO_I2S_SD2_EN |
 				HDMI_AUDIO_I2S_SD3_EN;
 		acore.layout = HDMI_AUDIO_LAYOUT_8CH;
+		audio->cea->db1_ct_cc = 7;
 	}
 
 	acore.en_spdif = false;
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/5 OMAPDSS: HDMI5: Set valid sample order

In reply to Jyri Sarha

From: Misael Lopez Cruz <[email protected]>

As per TRM, HDMI_WP_AUDIO_CFG[2] LEFT_BEFORE = 0 is reserved, so it must always be set to 1 (the first sample is the left).

---
 drivers/video/fbdev/omap2/dss/hdmi5_core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/video/fbdev/omap2/dss/hdmi5_core.c +1 -0
index a3cfe3d..7a80beb 100644
@@ -870,6 +870,7 @@ int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
 	audio_format.samples_per_word = HDMI_AUDIO_ONEWORD_TWOSAMPLES;
 	audio_format.sample_size = HDMI_AUDIO_SAMPLE_16BITS;
 	audio_format.justification = HDMI_AUDIO_JUSTIFY_LEFT;
+	audio_format.sample_order = HDMI_AUDIO_SAMPLE_LEFT_FIRST;
 
 	/* only LPCM atm */
 	audio_format.type = HDMI_AUDIO_TYPE_LPCM;
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 3/5 OMAPDSS: HDMI5: Fix AUDICONF3 bitfield offsets

In reply to Jyri Sarha

From: Misael Lopez Cruz <[email protected]>

Downmix inhibit in HDMI_CORE_FC_AUDICONF3 register is in bit 4 while CEA861_AUDIO_INFOFRAME_DB5_DM_INH sets bit 7.

---
 drivers/video/fbdev/omap2/dss/hdmi5_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/fbdev/omap2/dss/hdmi5_core.c +3 -1
index 7a80beb..c3286bd 100644
@@ -790,7 +790,9 @@ static void hdmi5_core_audio_infoframe_cfg(struct hdmi_core_data *core,
 
 	hdmi_write_reg(base, HDMI_CORE_FC_AUDICONF1, info_aud->db2_sf_ss);
 	hdmi_write_reg(base, HDMI_CORE_FC_AUDICONF2, info_aud->db4_ca);
-	hdmi_write_reg(base, HDMI_CORE_FC_AUDICONF3, info_aud->db5_dminh_lsv);
+	hdmi_write_reg(base, HDMI_CORE_FC_AUDICONF3,
+	  (info_aud->db5_dminh_lsv & CEA861_AUDIO_INFOFRAME_DB5_DM_INH) >> 3 |
+	  (info_aud->db5_dminh_lsv & CEA861_AUDIO_INFOFRAME_DB5_LSV));
 }
 
 int hdmi5_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 4/5 ASoC: omap-hdmi-audio: Force channel allocation only for OMAP4

In reply to Jyri Sarha

From: Misael Lopez Cruz <[email protected]>

There is a constraint in the OMAP4 HDMI IP that requires to use the 8-channel code when transmitting more than two channels.

The constraint doesn't apply for OMAP5 so don't force the channel allocation in the sound driver as it can be done specifically for OMAP4 later in the hdmi4 core.

---
 drivers/video/fbdev/omap2/dss/hdmi4_core.c | 7 +++++++
 sound/soc/omap/omap-hdmi-audio.c           | 6 ++----
 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/video/fbdev/omap2/dss/hdmi4_core.c +7 -0
index 2b8bd22..fa72e73 100644
@@ -654,6 +654,13 @@ static void hdmi_core_audio_infoframe_cfg(struct hdmi_core_data *core,
 	hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(2), info_aud->db3);
 	sum += info_aud->db3;
 
+	/*
+	 * The OMAP HDMI IP requires to use the 8-channel channel code when
+	 * transmitting more than two channels.
+	 */
+	if (info_aud->db4_ca != 0x00)
+		info_aud->db4_ca = 0x13;
+
 	hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_DBYTE(3), info_aud->db4_ca);
 	sum += info_aud->db4_ca;
 
sound/soc/omap/omap-hdmi-audio.c +2 -4
index 4775da4..8df303f 100644
@@ -210,12 +210,10 @@ static int hdmi_dai_hw_params(struct snd_pcm_substream *substream,
 
 	cea->db3 = 0; /* not used, all zeros */
 
-	/*
-	 * The OMAP HDMI IP requires to use the 8-channel channel code when
-	 * transmitting more than two channels.
-	 */
 	if (params_channels(params) == 2)
 		cea->db4_ca = 0x0;
+	else if (params_channels(params) == 6)
+		cea->db4_ca = 0xb;
 	else
 		cea->db4_ca = 0x13;
 
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH 5/5 ASoC: omap-hdmi-audio: Fix invalid combination of DM_INH and CA

In reply to Jyri Sarha

From: Misael Lopez Cruz <[email protected]>

DM_INH = 1 (stereo downmix prohibited) and CA = 0x00 (Channel
Allocation: FR, FL) is an invalid combination according to the HDMI Compliance Test 7.31 "Audio InfoFrame".

---
 sound/soc/omap/omap-hdmi-audio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/omap/omap-hdmi-audio.c +5 -1
index 8df303f..aeef25c 100644
@@ -217,7 +217,11 @@ static int hdmi_dai_hw_params(struct snd_pcm_substream *substream,
 	else
 		cea->db4_ca = 0x13;
 
-	cea->db5_dminh_lsv = CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED;
+	if (cea->db4_ca == 0x00)
+		cea->db5_dminh_lsv = CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PERMITTED;
+	else
+		cea->db5_dminh_lsv = CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED;
+
 	/* the expression is trivial but makes clear what we are doing */
 	cea->db5_dminh_lsv |= (0 & CEA861_AUDIO_INFOFRAME_DB5_LSV);
 
Signature · 1 line
1.9.1
maintainer Acked-by on v1 5/5
#7 lore raw

Re: [PATCH 5/5] ASoC: omap-hdmi-audio: Fix invalid combination of DM_INH and CA

In reply to Jyri Sarha
Quoted 5 lines · Jyri Sarha

From: Misael Lopez Cruz <[email protected]>

DM_INH = 1 (stereo downmix prohibited) and CA = 0x00 (Channel
Allocation: FR, FL) is an invalid combination according to the HDMI Compliance Test 7.31 "Audio InfoFrame".

#8 lore raw
In reply to Jyri Sarha

Hi,

Quoted 19 lines · Jyri Sarha

I have rebased these patches from ti-linux-3.14.y on top of Linux 4.0.0. I tested them briefly on OMAP4 and OMAP5 in my environment, but I could not test any channel count beyond stereo. However, there were no conflicts in the rebase and each fix makes sense when looking at the chip TRM and the relevant HDMI specs.

All the changes are really minor, but most of them apply to OMAPDSS side, so it is probably best to merge them trough there.

Best regards,
Jyri

Misael Lopez Cruz (5):
OMAPDSS: HDMI4: Set correct CC for 8-channels layout
OMAPDSS: HDMI5: Set valid sample order
OMAPDSS: HDMI5: Fix AUDICONF3 bitfield offsets
ASoC: omap-hdmi-audio: Force channel allocation only for OMAP4
ASoC: omap-hdmi-audio: Fix invalid combination of DM_INH and CA

Quoted 4 lines
 drivers/video/fbdev/omap2/dss/hdmi4_core.c | 12 +++++++++++-
 drivers/video/fbdev/omap2/dss/hdmi5_core.c |  5 ++++-
 sound/soc/omap/omap-hdmi-audio.c           | 12 +++++++-----
 3 files changed, 22 insertions(+), 7 deletions(-)

I've queued these for 4.2.

Tomi