Skip to content

Instantly share code, notes, and snippets.

@warped-rudi
Created April 25, 2014 23:06
Show Gist options
  • Save warped-rudi/11306169 to your computer and use it in GitHub Desktop.
Save warped-rudi/11306169 to your computer and use it in GitHub Desktop.
SPDIF and HDMI validity
--- a/sound/soc/codecs/mxc_spdif.c
+++ b/sound/soc/codecs/mxc_spdif.c
@@ -367,7 +367,7 @@
static void spdif_write_channel_status(void)
{
- unsigned int ch_status;
+ unsigned int ch_status, regval;
ch_status =
(reverse_bits(mxc_spdif_control.ch_status[0]) << 16) |
@@ -381,6 +381,12 @@
pr_debug("STCSCH: 0x%06x\n", __raw_readl(spdif_base_addr + SPDIF_REG_STCSCH));
pr_debug("STCSCL: 0x%06x\n", __raw_readl(spdif_base_addr + SPDIF_REG_STCSCL));
+
+ /* Set outgoing validity off for non-audio */
+ regval = __raw_readl(spdif_base_addr + SPDIF_REG_SCR) & ~SCR_VAL_CLEAR;
+ if (mxc_spdif_control.ch_status[0] & IEC958_AES0_NONAUDIO)
+ regval |= SCR_VAL_CLEAR;
+ __raw_writel(regval, SPDIF_REG_SCR + spdif_base_addr);
}
/*
--- a/sound/soc/imx/imx-hdmi-dma.c
+++ b/sound/soc/imx/imx-hdmi-dma.c
@@ -328,6 +328,9 @@
subframe.B.c = (iec_header.U >> rtd->frame_idx) & 0x1;
else
subframe.B.c = 0;
+
+ /* fill v (validity) */
+ subframe.B.v = iec_header.B.linear_pcm;
subframe.B.p = odd_ones(pcm_data);
subframe.B.p ^= subframe.B.c;
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -324,6 +324,10 @@ static void spdif_write_channel_status(struct fsl_spdif_priv *spdif_priv)
regmap_write(regmap, REG_SPDIF_STCSCL, ch_status);
dev_dbg(&pdev->dev, "STCSCL: 0x%06x\n", ch_status);
+
+ /* Set outgoing validity off for non-audio */
+ regmap_update_bits(regmap, REG_SPDIF_SCR, SCR_VAL_MASK,
+ (ctrl->ch_status[0] & IEC958_AES0_NONAUDIO) ? SCR_VAL_CLEAR : 0);
}
/* Set SPDIF PhaseConfig register for rx clock */
--- a/sound/soc/fsl/imx-hdmi-dma.c
+++ b/sound/soc/fsl/imx-hdmi-dma.c
@@ -238,6 +238,9 @@ static u32 hdmi_dma_add_frame_info(struct hdmi_dma_priv *priv,
subframe.B.c = (iec_header.U >> priv->frame_idx) & 0x1;
else
subframe.B.c = 0;
+
+ /* fill v (validity) */
+ subframe.B.v = iec_header.B.linear_pcm;
subframe.B.p = odd_ones(pcm_data);
subframe.B.p ^= subframe.B.c;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment