All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Groeneveld <kgroeneveld@lenbrook.com>
To: alsa-devel@alsa-project.org
Cc: timur@tabi.org, Xiubo.Lee@gmail.com, tiwai@suse.com,
	nicoleotsuka@gmail.com,
	Kevin Groeneveld <kgroeneveld@lenbrook.com>
Subject: [PATCH] ASOC: fsl_spdif: fix bit order for spdif RX channel status
Date: Wed, 23 Sep 2015 10:00:47 -0400	[thread overview]
Message-ID: <1443016847-29857-1-git-send-email-kgroeneveld@lenbrook.com> (raw)

The bits within each byte of the hardware registers for the channel status
bits are reversed. Therefore when the channel status is read from the
hardware we need to reverse the bits.

The code which writes the channel status bits for the TX already correctly
reverses the bits. This patch implements similar functionality for the RX.

I have tested this patch running on imx6 using several different SPDIF
source devices.

Signed-off-by: Kevin Groeneveld <kgroeneveld@lenbrook.com>
---
 sound/soc/fsl/fsl_spdif.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index ab729f2..e84e839 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -676,14 +676,14 @@ static int fsl_spdif_capture_get(struct snd_kcontrol *kcontrol,
 		return -EAGAIN;
 
 	regmap_read(regmap, REG_SPDIF_SRCSH, &cstatus);
-	ucontrol->value.iec958.status[0] = (cstatus >> 16) & 0xFF;
-	ucontrol->value.iec958.status[1] = (cstatus >> 8) & 0xFF;
-	ucontrol->value.iec958.status[2] = cstatus & 0xFF;
+	ucontrol->value.iec958.status[0] = bitrev8((cstatus >> 16) & 0xFF);
+	ucontrol->value.iec958.status[1] = bitrev8((cstatus >> 8) & 0xFF);
+	ucontrol->value.iec958.status[2] = bitrev8(cstatus & 0xFF);
 
 	regmap_read(regmap, REG_SPDIF_SRCSL, &cstatus);
-	ucontrol->value.iec958.status[3] = (cstatus >> 16) & 0xFF;
-	ucontrol->value.iec958.status[4] = (cstatus >> 8) & 0xFF;
-	ucontrol->value.iec958.status[5] = cstatus & 0xFF;
+	ucontrol->value.iec958.status[3] = bitrev8((cstatus >> 16) & 0xFF);
+	ucontrol->value.iec958.status[4] = bitrev8((cstatus >> 8) & 0xFF);
+	ucontrol->value.iec958.status[5] = bitrev8(cstatus & 0xFF);
 
 	/* Clear intr */
 	regmap_write(regmap, REG_SPDIF_SIC, INT_CNEW);
-- 
1.7.4.1

             reply	other threads:[~2015-09-23 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 14:00 Kevin Groeneveld [this message]
2015-09-23 23:07 ` [PATCH] ASOC: fsl_spdif: fix bit order for spdif RX channel status Nicolin Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443016847-29857-1-git-send-email-kgroeneveld@lenbrook.com \
    --to=kgroeneveld@lenbrook.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=timur@tabi.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.