From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754256AbcKRQ72 (ORCPT ); Fri, 18 Nov 2016 11:59:28 -0500 Received: from mail-db5eur01on0101.outbound.protection.outlook.com ([104.47.2.101]:30703 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752605AbcKRQ7X (ORCPT ); Fri, 18 Nov 2016 11:59:23 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Subject: Re: [RFC PATCH v2 1/7] dt-bindings: document devicetree bindings for mux-gpio To: Rob Herring References: <1479419289-17553-1-git-send-email-peda@axentia.se> <1479419289-17553-2-git-send-email-peda@axentia.se> <20161118153528.tl24bp5xjwpjppk6@rob-hp-laptop> CC: , Wolfram Sang , Mark Rutland , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Arnd Bergmann , Greg Kroah-Hartman , , , From: Peter Rosin Organization: Axentia Technologies AB Message-ID: Date: Fri, 18 Nov 2016 17:59:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161118153528.tl24bp5xjwpjppk6@rob-hp-laptop> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB5PR08CA0055.eurprd08.prod.outlook.com (10.166.166.151) To VI1PR0201MB2319.eurprd02.prod.outlook.com (10.168.63.21) X-Microsoft-Exchange-Diagnostics: 1;VI1PR0201MB2319;2:uTizu/CzS0KClfl4DjotksUj52eXPIVnldygr92p9v7US9Bjiyneu2WJxDbfWutRkZOBjZyvnn6q9oS/Gth4wTVeA4uoZwK/AYagTjzy8nQrQC5A2kucRC32AlMPUuV0i2cRB4jivDh1EQrvLW38eJgk2oheu/YSRSBvMX3v3V4=;3:CxLrtXksQf66ZcKvegGKxprfEMYTHwxJKUUkaJMfMJYMrD5rx3xmXBNjuj+/qQHM5UAhAcNIPmbucoNinTOW8GPH2CcBuOPbJF8WyjSsC8PlbiJJK6gNYc9cu6iYuGhLAQbVa5ilT5auQif3BdtZ80XHfhyOgNQdJMem1LmnYGQ=;25:/Zew34PYn/vBxRlFNeYytxYTGadiTL2RtezhoZohurTiLhfAB/D5AJD3JjiYAMsEsnliZ7bKJINbGjHHMcgCphr+BNtV6dzxRxj0sFVQDSLZ314O5sBqrjoppkSEXl6VR2xxd2lr7CW+LXFPRiwMUtaiC6u4nP54kyKJDkkrHVt50CWdDlbsgrZS7TWfevcdFkkJaaGXhvZX78DMhaHq2Azbhg6AgmJcs7vkbPHCxWURLGdbEzUc8AeGT1CqED0VYtyfCDiQUUW6cLs6gtjkF6P+PWpYmbDt9JyMAGoKGGUJWujDHyumSKHCvz/c7QZ8ezOVMZK6VFJVxl0YFvfbX5SAMUTLmn/31Vwc/WIlHXnCW2k76gdiMT3NavTxnU3Ue4z2bJ6OWAPKfGhkSK+vX6jTzalcWVZbLkCOimuYtJ5sshFcN+vXiMJW0T6Y4Ym349jZGDKQs7p2unU1TtqjvQ== X-MS-Office365-Filtering-Correlation-Id: cc1a83eb-d64b-46a1-a0dd-08d40fd43d54 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:VI1PR0201MB2319; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0201MB2319;31:zXXn47Dfv2BIIjbp9GPfctWR/pcuROxOtJ/kzd4oxxHNYGPE35F27eHZyHx6+x4EVov5AZaIrOkc5tFsigbcG2+vuEv74zYySao0wE/1mZk34vsm72LbkIrsHJu44sMyHXIqg9lzXeJRctCF7I4mFTK37Acbb73cXLNIKa0lyCuC1BFhzu7ZZ2anXZuUBUexHyorO9KXMCWKJS/cZnwooDO+/eeNKZalVdKEOJY3ZweMRf7fg+SKArxSgyQnrbzYXbCGB+rF1zUCbo7fMQzkvGnTkup2q4UKCPu0B7JgDzo=;4:xqqTO8U9+4OrdW3WiyJpQG9hBNZzAjvXIo1pLxuVEAo8V3FSYMnb2TJncfHsMxWYtXw3OJyjq7CmZUc2MuvM4HgWCFN+KWTPm3fH25Uoe29w0kybnL1WHkaC31SS82I/lMifhCcRQgVKA+S7Tg2ZaxGbQXbtHrtnGl5tbdMKxDUWNAl4d1ixnAtmvSarKe+L6ZOYc4kYlN0A1xusQUfuKz3tw5N3LXWF/iQXrsVAr+KrDIZr0gdHm7m9WdmCC7EY7NRgOTtQiXfFGei5JBme2c71q6rErqRvr+yk4KMFyXMXxDNtZFuH5pOXYsn7kvnmtMGmAQ/6EUMlw/ESwyFCyOaDNQvy7tM2G2WIPOGGyLVRH/l4qhw9lVPAR4R1r6QmIdS2dzl2XEbiEcGURG2wTWX9N7wGMutcruH0B8Rg1ALJu614K0vnu309R1xqmjyx40ZRdY31Qtd2zHv9jxcrxQCFla6PJWiGiypeWP1W6IQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6040281)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041223)(6061324)(6043046);SRVR:VI1PR0201MB2319;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0201MB2319; X-Forefront-PRVS: 01304918F3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(377424004)(24454002)(52314003)(43544003)(199003)(189002)(31696002)(106356001)(97736004)(83506001)(81156014)(110136003)(229853002)(65806001)(105586002)(65826007)(81166006)(6916009)(117156001)(5660300001)(65956001)(23746002)(3846002)(38730400001)(561944003)(31686004)(2950100002)(230700001)(66066001)(74482002)(7416002)(42186005)(36756003)(47776003)(50986999)(101416001)(4001350100001)(6666003)(7846002)(6116002)(77096005)(68736007)(305945005)(8666005)(4001150100001)(7736002)(64126003)(92566002)(76176999)(33646002)(8676002)(50466002)(4326007)(2906002)(54356999)(189998001)(86362001)(7059030)(217873001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0201MB2319;H:[192.168.0.125];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;VI1PR0201MB2319;23:furgoXPeERLET2CrWdSBVGlYvSvm0O/bbZv?= =?Windows-1252?Q?C/oIinECjTqbfXzeQsm2tG4VuPpNglr9Z2jW4qXdOp+blaq4H8cTSAT1?= =?Windows-1252?Q?3gEk8f6tirNumP6U3wj4TPs0awBw687lbIY7EMk/SavAn00uKYEh0eth?= =?Windows-1252?Q?YrC1FYg8RfszidyqZh6LK/rtx9D/+LddN+8avbo8fk3hiJXScKGH5ugh?= =?Windows-1252?Q?JHSTz6GWHvTP1b37VVRd3k8b8jWIQh/rvQg2Bt3jm7su73eYDJIfundB?= =?Windows-1252?Q?LIiEIS6vc2vWKW86J/CxfRuxYu+FThYzF5ct69ruLjMNvODPLfiER0O+?= =?Windows-1252?Q?/a6eTBoULiaxIPPlUkPR1DjGXoW3reL/4cN2XakXXaWAaM+aDo2joTjg?= =?Windows-1252?Q?+m7rlvNzCLnc3mYvTp6+BM8+iUMjDIws9U++oqkCeBywISw8F0kfzaxH?= =?Windows-1252?Q?/GIkeJH3ytzrDVf/1zb92Wo46H6q+sz9zd94hffAsBxYBMuo954y6eTn?= =?Windows-1252?Q?sINotJ4I+dbkK4UHRK2gdO5opuYeJlDqB3yKmYE/L8MqvpuCuLwLlKwJ?= =?Windows-1252?Q?LE9PeAc+iQGFy8EqXbToaY2PGOs432+VnOKh1hzgFyLpMWoQQ3vLuk0n?= =?Windows-1252?Q?h5z7k0aDNAyY3LO5V79/S7Y5Cvh2/cVLYXthiuwkO9574m2wIxnN/B/G?= =?Windows-1252?Q?KaB0u4lUUezTYEq+bZNc8DzyIBSq68WgHcSoDPM+6h1dnd18nQEINLR/?= =?Windows-1252?Q?G68jHshfTuv/1raNWtKwapvZqVfgdpUstcruIFGmFazoZRZnKlHZBOGf?= =?Windows-1252?Q?Spq9PYS8NgWnVj3kmfc6oFzt6g0nA8D3iHWJ95ebWsQQGSbSaltwGvMD?= =?Windows-1252?Q?dexUzdzuD0AsoJtKC1oDWhH4ssf5sx8/QdDiRsaivDwka3UoOByYP3Cj?= =?Windows-1252?Q?H+8XvUE2gz3xnkb+5AJKzpLp1SlIBQDUpbeFEnrYGjpP/67du5kCT4sr?= =?Windows-1252?Q?NcSwYn5QhSVtLSkPzs5WrpH8uXf8dkRxVmRpaqXS4r9P63qdxeFc+Do+?= =?Windows-1252?Q?3NYGt3wmJERTWpDAdMA98cjFOpBBqTi68jHy0aa2VilR3cXQXdknbQMo?= =?Windows-1252?Q?ahLVoj1w++WUUOY4MNV0zXLo/Jw2KyGWfppcWKfL4sgaVO9rkcMpeykt?= =?Windows-1252?Q?1AaYOj2Id+0rlSZFq3uk/Aa8EIwCcV9bw41wwqfa+12xxUa2SqC5Uq4l?= =?Windows-1252?Q?n9+7i/3ykTDQs/xQdUp5eZzs+xWnw2sbzdlC++Uga05XlHc0LtNf7AKY?= =?Windows-1252?Q?qF1NbPkyw8MJfzSPdsbzG7VenxinDuZj6uGMTINkrPRLOaOo0fhlezH1?= =?Windows-1252?Q?BeYSYR89JsnchCns3qgLMrulDo4YaOr+RsveHFuXXSQxONlfMJVO1JcF?= =?Windows-1252?Q?pay8ZCXec5iDMxJDBYFYG6tvOX13ANV6R68bbQq+2qlidyNJM+5NanK6?= =?Windows-1252?Q?7HmRLp0TqN7RHw6SFpxZLCJrTtBL5RPEAKTLJXaO5ev9VQNOPnRpdumT?= =?Windows-1252?Q?V5fcfrc9LUS+428o6uVgto3a9Kfxg8Wk00ncBrXWWIxKN0P1joEbyueT?= =?Windows-1252?Q?fWMl03cNCVJnhqUmOc4W2qWE=3D?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR0201MB2319;6:6paNW4dJjwCFi5a+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z69P6qofACY= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2016 16:59:18.0744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0201MB2319 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016-11-18 16:35, Rob Herring wrote: > On Thu, Nov 17, 2016 at 10:48:03PM +0100, Peter Rosin wrote: >> --- >> .../devicetree/bindings/misc/mux-gpio.txt | 79 ++++++++++++++++++++++ >> 1 file changed, 79 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/misc/mux-gpio.txt >> >> diff --git a/Documentation/devicetree/bindings/misc/mux-gpio.txt b/Documentation/devicetree/bindings/misc/mux-gpio.txt >> new file mode 100644 >> index 000000000000..73699a37824f >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/misc/mux-gpio.txt >> @@ -0,0 +1,79 @@ >> +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. > > I think this makes sense in your case, but I think it is too complicated > for a non-shared case. Perhaps mux-gpios should be used directly (i.e. > in the adc-mux node) and control-muxes only used for the shared case. > > Part of me feels like you are working around in DT the GPIO subsystem > limitation that it can't share GPIO lines. Either this could be fixed > in some way in the GPIO subsystem, or the mux subsys could deal with it. > You just have to look up if you already have a mux registered for the > same GPIOs. Of course, that may make the mux subsys pretty much GPIO > only, but I'm having a hard time thinking how you would have shared > muxes that are not GPIO controlled. Any other control would be > integrated into the mux itself. But if someone wants to mux an adc line with a mux that is some kind of integrated i2c device, you'd have to add extra code to the iio muxer driver to handle that case. Or fork it. Or build something like the i2c muxer infrastructure and separate out the mux control in small drivers and handle the generic iio muxing centrally. But then someone else uses that i2c device to instead mux an i2c bus, and you'd end up with code duplication when that same muxer control code is added under drivers/i2c/muxes. With the proposed solution, this is unified. I'd just hate to see drivers for muxers added under drivers/i2c/muxes that do little more that control a mux that happens to be used to mux an i2c bus, but are generic muxers that could equally well mux something else. Even if the control is integrated into the mux, what the mux is actually used for should perhaps not determine where its driver should live. Anyway, I don't know what to make with your suggestion, I just don't see the path forward (not enough experience with the kernel and/or gpio code). And it would be a limited solution (GPIO only,a s you say) so it doesn't feel right. Is there perhaps some way to keep the complicated shared case work as is (or equivalently, the exact details are not important), and also provide a simpler in-node thingy to glue a mux control to a consumer w/o pointing to it with a phandle, but still have the same mux driver handle both cases? No, I'm not a devicetree guru, so I don't see a solution for that either, but maybe someone else does? Perhaps the consumer could look for the mux control in first the phandle, as in my proposal. If not found, it could also look for a mux provider bound to child node. adc-mux { compatible = "iio-mux"; io-channels = <&adc 0>; io-channel-names = "parent"; mux-control { compatible = "mux-gpio"; mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, <&pioA 1 GPIO_ACTIVE_HIGH>; }; #address-cells = <1>; #size-cells = <0>; sync-1@0 { reg = <0>; }; /* ... */ }; Or perhaps look in a parent node: mux-control { compatible = "mux-gpio"; mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, <&pioA 1 GPIO_ACTIVE_HIGH>; adc-mux { compatible = "iio-mux"; io-channels = <&adc 0>; io-channel-names = "parent"; #address-cells = <1>; #size-cells = <0>; sync-1@0 { reg = <0>; }; /* ... */ }; }; With the last suggestion, you could have multiple children of the mux-control node for the complicated case where it controls more than one mux. Not too bad? Hmm, what does the driver for the mux-control node have to do to have drivers tied to its children? Maybe this last layout should be the only thing supported? Good enough for me anyway... Cheers, Peter PS. I will take care of the other comments for the next round.