From patchwork Mon May 28 02:52:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10429709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 73A69601C7 for ; Mon, 28 May 2018 03:09:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62C4428AF5 for ; Mon, 28 May 2018 03:09:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56D5E28AF4; Mon, 28 May 2018 03:09:38 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 A751628AF4 for ; Mon, 28 May 2018 03:09:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753134AbeE1DJg (ORCPT ); Sun, 27 May 2018 23:09:36 -0400 Received: from mail-eopbgr00077.outbound.protection.outlook.com ([40.107.0.77]:9280 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752952AbeE1DJe (ORCPT ); Sun, 27 May 2018 23:09:34 -0400 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=gmaJrbocNku5dLpY3vPGdXen5rERykrAqZiddEQFftQ=; b=wyTh6fOrOzeT6eA/HDP5SPKvZWEF3TJ4jmEnH/kzQz36iYruezgS6+zJfm31oVnP3EzNhjX7IkY0uzcX6Tqv6WWMtNMB1+1aU5acnyKGtahlLopsWkpghRMpXDznE1AP8+lhKqIcoHgtxgWdmpXx4/vcwfC184n2R9Ww+hgmhM4= Received: from b47624-OptiPlex-7040.ap.freescale.net (92.121.68.129) by VI1PR0402MB3919.eurprd04.prod.outlook.com (2603:10a6:803:22::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Mon, 28 May 2018 03:09:26 +0000 From: Li Jun To: robh+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: cw00.choi@samsung.com, a.hajda@samsung.com, shufan_lee@richtek.com, peter.chen@nxp.com, garsilva@embeddedor.com, gsomlo@gmail.com, jun.li@nxp.com, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v6 04/15] usb: typec: add fwnode to tcpc Date: Mon, 28 May 2018 10:52:36 +0800 Message-Id: <1527475967-15201-5-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527475967-15201-1-git-send-email-jun.li@nxp.com> References: <1527475967-15201-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK2PR0302CA0015.apcprd03.prod.outlook.com (2603:1096:202::25) To VI1PR0402MB3919.eurprd04.prod.outlook.com (2603:10a6:803:22::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0402MB3919; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 3:zVsflv4/8erm2fi1byaI5HsHh9iRy3MtqeT3nWjYHjjmRhWZo1jFdFN7kJFPk9/QTpnD3Dy0oBwgJWFiHwk/drzeYcEhYukOw23s9mDK4JOqjczMiq4dNdv2I56NPqjawibraS0Wn8unq0ZlHveA1o3AYbhpjAl96N6liiBb/HfT6HpRBPA2OcHD4AcFN6J9jjBX1Z5UKGPnyQRYMXsTzvIPLYdtOPN091Nm7P6Ltm3bJYHajT6iWBRKrZ/xggoG; 25:q7oGRzFgPFTyTraOBBuiQjmvrnQWhvMbTvM1y4KjrNF/eNzHh2fbYWLowEZJlJSiQMiR3nqaMT5PmHWEj5BnvnlQHVTGfFXZV8HvKP1tQ96oo6Z1l+ogP1juDXHc5luYV6xJAZWuHDdTxlc98bdzo/NxUO7hVFM1ugay2VihBDKPcR1brEe6rum6xN1YfLPyGCao0Obnm/DMIPDb6WXKBzOLamyFAw6sYGN2MO5/6K8HIdrK8oOhrDiRnoJBf2Ndr6dckj4wuo9OS2clGTP/H+wEU4b5aTWaThDgsYxmm0OC/SxNRem2zxy4sn2oS2U6pyHcZCSbc2ee9EbA7DBJuA==; 31:d0luaH4YXkrlhaDGQxJ8aCilrs3vOBfS6jmFGqRMEWNUWcg/ts6S9zxUd/pMWGTXgE4t78UkZItn7wUXihWuJKl2M8hwpCpRuxx4ONdM6cckJwkNyiThAzLLqY3EQebes5+6OrvNKRB+hofRpi9pn4Hx3vgOUAMWww2R5PZA7eLNrNbqaKtrQfUvQQM35TLMHY+0EMjYbfuhf6xNPZxu13kZrFVPccT3agR/vfe9N0s= X-MS-TrafficTypeDiagnostic: VI1PR0402MB3919: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 20:HgoG0guF4gphGKGlZTNFm9kRlqoUC6GEeeJiKjL1X1MO33q119laTKLfxwINK9Th3653Ahi7zwBqjGehKBTEAJDmb7W215KLfCrn/C3uBN43cJW3euzzwYDJ8gnsloL/ZOvcnuD9cle4jQCUG9VnkBgR5n93dc09Fg1gLE8/xjG2v8X5lCdF+yAmkDDhNq9z0lRZpOX1CVIsZrPcgFpfcgAGxPWr/XBxCp5PbVxdp1j0guDuXBeo7u0O4qTLq/VdSfS7TbIEiyg/V437z7qlR5IzGQyLt85bl44bGK035+UiPcpBgUZNiiGywJHES9VlbISEKZQpTMvRjF5Ur9EzPvIGRAhnSloDY4+dP1rHxKSXLWBNOwFR2Ebs+C1iTusOwZFBw0+FQ0JlVOiE7XSE79UecILbcZjyJpkm5jjfKI7zpNMo/h4zCLoJzOyUfwKnZ+eBSrdRI+fCGjJtC+S/Gz9i+ywkcnI8M9GLLHGVKHmeg+KuzmV2nGabwe6p4iMG; 4:eUQZcMPqgoMKcNSNtLGJGkSq/ZExanrYjPKLcwzQWUD/gaEmtddZfIW3ZHo89lZqoDxKShDCkNfsYgYDA7HEP3ic3CKa2OznUoloEFsbKaujI4qzWTC2yO7+BQSfw0hHEH5VGUBZ4leFIhfWEToXqvKOvFtMaUo+UXDmHFPN3kXtxbel+mjP3Z+Yhc+frBGUAfa1tb6dEAckX5SWO9K1bHiB8GCb4JZVoMbdSvbsCaLanJJpo/Okcb8nPmG17FijfdBGDbDvlBncRE8A2gHZwiWu4GX7lVSnhdT6zW4+xi86nyr3O+92yJEugmUkiw9PgJO58N0b/ettLW6fCblPCEZEzQDWMemqU+5s9gsHuF8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0402MB3919; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0402MB3919; X-Forefront-PRVS: 06860EDC7B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(39860400002)(366004)(346002)(376002)(199004)(189003)(6506007)(8676002)(16526019)(305945005)(26005)(7736002)(386003)(486006)(446003)(48376002)(11346002)(956004)(2616005)(2906002)(66066001)(81156014)(186003)(3846002)(81166006)(478600001)(8936002)(50466002)(6486002)(5660300001)(6116002)(6666003)(7416002)(36756003)(50226002)(47776003)(39060400002)(476003)(86362001)(106356001)(68736007)(53936002)(51416003)(105586002)(59450400001)(16586007)(316002)(4326008)(6512007)(76176011)(97736004)(25786009)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB3919; H:b47624-OptiPlex-7040.ap.freescale.net; 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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0402MB3919; 23:dqDJVVJ6HqZRsrb/vCKsiA+Ox2rkGwYZaLlasHw?= =?us-ascii?Q?MIlq4Ou7BSUmqXUuI8NTvt5cUta6j8d95LQMFrpQZXDcVNrqMBoafUbGYg74?= =?us-ascii?Q?DTlCyRItgLf3S3yciT5mT2iXNGiazi48y4XykDIXC1/Nk6z/Tc+LSfMcZtXx?= =?us-ascii?Q?V+OGFjhKNJkSdAGsQxnYTV0ptz7KYf04m5AX77XSnIgWMJbM/ySK4K9toeEP?= =?us-ascii?Q?xY1WFwMd+pYZ3AjQCJr92KeW2iJx7V306G8nxvoiqGQnQUOBlp+25L2k0R4U?= =?us-ascii?Q?ZKQObl54byeqGn5lon7kgfaBw1/LkSX96ARV9+iBTtZRk7jSzF/r+RVOmTzq?= =?us-ascii?Q?pXoc1K+v8uQlTz97bSArYXHJsm9S0o/D7Db7IUodXHsu7f4qNL0Jz3z7qqvZ?= =?us-ascii?Q?xgkYgSewiLU/tReqibqx7xR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pZP16PnJxuNYqNgkYsztQl5+xN+seg2FevZWcrTDQMm17+9bNpajhs8QVAbNfyuAHOcxN0ss0ySxI58Ks/AfPn4g46w6fyLnkCrSP8CsGZ/jNL5u/oSjVz965VPPips2KLB67sWdXhuQjUxk1pR1F0q5zU1k0kqny3yj1a8zkx3wEWatrRToiLn8g2dq1TNfEugh8TUX8KOTE1GYdI4X0I X-MS-Office365-Filtering-Correlation-Id: 589b87bb-181b-42e0-8e21-08d5c4486e9b X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2018 03:09:26.2045 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 589b87bb-181b-42e0-8e21-08d5c4486e9b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3919 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 Add fwnode handle to get the fwnode so we can get typec configs it contains. Suggested-by: Heikki Krogerus Signed-off-by: Li Jun Reviewed-by: Heikki Krogerus --- drivers/staging/typec/tcpci.c | 7 +++++++ drivers/usb/typec/tcpm.c | 1 + include/linux/usb/tcpm.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index dd29288..e59547a 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -474,6 +475,12 @@ static int tcpci_parse_config(struct tcpci *tcpci) /* TODO: Populate struct tcpc_config from ACPI/device-tree */ tcpci->tcpc.config = &tcpci_tcpc_config; + tcpci->tcpc.fwnode = device_get_named_child_node(tcpci->dev, + "connector"); + if (!tcpci->tcpc.fwnode) { + dev_err(tcpci->dev, "Can't find connector node.\n"); + return -EINVAL; + } return 0; } diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index 0ccd2ce..fcd22e8 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -4581,6 +4581,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) else port->try_role = TYPEC_NO_PREFERRED_ROLE; + port->typec_caps.fwnode = tcpc->fwnode; port->typec_caps.prefer_role = tcpc->config->default_role; port->typec_caps.type = tcpc->config->type; port->typec_caps.data = tcpc->config->data; diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h index b231b93..193920a 100644 --- a/include/linux/usb/tcpm.h +++ b/include/linux/usb/tcpm.h @@ -110,6 +110,7 @@ enum tcpc_mux_mode { /** * struct tcpc_dev - Port configuration and callback functions * @config: Pointer to port configuration + * @fwnode: Pointer to port fwnode * @get_vbus: Called to read current VBUS state * @get_current_limit: * Optional; called by the tcpm core when configured as a snk @@ -138,6 +139,7 @@ enum tcpc_mux_mode { */ struct tcpc_dev { const struct tcpc_config *config; + struct fwnode_handle *fwnode; int (*init)(struct tcpc_dev *dev); int (*get_vbus)(struct tcpc_dev *dev);