diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-08-31 16:38:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:07:50 -0400 |
commit | 1f5ef19779df2c2f75870332b37dd3004c08a515 (patch) | |
tree | 684c5f74ad264e10e9abf39146772f767169d8d5 /drivers | |
parent | 3782e050f8860fb701d4cb14df16cd4ed9cce2d2 (diff) |
V4L/DVB (6141): tuner: use get_rf_strength instead of get_status to determine signal strength
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/tuner-core.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 8ee0be261076..2f74379f4e4b 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -110,6 +110,17 @@ static void fe_standby(struct tuner *t) | |||
110 | fe_tuner_ops->sleep(&t->fe); | 110 | fe_tuner_ops->sleep(&t->fe); |
111 | } | 111 | } |
112 | 112 | ||
113 | static int fe_has_signal(struct tuner *t) | ||
114 | { | ||
115 | struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops; | ||
116 | u16 strength; | ||
117 | |||
118 | if (fe_tuner_ops->get_rf_strength) | ||
119 | fe_tuner_ops->get_rf_strength(&t->fe, &strength); | ||
120 | |||
121 | return strength; | ||
122 | } | ||
123 | |||
113 | /* Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz */ | 124 | /* Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz */ |
114 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | 125 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) |
115 | { | 126 | { |
@@ -326,6 +337,7 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
326 | t->ops.set_radio_freq = fe_set_freq; | 337 | t->ops.set_radio_freq = fe_set_freq; |
327 | t->ops.standby = fe_standby; | 338 | t->ops.standby = fe_standby; |
328 | t->ops.release = fe_release; | 339 | t->ops.release = fe_release; |
340 | t->ops.has_signal = fe_has_signal; | ||
329 | } | 341 | } |
330 | 342 | ||
331 | tuner_info("type set to %s\n", t->i2c.name); | 343 | tuner_info("type set to %s\n", t->i2c.name); |
@@ -807,12 +819,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
807 | u32 tuner_status; | 819 | u32 tuner_status; |
808 | 820 | ||
809 | fe_tuner_ops->get_status(&t->fe, &tuner_status); | 821 | fe_tuner_ops->get_status(&t->fe, &tuner_status); |
810 | if (tuner_status & TUNER_STATUS_STEREO) | 822 | if (tuner_status & TUNER_STATUS_STEREO) |
811 | vt->flags |= VIDEO_TUNER_STEREO_ON; | 823 | vt->flags |= VIDEO_TUNER_STEREO_ON; |
812 | else | 824 | else |
813 | vt->flags &= ~VIDEO_TUNER_STEREO_ON; | 825 | vt->flags &= ~VIDEO_TUNER_STEREO_ON; |
814 | vt->signal = tuner_status & TUNER_STATUS_LOCKED | ||
815 | ? 65535 : 0; | ||
816 | } else { | 826 | } else { |
817 | if (t->ops.is_stereo) { | 827 | if (t->ops.is_stereo) { |
818 | if (t->ops.is_stereo(t)) | 828 | if (t->ops.is_stereo(t)) |
@@ -822,9 +832,10 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
822 | vt->flags &= | 832 | vt->flags &= |
823 | ~VIDEO_TUNER_STEREO_ON; | 833 | ~VIDEO_TUNER_STEREO_ON; |
824 | } | 834 | } |
825 | if (t->ops.has_signal) | ||
826 | vt->signal = t->ops.has_signal(t); | ||
827 | } | 835 | } |
836 | if (t->ops.has_signal) | ||
837 | vt->signal = t->ops.has_signal(t); | ||
838 | |||
828 | vt->flags |= VIDEO_TUNER_LOW; /* Allow freqs at 62.5 Hz */ | 839 | vt->flags |= VIDEO_TUNER_LOW; /* Allow freqs at 62.5 Hz */ |
829 | 840 | ||
830 | vt->rangelow = radio_range[0] * 16000; | 841 | vt->rangelow = radio_range[0] * 16000; |
@@ -948,15 +959,14 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
948 | fe_tuner_ops->get_status(&t->fe, &tuner_status); | 959 | fe_tuner_ops->get_status(&t->fe, &tuner_status); |
949 | tuner->rxsubchans = (tuner_status & TUNER_STATUS_STEREO) ? | 960 | tuner->rxsubchans = (tuner_status & TUNER_STATUS_STEREO) ? |
950 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; | 961 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; |
951 | tuner->signal = tuner_status & TUNER_STATUS_LOCKED ? 65535 : 0; | ||
952 | } else { | 962 | } else { |
953 | if (t->ops.is_stereo) { | 963 | if (t->ops.is_stereo) { |
954 | tuner->rxsubchans = t->ops.is_stereo(t) ? | 964 | tuner->rxsubchans = t->ops.is_stereo(t) ? |
955 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; | 965 | V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; |
956 | } | 966 | } |
957 | if (t->ops.has_signal) | ||
958 | tuner->signal = t->ops.has_signal(t); | ||
959 | } | 967 | } |
968 | if (t->ops.has_signal) | ||
969 | tuner->signal = t->ops.has_signal(t); | ||
960 | tuner->capability |= | 970 | tuner->capability |= |
961 | V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; | 971 | V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; |
962 | tuner->audmode = t->audmode; | 972 | tuner->audmode = t->audmode; |