aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/i2c')
-rw-r--r--sound/i2c/cs8427.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c
index 020a5d512472..04ae8704cdcd 100644
--- a/sound/i2c/cs8427.c
+++ b/sound/i2c/cs8427.c
@@ -23,6 +23,7 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/bitrev.h>
26#include <asm/unaligned.h> 27#include <asm/unaligned.h>
27#include <sound/core.h> 28#include <sound/core.h>
28#include <sound/control.h> 29#include <sound/control.h>
@@ -55,18 +56,6 @@ struct cs8427 {
55 struct cs8427_stream capture; 56 struct cs8427_stream capture;
56}; 57};
57 58
58static unsigned char swapbits(unsigned char val)
59{
60 int bit;
61 unsigned char res = 0;
62 for (bit = 0; bit < 8; bit++) {
63 res <<= 1;
64 res |= val & 1;
65 val >>= 1;
66 }
67 return res;
68}
69
70int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, 59int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
71 unsigned char val) 60 unsigned char val)
72{ 61{
@@ -149,7 +138,7 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device,
149 } 138 }
150 data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF; 139 data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF;
151 for (idx = 0; idx < count; idx++) 140 for (idx = 0; idx < count; idx++)
152 data[idx + 1] = swapbits(ndata[idx]); 141 data[idx + 1] = bitrev8(ndata[idx]);
153 if (snd_i2c_sendbytes(device, data, count + 1) != count + 1) 142 if (snd_i2c_sendbytes(device, data, count + 1) != count + 1)
154 return -EIO; 143 return -EIO;
155 return 1; 144 return 1;