From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755230AbdDMQoY (ORCPT ); Thu, 13 Apr 2017 12:44:24 -0400 Received: from mail-eopbgr30098.outbound.protection.outlook.com ([40.107.3.98]:55296 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754838AbdDMQlo (ORCPT ); Thu, 13 Apr 2017 12:41:44 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=axentia.se; From: Peter Rosin To: , Greg Kroah-Hartman CC: Peter Rosin , 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 , Philipp Zabel , Subject: [PATCH v13 02/10] dt-bindings: document devicetree bindings for mux-controllers and gpio-mux Date: Thu, 13 Apr 2017 18:43:06 +0200 Message-ID: <1492101794-13444-3-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1492101794-13444-1-git-send-email-peda@axentia.se> References: <1492101794-13444-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: AM4PR05CA0010.eurprd05.prod.outlook.com (10.171.184.151) To AM5PR0202MB2547.eurprd02.prod.outlook.com (10.173.89.8) X-MS-Office365-Filtering-Correlation-Id: 621432aa-4f36-4af9-86de-08d4828beffd X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075);SRVR:AM5PR0202MB2547; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0202MB2547;3:4OWo4SJLf+N4cjF60xq483a3R+NHn+h9xe/LKhMO7LqQzY94ORXkkM2Rv32+eyTyI4UnwUlOCS2MB6T2LjQ+VzKfHQvKBupScLmfVmgfaK5nzaZtwV0XegfY1wO20Iu+cH2BPfP+pPFwcr1WHSYwJO0Aln7+8FpyxQejLcHMyF+3k+hSKmINpzoVX/aT6X2iEJeh5IRxWsEclcSy94DdeJo4RmM6sUALmo/Cbc1XAzviDzgjW6pQfFX9uI4SVyKRp5I3GU+RfyZ3b/o3lT40lJQj+nnE5reFT9Ulzt9dO6V+i7slWYfomyyOhRshq3Gk;25:bzGlZ4xZh6btug/zpk/SJCZltMln+VsT3wjZK7h4ydVZL3rybU58i91Yu5TsC6ZjN8niBgzApLNrG8mUukTAruspBxZmFZ3yjbKjiMGNIhvN8n2U9tx5BMa8DCYXRKpXKZPDjziqW0SIIYz6sh+6fgNM3l0fScNo2+hCCLcmJXwpBmKS/5xXQuF4qaf+cSQuRdTYnHXBzZOKkaTQQg4s1+KGbel6yXF+ux/gHWNpEI6BxHI+ypNHoB/xteaRyrMSIYDUdQ6C9/A1xgNI6GipvYz2PvqGCIaHt8orZD6hgKHuQ4yf97uCN+W0DyTCcaGKon+w7t3NNEvZesO+HGjOulT5pKCTIW3b9KOt1er1nMYFGJAYrb/SAtR3tZA9hvot9GRAjFhsXwgXyhc2RK8l7l8l2t7ptY0EsTZsV+kYwNOTnUS/mO+ueCvlAUgMSgUX+R49Aw6eYGF6saG5M+IMCg== X-Microsoft-Exchange-Diagnostics: 1;AM5PR0202MB2547;31:b9ETHVXtwuvAeGLEwtu6Lu7BS2dYdpJLiiCGx4zEuH2Q09UPg9Tf17l/PKhUCv/tx5iJinI9Po3AUz9UY8Clf9IjCQOAxD0c6dyIa/+oveHgSlBv2u2z09xr9gRgnRJv6l94uTX1yk6I96P7TDb+3ZaQhnxEBD67St/LiXalrrfFUjqVS3OPGehlFhoZN/LUCqPELq1Iel3froUmMKwf/IFzMVlYz/vl5f09wDUuYAPRuI2G2XPDSc+eIGJpPrzw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(11668515415152); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(2016111802025)(20161123555025)(20161123560025)(6043046)(6072148);SRVR:AM5PR0202MB2547;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0202MB2547; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0202MB2547;4:43rzJdYpYW7NY5/wyRHU4hX6H1H8iHURL84tgrtH2pKsSJQkK7xnncCdz0TDVGZX2Whsm5azcmajHmNFTShfcpDgmob7Ok3BPGukxovbogojQJ7nKrSGsCrqdkVJpQB/hx57bkZPAkz2TluH8tBDUiEFUlbLpk09X35BVv3ilZHq/qxkfVjcdNz6639dgG1/HqNgCthe5QpNZWrFZpBbd67itIdMfal5Obu66R2DrKoKrhZ5tnhg7qrOccgqPOXLj5iHWNpbfIyeh9yOHl7LI07IUUf0Lmqf3OIqrms7NUMG+dBKuwOMyclFQy+n7JtmI9M2H0f8jdJtDZse6u8EUyiq7abB8hVeRP9aSKlfRh6MdZcgp8M84ISZzK+fflkwW4bVtlZgt8oYe2Y2D5k7OYxupnNvROcM6P53aRoG8mduO5Ivkj2zWQg02whs+jo5/oFH9/3fRkv6PXa6nFXGHyJELKXf8uCTfReyELmdFxHsrjdTT7aTLBFOiXYgeYWrvKk2oVdbOEi3h22P/O5DYrCzWrpJ462fCiJ61FVBKJaUUNKw0rMMvfhbaOygrvvHWWhzYfWfnW865rSFHW2qk5h+LngbiECZnFtBabVOn6y8XvotqNofxU/e5sASmzpBoPFqJQ9mJe+jObt5MwcklPVLT3kpfl14qlOoPAXVGy824yaw7zpcx5CHk44fz4WAD8LuW4QYu57zDDEHJIODfDJLi32FgSv8zTmHcJZdf2u/Q2c+HNTgoBhVYgwxXOOGynomdbEIYbsp9YgG3JaTz4fhjfacXxuSQRFax87W19E3WlrdTragULwCbUVP7rGH X-Forefront-PRVS: 02760F0D1C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6069001)(39450400003)(39830400002)(39410400002)(4326008)(25786009)(48376002)(47776003)(50466002)(6116002)(8666007)(50986999)(81166006)(33646002)(74482002)(86362001)(189998001)(66066001)(3846002)(6486002)(6512007)(305945005)(2950100002)(6666003)(53936002)(54906002)(76176999)(7736002)(5660300001)(7416002)(42186005)(38730400002)(8676002)(36756003)(6506006)(50226002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0202MB2547;H:localhost.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM5PR0202MB2547;23:6QOTRHWttQSsLYK2ZreVfkxWFX4fPbzeZ2cPe4a?= =?us-ascii?Q?GU7W18Wpnh0eU8TtG+ZWrsQV5jqKyJH0igMmfxQyYJeZnAsQtoJkUMjGHff0?= =?us-ascii?Q?llLD8YtbcHZ2qIHVPps9RuOwBBFP0Pk5YcEAZGYbY3UijFW1xGpMq3RWNu5y?= =?us-ascii?Q?AwTWbow9z/OLpBKFJB0oR0n+2sPXuiRCfwMqeEZsilNos90m0VHj11+SgUm8?= =?us-ascii?Q?8DKy376aVwZawj7d2jx14PrmE8QwH2cWSnjvUjshaAg90Uf1mnijvlAQaf/H?= =?us-ascii?Q?qEKzSmzX9Y4pzGQUVNyPnhZuiwHW1cwubxVc91FWnLnbLPJq120ZknWfHPkH?= =?us-ascii?Q?wReAXHAqcGTO/QZkFYlpwU4cpntOMadYzr+M9WxN8dIwhjpbI7PWHD5qaWWe?= =?us-ascii?Q?UfthTEuYEjsMzikV64SkjY/aEZWyAkQ8uHJRFVdMynqRAx6NxVxxeKNqBYij?= =?us-ascii?Q?uzQXaG4M/II/uuWn5OXPK3ZtHoG0377qG7uBMaiYFJVBAu4ow9i16LdZWsFU?= =?us-ascii?Q?c7Jngru3Z7M4GnphLPmBo0DAapE/+gxuXHowBztDyb9jrWiQGaS29fq/rDo1?= =?us-ascii?Q?YnjZ9PxhPFkRzETcfxsA9sUYssrEDYvhPhMrCsWtjtD7kNGKMFug5n7aurb6?= =?us-ascii?Q?VvV6CPcRnTwJ2LdY7FFrFzBiX7KA7qNurPqkja1/AI42kidSCHvnWqzWf0IZ?= =?us-ascii?Q?4NRRIjUldVpmzq1RbG3LtowqkyXdgd4S2fvDhBZFiIje3HxPscDd3X6U7KrB?= =?us-ascii?Q?Z+W1BZfNjlLKT/Skd8p6e9UmfM9h4M3rjKY9pWYFhAdla4i3RCarQmbuZD7q?= =?us-ascii?Q?yEx+6XGP8LmqMjlr8yPedRunz9ioxB7KAD6K//n6664vcYOgE7aKQrDVIv/w?= =?us-ascii?Q?Yp75LipWUoIoKKf27R7X/vbs12Ul0rJb9KTFjSAYNvu7WHIct2xN1hEFhAMg?= =?us-ascii?Q?wzBDYyqbfvfPSOMGNs6uL2FC5hgX3aeW3yyYkAhvXlA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;AM5PR0202MB2547;6:uMLxdt6Kgv8yvPUV+Ie1Jeae3v3dQps7vPS/YioTIyITxEd7RcccYKUqMsFu2sSlpqqMWkGxHaNJaH1wkUFV2Cgfj14MjvMlyoN7Xn0+bn6uuKbbSA5AsepbyvRpdt5/GMBj0ocFIRDqJAGSI2ITfD1OdIr3C4HljNmD9Z2ZyNumy/F+nlINMwms/asc9utBIzaspM5lRmydR6J8UEz0K/sCxzRUwnIGa+wRtjdJnZMglW0iluBb4lZJYOvjXKNbzn23QG9+Gu0xp0r4hd8lvWtm8oF1dWnEJUiYywzod9PMWWHUGJ1qeKLOB7UKG29xVjTBSXUuMq/ynaZI+njuZfYLWht0SYp4E/bjAP5LyO1dKxHjkIa79C824aA1HNUFf6tcE+U7BFRwVJPwM7Dvcc5wFZtJtViw86qIYbReBE6fND/W97KzYv/QTtgEN44Zgnew5N6fGiIkhQV/5xOgqg==;5:k0V4B8uYj9NVE5rORXw51M48EnD8DxFjP9OoMtd2dUqvXv8qNYusfcMr2ip9bE09GFr/tSftUA0UXXI4ZEyv/ttXrz2/i5cjG8s5ykuWCp464GbpM9ZIIjsVRNatfIJcCXpyk8iBnL22bRgc7Q0KAdyUkfXBfLRASOfsIVCv6fM=;24:0nt+4vDdX21CS6kOe3x2afvj5n1Kj0QN4/4veK13jB0vLI57zvynMe6UE+uwXmTU4XSGpcKUIE0JulVm5B2wdzuPKhGmdP2NXOaSJbKHEN0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0202MB2547;7:H3/8ahTcSKOZdC6KQ0E4AWuBL0BdAsJnFCXtGQ01DUNTI/zIIFlbpKOwHEcNTkwWM49HEl8rG3RlrFf+1G9nX+kvuCC9Dr1thq6k7hSQ63X0urehJEtMw7VLMgkoZLbhggGWqCh1oupnZXn70I0uoYnQQsSG6qdRm+/vfe61M1fk4/47g5/s7pDv7PGxSZAbR92b2RhIoRM2Xspp0TLIjCPAVb+uGVCVCcXksy+vnApf/KXOD3n71qMgijUPD0xSkL1oaKXklWvzW8tCoK/GHr6pA3HhyF05UBdaflP+owqvdy2vv7GlGS/YdHj0XEnSbrg32qXDrv2oT477SAjjfA== X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2017 16:41:28.9875 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0202MB2547 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow specifying that a single multiplexer controller can be used to control several parallel multiplexers, thus enabling sharing of the multiplexer controller by different consumers. Add a binding for a first mux controller in the form of a GPIO based mux controller. Acked-by: Jonathan Cameron Acked-by: Rob Herring Signed-off-by: Peter Rosin --- Documentation/devicetree/bindings/mux/gpio-mux.txt | 69 +++++++++ .../devicetree/bindings/mux/mux-controller.txt | 157 +++++++++++++++++++++ MAINTAINERS | 6 + include/dt-bindings/mux/mux.h | 16 +++ 4 files changed, 248 insertions(+) create mode 100644 Documentation/devicetree/bindings/mux/gpio-mux.txt create mode 100644 Documentation/devicetree/bindings/mux/mux-controller.txt create mode 100644 include/dt-bindings/mux/mux.h diff --git a/Documentation/devicetree/bindings/mux/gpio-mux.txt b/Documentation/devicetree/bindings/mux/gpio-mux.txt new file mode 100644 index 000000000000..b8f746344d80 --- /dev/null +++ b/Documentation/devicetree/bindings/mux/gpio-mux.txt @@ -0,0 +1,69 @@ +GPIO-based multiplexer controller bindings + +Define what GPIO pins are used to control a multiplexer. Or several +multiplexers, if the same pins control more than one multiplexer. + +Required properties: +- compatible : "gpio-mux" +- mux-gpios : list of gpios used to control the multiplexer, least + significant bit first. +- #mux-control-cells : <0> +* Standard mux-controller bindings as decribed in mux-controller.txt + +Optional properties: +- idle-state : if present, the state the mux will have when idle. The + special state MUX_IDLE_AS_IS is the default. + +The multiplexer state is defined as the number represented by the +multiplexer GPIO pins, where the first pin is the least significant +bit. An active pin is a binary 1, an inactive pin is a binary 0. + +Example: + + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + + mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, + <&pioA 1 GPIO_ACTIVE_HIGH>; + }; + + adc-mux { + compatible = "io-channel-mux"; + io-channels = <&adc 0>; + io-channel-names = "parent"; + + mux-controls = <&mux>; + + channels = "sync-1", "in", "out", "sync-2"; + }; + + i2c-mux { + compatible = "i2c-mux"; + i2c-parent = <&i2c1>; + + mux-controls = <&mux>; + + #address-cells = <1>; + #size-cells = <0>; + + i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + ssd1307: oled@3c { + /* ... */ + }; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + + pca9555: pca9555@20 { + /* ... */ + }; + }; + }; diff --git a/Documentation/devicetree/bindings/mux/mux-controller.txt b/Documentation/devicetree/bindings/mux/mux-controller.txt new file mode 100644 index 000000000000..4f47e4bd2fa0 --- /dev/null +++ b/Documentation/devicetree/bindings/mux/mux-controller.txt @@ -0,0 +1,157 @@ +Common multiplexer controller bindings +====================================== + +A multiplexer (or mux) controller will have one, or several, consumer devices +that uses the mux controller. Thus, a mux controller can possibly control +several parallel multiplexers. Presumably there will be at least one +multiplexer needed by each consumer, but a single mux controller can of course +control several multiplexers for a single consumer. + +A mux controller provides a number of states to its consumers, and the state +space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer, +0-7 for an 8-way multiplexer, etc. + + +Consumers +--------- + +Mux controller consumers should specify a list of mux controllers that they +want to use with a property containing a 'mux-ctrl-list': + + mux-ctrl-list ::= [mux-ctrl-list] + single-mux-ctrl ::= [mux-ctrl-specifier] + mux-ctrl-phandle : phandle to mux controller node + mux-ctrl-specifier : array of #mux-control-cells specifying the + given mux controller (controller specific) + +Mux controller properties should be named "mux-controls". The exact meaning of +each mux controller property must be documented in the device tree binding for +each consumer. An optional property "mux-control-names" may contain a list of +strings to label each of the mux controllers listed in the "mux-controls" +property. + +Drivers for devices that use more than a single mux controller can use the +"mux-control-names" property to map the name of the requested mux controller +to an index into the list given by the "mux-controls" property. + +mux-ctrl-specifier typically encodes the chip-relative mux controller number. +If the mux controller chip only provides a single mux controller, the +mux-ctrl-specifier can typically be left out. + +Example: + + /* One consumer of a 2-way mux controller (one GPIO-line) */ + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + + mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>; + }; + + adc-mux { + compatible = "io-channel-mux"; + io-channels = <&adc 0>; + io-channel-names = "parent"; + + mux-controls = <&mux>; + mux-control-names = "adc"; + + channels = "sync", "in"; + }; + +Note that in the example above, specifying the "mux-control-names" is redundant +because there is only one mux controller in the list. However, if the driver +for the consumer node in fact asks for a named mux controller, that name is of +course still required. + + /* + * Two consumers (one for an ADC line and one for an i2c bus) of + * parallel 4-way multiplexers controlled by the same two GPIO-lines. + */ + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + + mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, + <&pioA 1 GPIO_ACTIVE_HIGH>; + }; + + adc-mux { + compatible = "io-channel-mux"; + io-channels = <&adc 0>; + io-channel-names = "parent"; + + mux-controls = <&mux>; + + channels = "sync-1", "in", "out", "sync-2"; + }; + + i2c-mux { + compatible = "i2c-mux"; + i2c-parent = <&i2c1>; + + mux-controls = <&mux>; + + #address-cells = <1>; + #size-cells = <0>; + + i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + ssd1307: oled@3c { + /* ... */ + }; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + + pca9555: pca9555@20 { + /* ... */ + }; + }; + }; + + +Mux controller nodes +-------------------- + +Mux controller nodes must specify the number of cells used for the +specifier using the '#mux-control-cells' property. + +Optionally, mux controller nodes can also specify the state the mux should +have when it is idle. The idle-state property is used for this. If the +idle-state is not present, the mux controller is typically left as is when +it is idle. For multiplexer chips that expose several mux controllers, the +idle-state property is an array with one idle state for each mux controller. + +The special value (-1) may be used to indicate that the mux should be left +as is when it is idle. This is the default, but can still be useful for +mux controller chips with more than one mux controller, particularly when +there is a need to "step past" a mux controller and set some other idle +state for a mux controller with a higher index. + +Some mux controllers have the ability to disconnect the input/output of the +multiplexer. Using this disconnected high-impedance state as the idle state +is indicated with idle state (-2). + +These constants are available in + + #include + +as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2). + +An example mux controller node look like this (the adg972a chip is a triple +4-way multiplexer): + + mux: mux-controller@50 { + compatible = "adi,adg792a"; + reg = <0x50>; + #mux-control-cells = <1>; + + idle-state = ; + }; diff --git a/MAINTAINERS b/MAINTAINERS index c265a5fe4848..7fc06739c8ad 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8558,6 +8558,12 @@ S: Orphan F: drivers/mmc/host/mmc_spi.c F: include/linux/spi/mmc_spi.h +MULTIPLEXER SUBSYSTEM +M: Peter Rosin +S: Maintained +F: Documentation/devicetree/bindings/mux/ +F: include/linux/dt-bindings/mux/ + MULTISOUND SOUND DRIVER M: Andrew Veliath S: Maintained diff --git a/include/dt-bindings/mux/mux.h b/include/dt-bindings/mux/mux.h new file mode 100644 index 000000000000..c8e855c4a609 --- /dev/null +++ b/include/dt-bindings/mux/mux.h @@ -0,0 +1,16 @@ +/* + * This header provides constants for most Multiplexer bindings. + * + * Most Multiplexer bindings specify an idle state. In most cases, the + * the multiplexer can be left as is when idle, and in some cases it can + * disconnect the input/output and leave the multiplexer in a high + * impedance state. + */ + +#ifndef _DT_BINDINGS_MUX_MUX_H +#define _DT_BINDINGS_MUX_MUX_H + +#define MUX_IDLE_AS_IS (-1) +#define MUX_IDLE_DISCONNECT (-2) + +#endif -- 2.1.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Rosin Subject: [PATCH v13 02/10] dt-bindings: document devicetree bindings for mux-controllers and gpio-mux Date: Thu, 13 Apr 2017 18:43:06 +0200 Message-ID: <1492101794-13444-3-git-send-email-peda@axentia.se> References: <1492101794-13444-1-git-send-email-peda@axentia.se> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: <1492101794-13444-1-git-send-email-peda@axentia.se> Sender: linux-doc-owner@vger.kernel.org To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Peter Rosin , Wolfram Sang , Rob Herring , Mark Rutland , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Jonathan Corbet , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, linux-doc@vger.kernel.org, Andrew Morton , Colin Ian King , Paul Gortmaker , Philipp Zabel , kernel@pengutronix.de List-Id: devicetree@vger.kernel.org Allow specifying that a single multiplexer controller can be used to control several parallel multiplexers, thus enabling sharing of the multiplexer controller by different consumers. Add a binding for a first mux controller in the form of a GPIO based mux controller. Acked-by: Jonathan Cameron Acked-by: Rob Herring Signed-off-by: Peter Rosin --- Documentation/devicetree/bindings/mux/gpio-mux.txt | 69 +++++++++ .../devicetree/bindings/mux/mux-controller.txt | 157 +++++++++++++++++++++ MAINTAINERS | 6 + include/dt-bindings/mux/mux.h | 16 +++ 4 files changed, 248 insertions(+) create mode 100644 Documentation/devicetree/bindings/mux/gpio-mux.txt create mode 100644 Documentation/devicetree/bindings/mux/mux-controller.txt create mode 100644 include/dt-bindings/mux/mux.h diff --git a/Documentation/devicetree/bindings/mux/gpio-mux.txt b/Documentation/devicetree/bindings/mux/gpio-mux.txt new file mode 100644 index 000000000000..b8f746344d80 --- /dev/null +++ b/Documentation/devicetree/bindings/mux/gpio-mux.txt @@ -0,0 +1,69 @@ +GPIO-based multiplexer controller bindings + +Define what GPIO pins are used to control a multiplexer. Or several +multiplexers, if the same pins control more than one multiplexer. + +Required properties: +- compatible : "gpio-mux" +- mux-gpios : list of gpios used to control the multiplexer, least + significant bit first. +- #mux-control-cells : <0> +* Standard mux-controller bindings as decribed in mux-controller.txt + +Optional properties: +- idle-state : if present, the state the mux will have when idle. The + special state MUX_IDLE_AS_IS is the default. + +The multiplexer state is defined as the number represented by the +multiplexer GPIO pins, where the first pin is the least significant +bit. An active pin is a binary 1, an inactive pin is a binary 0. + +Example: + + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + + mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, + <&pioA 1 GPIO_ACTIVE_HIGH>; + }; + + adc-mux { + compatible = "io-channel-mux"; + io-channels = <&adc 0>; + io-channel-names = "parent"; + + mux-controls = <&mux>; + + channels = "sync-1", "in", "out", "sync-2"; + }; + + i2c-mux { + compatible = "i2c-mux"; + i2c-parent = <&i2c1>; + + mux-controls = <&mux>; + + #address-cells = <1>; + #size-cells = <0>; + + i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + ssd1307: oled@3c { + /* ... */ + }; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + + pca9555: pca9555@20 { + /* ... */ + }; + }; + }; diff --git a/Documentation/devicetree/bindings/mux/mux-controller.txt b/Documentation/devicetree/bindings/mux/mux-controller.txt new file mode 100644 index 000000000000..4f47e4bd2fa0 --- /dev/null +++ b/Documentation/devicetree/bindings/mux/mux-controller.txt @@ -0,0 +1,157 @@ +Common multiplexer controller bindings +====================================== + +A multiplexer (or mux) controller will have one, or several, consumer devices +that uses the mux controller. Thus, a mux controller can possibly control +several parallel multiplexers. Presumably there will be at least one +multiplexer needed by each consumer, but a single mux controller can of course +control several multiplexers for a single consumer. + +A mux controller provides a number of states to its consumers, and the state +space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer, +0-7 for an 8-way multiplexer, etc. + + +Consumers +--------- + +Mux controller consumers should specify a list of mux controllers that they +want to use with a property containing a 'mux-ctrl-list': + + mux-ctrl-list ::= [mux-ctrl-list] + single-mux-ctrl ::= [mux-ctrl-specifier] + mux-ctrl-phandle : phandle to mux controller node + mux-ctrl-specifier : array of #mux-control-cells specifying the + given mux controller (controller specific) + +Mux controller properties should be named "mux-controls". The exact meaning of +each mux controller property must be documented in the device tree binding for +each consumer. An optional property "mux-control-names" may contain a list of +strings to label each of the mux controllers listed in the "mux-controls" +property. + +Drivers for devices that use more than a single mux controller can use the +"mux-control-names" property to map the name of the requested mux controller +to an index into the list given by the "mux-controls" property. + +mux-ctrl-specifier typically encodes the chip-relative mux controller number. +If the mux controller chip only provides a single mux controller, the +mux-ctrl-specifier can typically be left out. + +Example: + + /* One consumer of a 2-way mux controller (one GPIO-line) */ + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + + mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>; + }; + + adc-mux { + compatible = "io-channel-mux"; + io-channels = <&adc 0>; + io-channel-names = "parent"; + + mux-controls = <&mux>; + mux-control-names = "adc"; + + channels = "sync", "in"; + }; + +Note that in the example above, specifying the "mux-control-names" is redundant +because there is only one mux controller in the list. However, if the driver +for the consumer node in fact asks for a named mux controller, that name is of +course still required. + + /* + * Two consumers (one for an ADC line and one for an i2c bus) of + * parallel 4-way multiplexers controlled by the same two GPIO-lines. + */ + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + + mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, + <&pioA 1 GPIO_ACTIVE_HIGH>; + }; + + adc-mux { + compatible = "io-channel-mux"; + io-channels = <&adc 0>; + io-channel-names = "parent"; + + mux-controls = <&mux>; + + channels = "sync-1", "in", "out", "sync-2"; + }; + + i2c-mux { + compatible = "i2c-mux"; + i2c-parent = <&i2c1>; + + mux-controls = <&mux>; + + #address-cells = <1>; + #size-cells = <0>; + + i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + ssd1307: oled@3c { + /* ... */ + }; + }; + + i2c@3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + + pca9555: pca9555@20 { + /* ... */ + }; + }; + }; + + +Mux controller nodes +-------------------- + +Mux controller nodes must specify the number of cells used for the +specifier using the '#mux-control-cells' property. + +Optionally, mux controller nodes can also specify the state the mux should +have when it is idle. The idle-state property is used for this. If the +idle-state is not present, the mux controller is typically left as is when +it is idle. For multiplexer chips that expose several mux controllers, the +idle-state property is an array with one idle state for each mux controller. + +The special value (-1) may be used to indicate that the mux should be left +as is when it is idle. This is the default, but can still be useful for +mux controller chips with more than one mux controller, particularly when +there is a need to "step past" a mux controller and set some other idle +state for a mux controller with a higher index. + +Some mux controllers have the ability to disconnect the input/output of the +multiplexer. Using this disconnected high-impedance state as the idle state +is indicated with idle state (-2). + +These constants are available in + + #include + +as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2). + +An example mux controller node look like this (the adg972a chip is a triple +4-way multiplexer): + + mux: mux-controller@50 { + compatible = "adi,adg792a"; + reg = <0x50>; + #mux-control-cells = <1>; + + idle-state = ; + }; diff --git a/MAINTAINERS b/MAINTAINERS index c265a5fe4848..7fc06739c8ad 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8558,6 +8558,12 @@ S: Orphan F: drivers/mmc/host/mmc_spi.c F: include/linux/spi/mmc_spi.h +MULTIPLEXER SUBSYSTEM +M: Peter Rosin +S: Maintained +F: Documentation/devicetree/bindings/mux/ +F: include/linux/dt-bindings/mux/ + MULTISOUND SOUND DRIVER M: Andrew Veliath S: Maintained diff --git a/include/dt-bindings/mux/mux.h b/include/dt-bindings/mux/mux.h new file mode 100644 index 000000000000..c8e855c4a609 --- /dev/null +++ b/include/dt-bindings/mux/mux.h @@ -0,0 +1,16 @@ +/* + * This header provides constants for most Multiplexer bindings. + * + * Most Multiplexer bindings specify an idle state. In most cases, the + * the multiplexer can be left as is when idle, and in some cases it can + * disconnect the input/output and leave the multiplexer in a high + * impedance state. + */ + +#ifndef _DT_BINDINGS_MUX_MUX_H +#define _DT_BINDINGS_MUX_MUX_H + +#define MUX_IDLE_AS_IS (-1) +#define MUX_IDLE_DISCONNECT (-2) + +#endif -- 2.1.4