]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/media/video/tuner-core.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[mirror_ubuntu-bionic-kernel.git] / drivers / media / video / tuner-core.c
1 /*
2 *
3 * i2c tv tuner chip device driver
4 * core core, i.e. kernel interfaces, registering and so on
5 */
6
7 #include <linux/module.h>
8 #include <linux/moduleparam.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <linux/string.h>
12 #include <linux/timer.h>
13 #include <linux/delay.h>
14 #include <linux/errno.h>
15 #include <linux/slab.h>
16 #include <linux/poll.h>
17 #include <linux/i2c.h>
18 #include <linux/types.h>
19 #include <linux/videodev.h>
20 #include <linux/init.h>
21
22 #include <media/tuner.h>
23 #include <media/audiochip.h>
24
25 #include "msp3400.h"
26
27 #define UNSET (-1U)
28
29 /* standard i2c insmod options */
30 static unsigned short normal_i2c[] = {
31 0x4b, /* tda8290 */
32 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
33 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
34 I2C_CLIENT_END
35 };
36
37 I2C_CLIENT_INSMOD;
38
39 /* insmod options used at init time => read/only */
40 static unsigned int addr = 0;
41 module_param(addr, int, 0444);
42
43 static unsigned int no_autodetect = 0;
44 module_param(no_autodetect, int, 0444);
45
46 static unsigned int show_i2c = 0;
47 module_param(show_i2c, int, 0444);
48
49 /* insmod options used at runtime => read/write */
50 unsigned int tuner_debug = 0;
51 module_param(tuner_debug, int, 0644);
52
53 static unsigned int tv_range[2] = { 44, 958 };
54 static unsigned int radio_range[2] = { 65, 108 };
55
56 module_param_array(tv_range, int, NULL, 0644);
57 module_param_array(radio_range, int, NULL, 0644);
58
59 MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
60 MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
61 MODULE_LICENSE("GPL");
62
63 static struct i2c_driver driver;
64 static struct i2c_client client_template;
65
66 /* ---------------------------------------------------------------------- */
67
68 /* Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz */
69 static void set_tv_freq(struct i2c_client *c, unsigned int freq)
70 {
71 struct tuner *t = i2c_get_clientdata(c);
72
73 if (t->type == UNSET) {
74 tuner_warn ("tuner type not set\n");
75 return;
76 }
77 if (NULL == t->tv_freq) {
78 tuner_warn ("Tuner has no way to set tv freq\n");
79 return;
80 }
81 if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) {
82 tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n",
83 freq / 16, freq % 16 * 100 / 16, tv_range[0],
84 tv_range[1]);
85 }
86 t->tv_freq(c, freq);
87 }
88
89 static void set_radio_freq(struct i2c_client *c, unsigned int freq)
90 {
91 struct tuner *t = i2c_get_clientdata(c);
92
93 if (t->type == UNSET) {
94 tuner_warn ("tuner type not set\n");
95 return;
96 }
97 if (NULL == t->radio_freq) {
98 tuner_warn ("tuner has no way to set radio frequency\n");
99 return;
100 }
101 if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) {
102 tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n",
103 freq / 16000, freq % 16000 * 100 / 16000,
104 radio_range[0], radio_range[1]);
105 }
106
107 t->radio_freq(c, freq);
108 return;
109 }
110
111 static void set_freq(struct i2c_client *c, unsigned long freq)
112 {
113 struct tuner *t = i2c_get_clientdata(c);
114
115 switch (t->mode) {
116 case V4L2_TUNER_RADIO:
117 tuner_dbg("radio freq set to %lu.%02lu\n",
118 freq / 16000, freq % 16000 * 100 / 16000);
119 set_radio_freq(c, freq);
120 break;
121 case V4L2_TUNER_ANALOG_TV:
122 case V4L2_TUNER_DIGITAL_TV:
123 tuner_dbg("tv freq set to %lu.%02lu\n",
124 freq / 16, freq % 16 * 100 / 16);
125 set_tv_freq(c, freq);
126 break;
127 }
128 t->freq = freq;
129 }
130
131 static void set_type(struct i2c_client *c, unsigned int type,
132 unsigned int new_mode_mask)
133 {
134 struct tuner *t = i2c_get_clientdata(c);
135 unsigned char buffer[4];
136
137 if (type == UNSET || type == TUNER_ABSENT) {
138 tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr);
139 return;
140 }
141
142 if (type >= tuner_count) {
143 tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count);
144 return;
145 }
146
147 /* This code detects calls by card attach_inform */
148 if (NULL == t->i2c.dev.driver) {
149 tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr);
150
151 t->type=type;
152 return;
153 }
154
155 t->type = type;
156
157 switch (t->type) {
158 case TUNER_MT2032:
159 microtune_init(c);
160 break;
161 case TUNER_PHILIPS_TDA8290:
162 tda8290_init(c);
163 break;
164 case TUNER_TEA5767:
165 if (tea5767_tuner_init(c) == EINVAL) {
166 t->type = TUNER_ABSENT;
167 t->mode_mask = T_UNINITIALIZED;
168 return;
169 }
170 t->mode_mask = T_RADIO;
171 break;
172 case TUNER_PHILIPS_FMD1216ME_MK3:
173 buffer[0] = 0x0b;
174 buffer[1] = 0xdc;
175 buffer[2] = 0x9c;
176 buffer[3] = 0x60;
177 i2c_master_send(c, buffer, 4);
178 mdelay(1);
179 buffer[2] = 0x86;
180 buffer[3] = 0x54;
181 i2c_master_send(c, buffer, 4);
182 default_tuner_init(c);
183 break;
184 case TUNER_LG_TDVS_H062F:
185 /* Set the Auxiliary Byte. */
186 buffer[2] &= ~0x20;
187 buffer[2] |= 0x18;
188 buffer[3] = 0x20;
189 i2c_master_send(c, buffer, 4);
190 default_tuner_init(c);
191 break;
192 default:
193 default_tuner_init(c);
194 break;
195 }
196
197 if (t->mode_mask == T_UNINITIALIZED)
198 t->mode_mask = new_mode_mask;
199
200 set_freq(c, t->freq);
201 tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
202 c->adapter->name, c->driver->name, c->addr << 1, type,
203 t->mode_mask);
204 }
205
206 /*
207 * This function apply tuner config to tuner specified
208 * by tun_setup structure. I addr is unset, then admin status
209 * and tun addr status is more precise then current status,
210 * it's applied. Otherwise status and type are applied only to
211 * tuner with exactly the same addr.
212 */
213
214 static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
215 {
216 struct tuner *t = i2c_get_clientdata(c);
217
218 if ((tun_setup->addr == ADDR_UNSET &&
219 (t->mode_mask & tun_setup->mode_mask)) ||
220 tun_setup->addr == c->addr) {
221 set_type(c, tun_setup->type, tun_setup->mode_mask);
222 }
223 }
224
225 static inline int check_mode(struct tuner *t, char *cmd)
226 {
227 if ((1 << t->mode & t->mode_mask) == 0) {
228 return EINVAL;
229 }
230
231 switch (t->mode) {
232 case V4L2_TUNER_RADIO:
233 tuner_dbg("Cmd %s accepted for radio\n", cmd);
234 break;
235 case V4L2_TUNER_ANALOG_TV:
236 tuner_dbg("Cmd %s accepted for analog TV\n", cmd);
237 break;
238 case V4L2_TUNER_DIGITAL_TV:
239 tuner_dbg("Cmd %s accepted for digital TV\n", cmd);
240 break;
241 }
242 return 0;
243 }
244
245 static char pal[] = "-";
246 module_param_string(pal, pal, sizeof(pal), 0644);
247 static char secam[] = "-";
248 module_param_string(secam, secam, sizeof(secam), 0644);
249
250 /* get more precise norm info from insmod option */
251 static int tuner_fixup_std(struct tuner *t)
252 {
253 if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) {
254 switch (pal[0]) {
255 case 'b':
256 case 'B':
257 case 'g':
258 case 'G':
259 tuner_dbg ("insmod fixup: PAL => PAL-BG\n");
260 t->std = V4L2_STD_PAL_BG;
261 break;
262 case 'i':
263 case 'I':
264 tuner_dbg ("insmod fixup: PAL => PAL-I\n");
265 t->std = V4L2_STD_PAL_I;
266 break;
267 case 'd':
268 case 'D':
269 case 'k':
270 case 'K':
271 tuner_dbg ("insmod fixup: PAL => PAL-DK\n");
272 t->std = V4L2_STD_PAL_DK;
273 break;
274 case 'M':
275 case 'm':
276 tuner_dbg ("insmod fixup: PAL => PAL-M\n");
277 t->std = V4L2_STD_PAL_M;
278 break;
279 case 'N':
280 case 'n':
281 tuner_dbg ("insmod fixup: PAL => PAL-N\n");
282 t->std = V4L2_STD_PAL_N;
283 break;
284 case '-':
285 /* default parameter, do nothing */
286 break;
287 default:
288 tuner_warn ("pal= argument not recognised\n");
289 break;
290 }
291 }
292 if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
293 switch (secam[0]) {
294 case 'd':
295 case 'D':
296 case 'k':
297 case 'K':
298 tuner_dbg ("insmod fixup: SECAM => SECAM-DK\n");
299 t->std = V4L2_STD_SECAM_DK;
300 break;
301 case 'l':
302 case 'L':
303 tuner_dbg ("insmod fixup: SECAM => SECAM-L\n");
304 t->std = V4L2_STD_SECAM_L;
305 break;
306 case '-':
307 /* default parameter, do nothing */
308 break;
309 default:
310 tuner_warn ("secam= argument not recognised\n");
311 break;
312 }
313 }
314
315 return 0;
316 }
317
318 /* ---------------------------------------------------------------------- */
319
320 /* static var Used only in tuner_attach and tuner_probe */
321 static unsigned default_mode_mask;
322
323 /* During client attach, set_type is called by adapter's attach_inform callback.
324 set_type must then be completed by tuner_attach.
325 */
326 static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
327 {
328 struct tuner *t;
329
330 client_template.adapter = adap;
331 client_template.addr = addr;
332
333 t = kmalloc(sizeof(struct tuner), GFP_KERNEL);
334 if (NULL == t)
335 return -ENOMEM;
336 memset(t, 0, sizeof(struct tuner));
337 memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
338 i2c_set_clientdata(&t->i2c, t);
339 t->type = UNSET;
340 t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
341 t->audmode = V4L2_TUNER_MODE_STEREO;
342 t->mode_mask = T_UNINITIALIZED;
343
344
345 tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
346
347 if (show_i2c) {
348 unsigned char buffer[16];
349 int i,rc;
350
351 memset(buffer, 0, sizeof(buffer));
352 rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer));
353 printk("tuner-%04x I2C RECV = ",addr);
354 for (i=0;i<rc;i++)
355 printk("%02x ",buffer[i]);
356 printk("\n");
357 }
358 /* TEA5767 autodetection code - only for addr = 0xc0 */
359 if (!no_autodetect) {
360 if (addr == 0x60) {
361 if (tea5767_autodetection(&t->i2c) != EINVAL) {
362 t->type = TUNER_TEA5767;
363 t->mode_mask = T_RADIO;
364 t->mode = T_STANDBY;
365 t->freq = 87.5 * 16; /* Sets freq to FM range */
366 default_mode_mask &= ~T_RADIO;
367
368 i2c_attach_client (&t->i2c);
369 set_type(&t->i2c,t->type, t->mode_mask);
370 return 0;
371 }
372 }
373 }
374
375 /* Initializes only the first adapter found */
376 if (default_mode_mask != T_UNINITIALIZED) {
377 tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask);
378 t->mode_mask = default_mode_mask;
379 t->freq = 400 * 16; /* Sets freq to VHF High */
380 default_mode_mask = T_UNINITIALIZED;
381 }
382
383 /* Should be just before return */
384 i2c_attach_client (&t->i2c);
385 set_type (&t->i2c,t->type, t->mode_mask);
386 return 0;
387 }
388
389 static int tuner_probe(struct i2c_adapter *adap)
390 {
391 if (0 != addr) {
392 normal_i2c[0] = addr;
393 normal_i2c[1] = I2C_CLIENT_END;
394 }
395
396 default_mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
397
398 if (adap->class & I2C_CLASS_TV_ANALOG)
399 return i2c_probe(adap, &addr_data, tuner_attach);
400 return 0;
401 }
402
403 static int tuner_detach(struct i2c_client *client)
404 {
405 struct tuner *t = i2c_get_clientdata(client);
406 int err;
407
408 err = i2c_detach_client(&t->i2c);
409 if (err) {
410 tuner_warn
411 ("Client deregistration failed, client not detached.\n");
412 return err;
413 }
414
415 kfree(t);
416 return 0;
417 }
418
419 /*
420 * Switch tuner to other mode. If tuner support both tv and radio,
421 * set another frequency to some value (This is needed for some pal
422 * tuners to avoid locking). Otherwise, just put second tuner in
423 * standby mode.
424 */
425
426 static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
427 {
428 if (mode == t->mode)
429 return 0;
430
431 t->mode = mode;
432
433 if (check_mode(t, cmd) == EINVAL) {
434 t->mode = T_STANDBY;
435 if (t->standby)
436 t->standby (client);
437 return EINVAL;
438 }
439 return 0;
440 }
441
442 #define switch_v4l2() if (!t->using_v4l2) \
443 tuner_dbg("switching to v4l2\n"); \
444 t->using_v4l2 = 1;
445
446 static inline int check_v4l2(struct tuner *t)
447 {
448 if (t->using_v4l2) {
449 tuner_dbg ("ignore v4l1 call\n");
450 return EINVAL;
451 }
452 return 0;
453 }
454
455 static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
456 {
457 struct tuner *t = i2c_get_clientdata(client);
458 unsigned int *iarg = (int *)arg;
459
460 switch (cmd) {
461 /* --- configuration --- */
462 case TUNER_SET_TYPE_ADDR:
463 tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n",
464 ((struct tuner_setup *)arg)->type,
465 ((struct tuner_setup *)arg)->addr,
466 ((struct tuner_setup *)arg)->mode_mask);
467
468 set_addr(client, (struct tuner_setup *)arg);
469 break;
470 case AUDC_SET_RADIO:
471 set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO");
472 break;
473 case TUNER_SET_STANDBY:
474 {
475 if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL)
476 return 0;
477 if (t->standby)
478 t->standby (client);
479 break;
480 }
481 case AUDC_CONFIG_PINNACLE:
482 if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL)
483 return 0;
484 switch (*iarg) {
485 case 2:
486 tuner_dbg("pinnacle pal\n");
487 t->radio_if2 = 33300 * 1000;
488 break;
489 case 3:
490 tuner_dbg("pinnacle ntsc\n");
491 t->radio_if2 = 41300 * 1000;
492 break;
493 }
494 break;
495 case VIDIOCSAUDIO:
496 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL)
497 return 0;
498 if (check_v4l2(t) == EINVAL)
499 return 0;
500
501 /* Should be implemented, since bttv calls it */
502 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
503
504 break;
505 case MSP_SET_MATRIX:
506 case TDA9887_SET_CONFIG:
507 break;
508 /* --- v4l ioctls --- */
509 /* take care: bttv does userspace copying, we'll get a
510 kernel pointer here... */
511 case VIDIOCSCHAN:
512 {
513 static const v4l2_std_id map[] = {
514 [VIDEO_MODE_PAL] = V4L2_STD_PAL,
515 [VIDEO_MODE_NTSC] = V4L2_STD_NTSC_M,
516 [VIDEO_MODE_SECAM] = V4L2_STD_SECAM,
517 [4 /* bttv */ ] = V4L2_STD_PAL_M,
518 [5 /* bttv */ ] = V4L2_STD_PAL_N,
519 [6 /* bttv */ ] = V4L2_STD_NTSC_M_JP,
520 };
521 struct video_channel *vc = arg;
522
523 if (check_v4l2(t) == EINVAL)
524 return 0;
525
526 if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL)
527 return 0;
528
529 if (vc->norm < ARRAY_SIZE(map))
530 t->std = map[vc->norm];
531 tuner_fixup_std(t);
532 if (t->freq)
533 set_tv_freq(client, t->freq);
534 return 0;
535 }
536 case VIDIOCSFREQ:
537 {
538 unsigned long *v = arg;
539
540 if (check_mode(t, "VIDIOCSFREQ") == EINVAL)
541 return 0;
542 if (check_v4l2(t) == EINVAL)
543 return 0;
544
545 set_freq(client, *v);
546 return 0;
547 }
548 case VIDIOCGTUNER:
549 {
550 struct video_tuner *vt = arg;
551
552 if (check_mode(t, "VIDIOCGTUNER") == EINVAL)
553 return 0;
554 if (check_v4l2(t) == EINVAL)
555 return 0;
556
557 if (V4L2_TUNER_RADIO == t->mode) {
558 if (t->has_signal)
559 vt->signal = t->has_signal(client);
560 if (t->is_stereo) {
561 if (t->is_stereo(client))
562 vt->flags |=
563 VIDEO_TUNER_STEREO_ON;
564 else
565 vt->flags &=
566 ~VIDEO_TUNER_STEREO_ON;
567 }
568 vt->flags |= VIDEO_TUNER_LOW; /* Allow freqs at 62.5 Hz */
569
570 vt->rangelow = radio_range[0] * 16000;
571 vt->rangehigh = radio_range[1] * 16000;
572
573 } else {
574 vt->rangelow = tv_range[0] * 16;
575 vt->rangehigh = tv_range[1] * 16;
576 }
577
578 return 0;
579 }
580 case VIDIOCGAUDIO:
581 {
582 struct video_audio *va = arg;
583
584 if (check_mode(t, "VIDIOCGAUDIO") == EINVAL)
585 return 0;
586 if (check_v4l2(t) == EINVAL)
587 return 0;
588
589 if (V4L2_TUNER_RADIO == t->mode && t->is_stereo)
590 va->mode = t->is_stereo(client)
591 ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
592 return 0;
593 }
594
595 case VIDIOC_S_STD:
596 {
597 v4l2_std_id *id = arg;
598
599 if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD")
600 == EINVAL)
601 return 0;
602
603 switch_v4l2();
604
605 t->std = *id;
606 tuner_fixup_std(t);
607 if (t->freq)
608 set_freq(client, t->freq);
609 break;
610 }
611 case VIDIOC_S_FREQUENCY:
612 {
613 struct v4l2_frequency *f = arg;
614
615 t->freq = f->frequency;
616 switch_v4l2();
617 if (V4L2_TUNER_RADIO == f->type &&
618 V4L2_TUNER_RADIO != t->mode) {
619 if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
620 == EINVAL)
621 return 0;
622 }
623 set_freq(client,t->freq);
624
625 break;
626 }
627 case VIDIOC_G_FREQUENCY:
628 {
629 struct v4l2_frequency *f = arg;
630
631 if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL)
632 return 0;
633 switch_v4l2();
634 f->type = t->mode;
635 f->frequency = t->freq;
636 break;
637 }
638 case VIDIOC_G_TUNER:
639 {
640 struct v4l2_tuner *tuner = arg;
641
642 if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL)
643 return 0;
644 switch_v4l2();
645
646 if (V4L2_TUNER_RADIO == t->mode) {
647
648 if (t->has_signal)
649 tuner->signal = t->has_signal(client);
650
651 if (t->is_stereo) {
652 if (t->is_stereo(client)) {
653 tuner->rxsubchans =
654 V4L2_TUNER_SUB_STEREO |
655 V4L2_TUNER_SUB_MONO;
656 } else {
657 tuner->rxsubchans =
658 V4L2_TUNER_SUB_MONO;
659 }
660 }
661
662 tuner->capability |=
663 V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
664
665 tuner->audmode = t->audmode;
666
667 tuner->rangelow = radio_range[0] * 16000;
668 tuner->rangehigh = radio_range[1] * 16000;
669 } else {
670 tuner->rangelow = tv_range[0] * 16;
671 tuner->rangehigh = tv_range[1] * 16;
672 }
673 break;
674 }
675 case VIDIOC_S_TUNER:
676 {
677 struct v4l2_tuner *tuner = arg;
678
679 if (check_mode(t, "VIDIOC_S_TUNER") == EINVAL)
680 return 0;
681
682 switch_v4l2();
683
684 if (V4L2_TUNER_RADIO == t->mode) {
685 t->audmode = tuner->audmode;
686 set_radio_freq(client, t->freq);
687 }
688 break;
689 }
690 default:
691 tuner_dbg("Unimplemented IOCTL 0x%08x(dir=%d,tp=0x%02x,nr=%d,sz=%d)\n",
692 cmd, _IOC_DIR(cmd), _IOC_TYPE(cmd),
693 _IOC_NR(cmd), _IOC_SIZE(cmd));
694 break;
695 }
696
697 return 0;
698 }
699
700 static int tuner_suspend(struct device *dev, pm_message_t state, u32 level)
701 {
702 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
703 struct tuner *t = i2c_get_clientdata (c);
704
705 tuner_dbg ("suspend\n");
706 /* FIXME: power down ??? */
707 return 0;
708 }
709
710 static int tuner_resume(struct device *dev, u32 level)
711 {
712 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
713 struct tuner *t = i2c_get_clientdata (c);
714
715 tuner_dbg ("resume\n");
716 if (t->freq)
717 set_freq(c, t->freq);
718 return 0;
719 }
720
721 /* ----------------------------------------------------------------------- */
722
723 static struct i2c_driver driver = {
724 .owner = THIS_MODULE,
725 .name = "tuner",
726 .id = I2C_DRIVERID_TUNER,
727 .flags = I2C_DF_NOTIFY,
728 .attach_adapter = tuner_probe,
729 .detach_client = tuner_detach,
730 .command = tuner_command,
731 .driver = {
732 .suspend = tuner_suspend,
733 .resume = tuner_resume,
734 },
735 };
736 static struct i2c_client client_template = {
737 .name = "(tuner unset)",
738 .flags = I2C_CLIENT_ALLOW_USE,
739 .driver = &driver,
740 };
741
742 static int __init tuner_init_module(void)
743 {
744 return i2c_add_driver(&driver);
745 }
746
747 static void __exit tuner_cleanup_module(void)
748 {
749 i2c_del_driver(&driver);
750 }
751
752 module_init(tuner_init_module);
753 module_exit(tuner_cleanup_module);
754
755 /*
756 * Overrides for Emacs so that we follow Linus's tabbing style.
757 * ---------------------------------------------------------------------------
758 * Local variables:
759 * c-basic-offset: 8
760 * End:
761 */