From patchwork Wed May 19 07:14:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12266491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F27AC433ED for ; Wed, 19 May 2021 07:32:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 464A961364 for ; Wed, 19 May 2021 07:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240210AbhESHdR (ORCPT ); Wed, 19 May 2021 03:33:17 -0400 Received: from mail-eopbgr140081.outbound.protection.outlook.com ([40.107.14.81]:32741 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239933AbhESHdP (ORCPT ); Wed, 19 May 2021 03:33:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nEZA+8CZACEyDiihk4iXI/kulZu57yO/hvQIFaR8RQxqSR1NSMKMK96LtTcL9rG390eiUI+ZjqCNY9KuXauxGQj7x+j7EdfIVfG9GqhKufByOoV3pQr85o3SRoV65GY1PL1emZxRF4dA23AkhdfZi7PlX0nLCFSI8dYgTdKyb9p/C7dzRDLMCLIGiSTOOq9Q3vZycYCzUSGQl/tICG02k5lj2eZFm5DOUOPb+LRuUtsuABA+WmHGv3xG6w/5OdD8kllqTtkh2Ab+kYY96RTtWRlsHaHIKq7IW5esaEeIh21mmKq17FgMox8pdZ4iIPOKQFD+yFIzpZuF84IhNuEHNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9xwyi4oxxQ69GZLox1vkTjd2gWOXRoa9oDKotSc/nIA=; b=WP7chmMbJ6+8bnuw/u7MBIdlX8MSa5YwrJJQ+hWc4/gS3rXXio6FmwylTp74fhChLuer4DJc2pDgzCgkpDcjQhqXKCQIS6ezFhbnqAgQzro1RuCAc7Zc2KYMkGFzREiYSmVCZmNcDpwqdDAIPzELxRPucfra/BT65mlD+in/UEBn+n2FlXcvnQxcvSCT6pjWuacpiR54xwhHkv7z+OUelknZxzP3yf1FDela+CFgqD5HkNrTGYSuC2Lpsdgo01IuOjb8U1D72adLKm+NjBHeT90XVbmLr7u63JsD7m3tfBCAx7z1LsZav2mXuhT2D02SblrZNGDWBj0lFnhNiRyqpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9xwyi4oxxQ69GZLox1vkTjd2gWOXRoa9oDKotSc/nIA=; b=a3KgCNaecFBi4Akw7vpA7NO07HaeStQDVeLpJQnzILBsx8IYx8r9C2Em1BLHvkylDVcvWJlPQlHZlYUzbdv3nTNoVAgvbNvhmGDQtMcsaP1lH534hA7LOalV+mOYUtUPt8YTt70oFUSf3BFO10f33jLt6casm8ywei7WVDcslAM= Authentication-Results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) by VI1PR04MB6237.eurprd04.prod.outlook.com (2603:10a6:803:f1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Wed, 19 May 2021 07:31:46 +0000 Received: from VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe]) by VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe%7]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:31:46 +0000 From: Li Jun To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, linux-usb@vger.kernel.org, linux-imx@nxp.com, jun.li@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] dt-bindings: connector: Add typec orientation switch properties Date: Wed, 19 May 2021 15:14:47 +0800 Message-Id: <1621408490-23811-2-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621408490-23811-1-git-send-email-jun.li@nxp.com> References: <1621408490-23811-1-git-send-email-jun.li@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4129.32 via Frontend Transport; Wed, 19 May 2021 07:31:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ae4968d-2436-4db9-cc54-08d91a982829 X-MS-TrafficTypeDiagnostic: VI1PR04MB6237: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QZtX73YN7AUBEEjxT+kheJCycZ4V1X7rYz+w8uNP7TE0rWJ9uQA+4Vm/FYRSvhEZfZZxxDtQljSDhV+XJ6ghHfeN64ZfyV1Ughv3Q7BnZE/uXo5v9S9qujLLCy0GPnTUdC8AtjA1PjR801tFJZ5q+q+gJHSSDuk6ndzv/cQU3DfkGX7ovBZRJN0rDXCS8Uq85MUH/40kmUysIMA0oVQRwkuziLkG5gcx27MzvCHbaF+1OB32ieljflACHmvapV18ZIV3xHS3SPOoaS476aLwZk29GY1sM1LFT8Z7dstadOyA1XaP97LPrtieOUQwoy8ha65hrQnM2FNbZZMICPF0Gb4DFOi8GuLp5RKeGaP1up9vqcauctNbCjCyWWRYTSJkVUCSrK0N+n69dH2gIFsBoJTuBvdc5jjCIPnNkas5CzNmZ20VGb1vJrjh6cdtWYpsdLjYL3equkXdBpGfFaozOUB1eDKDkD6GkFQxFx6OTSs0U6V0SpSbyQvMbznVvacjg5am7ohnU/B5RkQyzxshGwl0lrHGpmZiMguoKzuTM4Jnvn/XNcVrPLHwzV45hnAiVdJF/ne9RtJ1TVqhxije1o5DulwZvtnr6Y3cqanIFoMnAyKQVXFRvW/GEaQVcMSh/PKvtD0uOomLNIlG8NRYrMK4d2KaC/l/rvNJzKUiEwcLKL2yb4a8ueuCnwjlSMf4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5935.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(346002)(39860400002)(376002)(366004)(66476007)(5660300002)(66556008)(8936002)(66946007)(316002)(2616005)(8676002)(956004)(6512007)(86362001)(478600001)(36756003)(83380400001)(6506007)(38100700002)(38350700002)(16526019)(186003)(52116002)(4326008)(2906002)(26005)(6486002)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Zp2KQI8NSBy7KOwMoDvJ0f6JJBfo8D1Q9fXK5uBg9fucO17MjevGgNqnFd8wIzAVLJtG7Qr99HY8vSkch5XjY09J9XMRvO4xXelR+yx01O1U3a5/KlKs0oyDKtmYagm68DxJjhIkpPlHnju8P6jc4nxAzR34ALYnaVd2F1LWUR4YdY0g7mqgT2t0C4zB2tNryeqzA0ZuVFsQzHTB1rvae7uVk4HNxgJzvzOOo3cIOxCCH+4QanD/FncbGIfI37d+quvrrer763oDJVrh0lj2GZbIKTYRDTA3gssRFE2lvB28aJru5F5qpfwqKsFBfBZA5WxkHUNARBEntyPzep3kjYalSVoXVZkboXCZy564W9nU8Z7B992AP58i0I6K5xKlyPJDYf6pN+E0UcXtQckx8Sjz43p4rSOItcAsSQOcx3+7catfHeRWzFsuhulnx3iz4sMScfBWUlanyoeOOdwjbl58DRA1i/DGOUf6NoAY34bD3W+fK83ltDz8owZsL0yn8P0ENb40Dc54l1KLTawgE9TM/NllxarvZSJ7UaP0ZdC5dqCMV3QAJjGCWQqLkEHkq8fF43L8w9+7c7nwe6Mk9SR0+7CO9w5kYreaGLl33k7uNtb5FAXNFcmIUGESwyDs2hcfUTqCmAa+r9jsl4sYedS9qw+52fy+GvY2iusumV0WYWItm1cLfUzFr5BlrwD+W8o7aLKAWcmvytsavw4ztKYACTubwuQzZsUoaSdEtapANfA4TLAqc5LGKRICFKlu3a1JlxLaoyCoSimdQfKzapaOm/foSPADaG2Jj8Jq/O+n4R9hWj2J2AYG2GfPlJLzeZQ+yF3RYw+gzotBvokH59UQ0LYLLxc6cJn+GvK6j1nYb2DLnI+vcDSbXQIG1qtQdIHvgg94JGz3Mz+Ibo7WT7R+0i9si+GzYJhC9QfFN2KHrlFPdZgQt/aWaBSqh3+aU/I9d0ztacPohZD36z3pIbzMr9ONdiPjMHFLST+fQHOKFbvj0lCP1KxM8OuHSgBa+Z+6BPLcmnA9xpKC4NUlsvFdnLtbGd1tEl29l4qV+7TtYXw/j+zfrPDenmHdPM9W0JUJh521JIf/WZ5b+ibJ87uU7KRUaEZ5qPsWopPg1hbZ4ssCY+bPVgY6yg9Q/04dqfHDp+u41Xh+OprOt1zISoolc3NWkGLd0dtwfb1UJbcYrh7q9odZbkqBUNDeOlL27lIfjmjeDc6d1FkS/EHTv0X0wt7zVMYIWXHWcx2XihTHnNT6KDSEwwubQ0Pc4nWq9Jc9TaBQuD6KB9UOn2osOeRSGq9hrxClBgpl21m0wevhMMDUSXJW871mUEECcL37 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ae4968d-2436-4db9-cc54-08d91a982829 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5935.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:31:46.2583 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ftR9uSfQYDiSLEwxtppH11FNbTRLFZwr0sQy/rE/gYDeEREB+E6GY+3Jh6a55jTF X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6237 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Typec orientation switch can be implementaed as a consumer of mux controller, with this way, mux-control-name must be provided with name "typec-orientation-switch", along with its 3 states value array for none(high impedance), cc1, cc2. Signed-off-by: Li Jun --- .../bindings/connector/usb-connector.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml index 32509b98142e..567183e199a3 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml @@ -111,6 +111,24 @@ properties: - 1.5A - 3.0A + mux-controls: + description: + mux controller node to use for orientation switch selection. + maxItems: 1 + + mux-control-name: + items: + - const: typec-orientation-switch + + mux-control-switch-states: + description: | + An ordered u32 array describing the mux state value for each typec + orientations: NONE(high impedance), CC1, CC2, if there is no HW mux + state for NONE, use value of CC1 or CC2 for it, + minItems: 3 + maxItems: 3 + $ref: /schemas/types.yaml#/definitions/uint32-array + # The following are optional properties for "usb-c-connector" with power # delivery support. source-pdos: @@ -301,6 +319,9 @@ examples: sink-pdos = ; op-sink-microwatt = <10000000>; + mux-controls = <&mux>; + mux-control-names = "typec-orientation-switch"; + mux-control-switch-states = <2>, <0>, <1>; }; }; From patchwork Wed May 19 07:14:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12266493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53144C43460 for ; Wed, 19 May 2021 07:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37E176108D for ; Wed, 19 May 2021 07:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240267AbhESHdS (ORCPT ); Wed, 19 May 2021 03:33:18 -0400 Received: from mail-eopbgr140081.outbound.protection.outlook.com ([40.107.14.81]:32741 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239548AbhESHdQ (ORCPT ); Wed, 19 May 2021 03:33:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jSmeyw27Uw2eQ8o+dTeJGWEwUcR0riKdCvm69Ui8Uqxd3Dhzy/1me1/QlMulriTZfpZOk08R1kBQpsQ3CZz6MqKVvjGyjN6IE2bTOJ3aHS9Ygo8YbbpvXMj9jrh3OQquSbrqpVObndsZBXk2xWY5qdlOD6GmVxGTOx/TgK4UnyaSAVW+5i4ud7aVZACn5im3YCrvD46SRO9RC7V4pfMXeGBoBH3hcdbxqVYpOLbLSj7ZkfdFKpRPiO0sOQYCf0gZ5tIm/Btlyy8/Dul/hgRtxcCjcEoZhKTBBNnfjtRE3kkisn53538Pfozgzmq2HpYdcNz2lMOdsQQ7/5SYDMNiRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zBxjHPcoTm9JKCP6/X3QEVKNd8/3+Qqr9Qbi/CtJuhM=; b=A9XRxbmRSelalSbsbRfQsIqWBut/JBSM8PlRpco4h7tEDdamtjDxbBd+UkgQNW/1HhMWFbGPGDvnKYCGwXYaFDDMETadsVJ9Fhsqf2G3w8wk/7+s+TU5AT866z628TEBbzu2Gs1VsKpFHYzKnr7kMMQv3kefGLzZnlGNNoq/DR/ZX081NR+9z6i6BqRxZC6qYiqIRlJYc1DcjQWa012SHYFLZzGNhhbHd78469kz6xg3Y53ZOHuOZsDfS17U523kbGijk5a8t4Tjzq6zk7vOhmaNtyfzUj1zNDPIPBwCo4J3OxDrzaVoJO0g3Iy20T4jS8SZ6ousT7pRryWJNBZURA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zBxjHPcoTm9JKCP6/X3QEVKNd8/3+Qqr9Qbi/CtJuhM=; b=GzzQKW1mNV5PkMYlePKKSfRpzPv7Ay1i/bop9MyZvXIImH6MnAKL1q4MAWN5ZuHx8ObBTeRz7A2nfNYlYcKXZtCXXu/5P6g9YfRhOmQ/uvAY4BpUwO5dQYtE7ZN3rRA8dfVG3+irvtnDKVJL/zysMYoor52pdfhFBMaPkR7Q688= Authentication-Results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) by VI1PR04MB6237.eurprd04.prod.outlook.com (2603:10a6:803:f1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Wed, 19 May 2021 07:31:50 +0000 Received: from VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe]) by VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe%7]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:31:50 +0000 From: Li Jun To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, linux-usb@vger.kernel.org, linux-imx@nxp.com, jun.li@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] usb: typec: use typec cap fwnode's of_node for typec port Date: Wed, 19 May 2021 15:14:48 +0800 Message-Id: <1621408490-23811-3-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621408490-23811-1-git-send-email-jun.li@nxp.com> References: <1621408490-23811-1-git-send-email-jun.li@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4129.32 via Frontend Transport; Wed, 19 May 2021 07:31:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ccf085c-36bb-44c8-0780-08d91a982a3e X-MS-TrafficTypeDiagnostic: VI1PR04MB6237: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:350; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WgfFiCGm3EyAkVwyIX6tILXZwsmw0Slgp+bH5Qp32aacYFhHlIa7dSEhSwYFoyExTsgElM9J0ndIOF050ZIofmshclHRkMLxR/sW6prLh5mfdVZiDTyL/vkvlIoy6G+aOSb8tSqUZQ/ms3+scsdEQ7pFJC7Y4W7kCVpUG/Bm+IzAhXNrxs5NTWAngjMH4nsllJhjDhxs34PDbShDebyKPYMYEYTZuqemUgSfVTp0JeT4wLZikg/XVKWluC3NkuLmAkp5uoBkgRG/KAo8NA26BragcFYgUGBRwMK3L6Dfcmc/NrLeP5NMaifX81HHVIzoXJ0+PgX67eqPwrteRxijF47IXSjGKwcmKHSCSotMkwJ3pJT6VFiF0q041gQyov9I+UclIhc0UZNuR1mIw1CRUqtYKIYYFWQDDoSDzpSivSmvbOQthnlOWosSOt5Nu51iNOu+K6qp+VDbJzNvioS1mDVO2Ek5Ba0QOx1NmsKnuGNQNTPlg8l2vtC8XfJmcs0yPug52omGB1W08JxsTczGOME+VvrCfgpMdfnf5L1BZMb320rPNMnJGirLzQYJWVecdcENwaljUcnx4vzmyU0/6eQfxNUfPqamDaIAJVZ6Hn1iW7S4UMP66TGkdmeN9w1OZ+EAC11SPMtuSsTN7QPpWc+4wV5/cKhhzBqZQoPipi/R+CYFyb2qMpM8p8Rux26g X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5935.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(39860400002)(346002)(376002)(396003)(136003)(86362001)(478600001)(36756003)(4326008)(2906002)(52116002)(6486002)(26005)(38350700002)(6506007)(38100700002)(16526019)(186003)(4744005)(8936002)(316002)(66946007)(66476007)(5660300002)(66556008)(6512007)(2616005)(8676002)(956004)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: sPmgo/iySW4mlw9mYERpQVRfw1Q/zpDsBSmAp4z0+uc3GLzRa75utjuT7Csms1ZGQR4/iV5BGvB8wHD+pvv/ZlludTPcbULyArYMhw5bHItv1qqenrtPxucRVpwcouN15aT4BGcnrIu0YyUd5kW1uMPqpwrLkzH4qflKiGRXOI+kwII8oIFJUh9Vb9BnJ/9kE7IpI6OadB7I0LTKp9Qu+apIUtPAPWQwj9lH5eaV07hgItFZVnF37p4keHEi2cRMGlpZKFheEiykVgKpweb1A9GJQ6lAvLwcJ7rv0jgmzhfLZsYZuumpTuPQURQF80/3bMw5BqD6qyEp0GpQHxNPHX6d56t3FALOhe9RIqa5xl3R6CqVuGcSUukGPEN2GcqgSMKEgKcwy+dYmiagFtI9QRduHjfeDFZgY/aV2CfEcopyeHSZCClPpZ+ctiwUoGctZFdj33yGt39J3nd2M2aHTO/2+tgcihxDw/0QfTE5cyYWfjuUh+6h5+yGh2nwnplT1O1wTh9UY8/CDdB9mROegm8yYJBNXVqzXgYkYeGi4DNp2kp9TvEO/2FLCwWOx35UCWluy7PFdL02qPEW0GjE8q19Sn1eAITYRo24kRtyUdtbDaJoUK5Ezl3C+8kRykybmRKEL4dayX3zGb4dMx6Wz1ylMGc9/dBB4KPkzLvDnP5NwEHU5H48wHHVjL/oRnNdpk0W6xIRW/IP3hiCF/NjH2Bc+qUv4bWBCLgu+BFRDaHWeHiST5zLAwmK8vNz9NCrQrSwAdf+UYuerNd6ivoE1JJTKprxu5HsZi8+8boIiSsfvafr3fSKi4fO85hmkXr6KuDQKXNWSL/7s+5mOGY5LJoz6bl/T62BKpgEX5texrQtobXP9qxMY+QpSCiPl/urBdTUvToIweK2QiQ+E2Wbonv39KXLjdtObJmeQzrBJL1tbcN4jEaxtshrpZQfaJBAFJRgyCDor8UlXZAbumQWABKiGMx4IwDUouCWA4SyG47QmN5wio9bev0tW0wPnNXm75qSXqPccpaMeKcUENcGuA/dwMNt/BUubVja6XY0HX5mCY+9Ze3W+C4jicP287I7eE9vqw8kSAQ1lwzDIxD+IHs7lF29i1BlPbkY4J6NT35tX26Kn4UbNdILVuioPXFry8LspLUXA5KzxOVT5iEaUbllA1DBy09TPcL2yKgR5/ZvxEm9KK/7gzSUtizjhIxi1vCID8GbVJR7RJP/PsmJG4Xm2ArIWu5543lNJm1uCU0zvL7ZY07kX33YLzUhd+Kr9Jm7ajQgRw1C3dssAkVZlPU5JtgyuQ7DpXGI4eUhU3PsEY4Na2kPKVp9jTi0UF29 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ccf085c-36bb-44c8-0780-08d91a982a3e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5935.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:31:49.9593 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2g21yhlHPnd32+t5AJ3vFl0xSqftcT/TLJog/U7PlaM1fp2cydjqqgwKhwbY/yqb X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6237 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Asssign typec cap fwnode's of_node to typec port, then we can use typec port device to get properties from its OF. Signed-off-by: Li Jun --- drivers/usb/typec/class.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index b9429c9f65f6..a29bf2c32233 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -2049,6 +2050,7 @@ struct typec_port *typec_register_port(struct device *parent, port->dev.class = &typec_class; port->dev.parent = parent; port->dev.fwnode = cap->fwnode; + port->dev.of_node = to_of_node(cap->fwnode); port->dev.type = &typec_port_dev_type; dev_set_name(&port->dev, "port%d", id); dev_set_drvdata(&port->dev, cap->driver_data); From patchwork Wed May 19 07:14:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12266495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32959C433ED for ; Wed, 19 May 2021 07:32:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1972B61363 for ; Wed, 19 May 2021 07:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240290AbhESHdT (ORCPT ); Wed, 19 May 2021 03:33:19 -0400 Received: from mail-eopbgr140081.outbound.protection.outlook.com ([40.107.14.81]:32741 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240198AbhESHdS (ORCPT ); Wed, 19 May 2021 03:33:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtKa4ACr3JlWkFrEbHWfDtNXDYcbOA0nqPAz/V8jVQxCn19xFAG5u5Qn6ZkFSg4gXqUTtf7ZIV4tJVMPqJr6AP/FALL1OWpr4z9ISMi+Ety28Nn2/B0QntAaIxhKLZBmrJ5r8TNyrMU5AEMmtK2gk2kMNMGmVRiOR6uIPOf7gCqtpuoqU+SRKXwtSykZHyM+Zbgj92bJDfY17+QfY8LfULrz6rCyfSDZIDPK+1LcSdWccGPckSQCSXj/fLuHXMrmm3C16w7YHINQ3V2oCRleCehbUuJQvPUFvsvMi9EQSjkt3Aq30/HcUkvMHyY8DrhzxVk2268zerzFX027tJVo/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WGer17KI8S9a70ziwy2IG8bCagDvvn8KrUZqRRS+874=; b=g0bswPVitkbeIMjERQyWGFTFTvl6zbdeTaZs5acHbqzELaKbTLX2ZAMdV+YVnXnm7fP7VmJNU+GAImHhk9etcC9aZqpe20+aWRdv+ulWKvfCYeapVudp+bIcClP8nggUSXkvPYA2XzKPAO27Qt3htSUp1zXrVDmTS9UC53APiIJZ9YfxiaRvCjvdhDMWQqDtO8ch6CHdPK2qpf6I/pI6KbcFZqupjiyAEhW5bdEwgJf48s8wkbxV5jiU6/uZNpEg5UzUynVn/O5J9UbFoFGyKb/0JUzuo4xL1CPm0iZRYQGCOPO7qbUaBVR6lUZef7XA0itwqFUqbpUdDK/kOD0I9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WGer17KI8S9a70ziwy2IG8bCagDvvn8KrUZqRRS+874=; b=BbTPCBzsV6p8++lvm9uwqyDOXnIjgWgFKspbU7++Zp8DrUSSQ9noxK/htcDtomlovqYZXtIATPevDomvPYYd4KM7FO0UgTVTFZ7gKNgoy/PJ3KkW1iHGmLQNQUvExm5wg6UxHa18y4XV9y8zTe6bX6niMWi+F9j52LWLIEyuZfA= Authentication-Results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) by VI1PR04MB6237.eurprd04.prod.outlook.com (2603:10a6:803:f1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.28; Wed, 19 May 2021 07:31:53 +0000 Received: from VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe]) by VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe%7]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:31:53 +0000 From: Li Jun To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, linux-usb@vger.kernel.org, linux-imx@nxp.com, jun.li@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/4] usb: typec: add typec orientation switch support via mux controller Date: Wed, 19 May 2021 15:14:49 +0800 Message-Id: <1621408490-23811-4-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621408490-23811-1-git-send-email-jun.li@nxp.com> References: <1621408490-23811-1-git-send-email-jun.li@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4129.32 via Frontend Transport; Wed, 19 May 2021 07:31:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec68ce15-635f-474a-29d3-08d91a982c80 X-MS-TrafficTypeDiagnostic: VI1PR04MB6237: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pFhM2GXOHGpopPvoa/Rb1Y1KeaDJzJ0++CNFRRjaoZV7mGAXtMyMb1QR4Dtt5M34NxW2IYKcuvE3VdVWr+vVt/gn2tjTJWmCTosoAInxS0c5+/2d/8XI1bopE4FLnpdTiV2ZZHBeLyIjlyEXmryv7kXmxttxY6SzwssZws0H73mFQhcRuBZfkepGjq2bqu3G59v6KUJE0hbL9KyuhVq5gGzmIMCDsHv+cNhbWjmppGZ+n+yCPYb45Rd0JrNmN/xwrVnQCrgbBFa9LY4otPrmNzl3iySYk5ccvhAUpHuq0i6c/0/x1uvt8oxM+y8f+a3SoRY/87hwZ0HGfWlzQ0hf/avkcIQYgGs38wd2VnOBbwOa5kYpmQi1+km6qYdWS76HPvO1Kfm6gR2/1c2J6fFFbU/VkPOciqr3vyvHxHb4SjD6cS9xOKIHzOyunwu4g0slx6IPZm821f30M+TaIv6a2yAjig6EfhNpplbZkbxeLXV0oKf4Mqfh4xUxbTmyH8HbcZxfQOHnzhRBSFj40mCC169YQ+PpngVk3vjdF1rPbalyD3PXn+WxJAYXnLywBJZPE7T/0OmjmbX4EVQaZr/kLmPI8B0yKfE/Kk4mWrD0Lp5luaFpXcBx9oTY062qTFt9z4FcnnhVyrABZ4gYb4y42dQIaE8qKs2biEnPwYa/lM4RZmqJ5qczA83wKNEpbR6d X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5935.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(39860400002)(346002)(376002)(396003)(136003)(83380400001)(86362001)(478600001)(36756003)(4326008)(2906002)(52116002)(6486002)(26005)(38350700002)(6506007)(38100700002)(16526019)(186003)(8936002)(316002)(66946007)(66476007)(5660300002)(66556008)(6512007)(2616005)(8676002)(956004)(69590400013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UjOPlDe3geReTHtcfBGYAiL8zz7hHP2G0FAeqWFHFI0PSJTDYH/UGlPA0NGx9IwPPg9V66UgyoernBSKn21U2Ph9mWmK/Ped0oT6wB3a52LcnfkJNNc4jfDvKaiEFvZdcqVdMJPNVW9FGvOvQZmBeojOvo7OcrkD3hmfpY2I6kV6ufH3XtMuAij0G5N4v2cOcfuJ8VKYYRjt0pPFbCkg6r6unoc4QsqL9UL6qSsMu9LVPLwyI4E/FWsaqOKcnqHex9MyvaDFDPIzWUIDtnZRTw2cPq6fl2LoB1ylwwOnKVxdUjtZWetpNlF/zy1a3/gZXWXcEQvQk1QJO8ih5LtXt+BFCh+RQalWikdPaZrnXfaj8ERoUC46XmNomTcskP5ZJeecXjE9aTywbxEMVd7A6H3kLtVnX5Ia1ACz/8oVTxQpfBnk1iEckr+3pA8Xsj0mpo+s+3rw/R4qTxMuVs4XKoI2v4s0FeEzks7kaugHa/h0F3XUG34PJtJwXZ+/sTx3KXPOQo0v1fMbDnPXRl+Y1dIhE6J4D+RggfXmGlIOehwQtZrTBWHDI/6plEqaJ2jxzp+0q3Vyw4VUogkeI6bIAHfT1lbYiwn2ldtothkQlziUa5YSFmk7I+7SV5AA6ks+0Mv+xIdsu+HZ4si1c2Lq/79ps72GkMTwtJ4Y39UWFsBeCPdLS6qDflnByrlB+k861ZiInsc4ZxWpFEJf6lPvPHLaazd92UB10E3KzVSD9Y3cBJTfTvfjejXWOgi2Z6s2IJTJfviMdi19wGvEHr4Y+EU5SX18+fE2UhGyilcUQpTbu9PfcWBjw4vLi5cFvKxyN30mw6tvAQZvamaFOAtpWpkshw76CXbaTo8z3rGfrTobPlBeYWxKeQ0qMeZYiUziNWOCNuCHr95Dn9IqYRmZxuuQbhmYVo7r7mknpcR7MBSHUH2VG9gvGXM6xVSbVjyt54YaDIatiExnEktce+xhKW+q1hs+cWk4Y8AYdG+tt8NrXEejEm1v+So4T0Gtrhd3onq49yHt3cIlsWESCfDQEoQ7J5V8SO+huUZmEccDQYXulQl/pVEM6MjjpwNuQ3dIBUzVG5NDnmIQwiPIrlhwSoYAdBABZdzQKyEssgitT4HiQBknfe3IWLIcG+1XuwPbNiwsFdwNXtw7LnGbiQesGJ0VCgH5inAiRovpGUyTNPkQA1Gh3ghhUi4CE/GHcbqtrmrGQFSnofAd0LTg0M3asXjcTnSERJmk2X6XqDfr3GBrVOTe6GhGXt48iMzulP/yPoobMG2djlhlKs1qOB+8ETiKdO7ZMxw9sqJ8+X24MigMEJef8YCotClsbS99wN5F X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec68ce15-635f-474a-29d3-08d91a982c80 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5935.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:31:53.5832 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +1bdaOn92+4ZLkfpXQZ5GeJJg0Qiz/vFnd7MskPt+LEZzhB6h5vRThpz20WZN6Ip X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6237 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Some dedicated mux block can use existing mux controller as a mux provider, typec port as a consumer to select channel for orientation switch, this can be an alternate way to current typec_switch interface. Signed-off-by: Li Jun --- drivers/usb/typec/class.c | 26 +++++++++++++++++++++++++- drivers/usb/typec/class.h | 2 ++ drivers/usb/typec/mux.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/usb/typec_mux.h | 4 ++++ 4 files changed, 65 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index a29bf2c32233..1bb0275e6204 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1601,6 +1601,7 @@ static void typec_release(struct device *dev) ida_simple_remove(&typec_index_ida, port->id); ida_destroy(&port->mode_ids); typec_switch_put(port->sw); + typec_mux_control_switch_put(port->mux_control_switch); typec_mux_put(port->mux); kfree(port->cap); kfree(port); @@ -1816,6 +1817,13 @@ int typec_set_orientation(struct typec_port *port, if (ret) return ret; + if (!port->sw) { + ret = typec_mux_control_switch_set(port->mux_control_switch, + port->mux_control_switch_states[orientation]); + if (ret) + return ret; + } + port->orientation = orientation; sysfs_notify(&port->dev.kobj, NULL, "orientation"); kobject_uevent(&port->dev.kobj, KOBJ_CHANGE); @@ -1991,7 +1999,7 @@ struct typec_port *typec_register_port(struct device *parent, const struct typec_capability *cap) { struct typec_port *port; - int ret; + int ret = 0; int id; port = kzalloc(sizeof(*port), GFP_KERNEL); @@ -2068,6 +2076,22 @@ struct typec_port *typec_register_port(struct device *parent, return ERR_PTR(ret); } + if (!port->sw) { + /* Try to get typec switch via general mux controller */ + port->mux_control_switch = typec_mux_control_switch_get(&port->dev); + if (IS_ERR(port->mux_control_switch)) + ret = PTR_ERR(port->mux_control_switch); + else if (port->mux_control_switch) + ret = device_property_read_u32_array(&port->dev, + "mux-control-switch-states", + port->mux_control_switch_states, + 3); + if (ret) { + put_device(&port->dev); + return ERR_PTR(ret); + } + } + port->mux = typec_mux_get(&port->dev, NULL); if (IS_ERR(port->mux)) { ret = PTR_ERR(port->mux); diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h index aef03eb7e152..15dad2621c83 100644 --- a/drivers/usb/typec/class.h +++ b/drivers/usb/typec/class.h @@ -50,6 +50,8 @@ struct typec_port { enum typec_orientation orientation; struct typec_switch *sw; + struct mux_control *mux_control_switch; + int mux_control_switch_states[3]; struct typec_mux *mux; const struct typec_capability *cap; diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index 9da22ae3006c..6c5c4f07286d 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -176,6 +177,39 @@ void *typec_switch_get_drvdata(struct typec_switch *sw) } EXPORT_SYMBOL_GPL(typec_switch_get_drvdata); +struct mux_control *typec_mux_control_switch_get(struct device *dev) +{ + if (!device_property_present(dev, "mux-control-names")) + return NULL; + + return mux_control_get(dev, "typec-orientation-switch"); +} +EXPORT_SYMBOL_GPL(typec_mux_control_switch_get); + +int typec_mux_control_switch_set(struct mux_control *mc_sw, int state) +{ + int ret; + + if (!mc_sw) + return 0; + + ret = mux_control_deselect(mc_sw); + if (ret) + return ret; + + return mux_control_select(mc_sw, state); +} +EXPORT_SYMBOL_GPL(typec_mux_control_switch_set); + +void typec_mux_control_switch_put(struct mux_control *mc_sw) +{ + if (!mc_sw) + return; + + return mux_control_put(mc_sw); +} +EXPORT_SYMBOL_GPL(typec_mux_control_switch_put); + /* ------------------------------------------------------------------------- */ static int mux_fwnode_match(struct device *dev, const void *fwnode) diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index a9d9957933dc..e0933e205b80 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h @@ -27,6 +27,10 @@ void typec_switch_put(struct typec_switch *sw); int typec_switch_set(struct typec_switch *sw, enum typec_orientation orientation); +struct mux_control *typec_mux_control_switch_get(struct device *dev); +int typec_mux_control_switch_set(struct mux_control *mc_sw, int state); +void typec_mux_control_switch_put(struct mux_control *mc_sw); + static inline struct typec_switch *typec_switch_get(struct device *dev) { return fwnode_typec_switch_get(dev_fwnode(dev)); From patchwork Wed May 19 07:14:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 12266497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6A92C43461 for ; Wed, 19 May 2021 07:32:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC3576108D for ; Wed, 19 May 2021 07:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239548AbhESHdV (ORCPT ); Wed, 19 May 2021 03:33:21 -0400 Received: from mail-db8eur05on2062.outbound.protection.outlook.com ([40.107.20.62]:44513 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240317AbhESHdU (ORCPT ); Wed, 19 May 2021 03:33:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ntZV8UWcHiJvzd3h21zezb3Eln1aDVcIrRtsV8T/eUNUBgRQDyI7NUJdszE5gKcKNTOls896yqzJp3MdJzZBFYdW/JARJ5YPvDWde+Y2N2XBHZwmcvnaSrUr9snwLgD5XYXdaYFOdztHigfRRQIu5rzcjYtiE+l7gZji2iQYu8OS5ZvPDMB1JSG1m5WKfDer50R4KBsGxL6GZVmTG99X+55FSU4axnzTjJJ59/Bt8YJfheOT/edewS4LfMQidJZ60Lit34qJn+kgcSgo6FXES0RSetdaXDQlAQ+JBTCWXLn0H1EkNbGx/12qlJSlFvmVrYjXvewQIX6zzWpMF32QlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZB5AYziqxXaSieD11d32gB6lRYt/RK4z/qTAjFdxHl4=; b=Vmlc1rb9rbCGOT5jsFSjqVoLCHIR3vYtq1/JA6sgKxIlGDgpDMsJ3RwBCWXDrB4atJgPDVEOnK/iDrgLpDhlanD097DnKyAMhzYKztD7VV50K8KroabS3M6vTTBdxQ2kf7Qq2BDr8jpJBxPgbOAMlzUA/jFGfO8a1l2fH9qxg/+SAMuy+q2u9Lyh6ZLMQj5jUWxZbjKpwKQ6L4pbgOl46PAtys2EkxGOkF907no8/VFVsAa3qvE6RLBKkKxninSwaJjGVEG9FkHEzASsWJD0uF3Md0XZ7GDRFFFIrPF2T03C0mnN0apEttAV7uBIiXjUz/fxzb1i1ouCl4x+pbDRIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZB5AYziqxXaSieD11d32gB6lRYt/RK4z/qTAjFdxHl4=; b=hiFYjSbW+KptSIGeOphvKB9Llix8dSb2pkLH5nTMr10HF9kJootpJ5r/4Ft4xnc9ZOrwOge8Ea6FVe1yAJ7Bwf896WeFXqCRaH0Aj72qyF5QyMLksP5fsWqfDF976MwXGIZr+BsOR/XBSnbq0yhDF7l1m7o7mJVWW1GcISRbY40= Authentication-Results: linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) by VI1PR04MB4783.eurprd04.prod.outlook.com (2603:10a6:803:5e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Wed, 19 May 2021 07:31:57 +0000 Received: from VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe]) by VI1PR04MB5935.eurprd04.prod.outlook.com ([fe80::ddf7:8cd0:3132:7dbe%7]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:31:57 +0000 From: Li Jun To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, linux-usb@vger.kernel.org, linux-imx@nxp.com, jun.li@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] arm64: dts: imx8mp-evk: enable usb0 with typec connector Date: Wed, 19 May 2021 15:14:50 +0800 Message-Id: <1621408490-23811-5-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621408490-23811-1-git-send-email-jun.li@nxp.com> References: <1621408490-23811-1-git-send-email-jun.li@nxp.com> X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To VI1PR04MB5935.eurprd04.prod.outlook.com (2603:10a6:803:e9::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.66) by SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4129.32 via Frontend Transport; Wed, 19 May 2021 07:31:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98f4c95d-856a-4126-baed-08d91a982edf X-MS-TrafficTypeDiagnostic: VI1PR04MB4783: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:619; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /EZAYesQZ4kGz6cXJ7UaZPiLKnsp9JSihtze1pRX5T+/Dwy8+mAytdQNM5JxsiUTbRQk/uzXlaKnk4Ipresk14kMDq6IFf8ksUtfBqTy74zh9+b4zOwuSmg+ZM2BOd/SRHXTgpcIK+XdpodPSfjLZocTdRVyfM0uVXoaTaXXP4aFIGp43xJ/zoT6Gw+fsx8gEyC7Wpc9Ls+rs/+Z2lFTsWlodrdc8YPMJK+4LbcsO+H/lVNFMKXAdtwAKbD3tiyB+WKX0k3EqJTGhXD2Z5TQW+6/b/c+HatPsSFI2FgOHl8hYQG0g2sN66aEgcSVy1uxDAD0ZfDsYamQAL4EsjJpFTo+4HJxouyPhiKa+7jGg5Ac92oIFQG1eboLyU9X6y6fJjpk2WmIkMmm0pNvjVylnGwid178XwdJJ03Z41/yjS6BXyMpNlPgr1S0oCydZDslJcD242Ygk51VZEVHfLrOLNnW0kVTdy6u0CrPX4zClmE9MQWrk3iVf7qXkYAVQPwmjsyp0h4cpX+b0+o4bvyG9RCd2V+yAFGzobfCXXtON/vU750E8nyS8vwx/Jy13Q3/4THnZn295xOHk1w/kEbsAONqno/OMqsa70+nu5ps5vnvBqzYD/en0ZOkEBpJZiv9cxZFTM1UOoPrV3uDeZfY+usHmKpZ+XtsrEK0+iDSBU4WaHKYDeznjsMfZrsNVUqv3lM1imj81TSVqCC9uMlWKKZhHRhcbd6nkOkoF+cc/+NW6VjsMjkb1WDqkmDjon7W X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5935.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(366004)(376002)(39860400002)(396003)(346002)(6506007)(16526019)(38100700002)(66556008)(36756003)(66476007)(186003)(66946007)(38350700002)(26005)(478600001)(6486002)(6512007)(52116002)(956004)(86362001)(8676002)(316002)(2906002)(83380400001)(4326008)(8936002)(5660300002)(2616005)(69590400013)(32563001)(473944003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: QzkQwL61kHN7cO5XIJAI+moI46ndbbUymC3NT3eka3aTwpTM1LdwxmxS0oZSHmgyxEtd8JdupK4BFxUe3bxjgAZto4r37v3yF2G1Zd5/frGDDGAweFUU1eHBi+jSBhuuMniaopJ2FK+Q/Nw3TmYMAgyTEhGSwcRAUDHMMoth2CLl6H+6YF6kIYYapcdR3G1c0GLv/NDp3ZnVo4I9KKjqh9hwcGG+NDOlgUdJfS6o30Qf/bm96aBglu7UjeFxOle19jk5NTyX6xlrpTDhzBh2Ydf6ocxgzknvQWmyA08hJVC/QuIF/bL1eYdfxs00EEbUiuhb/gsicSWKtLzxGavTA1zYMQsn+qvdH362HAVkfwUYMykMQYX17GdzeWCDo/iySyzSHQfXkJqFAIwtx4UQqIzYYPXTM+D2TLKbA2R43qDgXcwUdm9xv2ow9HQVt5qqgMXcHuF34q/48tlrJbYA3gI21MZFa5mX7ZULMA/J4Uy4fZpIxCYppuCcesd4utRcAN+S9MNgwFkhHTy3UBxYkKUFDYek41YxrvtM0bWSzfntdoYs9AmfVMm0BOX4dkF4HV/GM07UoBKQeb0mQgez13Ol21sXmWZh466JDMJ6L35+n9Z4UEAWqpkd2L9bzK0cr/y/vm8j1nAc3wLKmLkwqnpiTjd65WkyUDaCmyIHPmU4pUEna7lgSFQL0fA40YBfrfvKzwNFETVuOt5Wn6eOnba0HQDvmTu9SJJB5+G1PpljqfDfmcZkE7SXvEQrozspb0mZPQc1jTe2vcMt7WFjgZfhnwZzYgIbSVxUsth/amx1UfonQOmNGmYV0SB4zQeCVhf8EA4QHEJFkabc/C3KPAE0UsXWuaWIxFQtV1NL/Ggl5Hk2EGuyylCYIL2JBtjLUU9WxqtzxImn2Hi5Wrknm3tL8R+tGD4GPEtJkwVmz2LumbkX5Rxs2mhIWDTjvBx1Mrz/kNP6WsM3Q3AKrQATxHbwwr+F5ni2WR9kvvSn3eFD8FEhz4GIBV4sene5Qav2jfxZahf00YEv6OuDuf9kM+wDrqrYNd4OVx4D2mZ/+0mMG3JV5DQ/58844VBlAksNWPzkvtg/LiTrHLegRCYWK8UqlC7JkenOMwfyKX00HHSRf64FxlVDJ71KDs8yMh4UcQj+Fo9JqFLDVGwcfwR5Hryx7Ma9P6JJxj/GiU5Uxenk2Tj+uVrR99yIEHndzz/R+T3tFBvwwGWqQBaSX1oKJ0NBvqRAmbySo68iA6Z1jMZQKiV4sNIG8vh2T0iCl/CwgTXudfyqh4vGnkeccGdg0Dx/ytmwvABMzVPNGMdLHSKGgwy1UxV7gTd6szb3LckV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98f4c95d-856a-4126-baed-08d91a982edf X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5935.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:31:57.7379 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rrX8XEM6dVENfmYuEe7oaSPILm/k5j93FZE8ntafhA/cequxQv1yjwJGrNLSfFQL X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4783 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The first usb port on imx8mp evk board has typec connector, it has dual data role and dual power role with power delivery support. Signed-off-by: Li Jun --- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 110 +++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts index 2c28e589677e..c69514910eb9 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts @@ -5,6 +5,7 @@ /dts-v1/; +#include #include "imx8mp.dtsi" / { @@ -65,6 +66,22 @@ reg_usdhc2_vmmc: regulator-usdhc2 { gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; enable-active-high; }; + + mux: mux-controller { + compatible = "gpio-mux"; + #mux-control-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_typec_mux>; + mux-gpios = <&gpio4 20 GPIO_ACTIVE_HIGH>, + <&gpio2 20 GPIO_ACTIVE_HIGH>; + idle-state = <2>; + + port { + usb3_data_ss: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; + }; }; &flexcan1 { @@ -104,6 +121,56 @@ ethphy1: ethernet-phy@1 { }; }; +&i2c2 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c2>; + status = "okay"; + + ptn5110: tcpc@50 { + compatible = "nxp,ptn5110"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_typec>; + reg = <0x50>; + interrupt-parent = <&gpio4>; + interrupts = <19 8>; + + port { + typec_dr_sw: endpoint { + remote-endpoint = <&usb3_drd_sw>; + }; + }; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + power-role = "dual"; + data-role = "dual"; + try-power-role = "sink"; + source-pdos = ; + sink-pdos = ; + op-sink-microwatt = <15000000>; + self-powered; + mux-controls = <&mux>; + mux-control-names = "typec-orientation-switch"; + mux-control-switch-states = <2>, <0>, <1>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + typec_con_ss: endpoint { + remote-endpoint = <&usb3_data_ss>; + }; + }; + }; + }; + }; +}; + &i2c3 { clock-frequency = <400000>; pinctrl-names = "default"; @@ -137,6 +204,29 @@ &usb3_1 { status = "okay"; }; +&usb3_phy0 { + status = "okay"; +}; + +&usb3_0 { + status = "okay"; +}; + +&usb_dwc3_0 { + dr_mode = "otg"; + hnp-disable; + srp-disable; + adp-disable; + usb-role-switch; + status = "okay"; + + port { + usb3_drd_sw: endpoint { + remote-endpoint = <&typec_dr_sw>; + }; + }; +}; + &usb_dwc3_1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usb1_vbus>; @@ -229,6 +319,13 @@ MX8MP_IOMUXC_NAND_READY_B__GPIO3_IO16 0x19 >; }; + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX8MP_IOMUXC_I2C2_SCL__I2C2_SCL 0x400001c3 + MX8MP_IOMUXC_I2C2_SDA__I2C2_SDA 0x400001c3 + >; + }; + pinctrl_i2c3: i2c3grp { fsl,pins = < MX8MP_IOMUXC_I2C3_SCL__I2C3_SCL 0x400001c3 @@ -242,6 +339,19 @@ MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19 0x41 >; }; + pinctrl_typec: typec1grp { + fsl,pins = < + MX8MP_IOMUXC_SAI1_TXD7__GPIO4_IO19 0x1c4 + >; + }; + + pinctrl_typec_mux: typec1muxgrp { + fsl,pins = < + MX8MP_IOMUXC_SAI1_MCLK__GPIO4_IO20 0x16 + MX8MP_IOMUXC_SD2_WP__GPIO2_IO20 0x16 + >; + }; + pinctrl_uart2: uart2grp { fsl,pins = < MX8MP_IOMUXC_UART2_RXD__UART2_DCE_RX 0x49