From patchwork Sat Feb 28 15:25:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 5905651 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4EE13BF440 for ; Sat, 28 Feb 2015 15:25:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F8EB2037D for ; Sat, 28 Feb 2015 15:25:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B0128202AE for ; Sat, 28 Feb 2015 15:25:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126AbbB1PZm (ORCPT ); Sat, 28 Feb 2015 10:25:42 -0500 Received: from mail-lb0-f169.google.com ([209.85.217.169]:39259 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751615AbbB1PZl (ORCPT ); Sat, 28 Feb 2015 10:25:41 -0500 Received: by lbvn10 with SMTP id n10so22491556lbv.6 for ; Sat, 28 Feb 2015 07:25:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=0ofUInSjiO0jCvTPuPCmnKLKhBX/HzKWy2f4THoLhOE=; b=nLLF2d6mPcyVcyii8ost8uEK3gZg54e/2B7G0bLvs/vF6LHJyTw9kv4W/R852Bs3xa Pg4mucby2zlVjU433ftWVGtRoogYajoawZTNbEtZ6Mq6xPkQvlC5WqpjdPLnVk0EocsQ thE5O38PveHn3EYk6+0GDDj+U8Te1VkUkR0xtqw3KvpX38Dj/CZ9fhHcfc5j7uo4mqSs Mj4W4DkzFfDjeOSmcb+lEcZTCo1K7dP32F32vd0WG/LVms4sv4fstRpBF/Yv4rM9dVU9 fY6YgUrAXAAQu/bnrH7Bki/fweFp0jyjGBqRhlsu/pGu535a38KnbwBS5izsAcQiAOzj izvQ== X-Gm-Message-State: ALoCoQk3kj/oJ9ooRzC3thWhpCrCMa8qWOoUMepze9GPX9Et0oNnkJb9FhKe9NorhFCpyMkgVCPy X-Received: by 10.152.191.135 with SMTP id gy7mr16864766lac.91.1425137140001; Sat, 28 Feb 2015 07:25:40 -0800 (PST) Received: from dl160.lan (37-33-50-203.bb.dnainternet.fi. [37.33.50.203]) by mx.google.com with ESMTPSA id an8sm1496360lbc.45.2015.02.28.07.25.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 28 Feb 2015 07:25:38 -0800 (PST) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 1/2] si2157: IF frequency for ATSC and QAM Date: Sat, 28 Feb 2015 17:25:23 +0200 Message-Id: <1425137124-17324-1-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For supporting ATSC and QAM modes the driver should use a smaller IF frequency than 5 MHz. Signed-off-by: Olli Salonen --- drivers/media/tuners/si2157.c | 23 ++++++++++++++++++++++- drivers/media/tuners/si2157_priv.h | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index fcf139d..d8309b9 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -244,6 +244,7 @@ static int si2157_set_params(struct dvb_frontend *fe) int ret; struct si2157_cmd cmd; u8 bandwidth, delivery_system; + u32 if_frequency = 5000000; dev_dbg(&client->dev, "delivery_system=%d frequency=%u bandwidth_hz=%u\n", @@ -266,9 +267,11 @@ static int si2157_set_params(struct dvb_frontend *fe) switch (c->delivery_system) { case SYS_ATSC: delivery_system = 0x00; + if_frequency = 3250000; break; case SYS_DVBC_ANNEX_B: delivery_system = 0x10; + if_frequency = 4000000; break; case SYS_DVBT: case SYS_DVBT2: /* it seems DVB-T and DVB-T2 both are 0x20 here */ @@ -302,6 +305,20 @@ static int si2157_set_params(struct dvb_frontend *fe) if (ret) goto err; + /* set if frequency if needed */ + if (if_frequency != dev->if_frequency) { + memcpy(cmd.args, "\x14\x00\x06\x07", 4); + cmd.args[4] = (if_frequency / 1000) & 0xff; + cmd.args[5] = ((if_frequency / 1000) >> 8) & 0xff; + cmd.wlen = 6; + cmd.rlen = 4; + ret = si2157_cmd_execute(client, &cmd); + if (ret) + goto err; + + dev->if_frequency = if_frequency; + } + /* set frequency */ memcpy(cmd.args, "\x41\x00\x00\x00\x00\x00\x00\x00", 8); cmd.args[4] = (c->frequency >> 0) & 0xff; @@ -322,7 +339,10 @@ err: static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) { - *frequency = 5000000; /* default value of property 0x0706 */ + struct i2c_client *client = fe->tuner_priv; + struct si2157_dev *dev = i2c_get_clientdata(client); + + *frequency = dev->if_frequency; return 0; } @@ -360,6 +380,7 @@ static int si2157_probe(struct i2c_client *client, dev->inversion = cfg->inversion; dev->fw_loaded = false; dev->chiptype = (u8)id->driver_data; + dev->if_frequency = 5000000; /* default value of property 0x0706 */ mutex_init(&dev->i2c_mutex); /* check if the tuner is there */ diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index 7aa53bc..cd8fa5b 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -28,6 +28,7 @@ struct si2157_dev { bool fw_loaded; bool inversion; u8 chiptype; + u32 if_frequency; }; #define SI2157_CHIPTYPE_SI2157 0