From patchwork Mon Mar 27 14:21:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 743848 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vsGXC6bwnz9s7D for ; Tue, 28 Mar 2017 01:25:31 +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="AAzQTDf4"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753260AbdC0OVA (ORCPT ); Mon, 27 Mar 2017 10:21:00 -0400 Received: from mail-db5eur01on0100.outbound.protection.outlook.com ([104.47.2.100]:11432 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753186AbdC0OUy (ORCPT ); Mon, 27 Mar 2017 10:20:54 -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=EMezxtgBB17C/tRZUgqbtorGdoWgcivHkI2/WlqW5gM=; b=AAzQTDf44xzlw4zfO3LAN7lxkFx8vFxNOmv56+7ku31Tx5K4Whbp2nde2Fow8nWVG5rl2FBwbHKLRxoLpJISM2pCeZBaHNLJyAYOQUdiJ/12RNGgX595V6A+UTgzkPkRBt5lV0TYqNbqQaw0ex9KTZo8QWpN4dvyyfblsBMZoXo= Authentication-Results: linuxfoundation.org; dkim=none (message not signed) header.d=none; linuxfoundation.org; dmarc=none action=none header.from=axentia.se; Received: from localhost.localdomain (81.224.171.159) by DB6PR0202MB2550.eurprd02.prod.outlook.com (10.169.211.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Mon, 27 Mar 2017 14:20:32 +0000 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 Subject: [PATCH v12 02/10] dt-bindings: document devicetree bindings for mux-controllers and gpio-mux Date: Mon, 27 Mar 2017 16:21:57 +0200 Message-ID: <1490624525-15865-3-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490624525-15865-1-git-send-email-peda@axentia.se> References: <1490624525-15865-1-git-send-email-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: DB6PR0202CA0048.eurprd02.prod.outlook.com (10.171.70.34) To DB6PR0202MB2550.eurprd02.prod.outlook.com (10.169.211.8) X-MS-Office365-Filtering-Correlation-Id: c0532e5c-c04a-4ce3-4f8e-08d4751c6ea1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DB6PR0202MB2550; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2550; 3:qHO52N01yyDZH+3S/ecFADAtey9yC7MQHd8WWz54iQa940putgqvQEevY4NIxCmMlIipfKIpn6OdsKo+rBQusvLA3J+CSpsnPCR61C2jDLeUp/Dgd12BVwyA2qlM/8c1WIR5iQkC/ICTVrDYSzIFKwqTF0AOjtaR6dklOHgzkC/Uub8+ygVNF1cxXvAzQXSX2Gs4NJZZmwbWgkuxBBb9MleLBIGMMnatCwyHqlznXItGahMJuXtyZZaoLVIU2/qp9dw0YCnACnjGYgEH2b6fSQ==; 25:Vw27BRmwO8mk4emBkErFyNfuvaCiSPusrgH/XkVCkOiXKnY5d4iqTKskdvvYpVQIybLr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LJ1X5YNiuHIZ+GdS/dYI6TDIeSzAH39AuCVcSDWELyuL3xmFfFEd+6Dww0E+ZMBQV8i1W3FfPJbmJt14w3PXyEQe00lAUDJJOyCnqYevzNXM6/Rf9kyFLJbowBwtaND1saIT0ygRfaX+oUgu1p2KS7bB5zEkeu5qVT638cluge/FV6gQIfSEiF5iCx5HfxeYjfFgRpd/I8hhOi6tIJszSFxseFrW2DuRGcbPc1EQFq1qtSVrJ2En/JZaLUXdGkAcEbfcO3qylLlkBROcUcP/qHaPhSQ4xO1DYGEVQN7shaahY55Kb1P+ARklgJGSjPHATp0A5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(11668515415152); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123564025)(20161123558025)(20161123555025)(20161123560025)(20161123562025)(2016111802025)(6072148)(6043046); SRVR:DB6PR0202MB2550; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0202MB2550; X-Forefront-PRVS: 02596AB7DA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(39410400002)(39450400003)(39830400002)(4326008)(36756003)(5003940100001)(33646002)(50466002)(53936002)(76176999)(66066001)(47776003)(6506006)(6486002)(7736002)(8666007)(50986999)(54906002)(38730400002)(50226002)(86362001)(6512007)(48376002)(3846002)(6116002)(8676002)(110136004)(2906002)(81166006)(42186005)(7416002)(189998001)(6916009)(305945005)(6666003)(25786009)(2950100002)(74482002)(5660300001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0202MB2550; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0202MB2550; 23:bpJv4LWiLnm1rcuDZFFEwP0BCr2LgGwSwPJXsHt?= =?us-ascii?Q?miN8RyNYKQ/MYEPQVDxMc+bF+I+3w7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oLKcJ7JagZu8/GXRJvh0TqfQa4HL4NMC7iEHVrA9xQ68s/g?= =?us-ascii?Q?lA5o3oyyhPF4Hr65KNM0EutrcH0G9im+8JGmlK8P40e2iPr8XyF0hk+uxdch?= =?us-ascii?Q?K1r8uwLQjYnLvUNaN4OzdvtuTB2wu?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2550; 6:YCkp1y97GLvb4Ouf7RA7fnnjecFS9OddXJ/2H7qXWJ4h+SwEkUxc8vvEU5c6OO1SzC4au1VrA+JPxOHtIQNe2r4dsHezJw0bfNFhJrYAko15qk27waZU3boXumpIhut6mnLXXaoXD0+enry9x9HAnTwczFrrKNy4FUYnijIGFBDpSao6SnZf0D4VLCiq9jIMPV5q0EkpehoX+5Ke9ok3asF6ry8iYDexdDTHegxhuJnb7/ylZj6cXqALnfHBaHZu22DGW4GpakFH5Xi2vAGwi6d9iZklHyEGvx2RCJdTAr/tV7J2WcJ5/TXecwDX8mcnDis3YSc/uqips53kjE/S+80bHhVKCTaZio/FlUP4ei048m51oAJTUCpJfZeBlEXuI+NMOyzSME7Wp//m+cN9Pw==; 5:nsS75ulwdcAQc3MPOR6atA8dGn5eP2Ye6Pd8uSSXebieCQZhBoayq+FNRSOtKfj2B9GBNSmMsOknf/LEch++sZlBqRV/A05W0HgnxUd3vIiAhtluF2SFJHtYQ/6GpdGJbiXa29GRbhFei1JWDV/eEw==; 24:uNQfboLzo2dS6JeZmMKKVU2A+4iYJFlTwnzplwCdUVHsdMtDoYNSLaH8RH8A7rkWhFq6+rc/WdQXcsDwfXXW9F5FXSYAd6RZDCp9ViLEwwo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0202MB2550; 7:irh8v4ONZuW0XqHLJaYgf+EssgwuxU/hqEFotK7m2bZ80dhP1A+Fb3UOl/X9KZNOe2julXY7yQEwrb/ur6J+WongMKACMjBfQ4iDaMRE4xEXkJMsvGvfV0zZ3dB/he1je3cAKNEYJIOvchwXo4NUTO4yRCUwwJbens2VKRZa5pQVM6IWOvQw/2B3OWIiMIXlQ0EAggqEbUiTVgkSjIV79mnpQ/dbOQRAdTdVehzl8cq0QJxnhOxdW+o+dYfYm4rMdXQG5/Y6XCK/K4gocZphvU6EbMpTi8rBmYj1IG1gjXd9DxIUZwrGS7B67E+awd6zKTgfWeuLguPa1dANwLar2w== X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2017 14:20:32.4707 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0202MB2550 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: 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