blob: 70bc72e795d04b30814e32eb599f3b42f1de4328 [file] [log] [blame]
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -07001/*
2 Driver for SAA6588 RDS decoder
3
4 (c) 2005 Hans J. Koch
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21
22#include <linux/module.h>
23#include <linux/kernel.h>
24#include <linux/i2c.h>
25#include <linux/types.h>
Hans Verkuil7f6adea2009-02-19 17:31:17 -030026#include <linux/videodev2.h>
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070027#include <linux/init.h>
28#include <linux/errno.h>
29#include <linux/slab.h>
30#include <linux/poll.h>
31#include <linux/wait.h>
32#include <asm/uaccess.h>
33
Hans Verkuilb9218f22010-12-27 12:22:46 -030034#include <media/saa6588.h>
Hans Verkuilc3fda7f2009-02-11 19:23:57 -030035#include <media/v4l2-device.h>
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070036
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070037
38/* insmod options */
Douglas Schilling Landgrafff699e62008-04-22 14:41:48 -030039static unsigned int debug;
40static unsigned int xtal;
Hans Verkuil3c86cf72009-06-20 06:09:14 -030041static unsigned int mmbs;
Douglas Schilling Landgrafff699e62008-04-22 14:41:48 -030042static unsigned int plvl;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070043static unsigned int bufblocks = 100;
44
Eric Sesterhenn / snakebyte9b565eb2006-01-13 14:10:23 -020045module_param(debug, int, 0644);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070046MODULE_PARM_DESC(debug, "enable debug messages");
Eric Sesterhenn / snakebyte9b565eb2006-01-13 14:10:23 -020047module_param(xtal, int, 0);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070048MODULE_PARM_DESC(xtal, "select oscillator frequency (0..3), default 0");
Hans Verkuil3c86cf72009-06-20 06:09:14 -030049module_param(mmbs, int, 0);
50MODULE_PARM_DESC(mmbs, "enable MMBS mode: 0=off (default), 1=on");
Eric Sesterhenn / snakebyte9b565eb2006-01-13 14:10:23 -020051module_param(plvl, int, 0);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070052MODULE_PARM_DESC(plvl, "select pause level (0..3), default 0");
Eric Sesterhenn / snakebyte9b565eb2006-01-13 14:10:23 -020053module_param(bufblocks, int, 0);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070054MODULE_PARM_DESC(bufblocks, "number of buffered blocks, default 100");
55
56MODULE_DESCRIPTION("v4l2 driver module for SAA6588 RDS decoder");
57MODULE_AUTHOR("Hans J. Koch <koch@hjk-az.de>");
58
59MODULE_LICENSE("GPL");
60
61/* ---------------------------------------------------------------------- */
62
63#define UNSET (-1U)
64#define PREFIX "saa6588: "
65#define dprintk if (debug) printk
66
67struct saa6588 {
Hans Verkuilc3fda7f2009-02-11 19:23:57 -030068 struct v4l2_subdev sd;
Jean Delvarefb6991d2009-03-07 07:44:12 -030069 struct delayed_work work;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070070 spinlock_t lock;
71 unsigned char *buffer;
72 unsigned int buf_size;
73 unsigned int rd_index;
74 unsigned int wr_index;
75 unsigned int block_count;
76 unsigned char last_blocknum;
77 wait_queue_head_t read_queue;
78 int data_available_for_read;
Hans Verkuil3c86cf72009-06-20 06:09:14 -030079 u8 sync;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070080};
81
Hans Verkuilc3fda7f2009-02-11 19:23:57 -030082static inline struct saa6588 *to_saa6588(struct v4l2_subdev *sd)
83{
84 return container_of(sd, struct saa6588, sd);
85}
86
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -070087/* ---------------------------------------------------------------------- */
88
89/*
90 * SAA6588 defines
91 */
92
93/* Initialization and mode control byte (0w) */
94
95/* bit 0+1 (DAC0/DAC1) */
96#define cModeStandard 0x00
97#define cModeFastPI 0x01
98#define cModeReducedRequest 0x02
99#define cModeInvalid 0x03
100
101/* bit 2 (RBDS) */
102#define cProcessingModeRDS 0x00
103#define cProcessingModeRBDS 0x04
104
105/* bit 3+4 (SYM0/SYM1) */
106#define cErrCorrectionNone 0x00
107#define cErrCorrection2Bits 0x08
108#define cErrCorrection5Bits 0x10
109#define cErrCorrectionNoneRBDS 0x18
110
111/* bit 5 (NWSY) */
112#define cSyncNormal 0x00
113#define cSyncRestart 0x20
114
115/* bit 6 (TSQD) */
116#define cSigQualityDetectOFF 0x00
117#define cSigQualityDetectON 0x40
118
119/* bit 7 (SQCM) */
120#define cSigQualityTriggered 0x00
121#define cSigQualityContinous 0x80
122
123/* Pause level and flywheel control byte (1w) */
124
125/* bits 0..5 (FEB0..FEB5) */
126#define cFlywheelMaxBlocksMask 0x3F
127#define cFlywheelDefault 0x20
128
129/* bits 6+7 (PL0/PL1) */
130#define cPauseLevel_11mV 0x00
131#define cPauseLevel_17mV 0x40
132#define cPauseLevel_27mV 0x80
133#define cPauseLevel_43mV 0xC0
134
135/* Pause time/oscillator frequency/quality detector control byte (1w) */
136
137/* bits 0..4 (SQS0..SQS4) */
138#define cQualityDetectSensMask 0x1F
139#define cQualityDetectDefault 0x0F
140
141/* bit 5 (SOSC) */
142#define cSelectOscFreqOFF 0x00
143#define cSelectOscFreqON 0x20
144
145/* bit 6+7 (PTF0/PTF1) */
146#define cOscFreq_4332kHz 0x00
147#define cOscFreq_8664kHz 0x40
148#define cOscFreq_12996kHz 0x80
149#define cOscFreq_17328kHz 0xC0
150
151/* ---------------------------------------------------------------------- */
152
Al Viroae8aed02005-09-29 00:37:34 +0100153static int block_to_user_buf(struct saa6588 *s, unsigned char __user *user_buf)
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700154{
155 int i;
156
157 if (s->rd_index == s->wr_index) {
158 if (debug > 2)
159 dprintk(PREFIX "Read: buffer empty.\n");
160 return 0;
161 }
162
163 if (debug > 2) {
164 dprintk(PREFIX "Read: ");
165 for (i = s->rd_index; i < s->rd_index + 3; i++)
166 dprintk("0x%02x ", s->buffer[i]);
167 }
168
169 if (copy_to_user(user_buf, &s->buffer[s->rd_index], 3))
170 return -EFAULT;
171
172 s->rd_index += 3;
173 if (s->rd_index >= s->buf_size)
174 s->rd_index = 0;
175 s->block_count--;
176
177 if (debug > 2)
178 dprintk("%d blocks total.\n", s->block_count);
179
180 return 1;
181}
182
Hans Verkuilb9218f22010-12-27 12:22:46 -0300183static void read_from_buf(struct saa6588 *s, struct saa6588_command *a)
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700184{
185 unsigned long flags;
186
Al Viroae8aed02005-09-29 00:37:34 +0100187 unsigned char __user *buf_ptr = a->buffer;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700188 unsigned int i;
189 unsigned int rd_blocks;
190
191 a->result = 0;
192 if (!a->buffer)
193 return;
194
195 while (!s->data_available_for_read) {
196 int ret = wait_event_interruptible(s->read_queue,
197 s->data_available_for_read);
198 if (ret == -ERESTARTSYS) {
199 a->result = -EINTR;
200 return;
201 }
202 }
203
204 spin_lock_irqsave(&s->lock, flags);
205 rd_blocks = a->block_count;
206 if (rd_blocks > s->block_count)
207 rd_blocks = s->block_count;
208
Ira Snydera5bbc7d2006-11-20 07:20:48 -0300209 if (!rd_blocks) {
210 spin_unlock_irqrestore(&s->lock, flags);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700211 return;
Ira Snydera5bbc7d2006-11-20 07:20:48 -0300212 }
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700213
214 for (i = 0; i < rd_blocks; i++) {
215 if (block_to_user_buf(s, buf_ptr)) {
216 buf_ptr += 3;
217 a->result++;
218 } else
219 break;
220 }
221 a->result *= 3;
222 s->data_available_for_read = (s->block_count > 0);
223 spin_unlock_irqrestore(&s->lock, flags);
224}
225
226static void block_to_buf(struct saa6588 *s, unsigned char *blockbuf)
227{
228 unsigned int i;
229
230 if (debug > 3)
231 dprintk(PREFIX "New block: ");
232
233 for (i = 0; i < 3; ++i) {
234 if (debug > 3)
235 dprintk("0x%02x ", blockbuf[i]);
236 s->buffer[s->wr_index] = blockbuf[i];
237 s->wr_index++;
238 }
239
240 if (s->wr_index >= s->buf_size)
241 s->wr_index = 0;
242
243 if (s->wr_index == s->rd_index) {
Hans J. Koch6c3d67a2005-11-08 21:38:39 -0800244 s->rd_index += 3;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700245 if (s->rd_index >= s->buf_size)
246 s->rd_index = 0;
247 } else
248 s->block_count++;
249
250 if (debug > 3)
251 dprintk("%d blocks total.\n", s->block_count);
252}
253
254static void saa6588_i2c_poll(struct saa6588 *s)
255{
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300256 struct i2c_client *client = v4l2_get_subdevdata(&s->sd);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700257 unsigned long flags;
258 unsigned char tmpbuf[6];
259 unsigned char blocknum;
260 unsigned char tmp;
261
262 /* Although we only need 3 bytes, we have to read at least 6.
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300263 SAA6588 returns garbage otherwise. */
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300264 if (6 != i2c_master_recv(client, &tmpbuf[0], 6)) {
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700265 if (debug > 1)
266 dprintk(PREFIX "read error!\n");
267 return;
268 }
269
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300270 s->sync = tmpbuf[0] & 0x10;
271 if (!s->sync)
272 return;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700273 blocknum = tmpbuf[0] >> 5;
274 if (blocknum == s->last_blocknum) {
275 if (debug > 3)
276 dprintk("Saw block %d again.\n", blocknum);
277 return;
278 }
279
280 s->last_blocknum = blocknum;
281
282 /*
283 Byte order according to v4l2 specification:
284
285 Byte 0: Least Significant Byte of RDS Block
286 Byte 1: Most Significant Byte of RDS Block
287 Byte 2 Bit 7: Error bit. Indicates that an uncorrectable error
288 occurred during reception of this block.
289 Bit 6: Corrected bit. Indicates that an error was
290 corrected for this data block.
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300291 Bits 5-3: Same as bits 0-2.
292 Bits 2-0: Block number.
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700293
294 SAA6588 byte order is Status-MSB-LSB, so we have to swap the
295 first and the last of the 3 bytes block.
296 */
297
298 tmp = tmpbuf[2];
299 tmpbuf[2] = tmpbuf[0];
300 tmpbuf[0] = tmp;
301
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300302 /* Map 'Invalid block E' to 'Invalid Block' */
303 if (blocknum == 6)
304 blocknum = V4L2_RDS_BLOCK_INVALID;
305 /* And if are not in mmbs mode, then 'Block E' is also mapped
306 to 'Invalid Block'. As far as I can tell MMBS is discontinued,
307 and if there is ever a need to support E blocks, then please
308 contact the linux-media mailinglist. */
309 else if (!mmbs && blocknum == 5)
310 blocknum = V4L2_RDS_BLOCK_INVALID;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700311 tmp = blocknum;
312 tmp |= blocknum << 3; /* Received offset == Offset Name (OK ?) */
313 if ((tmpbuf[2] & 0x03) == 0x03)
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300314 tmp |= V4L2_RDS_BLOCK_ERROR; /* uncorrectable error */
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700315 else if ((tmpbuf[2] & 0x03) != 0x00)
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300316 tmp |= V4L2_RDS_BLOCK_CORRECTED; /* corrected error */
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700317 tmpbuf[2] = tmp; /* Is this enough ? Should we also check other bits ? */
318
319 spin_lock_irqsave(&s->lock, flags);
320 block_to_buf(s, tmpbuf);
321 spin_unlock_irqrestore(&s->lock, flags);
322 s->data_available_for_read = 1;
323 wake_up_interruptible(&s->read_queue);
324}
325
David Howellsc4028952006-11-22 14:57:56 +0000326static void saa6588_work(struct work_struct *work)
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700327{
Jean Delvarefb6991d2009-03-07 07:44:12 -0300328 struct saa6588 *s = container_of(work, struct saa6588, work.work);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700329
330 saa6588_i2c_poll(s);
Jean Delvarefb6991d2009-03-07 07:44:12 -0300331 schedule_delayed_work(&s->work, msecs_to_jiffies(20));
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700332}
333
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300334static void saa6588_configure(struct saa6588 *s)
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700335{
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300336 struct i2c_client *client = v4l2_get_subdevdata(&s->sd);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700337 unsigned char buf[3];
338 int rc;
339
340 buf[0] = cSyncRestart;
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300341 if (mmbs)
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700342 buf[0] |= cProcessingModeRBDS;
343
344 buf[1] = cFlywheelDefault;
345 switch (plvl) {
346 case 0:
347 buf[1] |= cPauseLevel_11mV;
348 break;
349 case 1:
350 buf[1] |= cPauseLevel_17mV;
351 break;
352 case 2:
353 buf[1] |= cPauseLevel_27mV;
354 break;
355 case 3:
356 buf[1] |= cPauseLevel_43mV;
357 break;
358 default: /* nothing */
359 break;
360 }
361
362 buf[2] = cQualityDetectDefault | cSelectOscFreqON;
363
364 switch (xtal) {
365 case 0:
366 buf[2] |= cOscFreq_4332kHz;
367 break;
368 case 1:
369 buf[2] |= cOscFreq_8664kHz;
370 break;
371 case 2:
372 buf[2] |= cOscFreq_12996kHz;
373 break;
374 case 3:
375 buf[2] |= cOscFreq_17328kHz;
376 break;
377 default: /* nothing */
378 break;
379 }
380
381 dprintk(PREFIX "writing: 0w=0x%02x 1w=0x%02x 2w=0x%02x\n",
382 buf[0], buf[1], buf[2]);
383
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300384 rc = i2c_master_send(client, buf, 3);
Hans Verkuilb5ffc222009-02-11 19:14:09 -0300385 if (rc != 3)
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700386 printk(PREFIX "i2c i/o error: rc == %d (should be 3)\n", rc);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700387}
388
389/* ---------------------------------------------------------------------- */
390
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300391static long saa6588_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700392{
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300393 struct saa6588 *s = to_saa6588(sd);
Hans Verkuilb9218f22010-12-27 12:22:46 -0300394 struct saa6588_command *a = arg;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700395
396 switch (cmd) {
397 /* --- open() for /dev/radio --- */
Hans Verkuilb9218f22010-12-27 12:22:46 -0300398 case SAA6588_CMD_OPEN:
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700399 a->result = 0; /* return error if chip doesn't work ??? */
400 break;
401 /* --- close() for /dev/radio --- */
Hans Verkuilb9218f22010-12-27 12:22:46 -0300402 case SAA6588_CMD_CLOSE:
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700403 s->data_available_for_read = 1;
404 wake_up_interruptible(&s->read_queue);
405 a->result = 0;
406 break;
407 /* --- read() for /dev/radio --- */
Hans Verkuilb9218f22010-12-27 12:22:46 -0300408 case SAA6588_CMD_READ:
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700409 read_from_buf(s, a);
410 break;
411 /* --- poll() for /dev/radio --- */
Hans Verkuilb9218f22010-12-27 12:22:46 -0300412 case SAA6588_CMD_POLL:
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700413 a->result = 0;
414 if (s->data_available_for_read) {
415 a->result |= POLLIN | POLLRDNORM;
416 }
417 poll_wait(a->instance, &s->read_queue, a->event_list);
418 break;
419
420 default:
421 /* nothing */
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300422 return -ENOIOCTLCMD;
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700423 }
424 return 0;
425}
426
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300427static int saa6588_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
428{
429 struct saa6588 *s = to_saa6588(sd);
430
Matti Aaltonencb0ed222010-10-18 06:54:14 -0300431 vt->capability |= V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_BLOCK_IO;
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300432 if (s->sync)
433 vt->rxsubchans |= V4L2_TUNER_SUB_RDS;
434 return 0;
435}
436
Hans Verkuil2f73c7c2013-03-15 06:10:06 -0300437static int saa6588_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt)
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300438{
439 struct saa6588 *s = to_saa6588(sd);
440
441 saa6588_configure(s);
442 return 0;
443}
444
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300445/* ----------------------------------------------------------------------- */
446
447static const struct v4l2_subdev_core_ops saa6588_core_ops = {
448 .ioctl = saa6588_ioctl,
449};
450
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300451static const struct v4l2_subdev_tuner_ops saa6588_tuner_ops = {
452 .g_tuner = saa6588_g_tuner,
453 .s_tuner = saa6588_s_tuner,
454};
455
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300456static const struct v4l2_subdev_ops saa6588_ops = {
457 .core = &saa6588_core_ops,
Hans Verkuil3c86cf72009-06-20 06:09:14 -0300458 .tuner = &saa6588_tuner_ops,
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300459};
460
461/* ---------------------------------------------------------------------- */
462
463static int saa6588_probe(struct i2c_client *client,
464 const struct i2c_device_id *id)
465{
466 struct saa6588 *s;
467 struct v4l2_subdev *sd;
468
469 v4l_info(client, "saa6588 found @ 0x%x (%s)\n",
470 client->addr << 1, client->adapter->name);
471
Laurent Pinchartc02b2112013-05-02 08:29:43 -0300472 s = devm_kzalloc(&client->dev, sizeof(*s), GFP_KERNEL);
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300473 if (s == NULL)
474 return -ENOMEM;
475
476 s->buf_size = bufblocks * 3;
477
Laurent Pinchartc02b2112013-05-02 08:29:43 -0300478 s->buffer = devm_kzalloc(&client->dev, s->buf_size, GFP_KERNEL);
479 if (s->buffer == NULL)
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300480 return -ENOMEM;
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300481 sd = &s->sd;
482 v4l2_i2c_subdev_init(sd, client, &saa6588_ops);
483 spin_lock_init(&s->lock);
484 s->block_count = 0;
485 s->wr_index = 0;
486 s->rd_index = 0;
487 s->last_blocknum = 0xff;
488 init_waitqueue_head(&s->read_queue);
489 s->data_available_for_read = 0;
490
491 saa6588_configure(s);
492
493 /* start polling via eventd */
Jean Delvarefb6991d2009-03-07 07:44:12 -0300494 INIT_DELAYED_WORK(&s->work, saa6588_work);
495 schedule_delayed_work(&s->work, 0);
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300496 return 0;
497}
498
499static int saa6588_remove(struct i2c_client *client)
500{
501 struct v4l2_subdev *sd = i2c_get_clientdata(client);
502 struct saa6588 *s = to_saa6588(sd);
503
504 v4l2_device_unregister_subdev(sd);
505
Jean Delvarefb6991d2009-03-07 07:44:12 -0300506 cancel_delayed_work_sync(&s->work);
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300507
Hans Verkuilc3fda7f2009-02-11 19:23:57 -0300508 return 0;
509}
510
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700511/* ----------------------------------------------------------------------- */
512
Hans Verkuilb5ffc222009-02-11 19:14:09 -0300513static const struct i2c_device_id saa6588_id[] = {
514 { "saa6588", 0 },
515 { }
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700516};
Hans Verkuilb5ffc222009-02-11 19:14:09 -0300517MODULE_DEVICE_TABLE(i2c, saa6588_id);
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700518
Hans Verkuil440d0512010-09-15 15:12:49 -0300519static struct i2c_driver saa6588_driver = {
520 .driver = {
521 .owner = THIS_MODULE,
522 .name = "saa6588",
523 },
524 .probe = saa6588_probe,
525 .remove = saa6588_remove,
526 .id_table = saa6588_id,
Mauro Carvalho Chehab10b89ee32005-09-09 13:04:03 -0700527};
Hans Verkuil440d0512010-09-15 15:12:49 -0300528
Axel Linc6e8d862012-02-12 06:56:32 -0300529module_i2c_driver(saa6588_driver);