aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/virtuoso.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-09-22 03:06:04 -0400
committerClemens Ladisch <clemens@ladisch.de>2008-09-22 03:06:04 -0400
commit4f50d2fd00da451261f51f28e929ebd161068422 (patch)
tree209aa18811256bb2fdabd789ce9bc074e91e5d03 /sound/pci/oxygen/virtuoso.c
parentc2bc4ff58d7aabcf1fc96134200d685d796ae425 (diff)
ALSA: virtuoso: allow I2C-connected PCM1796
Add support for PCM1796 chips that are connected with an I2C bus instead of SPI. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/pci/oxygen/virtuoso.c')
-rw-r--r--sound/pci/oxygen/virtuoso.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 8f65aa80d3bc..853e8898bf9b 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -124,6 +124,7 @@ MODULE_DEVICE_TABLE(pci, xonar_ids);
124#define GPIO_DX_FRONT_PANEL 0x0002 124#define GPIO_DX_FRONT_PANEL 0x0002
125#define GPIO_DX_INPUT_ROUTE 0x0100 125#define GPIO_DX_INPUT_ROUTE 0x0100
126 126
127#define I2C_DEVICE_PCM1796(i) (0x98 + ((i) << 1)) /* 10011, ADx=i, /W=0 */
127#define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ 128#define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */
128#define I2C_DEVICE_CS4362A 0x30 /* 001100, AD0=0, /W=0 */ 129#define I2C_DEVICE_CS4362A 0x30 /* 001100, AD0=0, /W=0 */
129 130
@@ -142,8 +143,8 @@ struct xonar_data {
142 143
143static void xonar_gpio_changed(struct oxygen *chip); 144static void xonar_gpio_changed(struct oxygen *chip);
144 145
145static void pcm1796_write(struct oxygen *chip, unsigned int codec, 146static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
146 u8 reg, u8 value) 147 u8 reg, u8 value)
147{ 148{
148 /* maps ALSA channel pair number to SPI output */ 149 /* maps ALSA channel pair number to SPI output */
149 static const u8 codec_map[4] = { 150 static const u8 codec_map[4] = {
@@ -157,6 +158,22 @@ static void pcm1796_write(struct oxygen *chip, unsigned int codec,
157 (reg << 8) | value); 158 (reg << 8) | value);
158} 159}
159 160
161static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
162 u8 reg, u8 value)
163{
164 oxygen_write_i2c(chip, I2C_DEVICE_PCM1796(codec), reg, value);
165}
166
167static void pcm1796_write(struct oxygen *chip, unsigned int codec,
168 u8 reg, u8 value)
169{
170 if ((chip->model.function_flags & OXYGEN_FUNCTION_2WIRE_SPI_MASK) ==
171 OXYGEN_FUNCTION_SPI)
172 pcm1796_write_spi(chip, codec, reg, value);
173 else
174 pcm1796_write_i2c(chip, codec, reg, value);
175}
176
160static void cs4398_write(struct oxygen *chip, u8 reg, u8 value) 177static void cs4398_write(struct oxygen *chip, u8 reg, u8 value)
161{ 178{
162 oxygen_write_i2c(chip, I2C_DEVICE_CS4398, reg, value); 179 oxygen_write_i2c(chip, I2C_DEVICE_CS4398, reg, value);