From patchwork Sun Apr 21 19:00:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 2469311 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 13A483FC64 for ; Sun, 21 Apr 2013 19:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754114Ab3DUTAq (ORCPT ); Sun, 21 Apr 2013 15:00:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23827 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754063Ab3DUTAp (ORCPT ); Sun, 21 Apr 2013 15:00:45 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3LJ0jTV022594 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 21 Apr 2013 15:00:45 -0400 Received: from pedra (vpn1-7-177.gru2.redhat.com [10.97.7.177]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3LJ0g3X005155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 21 Apr 2013 15:00:43 -0400 Received: from v4l by pedra with local (Exim 4.80.1) (envelope-from ) id 1UTzVB-0000bA-Ck; Sun, 21 Apr 2013 16:00:41 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List Subject: [PATCH RFCv3 07/10] [media] tuner-core: add SDR support for g_tuner Date: Sun, 21 Apr 2013 16:00:36 -0300 Message-Id: <1366570839-662-8-git-send-email-mchehab@redhat.com> In-Reply-To: <1366570839-662-1-git-send-email-mchehab@redhat.com> References: <1366570839-662-1-git-send-email-mchehab@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Properly initialize the fields for VIDIOC_G_TUNER, if the device is in SDR mode. Signed-off-by: Mauro Carvalho Chehab --- 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; }