diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2011-06-26 04:35:34 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-07 16:20:04 -0400 |
commit | 5ad339a29858db6544052f98973d235129f9f49c (patch) | |
tree | 28d7c175a1495f79162c8e0e6f2056d07f1272e9 /drivers/media | |
parent | d118e294e27000bfd728308d7b74ba67350e779c (diff) |
[media] tuner-core.c: don't change type field in g_tuner or g_frequency
The tuner core should not silently change the type field in g_tuner and
g_frequency. If the tuner is in a different mode than the one that was
requested, then just fill in what you can and don't attempt to read afc,
signal or rxsubchans values.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/tuner-core.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 39af999112f9..cfa9f7efe93d 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1101,8 +1101,7 @@ static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f) | |||
1101 | 1101 | ||
1102 | if (check_mode(t, f->type) == -EINVAL) | 1102 | if (check_mode(t, f->type) == -EINVAL) |
1103 | return 0; | 1103 | return 0; |
1104 | f->type = t->mode; | 1104 | if (f->type == t->mode && fe_tuner_ops->get_frequency && !t->standby) { |
1105 | if (fe_tuner_ops->get_frequency && !t->standby) { | ||
1106 | u32 abs_freq; | 1105 | u32 abs_freq; |
1107 | 1106 | ||
1108 | fe_tuner_ops->get_frequency(&t->fe, &abs_freq); | 1107 | fe_tuner_ops->get_frequency(&t->fe, &abs_freq); |
@@ -1110,7 +1109,7 @@ static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f) | |||
1110 | DIV_ROUND_CLOSEST(abs_freq * 2, 125) : | 1109 | DIV_ROUND_CLOSEST(abs_freq * 2, 125) : |
1111 | DIV_ROUND_CLOSEST(abs_freq, 62500); | 1110 | DIV_ROUND_CLOSEST(abs_freq, 62500); |
1112 | } else { | 1111 | } else { |
1113 | f->frequency = (V4L2_TUNER_RADIO == t->mode) ? | 1112 | f->frequency = (V4L2_TUNER_RADIO == f->type) ? |
1114 | t->radio_freq : t->tv_freq; | 1113 | t->radio_freq : t->tv_freq; |
1115 | } | 1114 | } |
1116 | return 0; | 1115 | return 0; |
@@ -1134,32 +1133,33 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) | |||
1134 | 1133 | ||
1135 | if (check_mode(t, vt->type) == -EINVAL) | 1134 | if (check_mode(t, vt->type) == -EINVAL) |
1136 | return 0; | 1135 | return 0; |
1137 | vt->type = t->mode; | 1136 | if (vt->type == t->mode && analog_ops->get_afc) |
1138 | if (analog_ops->get_afc) | ||
1139 | vt->afc = analog_ops->get_afc(&t->fe); | 1137 | vt->afc = analog_ops->get_afc(&t->fe); |
1140 | if (t->mode == V4L2_TUNER_ANALOG_TV) | 1138 | if (vt->type == V4L2_TUNER_ANALOG_TV) |
1141 | vt->capability |= V4L2_TUNER_CAP_NORM; | 1139 | vt->capability |= V4L2_TUNER_CAP_NORM; |
1142 | if (t->mode != V4L2_TUNER_RADIO) { | 1140 | if (vt->type != V4L2_TUNER_RADIO) { |
1143 | vt->rangelow = tv_range[0] * 16; | 1141 | vt->rangelow = tv_range[0] * 16; |
1144 | vt->rangehigh = tv_range[1] * 16; | 1142 | vt->rangehigh = tv_range[1] * 16; |
1145 | return 0; | 1143 | return 0; |
1146 | } | 1144 | } |
1147 | 1145 | ||
1148 | /* radio mode */ | 1146 | /* radio mode */ |
1149 | vt->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 1147 | if (vt->type == t->mode) { |
1150 | if (fe_tuner_ops->get_status) { | 1148 | vt->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
1151 | u32 tuner_status; | 1149 | if (fe_tuner_ops->get_status) { |
1152 | 1150 | u32 tuner_status; | |
1153 | fe_tuner_ops->get_status(&t->fe, &tuner_status); | 1151 | |
1154 | vt->rxsubchans = | 1152 | fe_tuner_ops->get_status(&t->fe, &tuner_status); |
1155 | (tuner_status & TUNER_STATUS_STEREO) ? | 1153 | vt->rxsubchans = |
1156 | V4L2_TUNER_SUB_STEREO : | 1154 | (tuner_status & TUNER_STATUS_STEREO) ? |
1157 | V4L2_TUNER_SUB_MONO; | 1155 | V4L2_TUNER_SUB_STEREO : |
1156 | V4L2_TUNER_SUB_MONO; | ||
1157 | } | ||
1158 | if (analog_ops->has_signal) | ||
1159 | vt->signal = analog_ops->has_signal(&t->fe); | ||
1160 | vt->audmode = t->audmode; | ||
1158 | } | 1161 | } |
1159 | if (analog_ops->has_signal) | ||
1160 | vt->signal = analog_ops->has_signal(&t->fe); | ||
1161 | vt->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; | 1162 | vt->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; |
1162 | vt->audmode = t->audmode; | ||
1163 | vt->rangelow = radio_range[0] * 16000; | 1163 | vt->rangelow = radio_range[0] * 16000; |
1164 | vt->rangehigh = radio_range[1] * 16000; | 1164 | vt->rangehigh = radio_range[1] * 16000; |
1165 | 1165 | ||