diff options
author | Joonyoung Shim | 2011-03-11 03:54:46 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab | 2011-05-20 09:27:43 -0300 |
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) if (retval < 0) goto done; - /* enable RDS interrupt */ + /* enable RDS / STC interrupt */ radio->registers[SYSCONFIG1] |= SYSCONFIG1_RDSIEN; + radio->registers[SYSCONFIG1] |= SYSCONFIG1_STCIEN; radio->registers[SYSCONFIG1] &= ~SYSCONFIG1_GPIO2; radio->registers[SYSCONFIG1] |= 0x1 << 2; retval = si470x_set_register(radio, SYSCONFIG1); @@ -274,12 +275,20 @@ static void si470x_i2c_interrupt_work(struct work_struct *work) unsigned char tmpbuf[3]; int retval = 0; + /* check Seek/Tune Complete */ + retval = si470x_get_register(radio, STATUSRSSI); + if (retval < 0) + return; + + if (radio->registers[STATUSRSSI] & STATUSRSSI_STC) + complete(&radio->completion); + /* safety checks */ if ((radio->registers[SYSCONFIG1] & SYSCONFIG1_RDS) == 0) return; /* Update RDS registers */ - for (regnr = 0; regnr < RDS_REGISTER_NUM; regnr++) { + for (regnr = 1; regnr < RDS_REGISTER_NUM; regnr++) { retval = si470x_get_register(radio, STATUSRSSI + regnr); if (retval < 0) return; @@ -441,6 +450,10 @@ static int __devinit si470x_i2c_probe(struct i2c_client *client, radio->rd_index = 0; init_waitqueue_head(&radio->read_queue); + /* mark Seek/Tune Complete Interrupt enabled */ + radio->stci_enabled = true; + init_completion(&radio->completion); + retval = request_irq(client->irq, si470x_i2c_interrupt, IRQF_TRIGGER_FALLING, DRIVER_NAME, radio); if (retval) { |