From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756563AbdDRNgf (ORCPT ); Tue, 18 Apr 2017 09:36:35 -0400 Received: from mail-ve1eur01on0098.outbound.protection.outlook.com ([104.47.1.98]:50560 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753332AbdDRNg2 (ORCPT ); Tue, 18 Apr 2017 09:36:28 -0400 Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=axentia.se; Subject: Re: [PATCH v13 02/10] dt-bindings: document devicetree bindings for mux-controllers and gpio-mux To: Philipp Zabel References: <1492101794-13444-1-git-send-email-peda@axentia.se> <1492101794-13444-3-git-send-email-peda@axentia.se> <1492509996.2432.63.camel@pengutronix.de> CC: , Greg Kroah-Hartman , Mark Rutland , , Lars-Peter Clausen , Wolfram Sang , , Jonathan Corbet , , , Paul Gortmaker , Rob Herring , , Peter Meerwald-Stadler , Hartmut Knaack , Colin Ian King , Andrew Morton , Jonathan Cameron From: Peter Rosin Organization: Axentia Technologies AB Message-ID: <17135062-e58a-b50e-ac85-5f0f0b73d958@axentia.se> Date: Tue, 18 Apr 2017 15:36:14 +0200 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: <1492509996.2432.63.camel@pengutronix.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [81.224.171.159] X-ClientProxiedBy: DB6PR07CA0080.eurprd07.prod.outlook.com (10.175.238.18) To HE1PR0202MB2556.eurprd02.prod.outlook.com (10.168.184.9) X-MS-Office365-Filtering-Correlation-Id: a5366484-780f-4ce1-e49e-08d4865fe66d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075);SRVR:HE1PR0202MB2556; X-Micro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wc0B0ow2hb6qOpdAT/K5wzZkvTHOjl+ry++0qpScLrazcGhe/ogX6WBxTe3gLmK8gM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(35073007944872)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123562025)(20161123560025)(2016111802025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6043046)(6072148);SRVR:HE1PR0202MB2556;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0202MB2556; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2556;4:RvLLGjDuAQXE7cY4fHBnUdSRrV6CLGZTMrKxiRyHsXIIAXR0GzUbBQ+9cW56v6u/LeTM6+ETAS+pxyVuS4+jbSfpvgQgolOp5/y4wDX4eS6pm7YDb9LKDZ+WoZCmyYal0gjP1EBbhhmSpA+6k60FYHF+iHLjLgM2U0kWzvPUtcrZ4316rXyAofPBC1Xab1PMmyOfPXV6MWmX+LSYTNN8wHRhAV8iz1orNxJufjaLh3/2+lnNO0JGRen5kI8iWIp5ed0D0iPcay3OMsJBSs8qxINQnc6DDfY3CDNRS3LTrxAkxBFxdswglEbsOb69cbGamOnFHXaOWNdI52LrNcM6HNbmfr9zlXpyOV14GL4tmsYCaD4sTLZSV/9igSiIx8iItxpZ08NojHiq22U5jjtUk0KzoYxNjlmzVmeeDxKLCrMyw4f2jx4RyhtXnStoROMa4TvNfTjHbDbTtUPSMc3mchZfxmS/f7OwVWZ8rdxq4vH7oMq1+Fc/raYmqDdf1COFPSt++sFWeVLBLjda+Wpsx4A0QZPuSoobLf4uGoahNdYvEgKKA5PDUzJkfPEfUisGUxzmOvOsrLyuooILzU3CYUmzNFD4sg7syip+Yn5B98tLVeDiRM5K11jt0a8Aa+XhrB7wYItVJyCHiti1vBSSC4YalhO8D6Y410xseRpq8Gs4pejPXcUwx+3DkTqycCTbC8wfAy4Z4crurT7YgjGz6Bt8bDD7zx1f3yGk033FpHC5ngx6bU8x8inFM0KcjCdr7fqYkvzSsk0DwUeHHrthhI6wBnM0rG16Kh/xPnquiOE8Plpvh68rHv8f4SkBvS7PbpetuYW5+aTBW7+QtDfPT+jmbp71O/VyTvBmGhD7vnU= X-Forefront-PRVS: 028166BF91 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(39450400003)(39830400002)(39400400002)(39410400002)(51444003)(24454002)(229853002)(25786009)(4326008)(230700001)(53546009)(42186005)(6116002)(64126003)(117156002)(6916009)(36756003)(83506001)(31686004)(2906002)(65806001)(50466002)(47776003)(3846002)(65956001)(66066001)(31696002)(33646002)(86362001)(77096006)(23676002)(3260700006)(189998001)(81166006)(6666003)(5660300001)(110136004)(2950100002)(8676002)(305945005)(53936002)(6486002)(4001350100001)(50986999)(7736002)(7416002)(76176999)(54356999)(38730400002)(74482002)(8666007)(6246003)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0202MB2556;H:[192.168.0.125];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjAyMDJNQjI1NTY7MjM6UGw2S0V4em52Rzd1YnRUZzZEWnFMcXcv?= =?utf-8?B?SmM5NHpDSnVqeCtudjVmdWxnRXMvVzR5RGRnYmo2N21iOFQ0WWVWL3BsZUw4?= =?utf-8?B?Zm5rTWpCQkRjVEh4Nmd1cmJHMTZLN29TU1gwWEhiQUJYK2Y4bnJ0aS9iQTBF?= =?utf-8?B?WTdQeE0vMUtTZk4vck1SbktDSTNVRXBoREM0ZWJtdmVJaXhwZGNuNHdnZTVm?= =?utf-8?B?QTNyY1B0NEZwY0wyTGFTUkRCbGcyRmQzVGlxeFpUYUVGWi8vbXBtUk5ENWZJ?= =?utf-8?B?Q1YyYXp6QjdYRlUyM202dXFHUGJNSk1TMVB1L3VyN0p0dy9HZXRD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EPu4YjG0zaEITdQdsdHaKHxfjyb4I8tgBkYt9v1ylM3QedTxilCMNBnCVnH9Rn50FF8Vb3tAl7X7OlvBvp9znfKEYP6s7HQsgT8HOkcJGCIj3ZoCAbxvguF2I4vKCT3otdsKehwhDufZNZMSEP+TB01I4Mif4MOikmSHtKGA==;5:O890qjGq23UGHp2hJQK9d1OuhSHVlZCLnGxh6lj80YzhS3RFVH8H/NlmZJMc/uWP6V/B0G4MvdJQlVYKLPmoHy7RkD7DGsh/qaPvUtmV/4+tawc+YrhUHqPqMdfrfbyMPzB9kjZuVZ2y6MaM5unyMw==;24:o07D/6kRtCFnl9riprubAD4TB71U4ohCsW0Jl+FeYkddA55WvFrlttySnxUb1M0QYhGM7UD1JiRjuKMfFpnh27PbZvro+fxB2g58kGHQcJ4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2556;7:5otaTF93SlGkxPxQiaAn+o5O0s2LJJO2SLi/cYWenkr9179JOGPoHyF/S7u8ldu9yKPhUa3qC2mVgT2HLUGFbS75K/zXXGvkcqjoMq8/wRgWLrd7pIqj8xosNXoNk4iiFrdVTrZ866PfylAHAlveX6uIv9w46itGimzla2qR8wlveN2iytD+7U2BCR9JpyEQBOTotLTwdth4Hc1tKpTO2aQ3Y6gSwdqFcS8FPqFHDBt8HUmEc269jZYg+rUJhnFsmTQ6pH86lzbf+zjUCqj/1MFPx4m07nsOamL7KIQqxJVsgO3AtSKaMStmW3U3RWNIalHuIdf1aOhBZNJnSQZ/IQ== X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2017 13:36:18.3685 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0202MB2556 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-04-18 12:06, Philipp Zabel wrote: > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: >> 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"; >> + }; > > Could you explain in more detail the reasoning behind this split between > the mux controller and the actual mux? > For SoC internal video bus muxes that are controlled by a register > bitfield, it seems a bit strange to have to split them into two device > tree nodes. The background for the split is in the cover letter. Basically, when the same set of gpio lines control several muxes, and when these muxes are used for unrelated things, you needs some extra complexity. The mux controller is what controls those gpio lines, and thus the mux state for all muxes they are connected to. The consumers refer to the mux controller and request a certain state. So, the consumers naturally need to interact or else they would destroy the mux state for each other. Regarding the device tree layout, perhaps the mux consumers could be children of the mux controller, but I think that would make the mux controller more like a bus instead of a class. Anyway, I don't want to go there again, because I remember it as a messy place. Maybe I could do better now than I did way back when, but I'm not going willingly and someone would have to force me. The benefit of the split is that the mux consumer need no longer concern itself with if the mux is controlled by gpio lines, an I2C based chip like the ADG792 or if it is controlled by some mmio register. You can thus avoid building muxing sub-sub-systems like drivers/i2c/muxes for every subsystem needing muxing. The drawback is that you get an extra device tree node for the mux controller that may not make sense if it is in no way possible to reuse your driver for HW with a different mux. Which may be the case for your video case? But for generic stuff like ADC lines and I2C buses, muxing options are diverse... > Basically I'm trying to figure out whether a video mux (which has a mux > control plus OF-graph bindings to describe its ports and connections) > would fit into the same category as an adc-mux or i2c-mux, or whether it > would be better to handle them as a specialized form of mux-controller. I did read some earlier thread about your muxing requirements and I got the impression that you also had HW which controlled the mux with gpio lines? In that case, the mux subsystem seems like a perfect fit with a new syscon/mmio/reg based mux driver (or whatever the name should be, I think I'd go with syscon) pretty much as suggested in your RFC patches. And then of course reuse the existing gpio-mux driver for the other case. The video-mux would fit as a mux consumer just like the iio-mux and the i2c-mux are mux consumers, with input 0/input 1 being the port that would be selected with the mux I guess. I don't think there should be a bunch of video code inside the drivers/mux subdir, for the same reason there's no iio/i2c code in there. If I got things wrong when I skimmed whatever I came across, and if the mmio register is the only mux control option in the stars, it becomes less obvious... It's of course still possible to hook into the mux subsystem, but the benefit is questionable. And you do get the extra device tree node. You could of course also implement a mux driver outside of drivers/mux and thus make use of the mux api, but it's tiny and any benefit is truly small. Cheers, peda From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Rosin Subject: Re: [PATCH v13 02/10] dt-bindings: document devicetree bindings for mux-controllers and gpio-mux Date: Tue, 18 Apr 2017 15:36:14 +0200 Message-ID: <17135062-e58a-b50e-ac85-5f0f0b73d958@axentia.se> References: <1492101794-13444-1-git-send-email-peda@axentia.se> <1492101794-13444-3-git-send-email-peda@axentia.se> <1492509996.2432.63.camel@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1492509996.2432.63.camel@pengutronix.de> Sender: linux-doc-owner@vger.kernel.org To: Philipp Zabel Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Mark Rutland , devicetree@vger.kernel.org, Lars-Peter Clausen , Wolfram Sang , linux-iio@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, kernel@pengutronix.de, Paul Gortmaker , Rob Herring , linux-i2c@vger.kernel.org, Peter Meerwald-Stadler , Hartmut Knaack , Colin Ian King , Andrew Morton , Jonathan Cameron List-Id: devicetree@vger.kernel.org On 2017-04-18 12:06, Philipp Zabel wrote: > On Thu, 2017-04-13 at 18:43 +0200, Peter Rosin wrote: >> 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"; >> + }; > > Could you explain in more detail the reasoning behind this split between > the mux controller and the actual mux? > For SoC internal video bus muxes that are controlled by a register > bitfield, it seems a bit strange to have to split them into two device > tree nodes. The background for the split is in the cover letter. Basically, when the same set of gpio lines control several muxes, and when these muxes are used for unrelated things, you needs some extra complexity. The mux controller is what controls those gpio lines, and thus the mux state for all muxes they are connected to. The consumers refer to the mux controller and request a certain state. So, the consumers naturally need to interact or else they would destroy the mux state for each other. Regarding the device tree layout, perhaps the mux consumers could be children of the mux controller, but I think that would make the mux controller more like a bus instead of a class. Anyway, I don't want to go there again, because I remember it as a messy place. Maybe I could do better now than I did way back when, but I'm not going willingly and someone would have to force me. The benefit of the split is that the mux consumer need no longer concern itself with if the mux is controlled by gpio lines, an I2C based chip like the ADG792 or if it is controlled by some mmio register. You can thus avoid building muxing sub-sub-systems like drivers/i2c/muxes for every subsystem needing muxing. The drawback is that you get an extra device tree node for the mux controller that may not make sense if it is in no way possible to reuse your driver for HW with a different mux. Which may be the case for your video case? But for generic stuff like ADC lines and I2C buses, muxing options are diverse... > Basically I'm trying to figure out whether a video mux (which has a mux > control plus OF-graph bindings to describe its ports and connections) > would fit into the same category as an adc-mux or i2c-mux, or whether it > would be better to handle them as a specialized form of mux-controller. I did read some earlier thread about your muxing requirements and I got the impression that you also had HW which controlled the mux with gpio lines? In that case, the mux subsystem seems like a perfect fit with a new syscon/mmio/reg based mux driver (or whatever the name should be, I think I'd go with syscon) pretty much as suggested in your RFC patches. And then of course reuse the existing gpio-mux driver for the other case. The video-mux would fit as a mux consumer just like the iio-mux and the i2c-mux are mux consumers, with input 0/input 1 being the port that would be selected with the mux I guess. I don't think there should be a bunch of video code inside the drivers/mux subdir, for the same reason there's no iio/i2c code in there. If I got things wrong when I skimmed whatever I came across, and if the mmio register is the only mux control option in the stars, it becomes less obvious... It's of course still possible to hook into the mux subsystem, but the benefit is questionable. And you do get the extra device tree node. You could of course also implement a mux driver outside of drivers/mux and thus make use of the mux api, but it's tiny and any benefit is truly small. Cheers, peda