From patchwork Wed Mar 15 22:16:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 739454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vk5Zn6s8yz9ryj for ; Thu, 16 Mar 2017 09:17:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axentiatech.onmicrosoft.com header.i=@axentiatech.onmicrosoft.com header.b="rp3/jV7J"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753043AbdCOWRw (ORCPT ); Wed, 15 Mar 2017 18:17:52 -0400 Received: from mail-eopbgr30119.outbound.protection.outlook.com ([40.107.3.119]:55997 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751416AbdCOWRt (ORCPT ); Wed, 15 Mar 2017 18:17:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=iEDTWw6fk8s/KN0JT7at1/0lSla6E3dZryy28TF+9m8=; b=rp3/jV7J27MGpPHE7PRb69fNJ14Ja3InUPknBhYc9ItLZ+ldSFTfdorPio+GnbgqIw8H7qJEZUiVq9eFMLShYIIZVujIUylsxkFiYJNVEW0bEdQuLGFwCw5T5NZ08zhM3ULP5LQVcQAaXmWExYwdG2OKJyeAWhv/EesR9ad1IiQ= Authentication-Results: windriver.com; dkim=none (message not signed) header.d=none; windriver.com; dmarc=none action=none header.from=axentia.se; Received: from [192.168.0.125] (81.224.171.159) by VI1PR0202MB2557.eurprd02.prod.outlook.com (10.173.79.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Wed, 15 Mar 2017 22:16:27 +0000 Subject: Re: [PATCH v10 03/11] mux: minimal mux subsystem and gpio-based mux controller To: References: <1489144205-17427-1-git-send-email-peda@axentia.se> <1489144205-17427-4-git-send-email-peda@axentia.se> CC: Wolfram Sang , Rob Herring , Mark Rutland , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Jonathan Corbet , , , , , Andrew Morton , Colin Ian King , Paul Gortmaker From: Peter Rosin Organization: Axentia Technologies AB Message-ID: <43afcbb6-5e28-2399-95e2-10b568547c3b@axentia.se> Date: Wed, 15 Mar 2017 23:16:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1489144205-17427-4-git-send-email-peda@axentia.se> X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: DB5PR10CA0026.EURPRD10.PROD.OUTLOOK.COM (10.165.4.164) To VI1PR0202MB2557.eurprd02.prod.outlook.com (10.173.79.136) X-MS-Office365-Filtering-Correlation-Id: a7e2eacf-7bdd-4213-c735-08d46bf0edfe X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:VI1PR0202MB2557; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2557; 3:5otQPUbZF7E6caZfy8PuaUpEVNc7cqXXIL4nnzEDwQ8Q9E1e4MqpEATQUqlS3pPw9sJOUhf9ipFV2yxBHrAC70iYdosYW7kKWZuHLhag/ZHVjATA8+h1hdYT4dM+yIrflcwQYPdyRh6HnSPBNJCFpxIugyReRuDGnqWBA6oywUxA+q7rf/pqzJBehOGGsV87uWtlp+oJSAJmIMo5bimymfT5Vel5HJyTvhtMQqoNkUpOdIVL3wxAeslhDib7hmFT4H1lncOye0tnxmRvQ2u8qQ==; 25:eCjjDoklrgflhy4GsWrI+V/fo/Qw9xFWkJT1cHl4Ee647B5+64OmZ1QujAgEMtU2rOPPT5pDukiPeCwglIi6J6VJUhwUAb4xm4boUEgXUqhOoVJaQ9y0Yb/AUcQbGMMZQWz5msHk0dKRaiL4jxNG4UIQ/er+aN+l9zT4PdXUd2qYyTpx6NDLz1ZKEkxlqzgzxSyzhnJAugA09y0astWdwQEDbShw7MxR/P+f4nEh4Liu1RzZNQRJk5uvkyd4T6lI5Hdi+DuOJtvHM7U00a89l3hQn5LCZEk2E2GScK9wp2JCkYowqCdjbDwu00NS1fUbwJfN5wrfbj9NY2OsduAhvRcTYnpf0tvL8uENZDVJavEzDOpuklon37RSAsofNUJrLVYVwGBz7R0HiqDHCqLhULKdn6EB9n311HfpB37NkDk7bkokrghPL5ycgRRtpaRTdeTEzVOoUr5w1FCIsoyJTw== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2557; 31:HJ4TGeUKWjrBVWreP2R/bm8Sl5tvhuBR8LuvwIHfZB6zPl50IF3ZaWG7BFhRWq72nc8aRyhPm+eUgqTRWc2BjZIU93O1NmcKsAMGwIUYgnGYlgm+z2W2gzmRjayFsGrpem1uRCau+/nIGFCaTefjWTjCf1BNkqL2rCIBSfVr7S7IXzdb/2ZD/0eg+f25HgeHxfX44SVqkYNUPTt52UaT/lo0UrQkxjBj4LecWCOvJV8g9P/M0HZRoPFihnL4CTjd8gWkt4HlbT8g1JmO5quW3Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123560025)(20161123558025)(2016111802025)(20161123562025)(20161123555025)(20161123564025)(6043046)(6072148); SRVR:VI1PR0202MB2557; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0202MB2557; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2557; 4:Qf/CPyC76pcTvI88u+hghXli0zYFDleEmDLNzSqgEQv1u6WaVjXyIq3KrpNWLsAYTNnX5DmqRVnR7lpQoK3p5Yp51S87DuKPH6HgSRpeskz7sNaTnGolWq6g1mqtm4Y13hlZPZybki6wsPyt0kejENgVgvc19gb9pHWRaIvROsY+ArH0UvbCATDBx1l7UxXPzXrqXLFgRsiIXapOd9fc1wBfxKnM/UEMrNMgxaDkiQoSyU80o5q1dhVi6mpoK8dElbdGMWHiC9sBRrus7SLkUFM2YywAeHZOoFBjEgmWaVYQA0YnvQEyMwgPEMzoCRhp34ciakMH10BKj6gF1dGgLY974Y3iATE6gwmPi21F+vWq+TZEfh+I/6J4qfoncriC/3rBwZNa7Wzh4c95AQhwXxSWKVDJYRlC6PZzXumfK+GcVgo7rCKkfmGba81DEl+WRACcR69fwvUqYxAjPEpfKS7l1WM9/bqCPI/DRqwIJAyF52AHmdrK0KjpK+W5nZfuh95Xi5cIas9h1x9gcyWDyAA37eMAxLtorBkG+FaBvHPMHhD62ypzvaliJtKaw/pAo4+oWKXpgjLALkW8zPH4O0wn7BFmhnIqVMT7qGzNzdcKjhjgro7Saw38GJJ4JHU3kami7vPi7nS/pQ84dHOgxJhwtVAbBw1clTLRmVWef0Y= X-Forefront-PRVS: 02475B2A01 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6049001)(6009001)(39450400003)(24454002)(377424004)(230700001)(7736002)(33646002)(31696002)(86362001)(76176999)(4001350100001)(50466002)(189998001)(54356999)(66066001)(53546007)(5660300001)(7416002)(65826007)(2906002)(50986999)(8676002)(83506001)(81166006)(23746002)(305945005)(6246003)(64126003)(38730400002)(54906002)(6486002)(2950100002)(110136004)(74482002)(25786008)(42186005)(53936002)(6306002)(6916009)(117156001)(6116002)(36756003)(31686004)(4326008)(6666003)(229853002)(8666007)(65956001)(47776003)(77096006)(3846002)(65806001)(2351001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0202MB2557; H:[192.168.0.125]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; VI1PR0202MB2557; 23:HJNfKRW7pPa9mfS4vS6PZEgDL0viKyw/LOc?= =?Windows-1252?Q?/9krqZlpmDWKsdilcsFeeZ59A609WV/RiEaSRaRESN5dNdJmv50lip+D?= =?Windows-1252?Q?AK4dk1l+VvrqH/XRyI337yUT0g42ZFTsTTrFu16XuPsMWpWmOM74oNlH?= =?Windows-1252?Q?gdS4LhWvR6AJxpFTngQPFx/S2GAgD5G5xsyAfrSPTogx3SfR1XWw5QkE?= =?Windows-1252?Q?gz+13DDYOpMb9eGTA6J4RJ86oTZnMMj+p7wq/loZjHhKp4D3Ur+PG0C/?= =?Windows-1252?Q?u8SxD9lt7B/62V7HJ2igG1+7MRKzukgB6SfQQ65iKw2U9JpLtU+43+6d?= =?Windows-1252?Q?ZxY2Ov48xLESEvkrK0YGMKKkL3FbCXjjQm80Po4kB9AFqSyoXob2FnHN?= =?Windows-1252?Q?j+kQCGNLpDuPDzBUgQ3mwtlEC3dUB4HirvwQrnus40GphsBav749Xknm?= =?Windows-1252?Q?+2KD8yc6wkPs78yNOC43N2c6xSMuO2RdsvMfWB1wnaBzoCmU9zQeqzgT?= =?Windows-1252?Q?S8sNtDeIZYlQSJEgKv/ZjQWujkrDUo9R3/WSfWr/OB1UHUnOBwn3FYbC?= =?Windows-1252?Q?R43CL5J6sTZyaY678qIEUfjfSsAsCTZRp9LYGkTEEG+2exLjWNVV+8ta?= =?Windows-1252?Q?zbT3WZfRmQcz+A0cfHWZcxqO6PnTyfcOitUoKPpNSlzOPEj5DTd1xImc?= =?Windows-1252?Q?sZZTwSsyeAYEGzfCIIOq6GqZ0VmrG18ey8yUrkaG1mqdkXsaqgL2ENyi?= =?Windows-1252?Q?joRclN6p1RmcG/tJDs6TgQiwh86pGOhUIAUJGCNVF64D31TKxzYYW5cl?= =?Windows-1252?Q?nFs0zMXdrM7MRfbwNTUQ45PI2E+gHB7kzU23wh4dYbgycSfAitp69Io8?= =?Windows-1252?Q?1sYLx3GPwzfu0cAbLwvJlWuAol88c9EyNPlH4i5Lc7z5fO4lSIvh1JS+?= =?Windows-1252?Q?PCDIIAcQmRc1dofYGyLvz4XE3/1/t1QrFMsdlb8mMIWcmQyc8WxW3WMO?= =?Windows-1252?Q?dkjGShdc4qpZYLZHRfisP5m/dAXLXCsmKWIUAs4ZOzh+/yfbF7EltfUv?= =?Windows-1252?Q?nO4WkxNnN78ITCx87U55Dvkksnu/zMk3yNjg8zfWRcFJXDXbgyo3+b6n?= =?Windows-1252?Q?GRp3Ih/DmHvliz951xCKCvlMVAtwQH0D/r12jKze4xL7vKC+nh04nxLu?= =?Windows-1252?Q?dT/86Q9rRrRMwqIJkCGzBPkh9a0Z3DrCBljJtAtEQgEmVAxYMk2K0002?= =?Windows-1252?Q?hhJK2VekZCPMRcgzTQLEPp3/1WYAHJ30vCFw08pSP/DvtG4KQ9Y3wsGh?= =?Windows-1252?Q?Dc7IhDVQSHBeVopHkCBUviFuxw0DHfIb/z8N0feF9vu9XqbQllNC65p1?= =?Windows-1252?Q?rc0fSRJkHGas4rlRUxqwUnpDAaHj7Ef6feZDfSqBxY/qWqyKyuRRGaUU?= =?Windows-1252?Q?M0xe+ZyHuJ6H7Jjz6uE+e?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2557; 6:vE1j6dXJbbK5Q7je3n/XvqKJMpGy6Q4dA5jEoNkFjUAM2soJJ5hlR/x/zTWfv0ucRfGTVqPbfxMiAM52hEjT13BPWW3LMbrJ08QWs8y+Z+brJ0dKd3CbO+xBbnxpQMocBkkjL0eQlEqCYkhcsdcqpAw+Zoxw3Jp1xq6IGQz36F3BgddnmFoSkT03SFfpEcdIFR3sJdKXG8KfyK+Jbve0fAnorLG7Ye0awSUqMm16HAwCnhFWyv9ydg0fJKGeORFEKpyO3oqgmdIKM++3ZpQnTB4IfBaTj4b4SEQXR+j/qszQM70beZGbd6m/0YhdeNvG7CmdDQUwNBdrvOynUMJ2kXUBJI9KG7O3EkKGLVnHx23XtFp7pCPcbq4b3WHUgBtSXx1xxuJFBkUBhThgeMzk+A==; 5:ciLSAq4uv6HAHuz01WrL6ecYLIeB3h8E9zKLoTMn6myL32D7H66/z80r15iMgC8VXyiwZh2fwXTyogGzIY+7VygWrFtutlKP+nkIZcwMiXvJB4cBz2cVB5rpwty5ktqotBJV4eoosKwdO/jkDfD37A==; 24:z9HuFv9lrh8/OZwKg7HgxYqMXopS/iM6P9T5r1nvxZUx7bTgyMY4viHroU6DijdbILK9ngtPGXxyTn6wfDt8IRHX9mHYadfO54s5m+/6kJI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0202MB2557; 7:e3bMPWpBCrlThtassLY9WICHsdrcv0mjRyxxY8qpW55weCTw3WfUWcN9QCcrRasoDSKaJazTnxxtlVPAj4SGD0noLbFeVExSCX3h3g+PqCXy87Gf2RZmCjwjnFWR3DT0tQ2IDXKdudtJWZd+K7nwYpIMZ62ef03hkq3mVtRaWGEryzyeT6spkQPzyfyjLZt8OdRp3YqJ3j/Kw6WKy65n/+fa99FyyuPvn2wpapbyZVyK1N+gOSASNB5LYLc/t9lgOX+X+NvAarqxKQn5QnMz0rxq6v6h/aH83UU/LWbWzOSrO4gR7MgaCIrcsEL0MApwxh25vg4UQ7qutQFlqv3SxQ== X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2017 22:16:27.3204 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0202MB2557 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org On 2017-03-10 12:09, Peter Rosin wrote: > Add a new minimalistic subsystem that handles multiplexer controllers. > When multiplexers are used in various places in the kernel, and the > same multiplexer controller can be used for several independent things, > there should be one place to implement support for said multiplexer > controller. > > A single multiplexer controller can also be used to control several > parallel multiplexers, that are in turn used by different subsystems > in the kernel, leading to a need to coordinate multiplexer accesses. > The multiplexer subsystem handles this coordination. > > This new mux controller subsystem initially comes with a single backend > driver that controls gpio based multiplexers. Even though not needed by > this initial driver, the mux controller subsystem is prepared to handle > chips with multiple (independent) mux controllers. > > Reviewed-by: Jonathan Cameron > Signed-off-by: Peter Rosin I would like to mention a bugfix patch that I have added to the end of the series in response to feedback from Dan Carpenter. Can be found here: https://lkml.org/lkml/2017/3/14/700 And I have also amended the below editorials to this patch. Cheers, peda --- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/mux.h b/include/linux/mux.h index 7ef0864c8f38..febdde4246df 100644 --- a/include/linux/mux.h +++ b/include/linux/mux.h @@ -20,6 +20,10 @@ struct mux_chip; struct mux_control; struct platform_device; +/** + * struct mux_control_ops - Mux controller operations for a mux chip. + * @set: Set the state of the given mux controller. + */ struct mux_control_ops { int (*set)(struct mux_control *mux, int state); }; @@ -29,7 +33,7 @@ struct mux_control_ops { #define MUX_IDLE_DISCONNECT (-2) /** - * struct mux_control - Represents a mux controller. + * struct mux_control - Represents a mux controller. * @lock: Protects the mux controller state. * @chip: The mux chip that is handling this mux controller. * @states: The number of mux controller states. @@ -50,7 +54,7 @@ struct mux_control { /** * struct mux_chip - Represents a chip holding mux controllers. * @controllers: Number of mux controllers handled by the chip. - * @mux: Array of mux controllers that is handled. + * @mux: Array of mux controllers that are handled. * @dev: Device structure. * @id: Used to identify the device internally. * @ops: Mux controller operations. @@ -176,7 +180,7 @@ void devm_mux_chip_free(struct device *dev, struct mux_chip *mux_chip); * mux_control_deselect() if mux_control_select() fails. * * Return: 0 if the requested state was already active, or 1 it the - * mux-control state was changed to the requested state. Or a negavive + * mux-control state was changed to the requested state. Or a negative * errno on error. * * Note that the difference in return value of zero or one is of @@ -192,13 +196,13 @@ int mux_control_select(struct mux_control *mux, int state); * * Return: 0 on success and a negative errno on error. An error can only * occur if the mux has an idle state. Note that even if an error occurs, the - * mux-control is unlocked for others to access. + * mux-control is unlocked and is thus free for the next access. */ int mux_control_deselect(struct mux_control *mux); /** * mux_control_get_index() - Get the index of the given mux controller - * @mux: The mux-control to the the index for. + * @mux: The mux-control to get the index for. * * Return: The index of the mux controller within the mux chip the mux * controller is a part of.