From patchwork Mon Feb 25 07:27:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10828305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 691E71575 for ; Mon, 25 Feb 2019 07:27:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EE042A3F1 for ; Mon, 25 Feb 2019 07:27:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F9B82A97C; Mon, 25 Feb 2019 07:27:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9F332A3F1 for ; Mon, 25 Feb 2019 07:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728563AbfBYH1J (ORCPT ); Mon, 25 Feb 2019 02:27:09 -0500 Received: from mail-eopbgr10049.outbound.protection.outlook.com ([40.107.1.49]:50837 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728217AbfBYH1J (ORCPT ); Mon, 25 Feb 2019 02:27:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AiSsIDHXFXPV2SMaOmY1ADMtQHHiZUOiael9bWaotgo=; b=Q8CptR7MULk1Aqe/X84wfJ5T3HAGi8HsvqBKG8n09fm3IvPnzkqcs1+AoLw2tnZ331m43kp38tZZImFn1J6qeiCmPMVO4ddEVnbBK1mL0EorALi6gz8CL+cDFy/Vk/Uiq+Gk2LklFbx0jo6xObQdrdwO4/ALRNyvBQdJRz9YEso= Received: from VI1PR04MB4558.eurprd04.prod.outlook.com (20.177.55.216) by VI1PR04MB5518.eurprd04.prod.outlook.com (20.178.122.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.16; Mon, 25 Feb 2019 07:27:04 +0000 Received: from VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b0fe:dee7:b2d3:9355]) by VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b0fe:dee7:b2d3:9355%5]) with mapi id 15.20.1643.019; Mon, 25 Feb 2019 07:27:04 +0000 From: Jun Li To: "robh+dt@kernel.org" , "heikki.krogerus@linux.intel.com" CC: "gregkh@linuxfoundation.org" , "hdegoede@redhat.com" , "andy.shevchenko@gmail.com" , "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , dl-linux-imx Subject: [PATCH 1/2] dt-bindings: usb: add documentation for typec switch via GPIO Thread-Topic: [PATCH 1/2] dt-bindings: usb: add documentation for typec switch via GPIO Thread-Index: AQHUzNuBl0h1OVH1gkmdtEXLPmNDWw== Date: Mon, 25 Feb 2019 07:27:04 +0000 Message-ID: <1551078369-1654-1-git-send-email-jun.li@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR03CA0045.apcprd03.prod.outlook.com (2603:1096:203:2f::33) To VI1PR04MB4558.eurprd04.prod.outlook.com (2603:10a6:803:6f::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 75e53286-7c0f-442a-3f8c-08d69af2a3c4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5518; x-ms-traffictypediagnostic: VI1PR04MB5518: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR04MB5518=3B23=3A5A?= =?iso-8859-1?q?DosNvg3lU6RwKjMXc4tv7syO8mFT8btvgRzsdh1X1NQrJxKdeRivZ7IuHBP0?= =?iso-8859-1?q?n35ZglkyYDQSnQNl0Xme5ms/N/QcK2FCKpqoE4MJ7Q6qn23stoFFv9e5yyqa?= =?iso-8859-1?q?A7RmpwOUNnZRs0H25KqmwT+6iJtl5aWxMhA/gi1NVFm99yHdVILDUqhiXf8T?= =?iso-8859-1?q?TCbbGhb9Phy6zydYM5hgufVt9MbHtrj+i4OWPfh6VXa6GvwAqt9ux6T4vwch?= =?iso-8859-1?q?auLC0uswfij35ugVwfHjRjmNWJqZZIAN28+lj77sXJi7csDNQPso4Ee9S+rv?= =?iso-8859-1?q?qF72qV9hSjTRFufBhNq4kw4jVn2DVT2sc13U94djuMAhxureRiWabjMBMGC1?= =?iso-8859-1?q?Retfb+fk79FA55qGa2SdBG3O9wW9cb+2RKV51wlqqKuTr6lWLiN3VvUkxZzi?= =?iso-8859-1?q?RzH5+oy+GqzJBvUDpHE0rDMRusqHlnfGrYxzMohEz9vTi8dsmJL5NfAmjgwA?= =?iso-8859-1?q?4K+PnbFsYqYBQV3rpJj/2V4J3pMRsDydnBVrLP/9/zfaqUksCCEqcgytFt3C?= =?iso-8859-1?q?tgp0Dcw8TRQBeSvPYoc784LuVnCyTCOrjHxS0xGS6nPKsdyAXFqg60wFhqHG?= =?iso-8859-1?q?iBIw5Z/yLOyqUoqi00KHE1scPDNxaJWCYWXhrW0K7hnewT8qdbfg7yvbSfr1?= =?iso-8859-1?q?Yst+BjxgVLqSZ91cqPV8iuHGFFgeSVdeAdKGcBJBK/4y6jOuSbj3C3NCruSg?= =?iso-8859-1?q?WSWmFH6wzzscl/srG01SLeBTp7yVkWplpobsxQ38QKJRC1kLQ7HFZZIkCc0L?= =?iso-8859-1?q?YB3w+F+dWa12sTOX/H0cwHQCwDNSgWo266TiV1tJjfoLDaeIlb1FETvqQvhb?= =?iso-8859-1?q?y/R8RVM+7G0d/Ntk0tUf5LBssAkhTWrVwRQYZoxANWqdWtN18x5Qai2cO/+P?= =?iso-8859-1?q?mcoHd+l5iMzaPeqq7CnGnAAVhv4qDlIG3dDsn8+zqQJ7yeHPgjDx1w8pcpF0?= =?iso-8859-1?q?VVMXwKX4Wq9oJ0+tQ0N3mQhYcjul4KBFr96yM3W60xxyD5HGmybb6gxJdW5b?= =?iso-8859-1?q?iZblf7vYWkUdgwqTTEK1xy3ScsvchGObp1lWJATPRneU2tNj8flv/QoVG+gw?= =?iso-8859-1?q?ax3jGfdyiRx7ntdJ2uYU/4h7rCOExrh3aedW/W+IQNgfEke3pxFbsuUbhkSv?= =?iso-8859-1?q?/yRtYDycKq1TgatH30kpU+xmixs8aYiA=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 095972DF2F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(396003)(346002)(376002)(199004)(189003)(316002)(36756003)(6486002)(7736002)(68736007)(102836004)(8676002)(2906002)(81166006)(81156014)(386003)(6506007)(256004)(44832011)(86362001)(486006)(66066001)(476003)(2616005)(54906003)(305945005)(110136005)(6436002)(4326008)(105586002)(106356001)(5660300002)(71190400001)(2501003)(50226002)(6512007)(71200400001)(26005)(52116002)(99286004)(3846002)(6116002)(478600001)(14454004)(186003)(53936002)(8936002)(25786009)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5518;H:VI1PR04MB4558.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: hPPkbNg6RnZN7613GjVIfXSHcJtsXN/H+gJZx3rD96r2f5f42LkM3Qv4R2YWbKrbXCWK4dZCWbCMvcOYnCbiktVnDZKm2s/z7KosYma7+tNJ2PWXQpc3ljjuachX2o8Qzc6gHZDF1n3AREnHWI7vXhl3t+DqyTzZmUC+Vuuo7zeX7ieltPdnVFq8wS/JVXWUVVK7sTLTyalbWg99ET7Q+SyAEn6YBiw1LB3JNhrfg1CQ0NICgaxiw2DMWj9p6TLP6RjRU3uCYdaIP0cCSlvROPt0ga4axhWkK1dBrhZo00ZIkKC9KSBRVlrlVUI2uCuIWyfOrK8OhkK7a4FXUOgJIDibyvqScK13bN+9Enp046j7IQLrbAvtbq0tkN7QxZ57vg15blqwrDgkX04BkhlKRN4APX+C2XE/EL8r2JsLVv4= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75e53286-7c0f-442a-3f8c-08d69af2a3c4 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2019 07:27:00.8281 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5518 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some typec super speed active channel switch can be controlled via a GPIO, this binding can be used to specify the switch node by a GPIO and the remote endpoint of its consumre. Signed-off-by: Li Jun --- .../devicetree/bindings/usb/typec-switch-gpio.txt | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/typec-switch-gpio.txt diff --git a/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt new file mode 100644 index 0000000..4ef76cf --- /dev/null +++ b/Documentation/devicetree/bindings/usb/typec-switch-gpio.txt @@ -0,0 +1,30 @@ +Typec orientation switch via a GPIO +----------------------------------- + +Required properties: +- compatible: should be set one of following: + - "nxp,ptn36043" for NXP Type-C SuperSpeed active switch. + +- gpios: the GPIO used to switch the super speed active channel, + GPIO_ACTIVE_HIGH: GPIO state high for cc1; + GPIO_ACTIVE_LOW: GPIO state low for cc1. +- orientation-switch: must be present. + +Required sub-node: +- port: specify the remote endpoint of typec switch consumer. + +Example: + +ptn36043 { + compatible = "nxp,ptn36043"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ss_sel>; + gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>; + orientation-switch; + + port { + usb3_data_ss: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; +}; From patchwork Mon Feb 25 07:27:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10828307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A71A1805 for ; Mon, 25 Feb 2019 07:27:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 316DB2A3F1 for ; Mon, 25 Feb 2019 07:27:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 252BE2A97C; Mon, 25 Feb 2019 07:27:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AE232A3F1 for ; Mon, 25 Feb 2019 07:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728595AbfBYH1O (ORCPT ); Mon, 25 Feb 2019 02:27:14 -0500 Received: from mail-eopbgr20051.outbound.protection.outlook.com ([40.107.2.51]:40899 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728217AbfBYH1O (ORCPT ); Mon, 25 Feb 2019 02:27:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hey2eSpcDyvHL41pcBThoF8GYBnv/gL5tRK9lKjzIJ8=; b=GAXlTVE4cFuYpqlq7Qpat8N9Z+w4YhiieYy+jkzJv5eSSYclHRy7CbbXggqMu2LgzlmcOr1HMM+r0wDpO+56iQP0vJSgES237jJ8+AlPkb1E4KQoNQjSp2xuJwpepJhO9TEmtp4+2z+lQ9GtHg0bLJbS9TQtI/x/K5KACKA35po= Received: from VI1PR04MB4558.eurprd04.prod.outlook.com (20.177.55.216) by VI1PR04MB5518.eurprd04.prod.outlook.com (20.178.122.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.16; Mon, 25 Feb 2019 07:27:08 +0000 Received: from VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b0fe:dee7:b2d3:9355]) by VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b0fe:dee7:b2d3:9355%5]) with mapi id 15.20.1643.019; Mon, 25 Feb 2019 07:27:08 +0000 From: Jun Li To: "robh+dt@kernel.org" , "heikki.krogerus@linux.intel.com" CC: "gregkh@linuxfoundation.org" , "hdegoede@redhat.com" , "andy.shevchenko@gmail.com" , "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , dl-linux-imx Subject: [PATCH 2/2] usb: typec: add typec switch via GPIO control Thread-Topic: [PATCH 2/2] usb: typec: add typec switch via GPIO control Thread-Index: AQHUzNuDwcpxjc7r9Ual6vhyiKL3bw== Date: Mon, 25 Feb 2019 07:27:08 +0000 Message-ID: <1551078369-1654-2-git-send-email-jun.li@nxp.com> References: <1551078369-1654-1-git-send-email-jun.li@nxp.com> In-Reply-To: <1551078369-1654-1-git-send-email-jun.li@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR03CA0045.apcprd03.prod.outlook.com (2603:1096:203:2f::33) To VI1PR04MB4558.eurprd04.prod.outlook.com (2603:10a6:803:6f::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d323006c-6cef-4e61-8ef9-08d69af2a61f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB5518; x-ms-traffictypediagnostic: VI1PR04MB5518: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR04MB5518=3B23=3Aqu?= =?iso-8859-1?q?9iSuIjcSxzAZj6LUKpijahcWPUEj4elrK+LHa4HyR67xAJxYmVZML0nNtMR4?= =?iso-8859-1?q?skkdSpAwpHERfAZjv292w5Aw15NZnCA1RKHKdq4Mxw/v9zlsGr0HKlATRSKE?= =?iso-8859-1?q?E0lbSmWrCmecnUPsgt8LpZza/cQbbo4VvZXampagx/IBNFGKEXI9nxzauL1R?= =?iso-8859-1?q?q9Wo63eT9hbcx45KbGBuVLrYz6Oo0U+IjO8XyLqxDD6tnGViHqRUWjP4Cg/C?= =?iso-8859-1?q?+9Ee/HkOCMfSITXT83nmCW1idkXJdEAISxQz5rtllI9RzoYSNi1AuVdVY+Ww?= =?iso-8859-1?q?E1E8IP4kQtrGqTSLOBcYOS9lsyygVppnbJp6IfQSmN0JwbPrYRlt+8B0V+P/?= =?iso-8859-1?q?F6NO9l/6swrRN/PisYISxrswW0qJrF2tK6JwVGb3+DQ/AhnLqHosQFizW7pS?= =?iso-8859-1?q?0RO8Kj6H2nck8J42cCrcfhFBJz9P4G6Q3SVV7jbTsNIaYqGgQlbmaMOMOEi8?= =?iso-8859-1?q?stJAEhEvPwigBqzLnCJMeiSje8lj6rEUEL89pV39BqFcTYYl28z1TabtkLmn?= =?iso-8859-1?q?m+pYPMg3AMHgIUwDggdwdhi7kocJ4xOCWO0d1nHHrVdCnt7AUZUm9XApG85k?= =?iso-8859-1?q?6bPWaYOwrmObr6BFujtvLMVXUYgj4uNXuPozhyNQIxRblNSUiyyxmxIj722f?= =?iso-8859-1?q?7eZ2cAvWI4gtLu9FQ1uTfMPi2uT2rRwvT0y6gq7JKA3DAOsWBRbB+UroTw9B?= =?iso-8859-1?q?iT1aUkqtfEItZ/AY3/NscwCgzWXxeb/qlDgX+IjYVPUZSChtxWCronT1Ei5Y?= =?iso-8859-1?q?b5ggXWo0kYxxc39zEV4/kcs8EaqCy57Upcpq/Ez4uxwYLWV99wCGRBZUXcWL?= =?iso-8859-1?q?9JKJHY3UHSYqEw5JJO7GA07vTtavHm13i/HRk7vGDogHr8CtbYriRid/0uiF?= =?iso-8859-1?q?4eb4i3pmcxy7wjFDgM05CAwPA89vcghY2Adge4P6NtKeS5Md4jOpNpPUdXme?= =?iso-8859-1?q?5grJ1PX/9rZJNGTCkowSo8/S9hFE5ieee1BT2yaoSov5YZHOjixoYhm0YsBf?= =?iso-8859-1?q?yvJnN6RpKmb4fofvJYsSIFWW5c9TZQY91WBwMdi0KasZycxdeNYSEQDJQppO?= =?iso-8859-1?q?LqvKIM7L5MIIOn3UrCeyhyA2LawGPw6N+ruv1hy9mHSXPok+iylyYZkRWzbH?= =?iso-8859-1?q?qFROcudoMMgwtmh/aPZ7/d9mKYY1MjNjGs8jVWZKBsV0tWsCi5UbxNj2CRBE?= =?iso-8859-1?q?rsvwe7FGWGT6XBpH6AOvNIA4qij5hFzRWvrwTJ4mhHFGk2xwqfPu/vwuY=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 095972DF2F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(396003)(346002)(376002)(199004)(189003)(316002)(36756003)(6486002)(7736002)(68736007)(102836004)(8676002)(2906002)(81166006)(81156014)(76176011)(386003)(6506007)(256004)(11346002)(44832011)(86362001)(446003)(486006)(66066001)(476003)(2616005)(54906003)(305945005)(110136005)(6436002)(4326008)(105586002)(106356001)(5660300002)(71190400001)(2501003)(50226002)(14444005)(6512007)(71200400001)(26005)(52116002)(99286004)(3846002)(6116002)(478600001)(14454004)(186003)(53936002)(8936002)(25786009)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB5518;H:VI1PR04MB4558.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ibDPsKKYLwYCKQ8WIF+hSnESlZDCLfudvgBAUSUP8C5CfJznnG7Y4L8VgtoTwQOVNjBqWrRzHZvXMLQEmjgEnuqOARgsnQLPyt1id4gxFu66TOSV4cmet69YG8o8DWuKK6cd5/4AiXgTNcoofKjTeBJ5kodHpc+EJzA2pTeWThNU+n6Pxza47HadZJ2XqrjklQM6hD7MvqVd8vexpGb22WhoiZHjg3s7tDqhAlHFmq5KoAvHi+HNDRgocI/fsAp9SYlVU6ps7iSzz6S70r+/cWqpZftw9Svmj0Sj+PwR1W9ki5OlteZbPb1sLuSNYV2xkY7z9AhOVFRzPrkGq3eU31ZDTZU0pJ7cUX0cAX1QjGUxogBSN88ppJE76bVrR+rmqVt0ty0IpNv1vi5pI55v33paNFKGzBns2H8QbcPX7X4= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d323006c-6cef-4e61-8ef9-08d69af2a61f X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2019 07:27:04.8490 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5518 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a simple typec switch driver which only needs a GPIO to switch the super speed active channel according to typec orientation. Signed-off-by: Li Jun --- drivers/usb/typec/mux/Kconfig | 6 +++ drivers/usb/typec/mux/Makefile | 1 + drivers/usb/typec/mux/gpio-switch.c | 105 ++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 drivers/usb/typec/mux/gpio-switch.c diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig index 01ed0d5..bc7d3c7 100644 --- a/drivers/usb/typec/mux/Kconfig +++ b/drivers/usb/typec/mux/Kconfig @@ -9,4 +9,10 @@ config TYPEC_MUX_PI3USB30532 Say Y or M if your system has a Pericom PI3USB30532 Type-C cross switch / mux chip found on some devices with a Type-C port. +config TYPEC_SWITCH_GPIO + tristate "Simple Super Speed Active Switch via GPIO" + help + Say Y or M if your system has a typec super speed channel + switch via a simple GPIO control. + endmenu diff --git a/drivers/usb/typec/mux/Makefile b/drivers/usb/typec/mux/Makefile index 1332e46..e29377c 100644 --- a/drivers/usb/typec/mux/Makefile +++ b/drivers/usb/typec/mux/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_TYPEC_MUX_PI3USB30532) += pi3usb30532.o +obj-$(CONFIG_TYPEC_SWITCH_GPIO) += gpio-switch.o diff --git a/drivers/usb/typec/mux/gpio-switch.c b/drivers/usb/typec/mux/gpio-switch.c new file mode 100644 index 0000000..a51da68 --- /dev/null +++ b/drivers/usb/typec/mux/gpio-switch.c @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: GPL-2.0 +/** + * gpio-switch.c - typec switch via a simple GPIO control. + * + * Copyright 2019 NXP + * Author: Jun Li + * + */ + +#include +#include +#include +#include +#include +#include +#include + +struct gpio_typec_switch { + struct typec_switch sw; + struct mutex lock; + struct gpio_desc *ss_sel; +}; + +static int switch_gpio_set(struct typec_switch *sw, + enum typec_orientation orientation) +{ + struct gpio_typec_switch *gpio_sw = container_of(sw, + struct gpio_typec_switch, sw); + + mutex_lock(&gpio_sw->lock); + + switch (orientation) { + case TYPEC_ORIENTATION_NORMAL: + gpiod_set_value_cansleep(gpio_sw->ss_sel, 1); + break; + case TYPEC_ORIENTATION_REVERSE: + gpiod_set_value_cansleep(gpio_sw->ss_sel, 0); + break; + case TYPEC_ORIENTATION_NONE: + break; + } + + mutex_unlock(&gpio_sw->lock); + + return 0; +} + +static int typec_switch_gpio_probe(struct platform_device *pdev) +{ + struct gpio_typec_switch *gpio_sw; + struct device *dev = &pdev->dev; + int ret; + + gpio_sw = devm_kzalloc(dev, sizeof(*gpio_sw), GFP_KERNEL); + if (!gpio_sw) + return -ENOMEM; + + platform_set_drvdata(pdev, gpio_sw); + + gpio_sw->sw.dev = dev; + gpio_sw->sw.set = switch_gpio_set; + mutex_init(&gpio_sw->lock); + + /* Get the super speed active channel selection GPIO */ + gpio_sw->ss_sel = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW); + if (IS_ERR(gpio_sw->ss_sel)) + return PTR_ERR(gpio_sw->ss_sel); + + ret = typec_switch_register(&gpio_sw->sw); + if (ret) { + dev_err(dev, "Error registering typec switch: %d\n", ret); + return ret; + } + + return 0; +} + +static int typec_switch_gpio_remove(struct platform_device *pdev) +{ + struct gpio_typec_switch *gpio_sw = platform_get_drvdata(pdev); + + typec_switch_unregister(&gpio_sw->sw); + + return 0; +} + +static const struct of_device_id of_typec_switch_gpio_match[] = { + { .compatible = "nxp,ptn36043" }, + { /* Sentinel */ } +}; +MODULE_DEVICE_TABLE(of, of_typec_switch_gpio_match); + +static struct platform_driver typec_switch_gpio_driver = { + .probe = typec_switch_gpio_probe, + .remove = typec_switch_gpio_remove, + .driver = { + .name = "typec-switch-gpio", + .of_match_table = of_typec_switch_gpio_match, + }, +}; + +module_platform_driver(typec_switch_gpio_driver); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("TypeC Super Speed Switch GPIO driver"); +MODULE_AUTHOR("Jun Li ");