From patchwork Mon Nov 24 06:57:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 27114 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1XsndM-00058v-MK; Mon, 24 Nov 2014 08:00:28 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-5) with esmtp id 1XsndK-00054q-79; Mon, 24 Nov 2014 08:00:28 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbaKXHAX (ORCPT + 1 other); Mon, 24 Nov 2014 02:00:23 -0500 Received: from mail-la0-f49.google.com ([209.85.215.49]:41005 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbaKXHAX (ORCPT ); Mon, 24 Nov 2014 02:00:23 -0500 Received: by mail-la0-f49.google.com with SMTP id hs14so6923284lab.22 for ; Sun, 23 Nov 2014 23:00:21 -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=jXu4qJbRu7qPiSxirYzBtaaQ1MDypoD6UFUp0BwUJCY=; b=kUvcOt6nhBLmUleWvSsZ+VUiprc/aJiyfnOtW1pYdZBfinzDW5OJCrv8+4+d0quiop 33xwkP6Amv0UzLrMkRYIIWsg2BeESltwNNZBiebqz2rtoP8e/yXu7/ro0UndFvH4+CMN xJPYirrvyXNN9oVg6WfuEWjQQRfO/p4ERv+GGwvMiEMVTgfNymt6sa/KuCw3kLG+BESp QenCMWQieGcbNkBIUHxjm8YmEGrR+mrjVNt7Y9EUlv+qyJDL3pEywjQJPclYjNsYPtLo 2R2P6HffkWPjjo7oknPt3CtxB3M04q/BdELpWGFFSGr8ScYqNGb5R26OLVWzVbLqsSiB t9yw== X-Gm-Message-State: ALoCoQnrk72+ZdhMA+LD4ODBVg4K/xvC2SnJXXDVU8T9wQQ9Tnbmbt/NDGvgbquWudMys6zF4t8Q X-Received: by 10.112.167.130 with SMTP id zo2mr18815826lbb.4.1416812421507; Sun, 23 Nov 2014 23:00:21 -0800 (PST) Received: from dl160.lan (188-67-15-102.bb.dnainternet.fi. [188.67.15.102]) by mx.google.com with ESMTPSA id r4sm3311273lah.23.2014.11.23.23.00.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Nov 2014 23:00:20 -0800 (PST) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCHv2 1/4] si2157: Add support for Si2146-A10 Date: Mon, 24 Nov 2014 08:57:33 +0200 Message-Id: <1416812256-27894-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-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.11.24.65121 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_5000_5999 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NS , __YOUTUBE_RCVD 0' The Silicon Labs Si2146 tuner seems to work with the same driver as the Si2157, but there a few exceptions. The powerup command seems to be quite a bit different. In addition there's a property 0207 that requires a different value. Thus another entry is created in the si2157_id table to support also si2146 in this driver. The datasheet is available on manufacturer's website: http://www.silabs.com/support%20documents/technicaldocs/Si2146-short.pdf Patch v2 adds also updates the descriptions to contain the newly supported chip. Signed-off-by: Olli Salonen --- drivers/media/tuners/si2157.c | 29 ++++++++++++++++++++++------- drivers/media/tuners/si2157.h | 2 +- drivers/media/tuners/si2157_priv.h | 8 ++++++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index b086b87..a8f2edb9 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari * @@ -93,8 +93,13 @@ static int si2157_init(struct dvb_frontend *fe) goto warm; /* power up */ - memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15); - cmd.wlen = 15; + if (s->chiptype == SI2157_CHIPTYPE_SI2146) { + memcpy(cmd.args, "\xc0\x05\x01\x00\x00\x0b\x00\x00\x01", 9); + cmd.wlen = 9; + } else { + memcpy(cmd.args, "\xc0\x00\x0c\x00\x00\x01\x01\x01\x01\x01\x01\x02\x00\x00\x01", 15); + cmd.wlen = 15; + } cmd.rlen = 1; ret = si2157_cmd_execute(s, &cmd); if (ret) @@ -114,6 +119,7 @@ static int si2157_init(struct dvb_frontend *fe) #define SI2158_A20 ('A' << 24 | 58 << 16 | '2' << 8 | '0' << 0) #define SI2157_A30 ('A' << 24 | 57 << 16 | '3' << 8 | '0' << 0) #define SI2147_A30 ('A' << 24 | 47 << 16 | '3' << 8 | '0' << 0) + #define SI2146_A10 ('A' << 24 | 46 << 16 | '1' << 8 | '0' << 0) switch (chip_id) { case SI2158_A20: @@ -121,6 +127,7 @@ static int si2157_init(struct dvb_frontend *fe) break; case SI2157_A30: case SI2147_A30: + case SI2146_A10: goto skip_fw_download; break; default: @@ -275,7 +282,10 @@ static int si2157_set_params(struct dvb_frontend *fe) if (ret) goto err; - memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6); + if (s->chiptype == SI2157_CHIPTYPE_SI2146) + memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6); + else + memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6); cmd.wlen = 6; cmd.rlen = 4; ret = si2157_cmd_execute(s, &cmd); @@ -308,7 +318,7 @@ static int si2157_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) static const struct dvb_tuner_ops si2157_ops = { .info = { - .name = "Silicon Labs Si2157/Si2158", + .name = "Silicon Labs Si2146/2147/2157/2158", .frequency_min = 110000000, .frequency_max = 862000000, }, @@ -339,6 +349,7 @@ static int si2157_probe(struct i2c_client *client, s->fe = cfg->fe; s->inversion = cfg->inversion; s->fw_loaded = false; + s->chiptype = (u8)id->driver_data; mutex_init(&s->i2c_mutex); /* check if the tuner is there */ @@ -355,7 +366,10 @@ static int si2157_probe(struct i2c_client *client, i2c_set_clientdata(client, s); dev_info(&s->client->dev, - "Silicon Labs Si2157/Si2158 successfully attached\n"); + "Silicon Labs %s successfully attached\n", + s->chiptype == SI2157_CHIPTYPE_SI2146 ? + "Si2146" : "Si2147/2157/2158"); + return 0; err: dev_dbg(&client->dev, "failed=%d\n", ret); @@ -380,6 +394,7 @@ static int si2157_remove(struct i2c_client *client) static const struct i2c_device_id si2157_id[] = { {"si2157", 0}, + {"si2146", 1}, {} }; MODULE_DEVICE_TABLE(i2c, si2157_id); @@ -396,7 +411,7 @@ static struct i2c_driver si2157_driver = { module_i2c_driver(si2157_driver); -MODULE_DESCRIPTION("Silicon Labs Si2157/Si2158 silicon tuner driver"); +MODULE_DESCRIPTION("Silicon Labs Si2146/2147/2157/2158 silicon tuner driver"); MODULE_AUTHOR("Antti Palosaari "); MODULE_LICENSE("GPL"); MODULE_FIRMWARE(SI2158_A20_FIRMWARE); diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h index d3b19ca..8467d08 100644 --- a/drivers/media/tuners/si2157.h +++ b/drivers/media/tuners/si2157.h @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari * diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h index e71ffaf..c1ea821 100644 --- a/drivers/media/tuners/si2157_priv.h +++ b/drivers/media/tuners/si2157_priv.h @@ -1,5 +1,5 @@ /* - * Silicon Labs Si2147/2157/2158 silicon tuner driver + * Silicon Labs Si2146/2147/2157/2158 silicon tuner driver * * Copyright (C) 2014 Antti Palosaari * @@ -28,9 +28,13 @@ struct si2157 { bool active; bool fw_loaded; bool inversion; + u8 chiptype; }; -/* firmare command struct */ +#define SI2157_CHIPTYPE_SI2157 0 +#define SI2157_CHIPTYPE_SI2146 1 + +/* firmware command struct */ #define SI2157_ARGLEN 30 struct si2157_cmd { u8 args[SI2157_ARGLEN];