From patchwork Sun Apr 21 19:00:38 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: 2469301 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 E66FA3FC64 for ; Sun, 21 Apr 2013 19:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754105Ab3DUTAq (ORCPT ); Sun, 21 Apr 2013 15:00:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12948 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754052Ab3DUTAp (ORCPT ); Sun, 21 Apr 2013 15:00:45 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3LJ0ivw016017 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 21 Apr 2013 15:00:44 -0400 Received: from pedra (vpn1-7-177.gru2.redhat.com [10.97.7.177]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3LJ0gD0018563 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 21 Apr 2013 15:00:44 -0400 Received: from v4l by pedra with local (Exim 4.80.1) (envelope-from ) id 1UTzVB-0000bJ-Is; Sun, 21 Apr 2013 16:00:41 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List Subject: [PATCH RFCv3 09/10] [media] tuner-core: add support to get the tuner frequency range Date: Sun, 21 Apr 2013 16:00:38 -0300 Message-Id: <1366570839-662-10-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.25 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 For SDR, the tuner range is different than TV or radio ranges. Only the actual tuner driver knows what's the range supported by the device. So, call the tuner to get it, if the tuner supports. Otherwise, keep the TV range, as is it broader than the radio one. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-core/dvb_frontend.h | 2 ++ drivers/media/v4l2-core/tuner-core.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h index 371b6ca..74a50e6 100644 --- a/drivers/media/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb-core/dvb_frontend.h @@ -215,6 +215,8 @@ struct dvb_tuner_ops { int (*get_frequency)(struct dvb_frontend *fe, u32 *frequency); int (*get_bandwidth)(struct dvb_frontend *fe, u32 *bandwidth); int (*get_if_frequency)(struct dvb_frontend *fe, u32 *frequency); + int (*get_tuner_freq_range)(struct dvb_frontend *fe, + u32 *min_freq, u32 *max_freq); #define TUNER_STATUS_LOCKED 1 #define TUNER_STATUS_STEREO 2 diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c index abdcda4..28bbcad 100644 --- a/drivers/media/v4l2-core/tuner-core.c +++ b/drivers/media/v4l2-core/tuner-core.c @@ -460,6 +460,13 @@ static void set_type(struct i2c_client *c, unsigned int type, t->tv_range[i] = tv_range[i] * 16; } + if (fe_tuner_ops->get_tuner_freq_range) { + u32 min, max; + fe_tuner_ops->get_tuner_freq_range(&t->fe, &min, &max); + t->sdr_range[0] = min / 16; + t->sdr_range[1] = max / 16; + } + tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", c->adapter->name, c->driver->driver.name, c->addr << 1, type, t->mode_mask);