Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934584AbdIYKfJ (ORCPT ); Mon, 25 Sep 2017 06:35:09 -0400 Received: from mail-db5eur01on0136.outbound.protection.outlook.com ([104.47.2.136]:27520 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753875AbdIYKfF (ORCPT ); Mon, 25 Sep 2017 06:35:05 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Subject: Re: [PATCH v2 10/11] staging: typec: fusb302: Hook up mux support using tcpc_gen_mux support To: Hans de Goede , Rob Herring Cc: MyungJoo Ham , Chanwoo Choi , Guenter Roeck , Heikki Krogerus , Darren Hart , Andy Shevchenko , Mathias Nyman , "linux-kernel@vger.kernel.org" , platform-driver-x86@vger.kernel.org, devel@driverdev.osuosl.org, Kuppuswamy Sathyanarayanan , Sathyanarayanan Kuppuswamy Natarajan , Greg Kroah-Hartman , Linux USB List , Mark Rutland , "devicetree@vger.kernel.org" References: <20170905164221.11266-1-hdegoede@redhat.com> <20170905164221.11266-11-hdegoede@redhat.com> <20170912222027.hzpejmmxkwbw6seu@rob-hp-laptop> From: Peter Rosin Organization: Axentia Technologies AB Message-ID: <3d207dc4-1dba-ce34-21af-bab001ec68c5@axentia.se> Date: Mon, 25 Sep 2017 12:34:58 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [81.224.168.30] X-ClientProxiedBy: HE1PR05CA0272.eurprd05.prod.outlook.com (2603:10a6:3:fc::24) To HE1PR0202MB2554.eurprd02.prod.outlook.com (2603:10a6:3:90::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e4d12b4-1888-45bc-ad33-08d504011434 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(2017082002075)(2017052603199)(201703131423075)(201702281549075);SRVR:HE1PR0202MB2554; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;3:QsNIGl02cYo7Vh4DE2ZBZiIlV4weI8aJQWw+AaPhYP0wzQGioMowUCGtxd6xb45z8jWzN2JOiiRY//aQCfZa4HpxvfKE+RYfOU1myinJm8PO95W1gxR5ibERcxS4eynln0Lmr5TXsmSEM/Y7msmlKmBpyyXRVUaRKEFCcCLMXJv/7SjGYX34AZGS7Tz6t74tWDCN5KqXpQPS67nGusZ55vSssFcIant2hAALE18M+xTAi06R5Q2NMNp/WIlht37w;25:CykzkxnOUIdcyAlLStugk0rBwbsX8qqYEMF9B4Qd02VRgRHLPDwXNWd+1OS0b/ABYtDzsRSsnRUpt/Q3Roz0tSzjNNuSRr396RHCVFnVVFxibyNXcNbhpfI1M5JjvRIJ4eihuF0LR65jNus98Gdut5pTcBZ+gF1AxGPZVYIrQD64w/1aGSWxL1suswvByEpytlNJo/M6R2Uyq7qyByzefMopKZf0ZGoLZcr08vzewtDOAuDwd42AYttfSd8w9SS+Ui3J+2JFvyQyGtpzTWxs0cI5PlvmsTJ0JfJTYFccW33fZElEnGCLJ+NFAVOdoKsleLZzl0l/HHiQWMleaDNu1g==;31:mZAk3cVUxZqNquzaTw/C/+b0XJ9dHwOMEVheq+EkjYS0C2wYdy+TW6KTRQCMsBafBar0QLqvTdGWS68cpqeUjUU8hCdTRh4rejIcr8xUMeu8SdFIrx9drjA8bHwPu2ms8KTMWobiS9UnJuIfPB/euUKcZYjniqow1wqx7Hfm4ErkbyTKnhbBascUad5rIC8IVq+nI/EBOxHW7y1QS7ThOrKWUVz9Rx+4qWN2IP23l0A= X-MS-TrafficTypeDiagnostic: HE1PR0202MB2554: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(9452136761055); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6041248)(2016111802025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123564025)(20161123558100)(20161123562025)(6072148)(6043046)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR0202MB2554;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR0202MB2554; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0202MB2554;4:4tbG+cWrbYepuRsllOL1kGu76g1OfRw+8gF4y1aeKiHBxWHqJ1u8j2rmLUFE9cVOjNuDclGynkwZabWWAUgd8xYRYIKmOkPv4TJtRzRp+5Ku9AM2dpzmhIqXYjfOo074fGtofZvpN0YKw+R69LoH4o76zNobmbKCFuhfeerbdRrlfug+Zioz53HjlhpAp1v9j7lnjgzsxhu2N8HIrxgFBfpuDjE7zS0wUs344VhmbjBf6n3vIVnLcgPoW/FzD3utvU1kA3WOCKC2LudjegArm/cVRyyuofcva1+9v/gJqAzhNs8qJu9igqFLWQZKLfzbbHmWqW34fZS7zK6UL/8lkA== X-Forefront-PRVS: 04410E544A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(6049001)(39830400002)(346002)(376002)(377454003)(189002)(199003)(377424004)(24454002)(101416001)(117156002)(6486002)(316002)(189998001)(81156014)(53936002)(16576012)(31686004)(3846002)(74482002)(305945005)(23676002)(6116002)(7416002)(77096006)(7736002)(8936002)(65806001)(105586002)(54906003)(83506001)(110136005)(81166006)(58126008)(39060400002)(36756003)(478600001)(86362001)(54356999)(3260700006)(50986999)(4326008)(76176999)(33646002)(65956001)(53546010)(8676002)(2950100002)(25786009)(97736004)(5660300001)(47776003)(31696002)(5890100001)(68736007)(230700001)(106356001)(6666003)(229853002)(66066001)(93886005)(65826007)(2906002)(50466002)(6246003)(64126003)(52103002)(158003001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0202MB2554;H:[192.168.13.3];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjAyMDJNQjI1NTQ7MjM6OG1IejFaYVFiR3BnUEtlRUFQVG5PaTBo?= =?utf-8?B?NUwxK1dIK1M5RHVpbjNZTGhBWmlROXV4L29MUldrNS9hNzBmZVVYSC85NGNX?= =?utf-8?B?YUc5UVJZeGpGTitiM2xjRjVTY09GMFhTbWdLREl3eG9zTVZwUjh3b0NSQUtF?= =?utf-8?B?cXo3NE4xOUIxQ05IMXFmSmFVK0ZPOTBJVXVqbjBvWXovbHRNRVNYSitTVElO?= =?utf-8?B?ZVJxWk9UNmZGUmROdWNuN0s0WENFZk16Ykp4N2R3MS9aQXUzN1daQUpiaXBU?= =?utf-8?B?cFU4bDNSVjdZa3l0RTJlTjNYeCswRWVXckhhWktpNVdrYm5BcVJsdkJrTWZr?= =?utf-8?B?UjdSeXdTVWp5cHVhSDZsWmdHSWJqbjlyQnErZmN5a1BtOGF0cXJMWXdLOGJ5?= =?utf-8?B?NGE4RWxzWWgvYkZVV1B0cVNlQ05wQzdMRlBLMURNczJLeWRCNHM3ZWR5Q0V0?= =?utf-8?B?T1hvRDRKcnFpSEcwVlZGa0hXRWdvSXEwdEJhT25RQTcvOE5scHRTeHRnYk9I?= =?utf-8?B?VExMWnhxdVhnVTMvTEdYSmZCRTlzV1ZjRmthcVdvT201blh2MXc2eitiRlJW?= =?utf-8?B?QU5Fek1rUDk4M0Mrd3ppVVJiZlM4bE9FSlFEa3ZuTFZXSnQxTHZ2WFlwcFR0?= =?utf-8?B?c2I1bkNwMThrL0JXN2YzeEhTWFBUMFd6NDZFQ210NzVOdktsY0RLc3VpSHpj?= =?utf-8?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EJX8nsYr+Qsn9Pw==;5:Q/kGptfbwCbz4shLplpvjFm8bGau2btxiZ0pTB55ARFY7cTXIkr20gEH6roOySRl9cftFtIryiZoaYgSTMA1Y0ka2h1bptK/yvnxxLymm+K6Ii8a/oNXU3qxo16MjRPd3PQGO2EvplwxWx1xU0sfIA==;24:PWYng+y+BMimsr9+R7s0Pv+jPbxy+M4pouguRpVyTOmqU1Xk5XX4oK0p7ukpTcapXPlQQzA9BeGLF6XV5EjHNR+/3Rky1OmfONAG92Kzwz4=;7:wbiwPJTCTEm4mQcXaA2s+1qez8qx+OMiTQllgkSNJ2RaCv90PgC7rEJrP4kOc61UqPtWcLjFWMUMQI8NM6gM9qbRMBEIUdc5VGN2+/WlEwFLFHr9zMweK1Bci6P+wW/58axhDeCMtVdsh5o/bIV3j5guGXJwP0OUU8YeuqRZoO3D9J7AIygAYHgUjlrjh5FeMeQL64Keg/XdyRwRFonpz1bwVoe47Vl0MRpAlavM84s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2017 10:35:01.1080 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0202MB2554 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7672 Lines: 177 On 2017-09-13 17:48, Hans de Goede wrote: > Hi, > > On 13-09-17 17:07, Rob Herring wrote: >> On Wed, Sep 13, 2017 at 9:06 AM, Hans de Goede wrote: >>> Hi, >>> >>> >>> On 13-09-17 15:38, Rob Herring wrote: >>>> >>>> On Wed, Sep 13, 2017 at 3:56 AM, Hans de Goede >>>> wrote: >>>>> >>>>> Hi, >>>>> >>>>> >>>>> On 13-09-17 00:20, Rob Herring wrote: >>>>>> >>>>>> >>>>>> On Tue, Sep 05, 2017 at 06:42:20PM +0200, Hans de Goede wrote: >>>>>>> >>>>>>> >>>>>>> Add mux support to the fusb302 driver, call devm_tcpc_gen_mux_create() >>>>>>> to let the generic tcpc_mux_dev code create a tcpc_mux_dev for us. >>>>>>> >>>>>>> Also document the mux-names used by the generic tcpc_mux_dev code in >>>>>>> our devicetree bindings. >>>>>>> >>>>>>> Cc: Rob Herring >>>>>>> Cc: Mark Rutland >>>>>>> Cc: devicetree@vger.kernel.org >>>>>>> Signed-off-by: Hans de Goede >>>>>>> --- >>>>>>> Documentation/devicetree/bindings/usb/fcs,fusb302.txt | 3 +++ >>>>>>> drivers/staging/typec/fusb302/fusb302.c | 11 >>>>>>> ++++++++++- >>>>>>> 2 files changed, 13 insertions(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt >>>>>>> b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt >>>>>>> index 472facfa5a71..63d639eadacd 100644 >>>>>>> --- a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt >>>>>>> +++ b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt >>>>>>> @@ -6,6 +6,9 @@ Required properties : >>>>>>> - interrupts : Interrupt specifier >>>>>>> Optional properties : >>>>>>> +- mux-controls : List of mux-ctrl-specifiers containing 1 or >>>>>>> 2 >>>>>>> muxes >>>>>>> +- mux-names : "type-c-mode-mux" when using 1 mux, or >>>>>>> + "type-c-mode-mux", "usb-role-mux" when >>>>>>> using >>>>>>> 2 muxes >>>>>> >>>>>> >>>>>> >>>>>> I'm not sure this is the right place for this. The mux is outside the >>>>>> FUSB302. In a type-C connector node or USB phy node would make more >>>>>> sense to me. >>>>> >>>>> >>>>> >>>>> The mux certainly does not belong in the USB phy node, it sits between >>>>> the >>>>> USB PHY >>>>> and the Type-C connector and can for example also mux the Type-C pins to >>>>> a >>>>> Display >>>>> Port PHY. >>>> >>>> >>>> Thinking about this some more, the mux(es) should be its own node(s). >>>> Then the question is where to put the nodes. >>> >>> >>> Right, the mux will be its own node per >>> Documentation/devicetree/bindings/mux/mux-controller.txt >>> the bindings bit this patch is adding is only adding phandles pointing >>> to that mux-node as the fusb302 "consumes" the mux functionality. >>> >>> So as such (the fusb302 is the component which should control the mux) >>> I do believe that the bindings this patch adds are correct. >> >> Humm, that's not how the mux binding works. The mux controller is what >> drives the mux select lines and is the provider. The consumer is the >> mux device itself. What decides the mux state is determined by what >> you are muxing, not which node has mux-controls property. >> >> By putting mux-controls in fusb302 node, you are saying fusb302 is a >> mux (or contains a mux). >> >> >>>>> As for putting it in a type-C connector node, currently we do not have >>>>> such >>>>> a node, >>>> >>>> >>>> Well, you should. Type-C connectors are certainly complicated enough >>>> that we'll need one. Plus we already require connector nodes for >>>> display outputs, so what do we do once you add display muxing? >>> >>> >>> An interesting question, I'm working on this for x86 + ACPI boards actually, >>> not a board using DT I've been adding DT bindings docs for device-properties >>> I use because that seems like the right thing to do where the binding is >>> obvious >>> (which I believe it is in this case as the fusb302 is the mux consumer) and >>> because the device-property code should work the same on x86 + ACPI >>> (where some platform-specific drivers attach the device properties) and >>> on e.g. ARM + DT. >>> >>> The rest should probably be left to be figured out when an actual DT >>> using device using the fusb302 or another Type-C controller shows up. >> >> Well this is a new one (maybe, I suppose others have sneaked by). If >> ACPI folks want to use DT bindings, then what do I care. But I have no >> interest in reviewing ACPI properties. The whole notion of sharing >> bindings between DT and ACPI beyond anything trivial is flawed IMO. >> The ptifalls have been discussed multiple times before, so I'm not >> going to repeat them here. > > Ok, so shall I just drop the Documentation/devicetree/bindings/usb/fcs,fusb302.txt > part of this patch then ? I totally agree with the concern that Rob expressed about handling USB C muxes in a non-adhoc way. And this makes this series scary. I don't know enough details about USB C muxes and PD (I just have a very superficial mental model) to tell if this series is going down the right path. Or how terrible it will be to fix things up if not? The series extends the mux subsystem with muxes that pins semantics to specific states. That is new, and shows up exactly here when Rob is not happy about the binding. And if Rob does not want this in the DT bindings then I'm not so sure it is wise to do it at all? This problem doesn't go away just because you remove the binding. I think I would feel much better if there was a path forward on how to represent USB C muxes in DT and how that would fit with the driver structure. If you compare to the i2c-muxes, there is a relatively new i2c-mux-gpmux driver that uses some general purpose mux from the mux subsystem to implement an i2c-mux. If USB C muxes where to be done similarly, I'd imagine there should be a general abstraction of what USB C muxes provide somewhere outside of the mux subsystem, and a bunch of implementations of that abstraction. One of those implementations could be to use "raw" muxes from the mux subsystem. Of course, this is not what this series is doing. Also, muxes that are not general purpose such as the ones added to the mux subsystem by this series could perhaps be repurposed for some other application, but since the interface implemented does not really obey the rules (the provided mux controller interacts with different sets of signals depending on the state) this will not be possible. These issues are what has caused me to do a lot of thinking and to sit silent, sorry about that, but I would like input from someone more experienced. If possible. But I'm not sure where to turn? As a crazy example, why is it not possible to hook up one signal pair from the USB C mux, not to DP, but instead to some I2C controller? Then, if done right, i2c-mux-gpmux could be hooked up with the relevant mux controller and use the signal pair for I2C, with the mux controller acting as a gate. So, maybe a bit crazy, but something like that is how I think it should work from the mux subsystem point of view. And while maybe crazy and while it might not be technically possible to do I2C over a USB C connector for some reason, I do think that whatever abstraction you come up with for USB C muxes, it has to deal with and broker requests from both the USB subsystem and whatever other subsystems deals with the alt pairs. Be it graphics for DP signals, or whatever. IIUC, the alt signals need not be graphics, and it would be sad to implement the USB C mux it in a way that makes it hard to use the alt pairs for something else. [maybe my understanding of USB C is just wrong] Cheers, Peter