From patchwork Tue Aug 23 19:54:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 12951981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3B8EC32772 for ; Tue, 23 Aug 2022 11:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jhnIug1Y0bbmAKHDCDrVcmZfi5VNR+LdF/n8dDdWw1g=; b=j4OxrZS2oGyT6p 7an75O4L72l3jIEnG5PpnuS5rWwd7+thX39mmkrVJHnssMqXKfl6tze7f2uOe+dqdvEX7yyJ1qq16 anYoEchArLxlXjQACU3p7NzUjqTK7N2j/osTVhob0hSzDl9NGGnPTSqbaNWAfXlrQQMe/MCqqB/Ge JjphoxdgKv8R9ICMxjTiid5TYEW10Tzmyaqys3XkyW1X7uNuiDBoUzlM/pdwonuQSlNWNz7Qui9k5 x7ljP1fXaXLtbJGwmchX3NXupVGBac6Jo4vjkEoEAsGjLnHoxoyQkKEEC3c5U6K+hB3MQ29L8SIL9 /YaZn7WFql+N+eTJGNzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSTR-005ZbO-Mt; Tue, 23 Aug 2022 11:53:38 +0000 Received: from mail-eopbgr130080.outbound.protection.outlook.com ([40.107.13.80] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSTF-005ZMv-Up for linux-arm-kernel@lists.infradead.org; Tue, 23 Aug 2022 11:53:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SzxO4+4CQRLleOx3BTm3jHk70BrxLkImddRtJlQ2V3d/8OrvOFbhurhEwIfJxwTZLsGVrZ8OkDra8+KA6cFbVx5RR8bsubVO+mQVtssV1hb9DLwgH5M61v54NT32GTI/lipisAdAWv2LwSTb2anWeqQJ1njq8+UoDm4xF+NBpXgjaOCx4y9OnUOUwcMEmyaMlA47K12wVqXnP+aB85livlEcF7A0pxKyf575mKcXzQOtUQTaah/OtL+2FWaPQZAox0AlNNqSoLge8flgFK39Ev8JEOC7InhoiKKvgW6o72t+cgOAKhbMYJKnjd6pCf/go+JKLnhr4Qx91ZttK89iZw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+LLbE1Q6XPZaP2naT3ealao5u80azla42tVcyyT4V0M=; b=GNKG4DhDAKGdHB/2aRzdkyZ/M6B+D+AaFPRcrT7yiqR4cxEcosAuPgQ03+iFvEj3y5FnTomVJZSvn/mAl8kZhbQfK6Ni18Nie8v7o5KPQDqmXCxzzh54JFFlDFIjgEAzs1+8ZyY5UBxphai88nXHFgdGdOedZTxniiWcWXh2Igwxp3/FyG8vwGoBqbLPcE7h3Tt/XR4qbYtUxtcKvi0JzZCJadmXbyTQhx8fwB4eH2kNBJLVgW3J+TK0gbfHx8Bws5jmy7nvkTdryURZdTaeZrO4oR837b/rXuIP4W1d1mh6Tmph5OxD/HgZwX/xshtQ5eq9xqh2fiKWo4nx0arb6g== 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=+LLbE1Q6XPZaP2naT3ealao5u80azla42tVcyyT4V0M=; b=p72Z+nwQaO12jYEOL+xqJyX3tPR8GgHHyojSO6euADDF5x1FerHOINI6TsdI9VeQgjSlelFK7G1Ux/6QG7Xn9yVevE/op3bL7locsm9YlIeGqkzzKKYuPe3+UHG+i6AxufDqYHrGoBrnG0WVl7F3PfwXMJ6grQLfQq0/bi/oXIU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) by VI1PR0402MB2720.eurprd04.prod.outlook.com (2603:10a6:800:b3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Tue, 23 Aug 2022 11:53:15 +0000 Received: from PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c]) by PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c%4]) with mapi id 15.20.5546.022; Tue, 23 Aug 2022 11:53:15 +0000 From: Xu Yang To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, peda@axentia.se, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, jun.li@nxp.com, xu.yang_2@nxp.com, linux-usb@vger.kernel.org, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/4] dt-bindings: connector: Add typec orientation switch properties Date: Wed, 24 Aug 2022 03:54:26 +0800 Message-Id: <20220823195429.1243516-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823195429.1243516-1-xu.yang_2@nxp.com> References: <20220823195429.1243516-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR04CA0155.apcprd04.prod.outlook.com (2603:1096:4::17) To PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66fd00ff-cc2d-4590-c13b-08da84fe101f X-MS-TrafficTypeDiagnostic: VI1PR0402MB2720:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GSiZgEbcx6jhe7MyU4Z8jUCzNKyloxC52xEGH+fWCQ5UfnsLwZx6IdmShuvp2/kI4rduM1v6shrXGD9fJbY+/J4b3P8DNcQ2p6oCVGDygnBIMYYc658HrU32ojoHzzCfxgjjIjWo9hN8U7sVxogdCNtnmer8P7wgeLlOY6RPrJvYGWgu2mnWKPSJXlaSIJlUDohsJ3uvMET53moZivC0DI+nhe6uFN7TMX1g24BPYHZnGnvy8r1SAINdzD+REKijsjMbzznpuJ189pJja+chlyAkCNQqJmYGDOiCa8QeTVJUtLv+UmLtk1JIeEa8TRLrm8bAi0ILFMn+jHDeeYidlIHtrgxJVt2VmKRmiqtFeid7Gld7vCTBJFMDlK0EO6ZEZsV3jiOd+DWWyQq2GXrNvhNpY7thVbs1Xh9BSHPpGPo5taIBGJh5F+mg8mgvexrAaJLTgUtkN08IG9wsKNsnNSALLaBt9m++sbHB2/ev/57i03drzjewmk+RM8AFhUIx1wivOfzCVMgOz2CDcNakOgOq7wraT+uvAFI+UDVjrdOCoGm3p3G+PUdfj9AIozgTXUbxSyahm/yQdYou/pNoxrz6E4vcRuoKQLJc7iT0z69V19DxDTDfJ+4ubQTcxMDJgj8V3aVQxszT2PVVlkaZvylYf3TPi+pT2VXeSwugzTsXoGzgJj1tYoOR7Z0OdfXus703GbLzR/Aj+gx7rVeCYdB/wfTvrtmq6BH+ZmGhrItYYv36AlVbpQGo2QemHoIl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8784.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(66556008)(66476007)(66946007)(8676002)(4326008)(86362001)(38350700002)(38100700002)(36756003)(186003)(8936002)(26005)(6512007)(52116002)(1076003)(6666004)(6506007)(41300700001)(6486002)(478600001)(316002)(2906002)(5660300002)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UFkSdq26jkyub2jAt+G22SMLo+jIcQtwJ3lYiyC3ad7NVQN3m+HdYpEhVYZhjM0le7qFzp0hzWEZ5K30sFqPF0Y3NjxdSoSp3aXf7fzE4TevoCPgVPiz1ArgArGriUNZ182KsRjfQ9pYCU2y5Ynr5PRKPw1718lSw2DvscBLeEulSWoo5VzZ1CL4ZrapcFFGtIgpmoxxLEWBA8vcWWjv48Fr1v37r/dKRAxss4jeM5/HE8dbWX2+czKIdOO03QyO2hkaA+BbrT6T175b/QwGzBO8H5n5imx7cuafjLZ004qG5Gap3aMlJFMjiwLp7oi0w+2Gi/xIjeVVZWhB11Hf1KiJWfhaniqV5pe5uyNEd6IhesGjOy9JXc/xDFR8/Xv1JtPsuze/tNulRL8W+zJwsZAtNA73uwLFlPkN+iagpfrnJbH+lKOHYYcfNDV2krUbx6Ue+sIBcUxzGT7snstXp3joswg5UmfNSj4ZMsgksBn9r95nZthDciK662ZWWokfpd3TlSwxvwsnc90xJ/S/4o10KEb0uK5yGwhqrheeHI+BhF2hzk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Message-Id: 66fd00ff-cc2d-4590-c13b-08da84fe101f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8784.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 11:53:15.5141 (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: hFO6Fp2eCqHsRPNJMKSZxH2xiRW41Jy1Y7yqCZHW3TpSG8Px8X5u1nnv2uNvE3HOIpxrwGUfiaJ/m/oL4bKjqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2720 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_045326_045598_5D0A4AC7 X-CRM114-Status: GOOD ( 10.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Typec orientation switch can be implemented as a consumer of mux controller. So we can use mux controller to control simple gpio switch or other types of switch. This will cover the following typec switch use case: High Speed, Super Speed and Sideband switch. Signed-off-by: Xu Yang --- Changes since v1: - No changes. .../bindings/connector/usb-connector.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml index ae515651fc6b..47f53cdbf31a 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml @@ -221,6 +221,24 @@ properties: SNK_READY for non-pd link. type: boolean + # The following are optional properties for "usb-c-connector". + mux-controls: + description: Mux controller node to use for orientation switch selection. This mux controller + could handle High Speed, Super Speed and Sideband switch use case one time. In orde to do so, + besides mux settings need to be properly configured for each switch under mux-controller node, + correct states should also be assigned to typec-switch-states parameter. + maxItems: 1 + + typec-switch-states: + description: An ordered u32 array describing the mux state value for each typec orientations. + Three states correspond to NONE(high impedance), NORMAL, REVERSE respectively. If there is + no HW mux state for NONE, use value of NORMAL or REVERSE for it. If this mux controller + handle more than 1 switch, correct states value need to be caculated according to the mux + settings. + minItems: 3 + maxItems: 3 + $ref: /schemas/types.yaml#/definitions/uint32-array + dependencies: sink-vdos-v1: [ 'sink-vdos' ] sink-vdos: [ 'sink-vdos-v1' ] From patchwork Tue Aug 23 19:54:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 12951983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2BA9C32772 for ; Tue, 23 Aug 2022 11:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tRzN3+LNP2oH0mSbCJ/d8RtgokXKIVvkCSOztPhFaZk=; b=s2ycllxxrvVvhP VgvHUnq2cCAfdvEeWLCLaOpaFi7Btne9sJJIWiGXKA0hS7lJbkmzdonSpTsLJxtezdRUtN5ySfmlW huvgL+I4UXja8hsiahLeOUECttLgD0rekdsArsidiodEPICX3KBpXgk2ADrkLpO0mHZD0mqGqLzuQ vMZ/HbK8Ee58sWSBiEFyf3NgmzOKfkSSK11ds9eXiHiYxmvpDgDdbwnV/5mjY0ZQdmvXQRLh5DgFw MFZvTj0RPS+BqWh5lXNQHxDdCQOmUv92npH0hSF4AAv193th80bEmMCbjg3qmsJg4xioFa5Bx8xOM NTjhSE8/7pqMUySKKTUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSTt-005ZuR-JP; Tue, 23 Aug 2022 11:54:06 +0000 Received: from mail-eopbgr130080.outbound.protection.outlook.com ([40.107.13.80] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSTH-005ZMv-Q6 for linux-arm-kernel@lists.infradead.org; Tue, 23 Aug 2022 11:53:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dmH8kJnR82a7rg3F31sJDu1HJz7j4Q9d8QDvHdiuo60ejiKWkCjYbHtj/ZawvOE5iaLulxGyvJKS/JWVdSjJHVFkhkEWb5rPjKgR7Ce8SkyalEygtphirv6eASU/h6iFyUuF5KbOVVfaC6f9tnfv1jM7cM0OTwsn8z8JhO0KzoO8E+TAtTIksaX2PqSNPrwBUL3DKkhUl5rTaC6qdzD+nUN8Czjv6UNO8/vKDWflB8MekQGZ/1PDYFAAXMPx2ZRhQji5QyXo4XjaBpLyyiZLBhy2Z2HOrMaGZx7qeoOhKLRjkHM74dbSqTsTLeRFfd29KoSt3OaMoPNMAZbxAsXycA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8g3FiEBF4Yiwk+v1X73ICBHVpDpOvYiPln0ZfGYDplk=; b=OSGTZKv8EV8DmQJqCecpSOIb0AaLHqLFXWG+b3MDu+Qbw52cHK+uEE8tfA4ZHcDSnzyXHnkIJfqRrb8S7ISn8D3t4VSGx+VLLiGEbjPs8buPFGzEhy5b2QF++TIlK3NAlJ0pIRsxVDfrsXhOqd/LNkyC529Z2BgZdZ2kLtNEpUvSfZyjfT77GmU01pOTTFBlNyzoIsMs0Q0T30d7v/p7N7rywaTjLh4pHC04t5uzmv3p1qqeqOu3LC/liAuK7WZSk3XwzgtkTz0MXMpHMGy50Bsp6sghA+fgcX8+/d6iBd7ykZjGWN/2xbjjlirMc6Bbg9shpQNO/+R2x586tD9LhQ== 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=8g3FiEBF4Yiwk+v1X73ICBHVpDpOvYiPln0ZfGYDplk=; b=NdRCykY37BH3csPo4Ka9BG/HzTg5yTRQIC1+ZuPzYjpcVpW9vZAXrNJPq7s+hJ9D2Oxoy5TGHGvmEbyGzs2TDUmLjNPJi/VmHccCzy03Vcfur/iWn+4SyKXFtDMFERz77Mk6z3dJrwNebH9d0cMMRzHvwE9vNKhdqRDrXmEH06I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) by VI1PR0402MB2720.eurprd04.prod.outlook.com (2603:10a6:800:b3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Tue, 23 Aug 2022 11:53:19 +0000 Received: from PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c]) by PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c%4]) with mapi id 15.20.5546.022; Tue, 23 Aug 2022 11:53:19 +0000 From: Xu Yang To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, peda@axentia.se, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, jun.li@nxp.com, xu.yang_2@nxp.com, linux-usb@vger.kernel.org, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] mux: convert to use fwnode interface Date: Wed, 24 Aug 2022 03:54:27 +0800 Message-Id: <20220823195429.1243516-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823195429.1243516-1-xu.yang_2@nxp.com> References: <20220823195429.1243516-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR04CA0155.apcprd04.prod.outlook.com (2603:1096:4::17) To PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67470485-9557-45ce-7563-08da84fe123d X-MS-TrafficTypeDiagnostic: VI1PR0402MB2720:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iBmFBj4e7SvpJdvAs4q4vVz92MJxN1GlOR6LLovN7BT83oA1tg+MyR2tFqZ0hR7c5C6+Wag3ui1GS1olWRUZFwZ8o42F2onGYjJm87jwegrWtgVDfmJsnsL1z6Fwfttc2vUS4t4+o2GT+8ekgdc14sqnBs3KUkHBbQRmRsqDKp2kS6bVK7d5X9iKS3v9lN3ckapTO8XH91/QGoakuQTNvi11/2+Gj5BPoUg4XF1WnFhkmco2imeTa9a+AmxHBZJXEMrtwcLDrLylPnAJNyQJQyxCUDblIaN4l1FahUPzR++yw6U3CFz+ZAHnnqrI9nDi7oxZWefK3I+4xdVnXcI27qe0DUAACQSmeXkGw1C+GLh5pd7LEc7AxeXDAyTgLt4UTvG4OIxIL4susWcrBT0+ml1p1OymJ/i+6ECvnEDfgZSLPr0aZG6LwC0jSxFWecMDcIkGp6/9p2GuncFeQBLPZIC5hQAZ6GAs9EZXSnoQ2fXwCZbj1wXXcgldTcz8RxMWTC6O22XqHZBS23p+Y20UEq7dISp3vuhMS13GbMyguCFluEWGP1q9E2r9hTqQaTPNT5Ii7LHQjSDjEU0rGDMRqiQUtmsl3+cC1kRAZksRcFahPk5vZtsq4w1X1K7hDgVUCjKvIEFMcqXdPouimmHvr3DN9L0Ocb27JN654fyMJhW4TMfFYQjam4b2JgScLAG5nI2iS3I8IoOPbJOqeWEzLXcPhqjU/Ey8EH9A4cgNKNnQpSX7f3vfbDRc2DaVz5VS94YC4Wt4Fy11jqaIspB96Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8784.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(66556008)(66476007)(66946007)(8676002)(4326008)(86362001)(38350700002)(38100700002)(36756003)(186003)(8936002)(26005)(6512007)(52116002)(1076003)(6666004)(6506007)(41300700001)(6486002)(478600001)(316002)(2906002)(5660300002)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ku9D59BFeoZWGpSVbzaDq+eF0Ag+48ExFenE2LO6QYXAaZtOwSsrPjNFGi20t+1yjG/b7Ayc4RzB4zp39a9jJelKnW9iK0hgcfkGVj3zs3iPmqHesgu4etry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zW97DEXanQ2tP+YrgJWOxGh9j1sRbQW6K/IeK3AgUwZ9EDFNFGXP3Gg+S8UstGO9rTG/rBF8Ft68g506uQsrPurgz2FLM17X7sKps08bH1P1QeFTSugMAQ8lOZoNA639c4FpmuJ+1UYzz4Tybu9vFpj3irM5he7jrOBJznNEqlvIyNI2F0Ar1XJTmblOVcFaOQJDiGeKW1TU6105THfmUkF9uj2h+KRhauafq311KcpaeXkPIKdMmA9Jc0RL51yxunb47dxqxwQsjMD11OsEiqoL91m+CSb/n8vw4wSxJoG1Q0AyrwM4R9zO0A8RQXhQ7EN2mWAuAqkfIfWKBQzR5io/lpV1uifcO2o5DwNJ2gAhoxbfLWoelG2Cu2YLj3x0jD4+JtOW6w X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67470485-9557-45ce-7563-08da84fe123d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8784.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 11:53:19.0954 (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: gPlnzjfdQSooDHTDEpJzAHfyRIhHV6OtlllkU93U7glSKvfcH8FUwofPlm7c3H3f8Z0XIsQRUQm+dkWhNsux+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2720 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_045327_901247_5B5CF103 X-CRM114-Status: GOOD ( 16.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As firmware node is a more common abstract, this will convert the whole thing to fwnode interface. Signed-off-by: Xu Yang --- Changes since v1: - convert to use fwnode interface drivers/mux/core.c | 65 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/drivers/mux/core.c b/drivers/mux/core.c index 49bedbe6316c..e30e859efd33 100644 --- a/drivers/mux/core.c +++ b/drivers/mux/core.c @@ -18,8 +18,7 @@ #include #include #include -#include -#include +#include #include /* @@ -510,11 +509,11 @@ int mux_state_deselect(struct mux_state *mstate) EXPORT_SYMBOL_GPL(mux_state_deselect); /* Note this function returns a reference to the mux_chip dev. */ -static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np) +static struct mux_chip *of_find_mux_chip_by_node(struct fwnode_handle *fwnode) { struct device *dev; - dev = class_find_device_by_of_node(&mux_class, np); + dev = class_find_device_by_fwnode(&mux_class, fwnode); return dev ? to_mux_chip(dev) : NULL; } @@ -531,8 +530,8 @@ static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np) static struct mux_control *mux_get(struct device *dev, const char *mux_name, unsigned int *state) { - struct device_node *np = dev->of_node; - struct of_phandle_args args; + struct fwnode_handle *fwnode = dev_fwnode(dev); + struct fwnode_reference_args args; struct mux_chip *mux_chip; unsigned int controller; int index = 0; @@ -540,11 +539,11 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name, if (mux_name) { if (state) - index = of_property_match_string(np, "mux-state-names", - mux_name); + index = fwnode_property_match_string(fwnode, + "mux-state-names", mux_name); else - index = of_property_match_string(np, "mux-control-names", - mux_name); + index = fwnode_property_match_string(fwnode, + "mux-control-names", mux_name); if (index < 0) { dev_err(dev, "mux controller '%s' not found\n", mux_name); @@ -553,35 +552,37 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name, } if (state) - ret = of_parse_phandle_with_args(np, - "mux-states", "#mux-state-cells", - index, &args); + ret = fwnode_property_get_reference_args(fwnode, + "mux-states", "#mux-state-cells", + 0, index, &args); else - ret = of_parse_phandle_with_args(np, - "mux-controls", "#mux-control-cells", - index, &args); + ret = fwnode_property_get_reference_args(fwnode, + "mux-controls", "#mux-control-cells", + 0, index, &args); + if (ret) { - dev_err(dev, "%pOF: failed to get mux-%s %s(%i)\n", - np, state ? "state" : "control", mux_name ?: "", index); + dev_err(dev, "%pfw: failed to get mux-%s %s(%i)\n", + fwnode, state ? "state" : "control", mux_name ?: "", + index); return ERR_PTR(ret); } - mux_chip = of_find_mux_chip_by_node(args.np); - of_node_put(args.np); + mux_chip = of_find_mux_chip_by_node(args.fwnode); + fwnode_handle_put(args.fwnode); if (!mux_chip) return ERR_PTR(-EPROBE_DEFER); controller = 0; if (state) { - if (args.args_count > 2 || args.args_count == 0 || - (args.args_count < 2 && mux_chip->controllers > 1)) { - dev_err(dev, "%pOF: wrong #mux-state-cells for %pOF\n", - np, args.np); + if (args.nargs > 2 || args.nargs == 0 || + (args.nargs < 2 && mux_chip->controllers > 1)) { + dev_err(dev, "%pfw: wrong #mux-state-cells for %pfw\n", + fwnode, args.fwnode); put_device(&mux_chip->dev); return ERR_PTR(-EINVAL); } - if (args.args_count == 2) { + if (args.nargs == 2) { controller = args.args[0]; *state = args.args[1]; } else { @@ -589,21 +590,21 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name, } } else { - if (args.args_count > 1 || - (!args.args_count && mux_chip->controllers > 1)) { - dev_err(dev, "%pOF: wrong #mux-control-cells for %pOF\n", - np, args.np); + if (args.nargs > 1 || + (!args.nargs && mux_chip->controllers > 1)) { + dev_err(dev, "%pfw: wrong #mux-control-cells for %pfw\n", + fwnode, args.fwnode); put_device(&mux_chip->dev); return ERR_PTR(-EINVAL); } - if (args.args_count) + if (args.nargs) controller = args.args[0]; } if (controller >= mux_chip->controllers) { - dev_err(dev, "%pOF: bad mux controller %u specified in %pOF\n", - np, controller, args.np); + dev_err(dev, "%pfw: bad mux controller %u specified in %pfw\n", + fwnode, controller, args.fwnode); put_device(&mux_chip->dev); return ERR_PTR(-EINVAL); } From patchwork Tue Aug 23 19:54:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 12951982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36199C32772 for ; Tue, 23 Aug 2022 11:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7cF7BxgIwkhV+ivM8vloqWxv1Cr3fuZwIv5ImHseHqE=; b=d71gZgY5pnMHRU N2MDQYmbDPLbK8HytcGSmLGBb4ZZN+1PSv0ii/24DiXffOF7qioFkIWm3jeZ2ai6eHBgmwCfk79n4 jRmvVZcXMnOj49Q9bF8gMqFeITChcwpdkOyyhjt6vLg0ODbzNBiU8bIDDzMNO7/GC60HET5vlTv+Z FmlGkabfiq46kgGJna4B+wUJ4GSqmxcoN/dBKxcgasqUOhr53/olrLkXuJONtZnnMNknTqvr0gKVr QkXD3Nq9krqeb/hukaav4zP6pb6u6XHWf7mg9oyRfW7vpU+eNiuYeTlkRj9cOSn2pVF4WV7HKWkWZ 5EIk/MCjJhlQ8H0lqfRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSTh-005ZnR-4R; Tue, 23 Aug 2022 11:53:53 +0000 Received: from mail-db8eur05on2083.outbound.protection.outlook.com ([40.107.20.83] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSTH-005ZU4-A0 for linux-arm-kernel@lists.infradead.org; Tue, 23 Aug 2022 11:53:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OtSOhbQbApvD+bvwggMqsLC6eXE/xd04MHR9/fWKkA4M2JtolK+PByfpX/ngqXp6ZqIsiGBwHVTMuFcu6en0icxgaXP6Cjrwi1LI4pv5PitsiTMXxN7sqJhPHluUfTyEuxNrk8fJUBPrYRksQJm7HptRSFLeEWkNcBeud6pn8RaFCmb+9HlvjKb5Sbvz4eHFdwaQr5uw0EC/W8XLGdy3VgNX8laKNVtgfGHFnh/O3ZYU192zyIwcW+C2HGoiffDD273i6J/PhJBgQRrMlcg2qsnn4h8egeW25GGCfWSeqd4rZXO7jhfNXIwwZ6y8uzvCeo9PFzGcfoJNX0p4VWVfgQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mDLc6BDZyYOkWIDUubehY7WBYEo7axYU4TpsHPO76q0=; b=XyMI17phl8ElILmJrnUts2ERfzcJZ1M/+3t2ftXb89KMprbM37T1rp+RxSjglCnGMjFLia4j5FqT5/Njq3S5SkI4sn4ZW2w+2qBdy0EQiTYkpdCzKKzI5CbTjOeqOEKfmCvfRQb86mjAHZRPd7khqaCh/YMGa8KAhcvSBwGbxifr5iGSvUwkQnKSY+sYF88s3k8jhb+JoaCyLqZupJ+h4uZg+z182O8eitXq0e8NgX5p9qkqRrhL9gcDJmHbN95mqn4iGRkUlhf7Hn7SU5Z4va3HNVWuTFBSjKro48+ZgtI9VD3ag7krKPKCnIQakV80sClpg7zWus8sx207ecaJlw== 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=mDLc6BDZyYOkWIDUubehY7WBYEo7axYU4TpsHPO76q0=; b=hZZu1gfLXqY2qHelcMJhMHGTVqJ1no/v414o1D5ab5eabDlukOAhFZF7DYC1ZjDXz4F2QodkhrePOskzTxZ9sUVqBQZf+VjPo9Izo1+qCeVKdPWZ/p4RlZCgo1c1A5XMtp/h4rye1u1qu6juKwxhV9uU4obldoku7Qza35NIJ7Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) by DB8PR04MB6668.eurprd04.prod.outlook.com (2603:10a6:10:10b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Tue, 23 Aug 2022 11:53:22 +0000 Received: from PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c]) by PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c%4]) with mapi id 15.20.5546.022; Tue, 23 Aug 2022 11:53:22 +0000 From: Xu Yang To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, peda@axentia.se, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, jun.li@nxp.com, xu.yang_2@nxp.com, linux-usb@vger.kernel.org, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/4] usb: typec: mux: add typec orientation switch support via mux controller Date: Wed, 24 Aug 2022 03:54:28 +0800 Message-Id: <20220823195429.1243516-4-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823195429.1243516-1-xu.yang_2@nxp.com> References: <20220823195429.1243516-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR04CA0155.apcprd04.prod.outlook.com (2603:1096:4::17) To PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8bb2dce8-bd40-4001-5767-08da84fe145f X-MS-TrafficTypeDiagnostic: DB8PR04MB6668:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YDAK5RxILIQSlS8W/DbnhTnnyC31gR/NwSd+BiQK+g06ub+wwwdvHeVhwwMcrI6LIXuDhYSfHfRxHJ+MfT5T9nJFIxFM+8YulDg4j0NqYWXyzJlGmb1qXeaGAoDx9sPd2zKiAah3qLnYp8RyVQciztsDIsU0/z2VqQxVD9vHNggGOgOKg4EaR4YXUSMXDjQaIbmVIcE09B1GpDysRFs+y0NEgx8HjxhR8QVZa7lcyVJh4H7hKIJhiU6ZzedgCKz8XT7G5WcFasf42tcsOT/ER4Y2ZDIwp/hVp6nI7qLt6w7N6iip1mxho6BVl1z3c80c4wAvFidrhw/X9epuXhpDT4/tF3dnwNR/O4GdDzs2y4cJpv05mnhGbJ0KO5e4K8E/xnac6P9jLM5sCscEEGNnyG3pi2eCfQ/nXP5diPQ8GJmwhjVrBmHljJ21t346e2iP40GVZsNDd1NtUQ6im2oMJpTjN3aWqk+brh8UbJP76gc5pCD54zX9vUdYdks53PvuWYEXIIAOhImvMtJZ40VxpfKS8QP/Okk4rEQE8d9FPjkY4nay18s0zAzgJX3UKOX4cu5+dXOyYk2G/6sC9JVZmNR8oAWNxBRLZ1MORsWzzEs0EdaUM9p5xpvmJd9JcR+FV6UCZNgppiwZ9ToFoZrM+Vy8I8lnTZ0e3JCpQmHl64SMEN1eMfUvQVydJW+tcNVp+g490sRz9yih8siVxPab7XeamGQ5xN1+4SZ8qu2KOXC3RkrPZo830yonOwTn8W8Z5NcVHXB2gVqpurT/VKJr1g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8784.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(396003)(376002)(346002)(136003)(366004)(38100700002)(66556008)(8676002)(66476007)(4326008)(86362001)(38350700002)(66946007)(36756003)(2616005)(26005)(52116002)(6512007)(6506007)(6486002)(5660300002)(478600001)(186003)(316002)(8936002)(1076003)(2906002)(83380400001)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lo2nh7cFpsenc4cworR+GmYSUE74dJkafQTsNfj9+xRhCdQCONZY33Rzvuz1H1i5M0XcfdcW0Rxc+OzmfclFc2On4m9avd1B52lfffKdABLXlc/TkyGtJPG0fV6yPt3vHSz5b3OkUu3tgYh8YR/8ovAut5jZT5udmfu4Zr3npRTjGo589FtOtQfj8z1d+6kEa//nwccKKN8O4EbEen/RtfMz9SWK7G8W55J9ZN0ZJQP+VErSxHZZERmudXYLM+J7LYO65Lh/Nw+bebTp0lbviQ9vfgFz3ANOeIV+rfBnBWGCP5+vUwq4QWsNbzJz2G5gQ/92WAbW99mWmtWFfP3K8KZhJ97GmAy1LoJHghbTkfC8/ZAZi8RSVPAIipwqkIplhrF9n/96ZIfOi0xHp77gRtvzLQ7tB0+Bu6K5IM+JlqkYgIMRu1AXNM1OId625G9WUb9UuhMwOvWpc+iq0/6r1iE2/ojA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XeXTvZ9lgDvjU6SJWE9vjG3FYzxtgySCQNWazDeU1ieiyEqZVB5oilA1qq8XOkJbW2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bb2dce8-bd40-4001-5767-08da84fe145f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8784.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 11:53:22.6430 (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: 4txh/yDkDwtFt2Phx9DZstC3eTaNYOZ9ZnkzxPNIrE/03D1l3DDFUhdxyqlUFyw4U3jrBV2LYYU85+mMkZ/pAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6668 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_045327_411714_8439B6A4 X-CRM114-Status: GOOD ( 19.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 control typec orientation switch. Also, one mux controller could cover highspeed, superspeed and sideband use case one time in this implementation. Reported-by: kernel test robot Signed-off-by: Xu Yang --- Changes since v1: - add build dependence (select MULTIPLEXER) - improve Multiplexer control logic drivers/usb/typec/Kconfig | 1 + drivers/usb/typec/mux.c | 76 ++++++++++++++++++++++++++++++++++- include/linux/usb/typec_mux.h | 7 +--- 3 files changed, 78 insertions(+), 6 deletions(-) diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig index 5defdfead653..73d4976d8148 100644 --- a/drivers/usb/typec/Kconfig +++ b/drivers/usb/typec/Kconfig @@ -2,6 +2,7 @@ menuconfig TYPEC tristate "USB Type-C Support" + select MULTIPLEXER help USB Type-C Specification defines a cable and connector for USB where only one type of plug is supported on both ends, i.e. there will not diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index 464330776cd6..05e6ed217620 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "class.h" #include "mux.h" @@ -22,6 +23,11 @@ struct typec_switch { struct typec_switch_dev *sw_devs[TYPEC_MUX_MAX_DEVS]; unsigned int num_sw_devs; + + /* Could handle HighSpeed, SuperSpeed, Sideband switch one time */ + struct mux_control *mux_switch; + /* 3 state correspond to NONE, NORMAL, REVERSE for all switches */ + int mux_states[3]; }; static int switch_fwnode_match(struct device *dev, const void *fwnode) @@ -117,6 +123,58 @@ struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode) } EXPORT_SYMBOL_GPL(fwnode_typec_switch_get); +static struct typec_switch *mux_control_typec_switch_get(struct device *dev) +{ + struct typec_switch *sw; + struct mux_control *mux; + int ret; + + if (!device_property_present(dev, "mux-controls")) + return NULL; + + sw = kzalloc(sizeof(*sw), GFP_KERNEL); + if (!sw) + return ERR_PTR(-ENOMEM); + + mux = mux_control_get(dev, NULL); + if (!IS_ERR(mux)) { + sw->mux_switch = mux; + ret = device_property_read_u32_array(dev, + "typec-switch-states", sw->mux_states, 3); + if (ret) { + kfree(sw); + return ERR_PTR(ret); + } + } else { + kfree(sw); + return ERR_CAST(mux); + } + + return sw; +} + +/** + * typec_switch_get - Find USB Type-C orientation switch + * @dev: The device using switch + * + * Finds a switch used by @dev. Returns a reference to the switch on + * success, NULL if no matching connection was found, or + * ERR_PTR(-EPROBE_DEFER) when a connection was found but the switch + * has not been enumerated yet, or ERR_PTR with a negative errno. + */ +struct typec_switch *typec_switch_get(struct device *dev) +{ + struct typec_switch *sw; + + sw = fwnode_typec_switch_get(dev_fwnode(dev)); + if (!sw) + /* Try get switch based on mux control */ + sw = mux_control_typec_switch_get(dev); + + return sw; +} +EXPORT_SYMBOL_GPL(typec_switch_get); + /** * typec_switch_put - Release USB Type-C orientation switch * @sw: USB Type-C orientation switch @@ -137,6 +195,10 @@ void typec_switch_put(struct typec_switch *sw) module_put(sw_dev->dev.parent->driver->owner); put_device(&sw_dev->dev); } + + if (sw->mux_switch) + mux_control_put(sw->mux_switch); + kfree(sw); } EXPORT_SYMBOL_GPL(typec_switch_put); @@ -204,6 +266,7 @@ int typec_switch_set(struct typec_switch *sw, enum typec_orientation orientation) { struct typec_switch_dev *sw_dev; + struct mux_control *mux; unsigned int i; int ret; @@ -218,7 +281,18 @@ int typec_switch_set(struct typec_switch *sw, return ret; } - return 0; + mux = sw->mux_switch; + if (!mux) + return 0; + + ret = mux_control_select(mux, sw->mux_states[orientation]); + if (ret) + return ret; + + /* Keep it as it is since idle_state is MUX_IDLE_AS_IS */ + ret = mux_control_deselect(mux); + + return ret; } EXPORT_SYMBOL_GPL(typec_switch_set); diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index 9292f0e07846..2287e5a5f591 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h @@ -24,16 +24,13 @@ struct typec_switch_desc { void *drvdata; }; + +struct typec_switch *typec_switch_get(struct device *dev); struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode); void typec_switch_put(struct typec_switch *sw); int typec_switch_set(struct typec_switch *sw, enum typec_orientation orientation); -static inline struct typec_switch *typec_switch_get(struct device *dev) -{ - return fwnode_typec_switch_get(dev_fwnode(dev)); -} - struct typec_switch_dev * typec_switch_register(struct device *parent, const struct typec_switch_desc *desc); From patchwork Tue Aug 23 19:54:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 12951984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98054C32772 for ; Tue, 23 Aug 2022 11:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TiDNLyTVKmK7vjk9OBLcwdSz8/sbEIPekWN6sznNCQ4=; b=FaNIKFdnDJptMq FifmIn7dsm4+x+tq1TedCvcE8bSOrVJIlbCKCxPxK50/PpQ2gbqYye3vIPb9twCfI/pkaFZ7ny5Mm ow+WB0GfT2OB3mDXom1hegcrLHWD8pQZpvvSlfvL0diUJd15tIfc0oXJPp9pmDuRyvEUriT+PrzK7 sai/HR1TjNfsrHS5fOr6fctnmUaQT7D/yjF7a9qp1TqmeRFiZDuvEKm8B5/kymDGYoNGduHBa5byW Ceiw6lQG2GRHB5wguDu7UNbJv/emskoFSpoocjoCuQ/SG4hEnFqQIA1dcOXBGFBoz6dpHtDwC/q+B cpSwWgfprDPtzEPjtOLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSUQ-005aE7-HL; Tue, 23 Aug 2022 11:54:39 +0000 Received: from mail-eopbgr130080.outbound.protection.outlook.com ([40.107.13.80] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQSTJ-005ZMv-Sm for linux-arm-kernel@lists.infradead.org; Tue, 23 Aug 2022 11:53:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DFxyDbbcp5mOGkSl8awC6giH3INkBlAm7JSkadgCSHBxTKjlrXLUVA93QU3icUGwy/G423pTBuToctFyhco1UK1bxloP/zThe8XguTQt7gszJNxZtCddWzDmqv0yIvniMsh0xhoGooh4nviz/ANakwLY5vxHMMJD5Tb+HM5X6KKx1pTO1tJuxG58nwYe1l19e2OGaKIMv942kyyuUfCyj/KuxeD1iaWcHkwM/aMQMRmeeKOh01SmtaAZyxu3hLSaiyFBFSeKXyWQG7Bh3en/qnRsi5TX/wDVp0vep1wcAoZ606LBGcL+QHbEJoD/hvKHFGrf5IagJ4dlU+snyT7MdA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+eIcy9yJgn4z686QFf811NahE/M9NAEaSyrZ3wYKCQQ=; b=kVjjP1G+XZGM9NVdSadQGQCqwAE9qehQ8WnTtmHyvlVhMXHioPOz3bfXHR3ALi/NQ0SbMwNGVp0wj3l9Ke1BkElGA2mwfSC1H8rSvjfh9l+buH4rWm808SuawatgE5ZwH/gzZtzF8xx7cZ9zXJgdk89GZgEtJBbcvp1kM+3Lb2P6e3GwneD234yQndY5sn19pf37E21uTW6uq5Om/FujzZOCS5bxvFpbFArcIQrKKrYlf++/yt36lkYVUCSyKtzXjZKa44uIkEXJvFBi8pB2tJIDtfYL+oDQcJfOydGvth7vKQ0P2wO394wWzPEWgKLgNNS8VWWAGYd7MaUmuO+5HA== 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=+eIcy9yJgn4z686QFf811NahE/M9NAEaSyrZ3wYKCQQ=; b=FTzqHmBhX4SnaGMPsUMo5bzwSj6NVBpdpJSG7SPykWBAH9ibzyF4E1TbYu1uHO+JUDcnx67fEdYSgdlmHHkUWuEa5nXFQFWHTihCnfJtG7AEJxzJOTiYaI0mqKY9j4+AKYXQic61XgXc/kdxEN4w5cm5OP4cqDXyqUxsWkBHJJo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) by VI1PR0402MB2720.eurprd04.prod.outlook.com (2603:10a6:800:b3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.22; Tue, 23 Aug 2022 11:53:26 +0000 Received: from PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c]) by PAXPR04MB8784.eurprd04.prod.outlook.com ([fe80::60b7:af13:8472:2e8c%4]) with mapi id 15.20.5546.022; Tue, 23 Aug 2022 11:53:26 +0000 From: Xu Yang To: heikki.krogerus@linux.intel.com, robh+dt@kernel.org, peda@axentia.se, shawnguo@kernel.org Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, jun.li@nxp.com, xu.yang_2@nxp.com, linux-usb@vger.kernel.org, linux-imx@nxp.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/4] arm64: dts: imx8mp-evk: add typec node Date: Wed, 24 Aug 2022 03:54:29 +0800 Message-Id: <20220823195429.1243516-5-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220823195429.1243516-1-xu.yang_2@nxp.com> References: <20220823195429.1243516-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR04CA0155.apcprd04.prod.outlook.com (2603:1096:4::17) To PAXPR04MB8784.eurprd04.prod.outlook.com (2603:10a6:102:20f::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38e7ec1a-0268-4f31-48b9-08da84fe167a X-MS-TrafficTypeDiagnostic: VI1PR0402MB2720:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8IVi0gvJ1YvxoJdow2bTYvUlXhJ3H1dMUpS1KG38PCZn32CoaoLLIMcwf4KCYUoW5T2Uc8nt6vzUP6vQYsdyc8ao/QUx4asOqflXhJWMG+x3fxJt82yY/EtfppSoHk+Tsa3tnLuhucrOR5mxzxjYWx3hFZzgzsx/IWMTOo9C/zYLlEU1+nYOnBSmgROJacqE1y7RvfGlNdkX4V4IZF3G8aoUx8wbaruvyPQiGTHyS1SVFoBRNYJhzhr2jB3Nmrzv5zYYhMmD+ROsEzUolYoHFIUEKGT4RvWuOTxPuS1sxYirt3LA/rb3qvG/1n6tEks10Ab/OQFTmebwLJuW7UymjEdLJuhGQvjLPegrzVOy4Y/u16539togyAlI7rMGD622ADL/8G+erZ4Hl9vupSiWLYTsZeThdaGWq5UPyBCDb8ysS6PvP2XTOGVDazqsTaPuJSD6nxKKpqOvB7q95Kd9YrHSostEP3XpeBB30WXllx7xF+K8i9mGnCTF21/YfV2jOTuQcOY4O9UKXfSL1RGEbBouKvy5t/cvXRFF9mfhQsoRY4MjL6inj/ARG3VKUB1rByf6Z70yfj8NHUli3/C58a3BuJz56bKMZznMHxiHJIIyn7ePT/SeEZTCq1IK2DoLZX8kHoIqbC22t3T6L8qvhbvTllRkV/qEJjkiqd84vNFSYUGonUDPkjsJ7wwm48MrDVZeB5eczli+x0SdWHnjh3M5Kr+Ic1bN86SxO0YpCGjxw5MVL41iPYAonmlk9LhmXTJhmiwXX0niamdSaCdnn3DA2/modi2qlLNYbB5Svqtkuiw1ZXZDco5ViCof4AdSRlOPX3xFRpFuJKit+t9Ghw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8784.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(66556008)(66476007)(66946007)(8676002)(4326008)(86362001)(38350700002)(38100700002)(36756003)(186003)(8936002)(26005)(6512007)(52116002)(1076003)(6506007)(41300700001)(6486002)(478600001)(316002)(2906002)(5660300002)(83380400001)(2616005)(32563001)(414714003)(473944003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1FEIMQEbeMjHB8M6VsAfvBJTQDqUqQ37rgLaFMPc4VmBja0gUfHFyer+Cid0BzByxVWF5JxZI4HNZKL704vNcr4HjHV6JaPsPaJ6orGUmg4TBed8GGzHV4Fhok71x+dpUvRz01tvmhd+QbsAkeDbfDY0NcOy0O/19inyYP8/BiW2lQ89aOTK3vz+KZEUzLkNTPagHHNLotkiEUHbGC2gwMf5M+R0eHhyKnjhT+5HpA5AYOO5tdODhRr6GHzxPzNVK4Mn3bUO8Xn4wuRgPmiPMKeSxWHAMy2yhFP/HqAnoSTPmBNj8BqEeEipj0b6K9GcqmMMY8Yzim29DhcdGTZHfgbvJthGxPQX8sdUyVh7hDBjjVEmHoXTTnXu78o8hZ1OoyLr+hlpfLng5N6di64L/fJA+Q/OZIHB1WEqw3wFc+ZdOT+7xdmimFdwRU3en8vBaE7xaly9R3L9LQrQutXmd3zseyyGC4SN78jaU0yPH997CrI5g/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jwTAHkgX3BLJdBurwxgX69fqK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38e7ec1a-0268-4f31-48b9-08da84fe167a X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8784.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2022 11:53:26.3143 (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: qm9/USsGP/s9oztejbAQ7iBV1G1H5zyGgZkF/sQKRA1C8XLdr/inkm1HaqS4RiN/LWzCU0IWRBVu6P9me8S7KA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2720 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_045329_964822_8D43132F X-CRM114-Status: UNSURE ( 9.70 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The first port of USB with type-C connector, which has dual data role and dual power role. Signed-off-by: Xu Yang --- Changes since v1: - change mux controller idle-state to MUX_IDLE_AS_IS arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 122 +++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts index f6b017ab5f53..a8e45a724fd9 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts @@ -5,6 +5,8 @@ /dts-v1/; +#include +#include #include "imx8mp.dtsi" / { @@ -65,6 +67,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 = ; + + port { + usb3_data_ss: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; + }; }; &A53_0 { @@ -299,6 +317,56 @@ LDO5 { }; }; +&i2c2 { + clock-frequency = <100000>; + 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>; + typec-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"; @@ -361,7 +429,41 @@ &uart2 { status = "okay"; }; +&usb3_phy0 { + fsl,phy-tx-vref-tune = <0xe>; + fsl,phy-tx-preemp-amp-tune = <3>; + fsl,phy-tx-vboost-level = <5>; + fsl,phy-comp-dis-tune = <7>; + fsl,pcs-tx-deemph-3p5db = <0x21>; + fsl,phy-pcs-tx-swing-full = <0x7f>; + status = "okay"; +}; + +&usb3_0 { + status = "okay"; +}; + +&usb_dwc3_0 { + dr_mode = "otg"; + hnp-disable; + srp-disable; + adp-disable; + usb-role-switch; + role-switch-default-mode = "none"; + snps,dis-u1-entry-quirk; + snps,dis-u2-entry-quirk; + status = "okay"; + + port { + usb3_drd_sw: endpoint { + remote-endpoint = <&typec_dr_sw>; + }; + }; +}; + &usb3_phy1 { + fsl,phy-tx-preemp-amp-tune = <3>; + fsl,phy-tx-vref-tune = <0xb>; status = "okay"; }; @@ -488,6 +590,13 @@ MX8MP_IOMUXC_I2C1_SDA__I2C1_SDA 0x400001c2 >; }; + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX8MP_IOMUXC_I2C2_SCL__I2C2_SCL 0x400001c2 + MX8MP_IOMUXC_I2C2_SDA__I2C2_SDA 0x400001c2 + >; + }; + pinctrl_i2c3: i2c3grp { fsl,pins = < MX8MP_IOMUXC_I2C3_SCL__I2C3_SCL 0x400001c2 @@ -527,6 +636,19 @@ MX8MP_IOMUXC_UART2_TXD__UART2_DCE_TX 0x140 >; }; + 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_usb1_vbus: usb1grp { fsl,pins = < MX8MP_IOMUXC_GPIO1_IO14__USB2_OTG_PWR 0x10