blob: 976ce207cfcba151834505c2684ae3c707864009 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * For the STS-Thompson TDA7432 audio processor chip
3 *
4 * Handles audio functions: volume, balance, tone, loudness
5 * This driver will not complain if used with any
6 * other i2c device with the same address.
7 *
8 * Muting and tone control by Jonathan Isom <jisom@ematic.com>
9 *
10 * Copyright (c) 2000 Eric Sandeen <eric_sandeen@bigfoot.com>
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -030011 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 * This code is placed under the terms of the GNU General Public License
13 * Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu)
14 * Which was based on tda8425.c by Greg Alexander (c) 1998
15 *
16 * OPTIONS:
17 * debug - set to 1 if you'd like to see debug messages
18 * set to 2 if you'd like to be inundated with debug messages
19 *
20 * loudness - set between 0 and 15 for varying degrees of loudness effect
21 *
22 * maxvol - set maximium volume to +20db (1), default is 0db(0)
23 *
24 *
25 * Revision: 0.7 - maxvol module parm to set maximium volume 0db or +20db
26 * store if muted so we can return it
27 * change balance only if flaged to
28 * Revision: 0.6 - added tone controls
29 * Revision: 0.5 - Fixed odd balance problem
30 * Revision: 0.4 - added muting
31 * Revision: 0.3 - Fixed silly reversed volume controls. :)
32 * Revision: 0.2 - Cleaned up #defines
33 * fixed volume control
34 * Added I2C_DRIVERID_TDA7432
35 * added loudness insmod control
36 * Revision: 0.1 - initial version
37 */
38
39#include <linux/module.h>
40#include <linux/init.h>
41#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#include <linux/string.h>
43#include <linux/timer.h>
44#include <linux/delay.h>
45#include <linux/errno.h>
46#include <linux/slab.h>
Hans Verkuil33b687c2008-07-25 05:32:50 -030047#include <linux/videodev2.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#include <linux/i2c.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Hans Verkuild5313052008-12-18 13:04:05 -030050#include <media/v4l2-device.h>
Hans Verkuil35ea11f2008-07-20 08:12:02 -030051#include <media/v4l2-ioctl.h>
Mauro Carvalho Chehabfa3fcce2006-03-23 21:45:24 -030052#include <media/i2c-addr.h>
Hans Verkuild5313052008-12-18 13:04:05 -030053#include <media/v4l2-i2c-drv-legacy.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55#ifndef VIDEO_AUDIO_BALANCE
56# define VIDEO_AUDIO_BALANCE 32
57#endif
58
59MODULE_AUTHOR("Eric Sandeen <eric_sandeen@bigfoot.com>");
60MODULE_DESCRIPTION("bttv driver for the tda7432 audio processor chip");
61MODULE_LICENSE("GPL");
62
63static int maxvol;
64static int loudness; /* disable loudness by default */
65static int debug; /* insmod parameter */
66module_param(debug, int, S_IRUGO | S_IWUSR);
67module_param(loudness, int, S_IRUGO);
68MODULE_PARM_DESC(maxvol,"Set maximium volume to +20db (0), default is 0db(1)");
69module_param(maxvol, int, S_IRUGO | S_IWUSR);
70
71
72/* Address to scan (I2C address of this chip) */
73static unsigned short normal_i2c[] = {
Mauro Carvalho Chehab09df1c12006-03-18 08:31:34 -030074 I2C_ADDR_TDA7432 >> 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 I2C_CLIENT_END,
76};
Hans Verkuilf87086e2008-07-18 00:50:58 -030077
Linus Torvalds1da177e2005-04-16 15:20:36 -070078I2C_CLIENT_INSMOD;
79
80/* Structure of address and subaddresses for the tda7432 */
81
82struct tda7432 {
Hans Verkuild5313052008-12-18 13:04:05 -030083 struct v4l2_subdev sd;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 int addr;
85 int input;
86 int volume;
87 int muted;
88 int bass, treble;
89 int lf, lr, rf, rr;
90 int loud;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091};
Hans Verkuild5313052008-12-18 13:04:05 -030092
93static inline struct tda7432 *to_state(struct v4l2_subdev *sd)
94{
95 return container_of(sd, struct tda7432, sd);
96}
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
Linus Torvalds1da177e2005-04-16 15:20:36 -070098/* The TDA7432 is made by STS-Thompson
99 * http://www.st.com
100 * http://us.st.com/stonline/books/pdf/docs/4056.pdf
101 *
102 * TDA7432: I2C-bus controlled basic audio processor
103 *
104 * The TDA7432 controls basic audio functions like volume, balance,
105 * and tone control (including loudness). It also has four channel
106 * output (for front and rear). Since most vidcap cards probably
107 * don't have 4 channel output, this driver will set front & rear
108 * together (no independent control).
109 */
110
111 /* Subaddresses for TDA7432 */
112
113#define TDA7432_IN 0x00 /* Input select */
114#define TDA7432_VL 0x01 /* Volume */
115#define TDA7432_TN 0x02 /* Bass, Treble (Tone) */
116#define TDA7432_LF 0x03 /* Attenuation LF (Left Front) */
117#define TDA7432_LR 0x04 /* Attenuation LR (Left Rear) */
118#define TDA7432_RF 0x05 /* Attenuation RF (Right Front) */
119#define TDA7432_RR 0x06 /* Attenuation RR (Right Rear) */
120#define TDA7432_LD 0x07 /* Loudness */
121
122
123 /* Masks for bits in TDA7432 subaddresses */
124
125/* Many of these not used - just for documentation */
126
127/* Subaddress 0x00 - Input selection and bass control */
128
129/* Bits 0,1,2 control input:
130 * 0x00 - Stereo input
131 * 0x02 - Mono input
132 * 0x03 - Mute (Using Attenuators Plays better with modules)
133 * Mono probably isn't used - I'm guessing only the stereo
134 * input is connected on most cards, so we'll set it to stereo.
135 *
136 * Bit 3 controls bass cut: 0/1 is non-symmetric/symmetric bass cut
137 * Bit 4 controls bass range: 0/1 is extended/standard bass range
138 *
139 * Highest 3 bits not used
140 */
141
142#define TDA7432_STEREO_IN 0
143#define TDA7432_MONO_IN 2 /* Probably won't be used */
144#define TDA7432_BASS_SYM 1 << 3
145#define TDA7432_BASS_NORM 1 << 4
146
147/* Subaddress 0x01 - Volume */
148
149/* Lower 7 bits control volume from -79dB to +32dB in 1dB steps
150 * Recommended maximum is +20 dB
151 *
152 * +32dB: 0x00
153 * +20dB: 0x0c
154 * 0dB: 0x20
155 * -79dB: 0x6f
156 *
157 * MSB (bit 7) controls loudness: 1/0 is loudness on/off
158 */
159
160#define TDA7432_VOL_0DB 0x20
161#define TDA7432_LD_ON 1 << 7
162
163
164/* Subaddress 0x02 - Tone control */
165
166/* Bits 0,1,2 control absolute treble gain from 0dB to 14dB
167 * 0x0 is 14dB, 0x7 is 0dB
168 *
169 * Bit 3 controls treble attenuation/gain (sign)
170 * 1 = gain (+)
171 * 0 = attenuation (-)
172 *
173 * Bits 4,5,6 control absolute bass gain from 0dB to 14dB
174 * (This is only true for normal base range, set in 0x00)
175 * 0x0 << 4 is 14dB, 0x7 is 0dB
176 *
177 * Bit 7 controls bass attenuation/gain (sign)
178 * 1 << 7 = gain (+)
179 * 0 << 7 = attenuation (-)
180 *
181 * Example:
182 * 1 1 0 1 0 1 0 1 is +4dB bass, -4dB treble
183 */
184
185#define TDA7432_TREBLE_0DB 0xf
186#define TDA7432_TREBLE 7
187#define TDA7432_TREBLE_GAIN 1 << 3
188#define TDA7432_BASS_0DB 0xf
189#define TDA7432_BASS 7 << 4
190#define TDA7432_BASS_GAIN 1 << 7
191
192
193/* Subaddress 0x03 - Left Front attenuation */
194/* Subaddress 0x04 - Left Rear attenuation */
195/* Subaddress 0x05 - Right Front attenuation */
196/* Subaddress 0x06 - Right Rear attenuation */
197
198/* Bits 0,1,2,3,4 control attenuation from 0dB to -37.5dB
199 * in 1.5dB steps.
200 *
201 * 0x00 is 0dB
202 * 0x1f is -37.5dB
203 *
204 * Bit 5 mutes that channel when set (1 = mute, 0 = unmute)
205 * We'll use the mute on the input, though (above)
206 * Bits 6,7 unused
207 */
208
209#define TDA7432_ATTEN_0DB 0x00
210#define TDA7432_MUTE 0x1 << 5
211
212
213/* Subaddress 0x07 - Loudness Control */
214
215/* Bits 0,1,2,3 control loudness from 0dB to -15dB in 1dB steps
216 * when bit 4 is NOT set
217 *
218 * 0x0 is 0dB
219 * 0xf is -15dB
220 *
221 * If bit 4 is set, then there is a flat attenuation according to
222 * the lower 4 bits, as above.
223 *
224 * Bits 5,6,7 unused
225 */
226
227
228
229/* Begin code */
230
Hans Verkuild5313052008-12-18 13:04:05 -0300231static int tda7432_write(struct v4l2_subdev *sd, int subaddr, int val)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232{
Hans Verkuild5313052008-12-18 13:04:05 -0300233 struct i2c_client *client = v4l2_get_subdevdata(sd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 unsigned char buffer[2];
Hans Verkuild5313052008-12-18 13:04:05 -0300235
236 v4l2_dbg(2, debug, sd, "In tda7432_write\n");
237 v4l2_dbg(1, debug, sd, "Writing %d 0x%x\n", subaddr, val);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 buffer[0] = subaddr;
239 buffer[1] = val;
Hans Verkuild5313052008-12-18 13:04:05 -0300240 if (2 != i2c_master_send(client, buffer, 2)) {
241 v4l2_err(sd, "I/O error, trying (write %d 0x%x)\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700242 subaddr, val);
243 return -1;
244 }
245 return 0;
246}
247
Hans Verkuild5313052008-12-18 13:04:05 -0300248static int tda7432_set(struct v4l2_subdev *sd)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249{
Hans Verkuild5313052008-12-18 13:04:05 -0300250 struct i2c_client *client = v4l2_get_subdevdata(sd);
251 struct tda7432 *t = to_state(sd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 unsigned char buf[16];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253
Hans Verkuild5313052008-12-18 13:04:05 -0300254 v4l2_dbg(1, debug, sd,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 "tda7432: 7432_set(0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n",
Hans Verkuild5313052008-12-18 13:04:05 -0300256 t->input, t->volume, t->bass, t->treble, t->lf, t->lr,
257 t->rf, t->rr, t->loud);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 buf[0] = TDA7432_IN;
259 buf[1] = t->input;
260 buf[2] = t->volume;
261 buf[3] = t->bass;
262 buf[4] = t->treble;
263 buf[5] = t->lf;
264 buf[6] = t->lr;
265 buf[7] = t->rf;
266 buf[8] = t->rr;
267 buf[9] = t->loud;
Hans Verkuild5313052008-12-18 13:04:05 -0300268 if (10 != i2c_master_send(client, buf, 10)) {
269 v4l2_err(sd, "I/O error, trying tda7432_set\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 return -1;
271 }
272
273 return 0;
274}
275
Hans Verkuild5313052008-12-18 13:04:05 -0300276static void do_tda7432_init(struct v4l2_subdev *sd)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277{
Hans Verkuild5313052008-12-18 13:04:05 -0300278 struct tda7432 *t = to_state(sd);
279
280 v4l2_dbg(2, debug, sd, "In tda7432_init\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281
282 t->input = TDA7432_STEREO_IN | /* Main (stereo) input */
283 TDA7432_BASS_SYM | /* Symmetric bass cut */
284 TDA7432_BASS_NORM; /* Normal bass range */
285 t->volume = 0x3b ; /* -27dB Volume */
286 if (loudness) /* Turn loudness on? */
287 t->volume |= TDA7432_LD_ON;
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300288 t->muted = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 t->treble = TDA7432_TREBLE_0DB; /* 0dB Treble */
290 t->bass = TDA7432_BASS_0DB; /* 0dB Bass */
291 t->lf = TDA7432_ATTEN_0DB; /* 0dB attenuation */
292 t->lr = TDA7432_ATTEN_0DB; /* 0dB attenuation */
293 t->rf = TDA7432_ATTEN_0DB; /* 0dB attenuation */
294 t->rr = TDA7432_ATTEN_0DB; /* 0dB attenuation */
295 t->loud = loudness; /* insmod parameter */
296
Hans Verkuild5313052008-12-18 13:04:05 -0300297 tda7432_set(sd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298}
299
Hans Verkuild5313052008-12-18 13:04:05 -0300300static int tda7432_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301{
Hans Verkuild5313052008-12-18 13:04:05 -0300302 struct tda7432 *t = to_state(sd);
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300303
304 switch (ctrl->id) {
305 case V4L2_CID_AUDIO_MUTE:
306 ctrl->value=t->muted;
307 return 0;
308 case V4L2_CID_AUDIO_VOLUME:
309 if (!maxvol){ /* max +20db */
310 ctrl->value = ( 0x6f - (t->volume & 0x7F) ) * 630;
311 } else { /* max 0db */
312 ctrl->value = ( 0x6f - (t->volume & 0x7F) ) * 829;
313 }
314 return 0;
315 case V4L2_CID_AUDIO_BALANCE:
316 {
317 if ( (t->lf) < (t->rf) )
318 /* right is attenuated, balance shifted left */
319 ctrl->value = (32768 - 1057*(t->rf));
320 else
321 /* left is attenuated, balance shifted right */
322 ctrl->value = (32768 + 1057*(t->lf));
323 return 0;
324 }
325 case V4L2_CID_AUDIO_BASS:
326 {
327 /* Bass/treble 4 bits each */
328 int bass=t->bass;
329 if(bass >= 0x8)
330 bass = ~(bass - 0x8) & 0xf;
331 ctrl->value = (bass << 12)+(bass << 8)+(bass << 4)+(bass);
332 return 0;
333 }
334 case V4L2_CID_AUDIO_TREBLE:
335 {
336 int treble=t->treble;
337 if(treble >= 0x8)
338 treble = ~(treble - 0x8) & 0xf;
339 ctrl->value = (treble << 12)+(treble << 8)+(treble << 4)+(treble);
340 return 0;
341 }
342 }
343 return -EINVAL;
344}
345
Hans Verkuild5313052008-12-18 13:04:05 -0300346static int tda7432_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300347{
Hans Verkuild5313052008-12-18 13:04:05 -0300348 struct tda7432 *t = to_state(sd);
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300349
350 switch (ctrl->id) {
351 case V4L2_CID_AUDIO_MUTE:
352 t->muted=ctrl->value;
353 break;
354 case V4L2_CID_AUDIO_VOLUME:
355 if(!maxvol){ /* max +20db */
356 t->volume = 0x6f - ((ctrl->value)/630);
357 } else { /* max 0db */
358 t->volume = 0x6f - ((ctrl->value)/829);
359 }
360 if (loudness) /* Turn on the loudness bit */
361 t->volume |= TDA7432_LD_ON;
362
Hans Verkuild5313052008-12-18 13:04:05 -0300363 tda7432_write(sd, TDA7432_VL, t->volume);
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300364 return 0;
365 case V4L2_CID_AUDIO_BALANCE:
366 if (ctrl->value < 32768) {
367 /* shifted to left, attenuate right */
368 t->rr = (32768 - ctrl->value)/1057;
369 t->rf = t->rr;
370 t->lr = TDA7432_ATTEN_0DB;
371 t->lf = TDA7432_ATTEN_0DB;
372 } else if(ctrl->value > 32769) {
373 /* shifted to right, attenuate left */
374 t->lf = (ctrl->value - 32768)/1057;
375 t->lr = t->lf;
376 t->rr = TDA7432_ATTEN_0DB;
377 t->rf = TDA7432_ATTEN_0DB;
378 } else {
379 /* centered */
380 t->rr = TDA7432_ATTEN_0DB;
381 t->rf = TDA7432_ATTEN_0DB;
382 t->lf = TDA7432_ATTEN_0DB;
383 t->lr = TDA7432_ATTEN_0DB;
384 }
385 break;
386 case V4L2_CID_AUDIO_BASS:
387 t->bass = ctrl->value >> 12;
388 if(t->bass>= 0x8)
389 t->bass = (~t->bass & 0xf) + 0x8 ;
390
Hans Verkuild5313052008-12-18 13:04:05 -0300391 tda7432_write(sd, TDA7432_TN, 0x10 | (t->bass << 4) | t->treble);
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300392 return 0;
393 case V4L2_CID_AUDIO_TREBLE:
394 t->treble= ctrl->value >> 12;
395 if(t->treble>= 0x8)
396 t->treble = (~t->treble & 0xf) + 0x8 ;
397
Hans Verkuild5313052008-12-18 13:04:05 -0300398 tda7432_write(sd, TDA7432_TN, 0x10 | (t->bass << 4) | t->treble);
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300399 return 0;
400 default:
401 return -EINVAL;
402 }
403
404 /* Used for both mute and balance changes */
405 if (t->muted)
406 {
407 /* Mute & update balance*/
Hans Verkuild5313052008-12-18 13:04:05 -0300408 tda7432_write(sd, TDA7432_LF, t->lf | TDA7432_MUTE);
409 tda7432_write(sd, TDA7432_LR, t->lr | TDA7432_MUTE);
410 tda7432_write(sd, TDA7432_RF, t->rf | TDA7432_MUTE);
411 tda7432_write(sd, TDA7432_RR, t->rr | TDA7432_MUTE);
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300412 } else {
Hans Verkuild5313052008-12-18 13:04:05 -0300413 tda7432_write(sd, TDA7432_LF, t->lf);
414 tda7432_write(sd, TDA7432_LR, t->lr);
415 tda7432_write(sd, TDA7432_RF, t->rf);
416 tda7432_write(sd, TDA7432_RR, t->rr);
Mauro Carvalho Chehab7a00d452006-08-25 16:53:09 -0300417 }
418 return 0;
419}
420
Hans Verkuild5313052008-12-18 13:04:05 -0300421static int tda7432_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422{
Hans Verkuild5313052008-12-18 13:04:05 -0300423 switch (qc->id) {
Hans Verkuild5313052008-12-18 13:04:05 -0300424 case V4L2_CID_AUDIO_VOLUME:
Hans Verkuil10afbef2009-02-21 18:47:24 -0300425 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880);
426 case V4L2_CID_AUDIO_MUTE:
427 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
Hans Verkuild5313052008-12-18 13:04:05 -0300428 case V4L2_CID_AUDIO_BALANCE:
429 case V4L2_CID_AUDIO_BASS:
430 case V4L2_CID_AUDIO_TREBLE:
Hans Verkuil10afbef2009-02-21 18:47:24 -0300431 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432 }
Hans Verkuild5313052008-12-18 13:04:05 -0300433 return -EINVAL;
434}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435
Hans Verkuild5313052008-12-18 13:04:05 -0300436static int tda7432_command(struct i2c_client *client, unsigned cmd, void *arg)
437{
438 return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg);
439}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440
Hans Verkuild5313052008-12-18 13:04:05 -0300441/* ----------------------------------------------------------------------- */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442
Hans Verkuild5313052008-12-18 13:04:05 -0300443static const struct v4l2_subdev_core_ops tda7432_core_ops = {
444 .queryctrl = tda7432_queryctrl,
445 .g_ctrl = tda7432_g_ctrl,
446 .s_ctrl = tda7432_s_ctrl,
447};
448
449static const struct v4l2_subdev_ops tda7432_ops = {
450 .core = &tda7432_core_ops,
451};
452
453/* ----------------------------------------------------------------------- */
454
455/* *********************** *
456 * i2c interface functions *
457 * *********************** */
458
459static int tda7432_probe(struct i2c_client *client,
460 const struct i2c_device_id *id)
461{
462 struct tda7432 *t;
463 struct v4l2_subdev *sd;
464
465 v4l_info(client, "chip found @ 0x%02x (%s)\n",
466 client->addr << 1, client->adapter->name);
467
468 t = kzalloc(sizeof(*t), GFP_KERNEL);
469 if (!t)
470 return -ENOMEM;
471 sd = &t->sd;
472 v4l2_i2c_subdev_init(sd, client, &tda7432_ops);
473 if (loudness < 0 || loudness > 15) {
474 v4l2_warn(sd, "loudness parameter must be between 0 and 15\n");
475 if (loudness < 0)
476 loudness = 0;
477 if (loudness > 15)
478 loudness = 15;
479 }
480
481 do_tda7432_init(sd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700482 return 0;
483}
484
Hans Verkuild5313052008-12-18 13:04:05 -0300485static int tda7432_remove(struct i2c_client *client)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486{
Hans Verkuild5313052008-12-18 13:04:05 -0300487 struct v4l2_subdev *sd = i2c_get_clientdata(client);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488
Hans Verkuild5313052008-12-18 13:04:05 -0300489 do_tda7432_init(sd);
490 v4l2_device_unregister_subdev(sd);
491 kfree(to_state(sd));
492 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493}
494
Hans Verkuild5313052008-12-18 13:04:05 -0300495static const struct i2c_device_id tda7432_id[] = {
496 { "tda7432", 0 },
497 { }
498};
499MODULE_DEVICE_TABLE(i2c, tda7432_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500
Hans Verkuild5313052008-12-18 13:04:05 -0300501static struct v4l2_i2c_driver_data v4l2_i2c_data = {
502 .name = "tda7432",
Hans Verkuild5313052008-12-18 13:04:05 -0300503 .command = tda7432_command,
504 .probe = tda7432_probe,
505 .remove = tda7432_remove,
506 .id_table = tda7432_id,
507};