aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cs53l32a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cs53l32a.c')
-rw-r--r--drivers/media/video/cs53l32a.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index 7d997aeda63e..b421068f7ea3 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -27,7 +27,7 @@
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-id.h> 28#include <linux/i2c-id.h>
29#include <linux/videodev.h> 29#include <linux/videodev.h>
30#include <media/audiochip.h> 30#include <media/v4l2-common.h>
31 31
32MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC"); 32MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
33MODULE_AUTHOR("Martin Vaughan"); 33MODULE_AUTHOR("Martin Vaughan");
@@ -39,21 +39,6 @@ module_param(debug, bool, 0644);
39 39
40MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On"); 40MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
41 41
42#define cs53l32a_dbg(fmt, arg...) \
43 do { \
44 if (debug) \
45 printk(KERN_INFO "%s debug %d-%04x: " fmt, \
46 client->driver->driver.name, \
47 i2c_adapter_id(client->adapter), client->addr , ## arg); \
48 } while (0)
49
50#define cs53l32a_err(fmt, arg...) do { \
51 printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
52 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
53#define cs53l32a_info(fmt, arg...) do { \
54 printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
55 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
56
57static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END }; 42static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END };
58 43
59 44
@@ -84,7 +69,7 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
84 the second goes through the PGA. Hence there are three 69 the second goes through the PGA. Hence there are three
85 possible inputs to choose from. */ 70 possible inputs to choose from. */
86 if (input->index > 2) { 71 if (input->index > 2) {
87 cs53l32a_err("Invalid input %d.\n", input->index); 72 v4l_err(client, "Invalid input %d.\n", input->index);
88 return -EINVAL; 73 return -EINVAL;
89 } 74 }
90 cs53l32a_write(client, 0x01, 0x01 + (input->index << 4)); 75 cs53l32a_write(client, 0x01, 0x01 + (input->index << 4));
@@ -124,9 +109,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
124 u8 m = cs53l32a_read(client, 0x03); 109 u8 m = cs53l32a_read(client, 0x03);
125 s8 vol = cs53l32a_read(client, 0x04); 110 s8 vol = cs53l32a_read(client, 0x04);
126 111
127 cs53l32a_info("Input: %d%s\n", (v >> 4) & 3, 112 v4l_info(client, "Input: %d%s\n", (v >> 4) & 3,
128 (m & 0xC0) ? " (muted)" : ""); 113 (m & 0xC0) ? " (muted)" : "");
129 cs53l32a_info("Volume: %d dB\n", vol); 114 v4l_info(client, "Volume: %d dB\n", vol);
130 break; 115 break;
131 } 116 }
132 117
@@ -166,12 +151,12 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
166 client->driver = &i2c_driver; 151 client->driver = &i2c_driver;
167 snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); 152 snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
168 153
169 cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); 154 v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);
170 155
171 for (i = 1; i <= 7; i++) { 156 for (i = 1; i <= 7; i++) {
172 u8 v = cs53l32a_read(client, i); 157 u8 v = cs53l32a_read(client, i);
173 158
174 cs53l32a_dbg("Read Reg %d %02x\n", i, v); 159 v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
175 } 160 }
176 161
177 /* Set cs53l32a internal register for Adaptec 2010/2410 setup */ 162 /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
@@ -189,7 +174,7 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
189 for (i = 1; i <= 7; i++) { 174 for (i = 1; i <= 7; i++) {
190 u8 v = cs53l32a_read(client, i); 175 u8 v = cs53l32a_read(client, i);
191 176
192 cs53l32a_dbg("Read Reg %d %02x\n", i, v); 177 v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
193 } 178 }
194 179
195 i2c_attach_client(client); 180 i2c_attach_client(client);