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.

Changed from v2: radio power check returns if power is off instead
of putting the rest of the function in the conditional.

Signed-off-by: Douglas Fischer <fischerdougl...@gmail.com>
---

diff -uprN linux.orig/drivers/media/radio/si470x/radio-si470x-common.c 
linux/drivers/media/radio/si470x/radio-si470x-common.c
--- linux.orig/drivers/media/radio/si470x/radio-si470x-common.c 2018-01-15 
21:58:10.675620432 -0500
+++ linux/drivers/media/radio/si470x/radio-si470x-common.c      2018-02-25 
19:18:11.108930138 -0500
@@ -207,6 +207,15 @@ static int si470x_set_chan(struct si470x
        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;

Reply via email to