From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753520AbdIDLTN (ORCPT ); Mon, 4 Sep 2017 07:19:13 -0400 Received: from mail-eopbgr00090.outbound.protection.outlook.com ([40.107.0.90]:3232 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753380AbdIDLTK (ORCPT ); Mon, 4 Sep 2017 07:19:10 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Subject: Re: [PATCH 00/11] mux/typec: Add USB / TypeC mux drivers and hook them up on some x86 systems To: Hans de Goede , MyungJoo Ham , Chanwoo Choi , Guenter Roeck , Heikki Krogerus , Darren Hart , Andy Shevchenko , Mathias Nyman Cc: platform-driver-x86@vger.kernel.org, devel@driverdev.osuosl.org, Kuppuswamy Sathyanarayanan , Sathyanarayanan Kuppuswamy Natarajan , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, Stephen Boyd References: <20170901214845.7153-1-hdegoede@redhat.com> From: Peter Rosin Organization: Axentia Technologies AB Message-ID: <56a7fa03-013c-8d7d-a914-a4dc1f879647@axentia.se> Date: Mon, 4 Sep 2017 13:18: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: <20170901214845.7153-1-hdegoede@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [81.224.168.30] X-ClientProxiedBy: HE1PR0301CA0018.eurprd03.prod.outlook.com (2603:10a6:3:76::28) To DB6PR0202MB2550.eurprd02.prod.outlook.com (2603:10a6:4:1b::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2921d5b-765d-4686-2a0b-08d4f386c0c2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(2017082002075)(300000503095)(300135400095)(201703131423075)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DB6PR0202MB2550; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0202MB2550;3:Rx+UgCRAIELnjqpg2lX7uI5sRNzMfr3+nLbvcmQnScA/IM/zVdDHMkUFUcOCsR1zmARVBYlzJzDOE2ppIz5nPu5f/65ncmTNABXTTS/eEIUwHSSDUU9HdIPo3JJ6yVy5fFsHIdONUdvPa4I0HES2kFVSUuK73sei64CyDrHLa7PS5UvRbU5MVrAK+ETVw4GNbSbYJ015S2SY2wXfttDzLS/gbeTuGnY1Tfiu8uGg8/iFgJqCZyKp9DAY05wfjx6R;25:gANAZ5182uSy4wLhOSyESYm/qul5unTeDX6sMFDkaOInCxkQrk2ipSG1e0BlFXYSj7bBWOrCetZ+Bejvkr5MvbNY84ZlsBopehjTfdHViEFCJ3Gj8yFy0E+wrQbcPTZJvJSGeDaM8kBiFYTAEJS8xFInZnNuSs7zyBiRF9cQdOFmFL4XWnP2cj9T54SBYs/66CZGnYmxgi7N0SwI4cUhif9SxdpuiF6ebcsuCCPb8vcwCL2qSMXyDWCk+AuhnBcbcFrHf2+SUSTgcL/M+2w6d+AehdewWx/dpgMPSj+AnQY4TWmqYnbpVjaKBrb4LsrJTYThyJafFpiJbS5JCrkeFg==;31:dR9XQi36B6WccuHdVGX6AcpOTozFU4djPbsd1NCmZq9Ik70xlw/uFlEXOjvlIt/vHhLPA+0NxNwBBQ2z+YEabB6fYPL8UuB9Ge/+voOtlPdO6YVn/soynOw1jt1vaTUCUFkBT8oknbSIN4l69Ip3Xsj4+pgOcJ3uYDPhAV/vzbtzqEonJN6mhgYr2vX0AK4DbD+sy7PMHUHwe6c3IpDeCrhBwvpWlwIwmmc7SVTkpxM= X-MS-TrafficTypeDiagnostic: DB6PR0202MB2550: X-Exchange-Antispam-Report-Test: UriScan:; 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)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(2016111802025)(20161123555025)(20161123558100)(6043046)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB6PR0202MB2550;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB6PR0202MB2550; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0202MB2550;4:bwAmAPWuDcneqhfMP/RqOBnNYnXC3IFQa7x1rTT9orv44IT6g+5W+8lsqGtdv1lQ/v0CYrYkU26PK2HCGdwJlDX+rhdXQkkttNnWOnxPdKEFDFoD46EIaDZIFp69rnZu8pdLQKI7Gn4KxM6sq8e/6dFxS0Ido6zYC/t9qrCPmDmpQuhPemte6x8ahgBJWEYhn2RdMwdc4DFEZATvTnDjgmZkzWCPtLU6gPQNJH2GlxOU1rEMwJiljtOjNdKxvmwb X-Forefront-PRVS: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(7370300001)(6009001)(6049001)(39830400002)(24454002)(53754006)(189002)(52314003)(377424004)(199003)(64126003)(77096006)(53546010)(23676002)(6486002)(229853002)(50466002)(83506001)(7416002)(101416001)(31686004)(8676002)(65826007)(6306002)(7736002)(66066001)(65806001)(76176999)(54356999)(50986999)(53936002)(74482002)(6246003)(966005)(54906002)(47776003)(305945005)(65956001)(117156002)(105586002)(42186005)(478600001)(106356001)(97736004)(4326008)(4001350100001)(36756003)(33646002)(345774005)(7350300001)(68736007)(81156014)(6666003)(2950100002)(3260700006)(5660300001)(81166006)(3846002)(6116002)(31696002)(2906002)(25786009)(86362001)(189998001)(230700001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0202MB2550;H:[192.168.13.3];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjAyMDJNQjI1NTA7MjM6WWpVMzE2TlRENUFFUXRTbDZLM2ljYnZ6?= =?utf-8?B?UnlqNjhCSVFJVVdpYXVkeGlyQkNOQkdiVFM1dmZkVUhIVUtMUTJvdTAwSFoy?= =?utf-8?B?YzlWMTJYWUU4ZXl5c3NJbFlvdVFaSk9ha2hIdURhMzh2OG9SWHpPemdQcGE4?= =?utf-8?B?dGV6WEhVUFh6elh4ckRTc002SUxudXF5RUYvZzZ1Z3pCWkJaOUhIOXhDYnJX?= =?utf-8?B?Ui9PaXdad1orRHVyb0JHSVYyNXVYRktHZlczcHFtK3JKajR3SXI0R1o5dFJa?= =?utf-8?B?NEs3QndZU2pINmtNMlgyVDhTTGF3cXc3NW5jVVRJYzNVSjhQb29XVHlBNWFX?= =?utf-8?B?QU4yOWpDQlV1NDIrakxIZCs5bEFhQ0dkRCtkbGhXaU92WGJ1bjNWMWVuVzlV?= =?utf-8?B?WUlhTk83R2thS2diSmdKOEloQ2RZWjJqeisxTitlUUh2VGpxeEFEdVYweWkw?= =?utf-8?B?WkY0VDlVVnl4bTZnNjhtNWNXakxNYzZFMDg5SzYzdjlNRy9rMGFaMXBOelhY?= =?utf-8?B?ZWVwSS94L1RuWGJsdGNiN2NuZkZ0dlNwNitPWURjYy8wQnN6ZXFtWTlrWmw2?= =?utf-8?B?SThhKzhOUytxcmNRblpXUTY3Z0tLY1VIemdnL2l1bXNyVTQ4MWNUN0tjRVY3?= =?utf-8?B?cVBLQVFoY0gyZHFFVjVWd29yVk53UFprMTdIOXhjQTdjZGRSOVZNakhwOU51?= =?utf-8?B?WEFFL0dISXUvUEVOYVBBM0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/YnQDQY1682fFnlzSMuffUC1dQHprILAGwrtuGTqhZlHaBZ54hWqbWNB60fx8uVyPdTHdylzMSGgwi6/BDkp5I/A==;24:8QOvEEnCZNzu2LfTm0lianZqqJgm4vtlAl+bVPzt+8aHLxTPszlDWdIPigIZfRyVGD76HEcmeq0Bp4RZmRB7VXeI7p1X7o7Ppo4IfwaKSlU=;7:IoByyjq5/juGNVm4jAuc8rqhKMxUEfC9BRVKzIftDC/p392VvtmvXHtPlV7CuOXRWnohQej7xaRDcxnsFNzE6wgNXhvTFRB9GaMl8XGyEik0+jLeYXezpkbuHZ58Uu9jaOYs9YtXYMKlmdMlDZ/Bn22xqSTxyKqiC7rSW5rHCfggiw0t/y5ZML4CmctOQX9Oaads14O7oSuWd57NGWGsz54gQDUEFbFrHecfR2NKheQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 11:19:02.9793 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0202MB2550 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-09-01 23:48, Hans de Goede wrote: > Hi All, > > This series consists of 4 parts: > > 1) Core mux changes to add support for getting mux-controllers on > non DT platforms and to add some standardised state values for USB > > 2) Add Intel CHT USB mux and Pericom-PI3USB30532 Type-C mux drivers > > 3) Hookup the Intel CHT USB mux driver for CHT devices without Type-C > > 4) Hookup both the Intel CHT USB mux and Pericom-PI3USB30532 Type-C mux > drivers to the fusb302 Type-C port controller found on some CHT x86 devs > > Please review, or in the case of the drivers/mux changes (which are a dep > for some of the other patches) merge if the patches are ready. Hi Hans, I see commonalities with this and the below patch seriess from Stephen Boyd [added to Cc]. https://lkml.org/lkml/2017/7/11/696 [PATCH 0/3] USB Mux support for Chipidea https://lkml.org/lkml/2017/7/14/654 [PATCH v2 0/3] USB Mux support for Chipidea Stephen had a patch that added mux_control_get_optional() that I think could be of use for this series? Anyway, there seems to be some interest in using the mux subsystem for handling the USB host/device role. I think the role-switch interface between the USB and mux subsystems should be done similarly, regardless of what particular USB driver needs to switch role using whatever particular mux driver. If at all possible. The way I read it, the pi3usb30532 driver is the one adding the need to involve the DP states and the inverted bit. Those things are not used by anything else, and I think it clutters up things for everybody when the weird needs of one driver "invades" the mux states needed to control the USB role. So, I would like USB role switching to have 2 states, device and host (0 and 1 is used by the above chipidea code). And then the USB switch can of course be idle, which is best represented with one of MUX_IDLE_DISCONNECT, MUX_IDLE_AS_IS or one of the modes depending on if the USB switch can or can't disconnect (or other considerations). Now, you can't explicitly set the idle state using mux_control_select(), it can only be set implicitly using mux_control_deselect(), so that will require some changes in the consumer logic. Regarding the pi3usb30532 driver, I think the above is in fact also better since the "swap bit" means something totally different when the switch is "open" (if I read the datasheet correctly). I.e. PI3USB30532_CONF_OPEN | PI3USB30532_CONF_SWAP is not sane, and that would just go away completely if the driver implemented MUX_IDLE_DISCONNECT as PI3USB30532_CONF_OPEN and removed the possibility to explicitly set the "open" state with mux_control_select(). So, I think the generic USB role switch interface should be something like: #define MUX_USB_DEVICE (0) /* USB device mode */ #define MUX_USB_HOST (1) /* USB host mode */ And then the pi3usb30532 driver can extend that: #define MUX_PI3USB30352_HOST_AND_DP_SRC (2) /* USB host + 2 lanes Display Port */ #define MUX_PI3USB30352_DP_SRC (3) /* 4 lanes Display Port source */ #define MUX_PI3USB30352_POLARITY_INV BIT(2) /* Polarity inverted bit */ #define MUX_PI3USB30352_STATES (8) Another idea is to expose the inverted bit as a separate mux controller, but I suspect that you're not too keen on operating three muxes in the tcpm driver... That will get simpler with mux_control_get_optional() though. BTW, I don't think these USB defines belong in mux/consumer.h, please add them in a new include/linux/mux/usb.h file or something. And I'd like some MAINTAINER entry to cover the new mux drivers... I'll respond to the individual patches with nits etc, but it generally looks tidy, thank you for that! Cheers, Peter