diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2011-03-11 01:54:46 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:27:43 -0400 |
commit | 0830be3fe107372b375256c5303cabd85d4be234 (patch) | |
tree | 4bfc253ded7b4d1020c336601255b223fb27f6a4 /drivers/media/radio/si470x/radio-si470x-i2c.c | |
parent | cc73b4b57c59141bb8a99f86a1af95f296262558 (diff) |
[media] radio-si470x: support seek and tune interrupt enable
Currently we use busy waiting to seek and tune, it can replace to
interrupt way. SI470X I2C driver supports interrupt way to week and tune
via this patch.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/si470x/radio-si470x-i2c.c')
-rw-r--r-- | drivers/media/radio/si470x/radio-si470x-i2c.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c index 4ce541a5eb47..5a2975ded5d2 100644 --- a/drivers/media/radio/si470x/radio-si470x-i2c.c +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c | |||
@@ -197,8 +197,9 @@ int si470x_fops_open(struct file *file) | |||
197 | if (retval < 0) | 197 | if (retval < 0) |
198 | goto done; | 198 | goto done; |
199 | 199 | ||
200 | /* enable RDS interrupt */ | 200 | /* enable RDS / STC interrupt */ |
201 | radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDSIEN; | 201 | radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDSIEN; |
202 | radio->registers[SYSCONFIG1] |= SYSCONFIG1_STCIEN; | ||
202 | radio->registers[SYSCONFIG1] &= ~SYSCONFIG1_GPIO2; | 203 | radio->registers[SYSCONFIG1] &= ~SYSCONFIG1_GPIO2; |
203 | radio->registers[SYSCONFIG1] |= 0x1 << 2; | 204 | radio->registers[SYSCONFIG1] |= 0x1 << 2; |
204 | retval = si470x_set_register(radio, SYSCONFIG1); | 205 | retval = si470x_set_register(radio, SYSCONFIG1); |
@@ -274,12 +275,20 @@ static void si470x_i2c_interrupt_work(struct work_struct *work) | |||
274 | unsigned char tmpbuf[3]; | 275 | unsigned char tmpbuf[3]; |
275 | int retval = 0; | 276 | int retval = 0; |
276 | 277 | ||
278 | /* check Seek/Tune Complete */ | ||
279 | retval = si470x_get_register(radio, STATUSRSSI); | ||
280 | if (retval < 0) | ||
281 | return; | ||
282 | |||
283 | if (radio->registers[STATUSRSSI] & STATUSRSSI_STC) | ||
284 | complete(&radio->completion); | ||
285 | |||
277 | /* safety checks */ | 286 | /* safety checks */ |
278 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) | 287 | if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) |
279 | return; | 288 | return; |
280 | 289 | ||
281 | /* Update RDS registers */ | 290 | /* Update RDS registers */ |
282 | for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++) { | 291 | for (regnr = 1; regnr < RDS_REGISTER_NUM; regnr++) { |
283 | retval = si470x_get_register(radio, STATUSRSSI + regnr); | 292 | retval = si470x_get_register(radio, STATUSRSSI + regnr); |
284 | if (retval < 0) | 293 | if (retval < 0) |
285 | return; | 294 | return; |
@@ -441,6 +450,10 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client, | |||
441 | radio->rd_index = 0; | 450 | radio->rd_index = 0; |
442 | init_waitqueue_head(&radio->read_queue); | 451 | init_waitqueue_head(&radio->read_queue); |
443 | 452 | ||
453 | /* mark Seek/Tune Complete Interrupt enabled */ | ||
454 | radio->stci_enabled = true; | ||
455 | init_completion(&radio->completion); | ||
456 | |||
444 | retval = request_irq(client->irq, si470x_i2c_interrupt, | 457 | retval = request_irq(client->irq, si470x_i2c_interrupt, |
445 | IRQF_TRIGGER_FALLING, DRIVER_NAME, radio); | 458 | IRQF_TRIGGER_FALLING, DRIVER_NAME, radio); |
446 | if (retval) { | 459 | if (retval) { |