From patchwork Tue Jun 26 23:45:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10490331 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 DAADF60386 for ; Wed, 27 Jun 2018 00:02:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD1DD1FF13 for ; Wed, 27 Jun 2018 00:02:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C126226E54; Wed, 27 Jun 2018 00:02:50 +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 414441FF13 for ; Wed, 27 Jun 2018 00:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932166AbeF0ACs (ORCPT ); Tue, 26 Jun 2018 20:02:48 -0400 Received: from mail-eopbgr00079.outbound.protection.outlook.com ([40.107.0.79]:52544 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932104AbeF0ACq (ORCPT ); Tue, 26 Jun 2018 20:02:46 -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=sI0awf0Xf9aPqWuSFM9t+PUCrtFdOuGMvAC75jb7cMc=; b=XV1DmFPA9v5x1fioTXddOKCkndP4dg2MUVKO+tSB7jqo/T7jSSHf8/Oh4+VaDUfLXvk1h2p6kU0XVivvbYglwvHD7xssLWAg2GJjL/vFKpDr7HbYZeGBMoWj19FaPxYHNL17gEhwZNtwounYjUClviwubSmAd4TQbzpC/E9w0o4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; Received: from b47624-OptiPlex-7040.ap.freescale.net (92.121.68.129) by AM0PR0402MB3908.eurprd04.prod.outlook.com (2603:10a6:208:f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.22; Wed, 27 Jun 2018 00:02:40 +0000 From: Li Jun To: robh+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: a.hajda@samsung.com, jun.li@nxp.com, cw00.choi@samsung.com, shufan_lee@richtek.com, peter.chen@nxp.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v8 04/14] usb: typec: add fwnode to tcpc Date: Wed, 27 Jun 2018 07:45:22 +0800 Message-Id: <1530056732-9640-5-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530056732-9640-1-git-send-email-jun.li@nxp.com> References: <1530056732-9640-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK0P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::23) To AM0PR0402MB3908.eurprd04.prod.outlook.com (2603:10a6:208:f::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dfcd953e-46c5-4230-1aa9-08d5dbc14f40 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM0PR0402MB3908; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 3:g7SLQC1N6WrqpiEml1zaEaK/r/GCFhGiCyyBxq/aAWnIpNJpDBR4zlA/Qrxn0pfS4UzKwhqIfMlkWZK5bMPSuVKKux2uHrHUzHYov/ZPKzj7NktLtKujXp2VSZgNMrmd8o/oMEri/h6+uUtnOTnFaKe8RBgNUv1MIz2C2yYQnZ64M3/sqOFslH0JgSD545ZBkzxKrzcjTM4YIPYQUbv8lkcWXI35wbi0q3DrSLJTWQEVo/WrEA+8p5zlvFCW+Kbb; 25:frqCKm0KWZVZPRHMSrW/76ifKoWxpdHBB3rFEQXD4K12eJBE5WQXq5nfuhah+1kUk7nrWbXbCmWs85ovzinwCMKPd/+EeES4Y+HEmEORauyMpYXlQ8o/f+k9D98NuUI+AlivLMWemo3AAA89wXinNU67k18r7xq+7a/d3i/1PeRb4zmNtehoYujcjbosM2+rpvnpoYeheeSYqXdwFskLTAp0hlU4jTkkFNYekpy2/gXC7FlkUiZ9Cxu/ILuCwIX9pWMAt1kVGfgOI9GijwrbBC9LDT7swHecQQ/rq+Z9e2ppPfjtOj2oNkwQup2KYtPUTp6zsEtZ09Bbr4lAm6TOzA==; 31:e8jCIzQs2jk9cWM5htqwJjra5nDUQKG82P/1swm0lO0chi9ybn8ObcsCMH9Dhu9hpK9vTrd1GOMWho8UvaUYx78USY9d/cDcuZrBileausaLd7QQqAm/na6BsIR3mURNByTKIN2wHU7GKMP/xfgemNSU1Sd+lXOoE0ovO6dsQq6zAvPFIO54AdAldYvy0y3BrRiRXVFeyID6yhFh9PoVA1VLF9bm6y9VLqo5V0ItF/Q= X-MS-TrafficTypeDiagnostic: AM0PR0402MB3908: X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 20:GGR9HJKO/XyYxsSvJOjUm4kSsLEiJhWrzUjghihYlULdP38u8EfKwBpiHfILWqJ0yaylha32fzlzO6ZZLemh7JxLU8XHxjlswbdoIinmoWiMHcVaxBnFQ80sjHcYLZd9hw1SMFjvLcXkg/BrO/4PQr9TXZ3EJYhzX5MsK3KI2zG5LAkGlJ5AHu4RcRok2AKMOjrraMfDK3RytN6cBh1TVNMj7Fgw03AY2zy8KKEqWWe3RTIkbP2yC+McGvu+W/AV03VA5dV3I3TrxstQhPMdtCzsUZrbK4GhzxO+CSLLmnK1k9ZcLUB5/WbpJye4hxj/nh1EXDVP/KtsAj1O6LWVCrpIg2C+q/Ym1oAMxruPQ3/VHpPLMn8dKgB0uar6kAGm6+5F97SjCjIGdxfVC5AJkUjld5qwIE4Zp14eco9EPTvi/+6YA/QEGJZzwBeGpvKUfkT6r0Ft3+1U/axezFHKJGdxz3TjJpf439vm2pmgVveNmE9Ad/gPr5pCM76GxMfS; 4:GEZIGsFVso/Ne6deMING+578b1N5ODzEYocTrPeAp6c8rGvK0OnMfMID93ZdneMKNSDe3if9zpwIe72d3UcEpBZYnw6Mk6X9T2LYg++aAK+yJBrC6TAedNaQls9VevgVzQvTwVwu9aL4j/GhCivwe5M6w7aw1Jf8+H7V5gk7KO1wtIk21t0JNbCTJLzcfdsa4+1LeNoEDqGqHqWNhwR21Vi5ki1hcHl5bRoGziVLV9fXwnrvuX3g68nX8Odkv5b7vfyZ9cBdXXuMvMk9gXiWP0A2fwJz/e/TFUZMQCNa4hDhHhYjWEGXRZTIj5tLCof+HEcN/uevnk2sqSI/9C89+S6Vo5BcVVWH2E8CrH79KZw= 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)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM0PR0402MB3908; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0402MB3908; X-Forefront-PRVS: 0716E70AB6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(376002)(366004)(39860400002)(396003)(189003)(199004)(2906002)(14444005)(7736002)(26005)(6486002)(305945005)(486006)(48376002)(478600001)(86362001)(25786009)(4326008)(16526019)(186003)(36756003)(50466002)(16586007)(68736007)(6512007)(47776003)(51416003)(52116002)(53936002)(3846002)(386003)(6506007)(6116002)(76176011)(316002)(97736004)(50226002)(476003)(2616005)(956004)(6666003)(11346002)(446003)(106356001)(8936002)(81156014)(66066001)(5660300001)(81166006)(8676002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0402MB3908; H:b47624-OptiPlex-7040.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR0402MB3908; 23:mBXHJRlFGGRvGR508SN7JkOVnv176gSn/o0xln3?= =?us-ascii?Q?cPFCYkxMAJpFUSO920hyoD8NfhcPVg9mtJvBo7kUIHUfmudeg/af4YvkvkPp?= =?us-ascii?Q?ev9BGFf9Yk1tlpNCr7h9/qrXtvL4cuVls/2dky8sE6v5MnXMXhyO5thNvqWs?= =?us-ascii?Q?9o2LfFriJX/QPacslm8rXS6GRqr8PYY1qViEl4O8HroTCSIl8Rane5MIN087?= =?us-ascii?Q?JznTZ2OmOXSnIIj3HSq44Uy6jOuHUzOWaOEkQ5s4EEKtoUAlm/zoQm/TaViQ?= =?us-ascii?Q?WzvfxPcJo1ZiGY2Fy9/7Go/nd8qTgWEx1eSFvtQ1LP4115sIdjx6LcOCOc0D?= =?us-ascii?Q?EEdWEsYydls/4HLeivrjbq5CFU9/uWLiT2Fay3iZOMQZwWiaCgqf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3TpG0FN6eE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 7:o2CYD5B8P8W/rnWQFXbuGA97TDPyjTKxO2GjgZrRM7+Vi1jt1RYUtjr9FwonjhWrN7xA4UOO0Mx87P3jDTm7y3r6McvmWjH9NNGhSJ+Q9DV5uGOkp1qrOPH8Q219lM7qhuQLQ2NepxUHFaAA1QOluGNVSQT/etwLgP5lypDkqpto5Pu3mY6aWck63FAb0f4LElJqq4Qy2hcuRKKUL7ZSzwDED7mm1cp45RkCio8pJKQPeRdPE8ygKyf45LKVJZiy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2018 00:02:40.2877 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dfcd953e-46c5-4230-1aa9-08d5dbc14f40 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3908 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 Reviewed-by: Heikki Krogerus Signed-off-by: Li Jun Reviewed-by: Guenter Roeck --- 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 8a201dd..d22b37b 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -4576,6 +4576,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);