Last active
August 29, 2015 14:04
-
-
Save warped-rudi/8f54b673a6a7e9a2525c to your computer and use it in GitHub Desktop.
subframe assembly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sound/soc/fsl/imx-hdmi-dma.c b/sound/soc/fsl/imx-hdmi-dma.c | |
index 612f8ed..3af0450 100644 | |
--- a/sound/soc/fsl/imx-hdmi-dma.c | |
+++ b/sound/soc/fsl/imx-hdmi-dma.c | |
@@ -213,6 +213,7 @@ static void hdmi_mask(int mask) | |
static inline int odd_ones(unsigned a) | |
{ | |
+ a ^= a >> 16; | |
a ^= a >> 8; | |
a ^= a >> 4; | |
a ^= a >> 2; | |
@@ -228,31 +229,29 @@ static u32 hdmi_dma_add_frame_info(struct hdmi_dma_priv *priv, | |
union hdmi_audio_dma_data_t subframe; | |
subframe.U = 0; | |
- iec_header.B.channel = subframe_idx; | |
- | |
- /* fill b (start-of-block) */ | |
- subframe.B.b = (priv->frame_idx == 0) ? 1 : 0; | |
/* fill c (channel status) */ | |
- if (priv->frame_idx < 42) | |
- subframe.B.c = (iec_header.U >> priv->frame_idx) & 0x1; | |
- else | |
- subframe.B.c = 0; | |
+ if (priv->frame_idx < 42) { | |
+ iec_header.B.channel = subframe_idx; | |
+ subframe.B.c = iec_header.U >> priv->frame_idx; | |
+ } | |
/* fill v (validity) */ | |
subframe.B.v = iec_header.B.linear_pcm; | |
- subframe.B.p = odd_ones(pcm_data); | |
- subframe.B.p ^= subframe.B.c; | |
- subframe.B.p ^= subframe.B.u; | |
- subframe.B.p ^= subframe.B.v; | |
- | |
/* fill data */ | |
if (priv->sample_bits == 16) | |
subframe.B.data = pcm_data << 8; | |
else | |
subframe.B.data = pcm_data; | |
+ /* fill p (parity) Note: Do not include b ! */ | |
+ subframe.B.p = odd_ones(subframe.U); | |
+ | |
+ /* fill b (start-of-block) */ | |
+ if (priv->frame_idx == 0) | |
+ subframe.B.b = 1; | |
+ | |
return subframe.U; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment