aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-09-28 07:18:07 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-05 13:55:38 -0500
commitba1066d2e9686a5c96c5c0dfcbda7f874fa7b88d (patch)
tree885080bd0311655ff9ec34a4f8a2b1b279cddfc6
parent84a15ded76ec8ec23d84974238b7864813143655 (diff)
[media] tuner-core: map audmode to STEREO for radio devices
Fixes a v4l2-compliance error: setting audmode to a value other than mono or stereo for a radio device should map to MODE_STEREO. The spec specifies that for radio devices only mono and stereo audmodes are valid. If the user specifies another audmode in v4l2_tuner, then that should be mapped to valid audmode. That didn't happen here. Note that tuner drivers might decide to limit the possible audmode even further if it only supports mono. In that case the tuner driver can set audmode to mono. However, that new value wasn't copied back to t->audmode, and that has been fixed as well in this patch. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/v4l2-core/tuner-core.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c
index b5a819af2b8c..b5a8aac2e126 100644
--- a/drivers/media/v4l2-core/tuner-core.c
+++ b/drivers/media/v4l2-core/tuner-core.c
@@ -1013,6 +1013,11 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq)
1013 t->standby = false; 1013 t->standby = false;
1014 1014
1015 analog_ops->set_params(&t->fe, &params); 1015 analog_ops->set_params(&t->fe, &params);
1016 /*
1017 * The tuner driver might decide to change the audmode if it only
1018 * supports stereo, so update t->audmode.
1019 */
1020 t->audmode = params.audmode;
1016} 1021}
1017 1022
1018/* 1023/*
@@ -1235,8 +1240,18 @@ static int tuner_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
1235 if (set_mode(t, vt->type)) 1240 if (set_mode(t, vt->type))
1236 return 0; 1241 return 0;
1237 1242
1238 if (t->mode == V4L2_TUNER_RADIO) 1243 if (t->mode == V4L2_TUNER_RADIO) {
1239 t->audmode = vt->audmode; 1244 t->audmode = vt->audmode;
1245 /*
1246 * For radio audmode can only be mono or stereo. Map any
1247 * other values to stereo. The actual tuner driver that is
1248 * called in set_radio_freq can decide to limit the audmode to
1249 * mono if only mono is supported.
1250 */
1251 if (t->audmode != V4L2_TUNER_MODE_MONO &&
1252 t->audmode != V4L2_TUNER_MODE_STEREO)
1253 t->audmode = V4L2_TUNER_MODE_STEREO;
1254 }
1240 set_freq(t, 0); 1255 set_freq(t, 0);
1241 1256
1242 return 0; 1257 return 0;