summaryrefslogtreecommitdiff
path: root/drivers/media/radio/si470x/radio-si470x-common.c
diff options
context:
space:
mode:
authorDouglas Fischer <fischerdouglasc@gmail.com>2018-02-26 05:24:06 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-03-21 18:53:40 +0300
commit36d6bf8976e9188915e34cb840a5a9d5a62fb8ca (patch)
treef1bd02248a72311f734216ee45cf0e9af4124c44 /drivers/media/radio/si470x/radio-si470x-common.c
parent3e187c81d405474ef6361acf6d875657940cc2c0 (diff)
downloadlinux-36d6bf8976e9188915e34cb840a5a9d5a62fb8ca.tar.xz
media: radio: Tuning bugfix for si470x over i2c
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>
Diffstat (limited to 'drivers/media/radio/si470x/radio-si470x-common.c')
-rw-r--r--drivers/media/radio/si470x/radio-si470x-common.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c
index e0054e0f410d..6f0bf438be59 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -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;