diff options
Diffstat (limited to 'drivers/media/video/bt832.c')
-rw-r--r-- | drivers/media/video/bt832.c | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 07f72f64c5f7..3bb347d93b9b 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c | |||
@@ -6,7 +6,7 @@ | |||
6 | It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly | 6 | It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly |
7 | connected to bt848/bt878 GPIO pins on this purpose. | 7 | connected to bt848/bt878 GPIO pins on this purpose. |
8 | (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) | 8 | (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) |
9 | 9 | ||
10 | Supported Cards: | 10 | Supported Cards: |
11 | - Pixelview Rev.4E: 0x8a | 11 | - Pixelview Rev.4E: 0x8a |
12 | GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! | 12 | GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! |
@@ -31,16 +31,16 @@ | |||
31 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | 33 | ||
34 | #include "id.h" | 34 | #include <media/audiochip.h> |
35 | #include "audiochip.h" | 35 | #include <media/id.h> |
36 | #include "bttv.h" | 36 | #include "bttv.h" |
37 | #include "bt832.h" | 37 | #include "bt832.h" |
38 | 38 | ||
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | 40 | ||
41 | /* Addresses to scan */ | 41 | /* Addresses to scan */ |
42 | static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1, | 42 | static unsigned short normal_i2c[] = {I2C_CLIENT_END}; |
43 | I2C_CLIENT_END }; | 43 | static unsigned short normal_i2c_range[] = {I2C_BT832_ALT1>>1,I2C_BT832_ALT2>>1,I2C_CLIENT_END}; |
44 | I2C_CLIENT_INSMOD; | 44 | I2C_CLIENT_INSMOD; |
45 | 45 | ||
46 | /* ---------------------------------------------------------------------- */ | 46 | /* ---------------------------------------------------------------------- */ |
@@ -95,7 +95,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
95 | 95 | ||
96 | buf=kmalloc(65,GFP_KERNEL); | 96 | buf=kmalloc(65,GFP_KERNEL); |
97 | bt832_hexdump(i2c_client_s,buf); | 97 | bt832_hexdump(i2c_client_s,buf); |
98 | 98 | ||
99 | if(buf[0x40] != 0x31) { | 99 | if(buf[0x40] != 0x31) { |
100 | printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); | 100 | printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); |
101 | kfree(buf); | 101 | kfree(buf); |
@@ -135,7 +135,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
135 | buf[1]= 0x27 & (~0x01); // Default | !skip | 135 | buf[1]= 0x27 & (~0x01); // Default | !skip |
136 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) | 136 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) |
137 | printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); | 137 | printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); |
138 | 138 | ||
139 | bt832_hexdump(i2c_client_s,buf); | 139 | bt832_hexdump(i2c_client_s,buf); |
140 | 140 | ||
141 | #if 0 | 141 | #if 0 |
@@ -168,8 +168,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
168 | 168 | ||
169 | 169 | ||
170 | 170 | ||
171 | static int bt832_attach(struct i2c_adapter *adap, int addr, | 171 | static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) |
172 | unsigned short flags, int kind) | ||
173 | { | 172 | { |
174 | struct bt832 *t; | 173 | struct bt832 *t; |
175 | 174 | ||
@@ -184,27 +183,32 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, | |||
184 | return -ENOMEM; | 183 | return -ENOMEM; |
185 | memset(t,0,sizeof(*t)); | 184 | memset(t,0,sizeof(*t)); |
186 | t->client = client_template; | 185 | t->client = client_template; |
187 | t->client.data = t; | 186 | i2c_set_clientdata(&t->client, t); |
188 | i2c_attach_client(&t->client); | 187 | i2c_attach_client(&t->client); |
189 | 188 | ||
190 | if(! bt832_init(&t->client)) { | 189 | if(! bt832_init(&t->client)) { |
191 | bt832_detach(&t->client); | 190 | bt832_detach(&t->client); |
192 | return -1; | 191 | return -1; |
193 | } | 192 | } |
194 | 193 | ||
195 | return 0; | 194 | return 0; |
196 | } | 195 | } |
197 | 196 | ||
198 | static int bt832_probe(struct i2c_adapter *adap) | 197 | static int bt832_probe(struct i2c_adapter *adap) |
199 | { | 198 | { |
199 | #ifdef I2C_CLASS_TV_ANALOG | ||
200 | if (adap->class & I2C_CLASS_TV_ANALOG) | 200 | if (adap->class & I2C_CLASS_TV_ANALOG) |
201 | return i2c_probe(adap, &addr_data, bt832_attach); | 201 | return i2c_probe(adap, &addr_data, bt832_attach); |
202 | #else | ||
203 | if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) | ||
204 | return i2c_probe(adap, &addr_data, bt832_attach); | ||
205 | #endif | ||
202 | return 0; | 206 | return 0; |
203 | } | 207 | } |
204 | 208 | ||
205 | static int bt832_detach(struct i2c_client *client) | 209 | static int bt832_detach(struct i2c_client *client) |
206 | { | 210 | { |
207 | struct bt832 *t = (struct bt832*)client->data; | 211 | struct bt832 *t = i2c_get_clientdata(client); |
208 | 212 | ||
209 | printk("bt832: detach.\n"); | 213 | printk("bt832: detach.\n"); |
210 | i2c_detach_client(client); | 214 | i2c_detach_client(client); |
@@ -215,7 +219,7 @@ static int bt832_detach(struct i2c_client *client) | |||
215 | static int | 219 | static int |
216 | bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) | 220 | bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) |
217 | { | 221 | { |
218 | struct bt832 *t = (struct bt832*)client->data; | 222 | struct bt832 *t = i2c_get_clientdata(client); |
219 | 223 | ||
220 | printk("bt832: command %x\n",cmd); | 224 | printk("bt832: command %x\n",cmd); |
221 | 225 | ||
@@ -249,19 +253,18 @@ static struct i2c_driver driver = { | |||
249 | }; | 253 | }; |
250 | static struct i2c_client client_template = | 254 | static struct i2c_client client_template = |
251 | { | 255 | { |
252 | .name = "bt832", | 256 | I2C_DEVNAME("bt832"), |
253 | .flags = I2C_CLIENT_ALLOW_USE, | 257 | .flags = I2C_CLIENT_ALLOW_USE, |
254 | .driver = &driver, | 258 | .driver = &driver, |
255 | }; | 259 | }; |
256 | 260 | ||
257 | 261 | ||
258 | int bt832_init_module(void) | 262 | static int __init bt832_init_module(void) |
259 | { | 263 | { |
260 | i2c_add_driver(&driver); | 264 | return i2c_add_driver(&driver); |
261 | return 0; | ||
262 | } | 265 | } |
263 | 266 | ||
264 | static void bt832_cleanup_module(void) | 267 | static void __exit bt832_cleanup_module(void) |
265 | { | 268 | { |
266 | i2c_del_driver(&driver); | 269 | i2c_del_driver(&driver); |
267 | } | 270 | } |
@@ -269,3 +272,10 @@ static void bt832_cleanup_module(void) | |||
269 | module_init(bt832_init_module); | 272 | module_init(bt832_init_module); |
270 | module_exit(bt832_cleanup_module); | 273 | module_exit(bt832_cleanup_module); |
271 | 274 | ||
275 | /* | ||
276 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
277 | * --------------------------------------------------------------------------- | ||
278 | * Local variables: | ||
279 | * c-basic-offset: 8 | ||
280 | * End: | ||
281 | */ | ||