]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: radio: Tuning bugfix for si470x over i2c
authorDouglas Fischer <fischerdouglasc@gmail.com>
Mon, 26 Feb 2018 02:24:06 +0000 (21:24 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 21 Mar 2018 15:53:40 +0000 (11:53 -0400)
Fixed si470x_set_channel() trying to tune before chip is turned
on, which causes warnings in dmesg and when probing, makes driver
wait for 3s for tuning timeout. This issue did not affect USB
devices because they have a different probing sequence.

Signed-off-by: Douglas Fischer <fischerdouglasc@gmail.com>
[hans.verkuil@cisco.com: fixed space-after-( checkpatch warning]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/radio/si470x/radio-si470x-common.c

index e0054e0f410df09db5c239e52fccc7db211c886b..6f0bf438be59d3579eca9a476b7545c6b4156a51 100644 (file)
@@ -207,6 +207,15 @@ static int si470x_set_chan(struct si470x_device *radio, unsigned short chan)
        unsigned long time_left;
        bool timed_out = false;
 
+       retval = si470x_get_register(radio, POWERCFG);
+       if (retval)
+               return retval;
+
+       if ((radio->registers[POWERCFG] & (POWERCFG_ENABLE|POWERCFG_DMUTE))
+               != (POWERCFG_ENABLE|POWERCFG_DMUTE)) {
+               return 0;
+       }
+
        /* start tuning */
        radio->registers[CHANNEL] &= ~CHANNEL_CHAN;
        radio->registers[CHANNEL] |= CHANNEL_TUNE | chan;