From patchwork Wed Apr 20 15:17:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 8892051 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 D37679F39A for ; Wed, 20 Apr 2016 15:35:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DBFE020263 for ; Wed, 20 Apr 2016 15:35:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 384C22024D for ; Wed, 20 Apr 2016 15:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbcDTPfT (ORCPT ); Wed, 20 Apr 2016 11:35:19 -0400 Received: from mail-db3on0146.outbound.protection.outlook.com ([157.55.234.146]:54816 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751899AbcDTPfQ (ORCPT ); Wed, 20 Apr 2016 11:35:16 -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=UJIJHbHKl1YsxRYWrq6WTQZoLkDr9Q3zhWhBlU0N108=; b=g0X8UIAsauUhDICdADDRM/etjxvvISb8Um8qlGSrxb5ZbIpdir1VuyLvPqcdDWHR2zNbB9ujWAuUWP6YOYTip4aPprwCFpRJfAjXUcLL4olK/ty+1HFdh3XHxAbzwLB3kje0Vt3cV45pucFHYs5qDkMxLFAPRonUtxlSJRMPRao= 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:56 +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 12/24] [media] si2168: convert to use an explicit i2c mux core Date: Wed, 20 Apr 2016 17:17:52 +0200 Message-ID: <1461165484-2314-13-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: d51b1d8d-e931-4e57-533f-08d3692f3e3f X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 2:3K3Pq6sSX0X2yazicm8q0zie9tY6X4DgC2U7F9Zge7qxWGZAFvGDJGIc7i7NOt+c9rRiFllsHcFlCE1EfG6NLGcVY8XcZDMAegNakCN0j+jO5qU7YdJBVGdfIQx8SGk0ftQ9x7qe+JtfQf8lCwPgXdhYnNlzqRzn4tOFwA+c28P8LRFKS4Ny46iHBtdQq+Rx; 3:XJUvgdDMRtxYwaYu8Wk6qs9D347GU0kFQQJKZ7p3l9ACodeB1z+Tb5vqznC5nxaT3mjG3zjahgUb5WSIKjYI4QQbbOw1mHM2SEbVVzjzH6nMccfGH5xwTriuH7EaUA2U X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1312; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1312; 25:zbAlOFEvDMdQsIcCfsJuyKgD8eEuLR558OaM+sh6OWJ+K9vLslXRbjGpU5+8MyHMYZwFokIANR7/FxkrNl8XK3Nl7Xkbit9MQ73cf6THk9VNE2k5gbuXqihLV/Top+d20e8GCQFCyqyl7NM+QzALwVzAcDc+225BVVhI75wiVoXirz1R+ZujZR95hhGjoaWxZnqTxqLEDaAmL+EXr3wmARLnkxH91wc4AY5eEmcy3VRZjRK+DVE3oQmYBBtsA00CvrqTesi3w9Tjs/PDpDFWwA6mpNXO5s8DrhI58G5BKlZ+etpsiSKAkQTSv4harezevq4f5J/0VT8KhQL7BdvJBNQgCUNtO4zhWJx7quEvZRYoBG/eeH49PKQ/L8EfJpx634YOz9Sfyq1gkyBhogXKxFrjrIbG7jFGcW2bW9pAJ+HscNBTBWzavYEdEtjEvsFHpMNX/+O1bH3yukJWALpwQkeNuqJAXug9IXaKO7UHSMw5KaRRXUW8Jn9gnR1j+IqbVPj/NGbMGrM1Rv4HBm/v7Xa6pidCRBsiXHjV2bX2YJJeqJCh2RgLGGK2gPZzJhRMmS+V0qXTWgmCCWfX/gAEM8W13yCKHsUfvoV+lL5CVQpT7Dl+73dbY/WNCJuNXpDI1ZSRNvuvVjAX4o8PE9HfeCyq/Ajcs8BPOJEJVCZ/iOw= 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:D+M4QH0zg1LEwn/tXkPyyx+baSm47hBbWIERyAaMmRfNQKxvF7yySEHGelt68fqXIUAKDteRu7i+OxJ/1X/hL5DhJs3DpZGtAaxIS3Oiewoipxr0iFeqJ/+qF6+oNvD1/sggZyUuT7fnWIV9JW6nl8scdc0HUspm7qiXaR1PZ/VDHfGs0hRTvlrs/K+SrSV7+EUQu77wF7jal2347J5Ie/CUwRl9gQToApbqVAWFX3KITf7Gkq4RK+y+rCr2UK7w7oILystHBFakLDfLor3hqiHgzyOZDbAPfJzMRY/2dAbWBPQSRgwbuLRADkD98Dw77sRJobVdDrHFnMM5s5nLHQkj1i5HWXoRIhkOA9BK3Kxh1NHX3jmZ3ReY3+edlYv1ol6iuZGGGOBZ01CBhI1AY1iScEZK/UNkTs4K1BFfpQ26Vg9j9JMbNplCzIfc3eCRJRIsW+tBRjYYWvoll1pT7g== 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)(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:lmHMxxpueblxkbOmIhHqng5lhwJujqmAm7On5+E+O?= =?us-ascii?Q?1qH0CmUyrzKUVPss/BA5dGnF5jQYeFiPauFBYY1vqo/RY5B5scAK0JFenRKU?= =?us-ascii?Q?ZmatB+cFZVzJFEJu8hYjwZc3A9UrLvmOgYK7D/2PH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R02MB1312; 5:+AtJ6wp0yoSCK1HsVf+DtUswG0mA3BlhMyuTUIE02esCp0lRBFT17nsgVyegCYUK7EdqIZSeMd1Pee8dS69ILCdsp1o8AuG3KwAMpDN8b7fdLNQHaqI2/w5+mO5i7s8q7xxPrTrsbcCabtjHrOOqloh+cpVt4HoXfzDdlSnaTGpWIPgzgzdLzOIexh1Ny6iV; 24:v0D2gwJFRUOMytYd/i03M6xGnQzFOD4GIsRsxfZSEmE0LUWccIFv12YFfjA2W6Hj2KhCWb1qLR7dRPnCJchE1CltCLV1dwj90ymtHhi6MnA=; 7:CbXqZQpn4RTBjXVvodsz3HbMtZrJvJkhPAfV72wrsGUreSXDLDLoVjT5ERm9T0cDS8HVtfD4mRDgyDa6vCgpVt21wqvjndm0+ndeHzL76UsZg5oHwOvOp1AxV8eyZCVwfwwplHBQOzAfqLUEDX6xpeoAb0GO6tnWxn5YyuvELhrfH1uox6lUUTbn/iObmjWhQZm0UjtrOJ08mXsY5Oj1EBUtbQB0x06YwMw2Wkj93Ps= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2016 15:19:56.9024 (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/deselect ops 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/si2168.c | 25 +++++++++++++++---------- drivers/media/dvb-frontends/si2168_priv.h | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c index 821a8f481507..5583827c386e 100644 --- a/drivers/media/dvb-frontends/si2168.c +++ b/drivers/media/dvb-frontends/si2168.c @@ -615,9 +615,9 @@ static int si2168_get_tune_settings(struct dvb_frontend *fe, * We must use unlocked I2C I/O because I2C adapter lock is already taken * by the caller (usually tuner driver). */ -static int si2168_select(struct i2c_adapter *adap, void *mux_priv, u32 chan) +static int si2168_select(struct i2c_mux_core *muxc, u32 chan) { - struct i2c_client *client = mux_priv; + struct i2c_client *client = i2c_mux_priv(muxc); int ret; struct si2168_cmd cmd; @@ -635,9 +635,9 @@ err: return ret; } -static int si2168_deselect(struct i2c_adapter *adap, void *mux_priv, u32 chan) +static int si2168_deselect(struct i2c_mux_core *muxc, u32 chan) { - struct i2c_client *client = mux_priv; + struct i2c_client *client = i2c_mux_priv(muxc); int ret; struct si2168_cmd cmd; @@ -709,17 +709,22 @@ static int si2168_probe(struct i2c_client *client, } /* create mux i2c adapter for tuner */ - dev->adapter = i2c_add_mux_adapter(client->adapter, &client->dev, - client, 0, 0, 0, si2168_select, si2168_deselect); - if (dev->adapter == NULL) { - ret = -ENODEV; + dev->muxc = i2c_mux_alloc(client->adapter, &client->dev, + 1, 0, 0, + si2168_select, si2168_deselect); + if (!dev->muxc) { + ret = -ENOMEM; goto err_kfree; } + dev->muxc->priv = client; + ret = i2c_mux_add_adapter(dev->muxc, 0, 0, 0); + if (ret) + goto err_kfree; /* create dvb_frontend */ memcpy(&dev->fe.ops, &si2168_ops, sizeof(struct dvb_frontend_ops)); dev->fe.demodulator_priv = client; - *config->i2c_adapter = dev->adapter; + *config->i2c_adapter = dev->muxc->adapter[0]; *config->fe = &dev->fe; dev->ts_mode = config->ts_mode; dev->ts_clock_inv = config->ts_clock_inv; @@ -743,7 +748,7 @@ static int si2168_remove(struct i2c_client *client) dev_dbg(&client->dev, "\n"); - i2c_del_mux_adapter(dev->adapter); + i2c_mux_del_adapters(dev->muxc); dev->fe.ops.release = NULL; dev->fe.demodulator_priv = NULL; diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h index c07e6fe2cb10..165bf1412063 100644 --- a/drivers/media/dvb-frontends/si2168_priv.h +++ b/drivers/media/dvb-frontends/si2168_priv.h @@ -29,7 +29,7 @@ /* state struct */ struct si2168_dev { - struct i2c_adapter *adapter; + struct i2c_mux_core *muxc; struct dvb_frontend fe; enum fe_delivery_system delivery_system; enum fe_status fe_status;