From patchwork Wed Apr 20 15:17:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 8892011 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1475E9F39A for ; Wed, 20 Apr 2016 15:35:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2539C2024F for ; Wed, 20 Apr 2016 15:35:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 934E62024D for ; Wed, 20 Apr 2016 15:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752134AbcDTPfF (ORCPT ); Wed, 20 Apr 2016 11:35:05 -0400 Received: from mail-db3on0125.outbound.protection.outlook.com ([157.55.234.125]:54592 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752082AbcDTPfB (ORCPT ); Wed, 20 Apr 2016 11:35:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=f1gHkWZitfiCtcBqpfxz/MOhzzlg+/3bWnlSnLnDILY=; b=jcuNY0zfrUBnJwI1UiyPX/ezeSEp+UvSYJlYT1AuTxJUMgLN4iQizWKS262nkgjJa227cXg2xOtNT3ceilUy5eLQ10ebaotAjrp0UheHjrockmZTJks2NUke6ukROythu0cq6DET+D6BpKbhEnUClhKKQAUL2cw3ZpMnkhPbOuU= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=axentia.se; Received: from localhost.localdomain (217.210.101.82) by VI1PR02MB1312.eurprd02.prod.outlook.com (10.165.231.154) with Microsoft SMTP Server (TLS) id 15.1.466.19; Wed, 20 Apr 2016 15:19:46 +0000 From: Peter Rosin To: CC: Peter Rosin , Wolfram Sang , Jonathan Corbet , Peter Korsgaard , Guenter Roeck , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald , Antti Palosaari , Mauro Carvalho Chehab , Rob Herring , Frank Rowand , Grant Likely , Andrew Morton , "David S. Miller" , Greg Kroah-Hartman , Kalle Valo , Jiri Slaby , Daniel Baluta , Lucas De Marchi , Adriana Reus , Matt Ranostay , Krzysztof Kozlowski , Hans Verkuil , Terry Heo , Arnd Bergmann , Tommi Rantala , Crestez Dan Leonard , , , , , , Peter Rosin Subject: [PATCH v7 10/24] [media] rtl2830: convert to use an explicit i2c mux core Date: Wed, 20 Apr 2016 17:17:50 +0200 Message-ID: <1461165484-2314-11-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1461165484-2314-1-git-send-email-peda@axentia.se> References: <1461165484-2314-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB3PR01CA0069.eurprd01.prod.exchangelabs.com (10.242.133.172) To VI1PR02MB1312.eurprd02.prod.outlook.com (10.165.231.154) X-MS-Office365-Filtering-Correlation-Id: 49d63f4e-4a95-430e-9364-08d3692f37d4 X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 2:gm0/T1WhZNuHIDKgUzyVCNvsxYw8DtS+vUlqAC9FZOJUCQ3eScOqtOrgtPFJ39RNFXMTn/3yS7/NJF1GVt8bcPta+37OHOJE20G77Rrkc7xfoZA6SYd6+B4Nc/vt3TYR6Sewd9Q7ilBboBuyYbvMch4ZUZ/jIxs7oweTg6YwPNKpYI7PiatLLmVB1SgdWT5B; 3:6Jsdbmrcjp7bjjKRx5Bm9eoH0wjAlpyes5HBzxzkU/r4UOTMJj5jaLYegaFimE00LshJ3qFBcxySm5J5rOfs+1yvoDB5Ew93zArQoijVzNqmWu8ncwLw2ex0g/vCXp/g; 25:xrjdiTz3PFY3jpRLBuWCBMfpjFQy18PQp8+8NHD5FU2wUprmNAcdDRfDUWcR1X6Uifam+SxbfI9+B1M6VbkI+eD5ZPL4NUJZTIjT6pGO3pXUsqd4MYpVGw/IQ+cSuTyzwOPNW2Giht89AvI/J3rd+Oai33Y85XkGea5A9ww+6blT5xbqc0APJb7F+V49aJpORms+Crpsht+W5eOWDfe9ra3fA9T43gX09aHkzb2KWTU+BP9BFB4zjzNlspWERCcayh3v8nUk7dNrFHB1qegiJm4zLQuPTypVNkN+6PxxTXmJ5zD0C1HkLy7fcVsdBN8pNNycDDH4pM2UnDiZxLpMmQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1312; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521026)(6040130)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041046)(6043046); SRVR:VI1PR02MB1312; BCL:0; PCL:0; RULEID:; SRVR:VI1PR02MB1312; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 4:6/KyMSiSnfDmPrQ8irnwTRlTjv5I2Tw+sza2TpxnYXm7g1Dci+La6igkN3VskjH9dd8jvd4PM61Kvrk+P7JRFICl+spHwv3UT8DJM2hAIS5LZPu4IoajRJ/xKmP3YgL6qzPSJZkQIKh8IaGkHt5sMqF+Wg4zLOzxj3aLdxY3nGhK6kX5ConVmeRw6gVde57VPYBS7g+PL3jpY5NDbM351ZyWRgKDJWZvmp1SWiDhhmlzooR+bipVaBR5GgOvxlOco9L30Bs6sl28YDFeMcE+SxFW4q2UoVTvVge16kGnyvK1klE6DH2IX8qR8QzZiC8EZePZ/XpUowpqfXwwYirHbPqpNlUSyY+yD/9/dGzHByPH3vsOXjuwVa3RYJ1FbUH1IdZoVh8cEmv4Kjh09q40na8cULYHfQiWD93MqWwkFIKQRIAEXfFOx9wRioP9aMsKn6JUXXky2Ql9NFaFkb1/eg== X-Forefront-PRVS: 0918748D70 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(66066001)(2906002)(19580395003)(19580405001)(110136002)(92566002)(189998001)(5008740100001)(47776003)(42186005)(33646002)(6116002)(3846002)(5003940100001)(586003)(81166005)(48376002)(2950100001)(4326007)(50466002)(76176999)(1096002)(50226001)(77096005)(50986999)(36756003)(575784001)(86362001)(2351001)(229853001)(74482002)(5004730100002)(7059030)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB1312; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR02MB1312; 23:F/T1U1HUzcwy6k9gHzQCXjfg2COZ7uBoJeMW/Nwcd?= =?us-ascii?Q?iy14APsCZ0kl10nv3Pw8fmnPyzEPnxjhLsaxRjtbODPWFST+ci/kmhI/K+zz?= =?us-ascii?Q?tsn9xmGeii1tNE/mAXWWFeAYmgjY45vFbEuk7IDW1KQnml1RO7e9b5lY5Jfj?= =?us-ascii?Q?PGNSVf7ayaBHgDZWyDBQU33MH/yYGR5RxmqQFEF8XdxrOAM1g2YXMGmY1OMC?= =?us-ascii?Q?1vS0t8KUNEMae8/s/iIdR2q1IwZPKw+imsJGcEn9it1nCsXAR1KZNvI3qQ7Z?= =?us-ascii?Q?iEkgHNV9JQ5iCh7yi9FWa4dlZ9QSTiYBgBtGS0bvcAI7jxL3TDrtvhxq0h9X?= =?us-ascii?Q?KSePxb0Of3T1GePmNNaX+g9CcLDss8NhSxWsb7NdTTrzM/igOA92nZ/lLFd3?= =?us-ascii?Q?Fq2pgXNPCBY44fqYgoxNI0WcTiW/95Mz160dpSoY5x/GbSXgRWUzYM0zdUZj?= =?us-ascii?Q?9faE72Y7frgw/88z3eAB6dhffkRI4kL6Mgnp3l8aEMy44IG4aj3+F194gXZz?= =?us-ascii?Q?x+36nMigCb0JGA6DjPQXllP4R2X4CNNeDargwcObwuNgwckaEFJgU+qmtsXo?= =?us-ascii?Q?fPc3EOKq8ALNdpd83OD46Kcl/rUD/JlmtSZRtmdBqCa12cl636V3Af2bqno4?= =?us-ascii?Q?OI393iclQgz1lQ0Q0/6Jq1eOT7QVNk4v3RwEMhsqRG1xbYHT5oreUClVRgtd?= =?us-ascii?Q?ENVAbbNgEXUwEmYS8GwJEgKCuJTYAkRzOwqO9fcsINv0iQkvNuAbsfEqBjjv?= =?us-ascii?Q?nlkyAr7cI8j/d6mvrrRvH2uaCIRk2GngZ2qQhgL5LEyQfgty0vutrz73Il2Q?= =?us-ascii?Q?Z7YliKjL2gKsOG7gshZfYYfxjqaFD+GIieSZGPg7CTTVjJMX8E+WS2/qLiJw?= =?us-ascii?Q?FLlVpybHqk5xWUsOoMLVdhx9AOmfqUegoDevMCNU3qoCUlFhcSWJdHareWHl?= =?us-ascii?Q?vETGyQTQOQuIResoOXgcd3iQAD3W8PuLrP330B5e3GABqsFoh+PTZZbqotTs?= =?us-ascii?Q?0I=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 5:tzZJdWZeKUV9BX4D7J1vo2QcxxYv/er7Sb+1BnNYODaXOcmKHa3gE+k8tXbiKsL/NQNgahKq159cTVWItFqzSwVd5VKjwjGv+K187+Gsys9eO8hfIsVBIg4VhQMMa/y9OhxFBo3eTVpgDgY4+I/33I34c7GyrFseivLZZaLWJw1F9bF4eE1ZPYrjXSe3NELS; 24:Hs8WNaqfszpT6hmUrWd8joxU/AQz/ZBAluxzchH3BVxjjleOkTlqn1K7y7t1o2qVw8w5gs7A5MRIA1fQ0H0Yt1WRhS+tySz4RMiD2s48q2s=; 7:K3D+QJhFHtSUREzgmXDVlFlFRzkA4y2NFuvDKXA7tA2fHypEXApxzEvoMRYa095QBCwYhQ/ld7rBxjocxIFcEUvnSjVYn3SunX6Z+5u9C0RIBWDE70bCCHhxwA7jpTuFjANIWGOk9DL0vCvdpjlMVbqMcm/nLg3UP9DtoXoAhxkw+JfXy76chbV4oIyHbX3pClenKXVOoWbi6cjGdGM78Z2MKA25Ja+0MwVXPKvp1zk= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2016 15:19:46.3709 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB1312 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 Allocate an explicit i2c mux core to handle parent and child adapters etc. Update the select op to be in terms of the i2c mux core instead of the child adapter. Reviewed-by: Antti Palosaari Signed-off-by: Peter Rosin --- drivers/media/dvb-frontends/rtl2830.c | 20 ++++++++++++-------- drivers/media/dvb-frontends/rtl2830_priv.h | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c index 3f96429af0e5..d25d1e0cd4ca 100644 --- a/drivers/media/dvb-frontends/rtl2830.c +++ b/drivers/media/dvb-frontends/rtl2830.c @@ -677,9 +677,9 @@ err: * adapter lock is already taken by tuner driver. * Gate is closed automatically after single I2C transfer. */ -static int rtl2830_select(struct i2c_adapter *adap, void *mux_priv, u32 chan_id) +static int rtl2830_select(struct i2c_mux_core *muxc, u32 chan_id) { - struct i2c_client *client = mux_priv; + struct i2c_client *client = i2c_mux_priv(muxc); struct rtl2830_dev *dev = i2c_get_clientdata(client); int ret; @@ -712,7 +712,7 @@ static struct i2c_adapter *rtl2830_get_i2c_adapter(struct i2c_client *client) dev_dbg(&client->dev, "\n"); - return dev->adapter; + return dev->muxc->adapter[0]; } /* @@ -865,12 +865,16 @@ static int rtl2830_probe(struct i2c_client *client, goto err_regmap_exit; /* create muxed i2c adapter for tuner */ - dev->adapter = i2c_add_mux_adapter(client->adapter, &client->dev, - client, 0, 0, 0, rtl2830_select, NULL); - if (dev->adapter == NULL) { - ret = -ENODEV; + dev->muxc = i2c_mux_alloc(client->adapter, &client->dev, 1, 0, 0, + rtl2830_select, NULL); + if (!dev->muxc) { + ret = -ENOMEM; goto err_regmap_exit; } + dev->muxc->priv = client; + ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0); + if (ret) + goto err_regmap_exit; /* create dvb frontend */ memcpy(&dev->fe.ops, &rtl2830_ops, sizeof(dev->fe.ops)); @@ -903,7 +907,7 @@ static int rtl2830_remove(struct i2c_client *client) /* stop statistics polling */ cancel_delayed_work_sync(&dev->stat_work); - i2c_del_mux_adapter(dev->adapter); + i2c_mux_del_adapters(dev->muxc); regmap_exit(dev->regmap); kfree(dev); diff --git a/drivers/media/dvb-frontends/rtl2830_priv.h b/drivers/media/dvb-frontends/rtl2830_priv.h index cf793f39a09b..da4909543da2 100644 --- a/drivers/media/dvb-frontends/rtl2830_priv.h +++ b/drivers/media/dvb-frontends/rtl2830_priv.h @@ -29,7 +29,7 @@ struct rtl2830_dev { struct rtl2830_platform_data *pdata; struct i2c_client *client; struct regmap *regmap; - struct i2c_adapter *adapter; + struct i2c_mux_core *muxc; struct dvb_frontend fe; bool sleeping; unsigned long filters;