From patchwork Thu May 3 00:24:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10376829 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 D74076038F for ; Thu, 3 May 2018 00:41:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4DBA29137 for ; Thu, 3 May 2018 00:41:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7B3029153; Thu, 3 May 2018 00:41:37 +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 1B63D29137 for ; Thu, 3 May 2018 00:41:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751852AbeECAlf (ORCPT ); Wed, 2 May 2018 20:41:35 -0400 Received: from mail-eopbgr10049.outbound.protection.outlook.com ([40.107.1.49]:21440 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751747AbeECAld (ORCPT ); Wed, 2 May 2018 20:41:33 -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; bh=RYWmn0lnLOzSEa5yvACBjFv3p1F9sFiAMSXhfVnJ3wo=; b=BS+uA2Fqb7q0CoO9otba72kbpPZ64Ek0yXtyX7wqxw3Ge8uYhz7Bzj/vc9+MmUQ4W7C+5waFqtw1deCtqP/p3cfjoFrbruVzSdFs/G4DQ4GWMys3sPmi4YSLsKPsqAnDMr4pcb6baVcDxaYrQDXYh510L2nALKkKfy7hDszZwGs= 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 DB3PR0402MB3914.eurprd04.prod.outlook.com (2603:10a6:8:f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.24; Thu, 3 May 2018 00:41:25 +0000 From: Li Jun To: robh+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: jun.li@nxp.com, a.hajda@samsung.com, cw00.choi@samsung.com, shufan_lee@richtek.com, peter.chen@nxp.com, gsomlo@gmail.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v5 04/14] usb: typec: add fwnode to tcpc Date: Thu, 3 May 2018 08:24:44 +0800 Message-Id: <1525307094-27402-5-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525307094-27402-1-git-send-email-jun.li@nxp.com> References: <1525307094-27402-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: OSAPR01CA0012.jpnprd01.prod.outlook.com (2603:1096:603:2a::24) To DB3PR0402MB3914.eurprd04.prod.outlook.com (2603:10a6:8:f::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0402MB3914; X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB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o574ywK09+Q7du0NceDVXuuDgb9u7dOCot7F74tG4wtgMGdoLjKur6orr1mGAsrtu0ykQyjYZ72Lih7uZRdtE1DJdGPQxiK7Tvk7JgK0MchVmgfED18nxRq2qRBOQfg1l5aMrg130kJ2ulqccpA7iIaFe0FgFt4SAogsRMAsvy21UV54MiPhv+0/vVdMD4Px2MXTsLrrsqRyybagtLcAKjrV/vwH1EZ+EEsZhN/JR72mWqVH4ZxVj9VCgF9Tf07JKEXoqsX4dafFyTeeSmpEGTBiH/RKxKLEhkE82Mo2nJXFkvjYlaMa3Wzd1dhoaBPe/8/XS24o6w0CjIBvJFsDJSWzP; 4:drC7ShiLlbfDNVQsMaUYJyanhclNJvYIP1NYjNtr0JYHA486TtnV0qlMKh6SnLQmzkEJgAyPWTuLjNRiT9wiWD6P3Gp4fu/Rl1AjxGpLQIthhe8HfGyyTRWASrYHZ4XUTttQzmvXES1a3XaJs/8xsakYeVPetTyD4TVqV4rf/ZXdXekNA2y/HGPjQMyF3ECoBh4p0M9rTAcnd+DD1Fu/Z+/zvZMFvGHR9/gy0vBJMJdBvbD5fQkfQIl8qdFgE74qS+vw5EnBX8JlROQU09f5aHTxggn5ARUakJbLlrj+kB929nc2Mz8ixqHXkjGl8CltOtAfVP05OB2euQgKKx3eb8thfoEM/gBSZJWQ+cZ4gT4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(6055026)(6041310)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DB3PR0402MB3914; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0402MB3914; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(39860400002)(346002)(366004)(189003)(199004)(7416002)(47776003)(7736002)(8936002)(66066001)(305945005)(106356001)(2906002)(5660300001)(6486002)(105586002)(6116002)(3846002)(6666003)(81166006)(8676002)(50226002)(68736007)(81156014)(36756003)(956004)(2616005)(386003)(16586007)(476003)(50466002)(6506007)(59450400001)(6512007)(97736004)(316002)(446003)(39060400002)(52116002)(26005)(76176011)(48376002)(4326008)(11346002)(486006)(16526019)(86362001)(51416003)(53936002)(186003)(478600001)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0402MB3914; 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; DB3PR0402MB3914; 23:xc4fMH7ruFUjE4EvcHMqtcAu52aapItZWCDCGjj?= =?us-ascii?Q?mywg+jxUprYYHkJO81JHVWMvpICc0zn3dyq32U0Ti+wt70kTAmxhlW3O+5vH?= =?us-ascii?Q?ChXqVIkh3qQI7QihEF7+W6nq7qQPJll81XDfHWTP4cdx+F6Df/RwzKMByO4U?= =?us-ascii?Q?0T+Tmfyq2FYJhJy+/pdIZbJfle58+y0f4mEjqNzfWlwYrYyuVJjbUrnMaNhA?= =?us-ascii?Q?E5bPof/qmjvV+7s+wRbtQ/tW/Rdu13pXRq+fD/xCCzzZX3N24rTJkoYYXsIw?= =?us-ascii?Q?gJEQVeIg05vaXO3RyVmU6F6CGJepldOKC2JW476sduImSchQ42AG6I8Rga1H?= =?us-ascii?Q?Mgn1nq0FsjNpLYL+zRtdrxOTzfvWM4OS3+thQmCcfYhISHlwYzoeNhI9Fofs?= =?us-ascii?Q?jw8Zu2JwXo4l3hBHp5qfqsUrI1bzwTyZnq/AzJkJpKre2wmd9FYdxM0rOyDC?= =?us-ascii?Q?O9uzddNttCE6Q7Im2+NhthbkV67Ma3SZzsChOuoc69wuyiOaLxIor6xdj5v0?= =?us-ascii?Q?DVwW38jMmxKAhjaQEdSrHqOrzvKq8qvKeF9xxrWdO7jk9jHlKh9qi6d3Tste?= =?us-ascii?Q?/lTda28PcUKVSCocj94WC3embwVqj+6JWEEB9ZMhD4Tl9nesicSg4m34cvZs?= =?us-ascii?Q?XayzZgo4DCGLzLBKxL5PomuQ19tq9Zd4RSBn+IXnoq7QTk2Rh7bIJUL7/8oS?= =?us-ascii?Q?7LNanBc0p4fizEQtSGSZAck929tdg7r8vPY+4y+BCPBCgRALSMITNDssoY7j?= =?us-ascii?Q?OUeEIurKdExMfgQ20jDcsS1h9xRkobsg1kttWLnQTDJi32qQjii6r6xjbtkw?= =?us-ascii?Q?gGku65+HT++aTOV78auwFTjSPPagYg/H0eTg5CUAedvm72plF1Z2/hWY6JBk?= =?us-ascii?Q?77ttyHNwJvyVTndsH5Hh3WylOj9WBfsPOOETOBNji7I7t/E7O/Yen3WfpgQH?= =?us-ascii?Q?0ObB1KelGGYwv0j9yOwawmkoS1LeBYMwrWkVoPZDdDW/qbYvbWrulqcwqNXi?= =?us-ascii?Q?owjyA8yXbredNrqxIRnDQzilCjxHGmv9eBr/dp70BOIAOZn4v4E/j28Boeho?= =?us-ascii?Q?h3ruNSvpKybjsMiW9rlpConNSpd7jLz0QOi+VOl7HbAdZvY9tWTm7YEkPsVz?= =?us-ascii?Q?H3dqLkUBpOc8jdlD6lqtYWfrIUscl/o4o6ObXP9Ao0GAUsQYiJSy9yZRjVbX?= =?us-ascii?Q?QNVR3hk9Wp31fpQv9FvwTGIbCqjg0+NsacSfw0iYAdpnDB8ctK1NXpOOfcw?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Antispam-Message-Info: uCOQ3fwl8YxSnFWokNm+cOH6cEcOnkl5Gp1YwQ4cJL5+3Mq4tv3O/0S4DCl7KtWkaX9mcJwF6RPFm2A7riE0+87DPtSbImGbusFTTtERZC4kxxpm5KvdaAUdnkVCMUAT8LrXLr/Mm0wWn1N5Kb6lAArs8y4tQpA+f+zO7fQ3Ozdq+sgZRipbia9pfkeqw7T8 X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 6:9Xa7quBAapef2EOoIKI96KjJZDEn8xCWiVojlfh1mStqtkoAbCN+HSjsRLIDMrLiOApQm+R22i4o3R8UYeC1kdzbhFg/ixNlKKXl2Iznn1IahZBnEpAkx31tNH/AOleINers74J8CvMxroNUmh6lpTXzgGaEmG66+RJSviV4TlB0M5PpoVTXlhyjiW3JakW6y4Tct5LPf0bu7okkkPwVX/0udAoMVOZ0+Uj8vkC84p8H/gsydHUx2EcWZz2VjYGgO5IHoI9jEFexOQcEa/cGhLUNwL/fcpx5qD9YxnYsy6sRUZ299D7sTZphkmcmeRCHlDUlTU3z1avJaYkiJR9P38cJ4eHzLt+oIVmaxtmqxiza611N8iY3DuVJTIZSHlm8l5zVAJiz+tzt8L7li+6u2TthJBbgmrhpkVnz+CNaCnoBkewa38MuDnLV8zilRyfMKFRW4hJP2uDUva/g2wkpAw==; 5:ASoMv0TKM2qNGe2ZaxrYW6KQD3zIvaLcUB2OA7tmj/r9soOX8soYNUW87piTTZYcW9AKX04vO4TPy19a0CgjGXmBUK69GVf7mtZ6II2UiG4Fpf7HGPoDultaHWaGRzCxrCVSaF8GPKPFvXOAp5b/NIQesW1U5p3o/UbS2dxsXaQ=; 24:yQrs525acmVubYqS/a1A68IwMf4rZcLhHUzw7IPr8xWXED34tfF3i1GwtLbm8dv7rfR47WcrqMDBVpKz7fkB4qWcjAxGrsf3wLb/17e2+jw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 7:eTZiZEvoY7rdBZjgptYROIsITDr+8N5jruXYkZHKjnevNoXqjZzQLHk0CROGEQHvlTCVJG6NENvE2XjxlhS8JzbXiOtQEEw8LLwp0q4OQtkJRHNzfRJhAKS7GFQe7JFbC/1bNEvQ+/LWk3q3GwB5E7TVTLieoQ5c3tzZ0pEQd0Rp5GNSYKMDKzJQoFgBzXGEwsUqqmwSk3BW0EDkPy/JHKfYkfyL3vphdfOhvEtQYz9+mlKp3GkGVEjVyv601t/C X-MS-Office365-Filtering-Correlation-Id: b751512a-2233-427f-2b4e-08d5b08e9cdc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 00:41:25.0686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b751512a-2233-427f-2b4e-08d5b08e9cdc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3914 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 --- 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 741a80a..01d14fb 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 7ee417a..80b2303 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -4579,6 +4579,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);