From patchwork Wed Mar 28 17:00:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiro TSUKADA X-Patchwork-Id: 10313625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2FF7560467 for ; Wed, 28 Mar 2018 17:01:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DE8F29F93 for ; Wed, 28 Mar 2018 17:01:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CBBA29FC1; Wed, 28 Mar 2018 17:01:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 905FE29F93 for ; Wed, 28 Mar 2018 17:01:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659AbeC1RB2 (ORCPT ); Wed, 28 Mar 2018 13:01:28 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:45763 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbeC1RB1 (ORCPT ); Wed, 28 Mar 2018 13:01:27 -0400 Received: by mail-pg0-f67.google.com with SMTP id y63so1149436pgy.12 for ; Wed, 28 Mar 2018 10:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mcjrMIU/7hx/S4l/kFANkuHV/ppVW/CrnfHfJ+E9cKE=; b=DW/FoGubm2hYUQ/xK1s20rurb40hrbzR57aOws8AQxbqBtlfdHW5jlP6XVxJl44zAZ ThxlGLNExmwoLY0TZjuYyfDovc9T+lJJL7Ic5MJg4JUvrBN+ggNzSrJcHPqodPyuuJbc /D92jHeyImZm9KJBzkx7yyAIeoOLhRps6IrNd8G8/fgCMTmycWP6qhIgVWXFiF05+L0I ffmBiKMwAw9o+h+pqrMdqFEXFtBt0iRgcM3BHR6fbKe43FGTV19wUBtB0saqQMZPshFN gICQ6RfT/cVst3q7tKWSG+gQcxDYi234Enb2SwzSSRDwS7ro693VByoO5sdXI4SRyIOu 6kJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mcjrMIU/7hx/S4l/kFANkuHV/ppVW/CrnfHfJ+E9cKE=; b=treCVYOu+EqbPcSn28ghvTJiDEQlYfDBss4u3GPi4s/9m8KiBN18DM8aSGCuFWvuxM 30s+kXvQu7pRT0AOH+zuwh8TTzwnUwbMyLHY9Cr6SSit86ExOm3s3OBoVMYx8PFgaqFB DBrzAOZkKTNdx+W7MDzTkZLdYOeoWTDEaGCgozhz+Oq/pF3iyQ2ZlAo67L1p6/QOCWGb Fc3JIqeOcNjaQ1j70u8wpYdG8TW5oLc6T2fdbR1gtjnR6MyuA4WDu5GUh0bn7s+UWpWT eJCFKm25zUZ+9eonTNQQvps0qWCT5NSydhtoU1wySuAuEmiq3RRk/2SweWgeOY6v1bjU Se9Q== X-Gm-Message-State: AElRT7FWUDzeAhnvD8DXS5wuuuBRy4uTkpYUhd4I+5BI8OtMXGh5DPOR lZPM6o8mabck3eLnv30jCtS/HA== X-Google-Smtp-Source: AIpwx4/i7lSI7LgiY3UjXL6zXgzKHNSc5t1lrhKge1UcRuxJP8kQS49U0ZgMNVsRrJhy5cPkJoiUFA== X-Received: by 10.98.14.215 with SMTP id 84mr3605794pfo.168.1522256486194; Wed, 28 Mar 2018 10:01:26 -0700 (PDT) Received: from localhost.localdomain (softbank219203027033.bbtec.net. [219.203.27.33]) by smtp.googlemail.com with ESMTPSA id u4sm8950012pfb.43.2018.03.28.10.01.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Mar 2018 10:01:25 -0700 (PDT) From: tskd08@gmail.com To: linux-media@vger.kernel.org Cc: mchehab@s-opensource.com, Akihiro Tsukada , crope@iki.fi Subject: [PATCH v4 1/5] dvb-frontends/dvb-pll: add i2c driver support Date: Thu, 29 Mar 2018 02:00:57 +0900 Message-Id: <20180328170101.29385-2-tskd08@gmail.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180328170101.29385-1-tskd08@gmail.com> References: <20180328170101.29385-1-tskd08@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Akihiro Tsukada registers the module as an i2c driver, but keeps dvb_pll_attach() untouched for compatibility. Signed-off-by: Akihiro Tsukada --- Changes since v3: - use standard i2c_device_id instead of dvb_pll_config drivers/media/dvb-frontends/dvb-pll.c | 67 +++++++++++++++++++++++++++++++++++ drivers/media/dvb-frontends/dvb-pll.h | 24 +++++++++++++ 2 files changed, 91 insertions(+) diff --git a/drivers/media/dvb-frontends/dvb-pll.c b/drivers/media/dvb-frontends/dvb-pll.c index 5553b89b804..e2a93aae04f 100644 --- a/drivers/media/dvb-frontends/dvb-pll.c +++ b/drivers/media/dvb-frontends/dvb-pll.c @@ -827,6 +827,73 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, } EXPORT_SYMBOL(dvb_pll_attach); + +static int +dvb_pll_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct dvb_pll_config *cfg; + struct dvb_frontend *fe; + unsigned int desc_id; + + cfg = client->dev.platform_data; + fe = cfg->fe; + i2c_set_clientdata(client, fe); + desc_id = (unsigned int) id->driver_data; + + if (!dvb_pll_attach(fe, client->addr, client->adapter, desc_id)) + return -ENOMEM; + + dev_info(&client->dev, "DVB Simple Tuner attached.\n"); + return 0; +} + +static int dvb_pll_remove(struct i2c_client *client) +{ + struct dvb_frontend *fe; + + fe = i2c_get_clientdata(client); + dvb_pll_release(fe); + return 0; +} + + +static const struct i2c_device_id dvb_pll_id[] = { + {DVB_PLL_THOMSON_DTT7579_NAME, DVB_PLL_THOMSON_DTT7579}, + {DVB_PLL_THOMSON_DTT759X_NAME, DVB_PLL_THOMSON_DTT759X}, + {DVB_PLL_LG_Z201_NAME, DVB_PLL_LG_Z201}, + {DVB_PLL_UNKNOWN_1_NAME, DVB_PLL_UNKNOWN_1}, + {DVB_PLL_TUA6010XS_NAME, DVB_PLL_TUA6010XS}, + {DVB_PLL_ENV57H1XD5_NAME, DVB_PLL_ENV57H1XD5}, + {DVB_PLL_TUA6034_NAME, DVB_PLL_TUA6034}, + {DVB_PLL_TDA665X_NAME, DVB_PLL_TDA665X}, + {DVB_PLL_TDED4_NAME, DVB_PLL_TDED4}, + {DVB_PLL_TDHU2_NAME, DVB_PLL_TDHU2}, + {DVB_PLL_SAMSUNG_TBMV_NAME, DVB_PLL_SAMSUNG_TBMV}, + {DVB_PLL_PHILIPS_SD1878_TDA8261_NAME, DVB_PLL_PHILIPS_SD1878_TDA8261}, + {DVB_PLL_OPERA1_NAME, DVB_PLL_OPERA1}, + {DVB_PLL_SAMSUNG_DTOS403IH102A_NAME, DVB_PLL_SAMSUNG_DTOS403IH102A}, + {DVB_PLL_SAMSUNG_TDTC9251DH0_NAME, DVB_PLL_SAMSUNG_TDTC9251DH0}, + {DVB_PLL_SAMSUNG_TBDU18132_NAME, DVB_PLL_SAMSUNG_TBDU18132}, + {DVB_PLL_SAMSUNG_TBMU24112_NAME, DVB_PLL_SAMSUNG_TBMU24112}, + {DVB_PLL_TDEE4_NAME, DVB_PLL_TDEE4}, + {DVB_PLL_THOMSON_DTT7520X_NAME, DVB_PLL_THOMSON_DTT7520X}, + {} +}; + + +MODULE_DEVICE_TABLE(i2c, dvb_pll_id); + +static struct i2c_driver dvb_pll_driver = { + .driver = { + .name = "dvb_pll", + }, + .probe = dvb_pll_probe, + .remove = dvb_pll_remove, + .id_table = dvb_pll_id, +}; + +module_i2c_driver(dvb_pll_driver); + MODULE_DESCRIPTION("dvb pll library"); MODULE_AUTHOR("Gerd Knorr"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb-frontends/dvb-pll.h b/drivers/media/dvb-frontends/dvb-pll.h index ca885e71d2f..e96994bf668 100644 --- a/drivers/media/dvb-frontends/dvb-pll.h +++ b/drivers/media/dvb-frontends/dvb-pll.h @@ -30,6 +30,30 @@ #define DVB_PLL_TDEE4 18 #define DVB_PLL_THOMSON_DTT7520X 19 +#define DVB_PLL_THOMSON_DTT7579_NAME "dtt7579" +#define DVB_PLL_THOMSON_DTT759X_NAME "dtt759x" +#define DVB_PLL_LG_Z201_NAME "z201" +#define DVB_PLL_UNKNOWN_1_NAME "unknown_1" +#define DVB_PLL_TUA6010XS_NAME "tua6010xs" +#define DVB_PLL_ENV57H1XD5_NAME "env57h1xd5" +#define DVB_PLL_TUA6034_NAME "tua6034" +#define DVB_PLL_TDA665X_NAME "tda665x" +#define DVB_PLL_TDED4_NAME "tded4" +#define DVB_PLL_TDHU2_NAME "tdhu2" +#define DVB_PLL_SAMSUNG_TBMV_NAME "tbmv" +#define DVB_PLL_PHILIPS_SD1878_TDA8261_NAME "sd1878_tda8261" +#define DVB_PLL_OPERA1_NAME "opera1" +#define DVB_PLL_SAMSUNG_DTOS403IH102A_NAME "dtos403ih102a" +#define DVB_PLL_SAMSUNG_TDTC9251DH0_NAME "tdtc9251dh0" +#define DVB_PLL_SAMSUNG_TBDU18132_NAME "tbdu18132" +#define DVB_PLL_SAMSUNG_TBMU24112_NAME "tbmu24112" +#define DVB_PLL_TDEE4_NAME "tdee4" +#define DVB_PLL_THOMSON_DTT7520X_NAME "dtt7520x" + +struct dvb_pll_config { + struct dvb_frontend *fe; +}; + #if IS_REACHABLE(CONFIG_DVB_PLL) /** * Attach a dvb-pll to the supplied frontend structure.