Properly initialize the fields for VIDIOC_G_TUNER, if the device is in SDR mode. Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> --- drivers/media/v4l2-core/tuner-core.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c index b97ec63..e54b5ae 100644 --- a/drivers/media/v4l2-core/tuner-core.c +++ b/drivers/media/v4l2-core/tuner-core.c @@ -1190,7 +1190,31 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) } /* radio mode */ - if (vt->type == t->mode) { + vt->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; + + if (V4L2_TUNER_IS_SDR(vt->type)) { + vt->rangelow = tv_range[0] * 16000; + vt->rangehigh = tv_range[1] * 16000; + else { + vt->rangelow = radio_range[0] * 16000; + vt->rangehigh = radio_range[1] * 16000; + } + /* Check if the radio device is active */ + if (vt->type != t->mode) + return 0; + + if (V4L2_TUNER_IS_SDR(vt->type)) { + if (fe_tuner_ops->get_bandwidth) + fe_tuner_ops->get_bandwidth(&t->fe, + &vt->bandwidth); + if (fe_tuner_ops->get_if_frequency) + fe_tuner_ops->get_if_frequency(&t->fe, + &vt->int_freq); + /* + * Sampe rate is not a tuner props - it is up to the + * bridge driver to fill it. + */ + } else { vt->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; if (fe_tuner_ops->get_status) { u32 tuner_status; @@ -1203,9 +1227,6 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) } vt->audmode = t->audmode; } - vt->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; - vt->rangelow = radio_range[0] * 16000; - vt->rangehigh = radio_range[1] * 16000; return 0; } -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html