From patchwork Fri Mar 3 14:33:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 658583 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 077A1C7EE32 for ; Fri, 3 Mar 2023 14:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231238AbjCCOeY (ORCPT ); Fri, 3 Mar 2023 09:34:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231294AbjCCOeV (ORCPT ); Fri, 3 Mar 2023 09:34:21 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4A351287C for ; Fri, 3 Mar 2023 06:34:05 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id b20so1671969pfo.6 for ; Fri, 03 Mar 2023 06:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677854045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=79Uwb6iDaWyQVJjZrRJ473QcWA7ttMYiWdGYGLA3qE0=; b=K6DPnUEhwAuq3ZfNxMIvOPR4SUuvBcbDP2j+8IK7g6phQeQaBx40sRrTwGVA5hkuyF gYIzWVSiB+ON2Y/GuvUTmuWTEbZQHKwyQ4KChVELGR2ZT5FzPcxtF8JD4lENhVH3jOj8 SEnz34mo0XPVbLXqUo1fl9VNQbZz461GH7YpE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677854045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=79Uwb6iDaWyQVJjZrRJ473QcWA7ttMYiWdGYGLA3qE0=; b=G3aWNQoAWr25VIjjuWn4YosEVpt74cHnrum5Rjrzfjib+GkQiBL+uGobl53QbVjqpA 79C9qGVeIXL7JQpr9ch+RpUFaHhnL2fXcZf0yYZAXAW4kFoz8e8w0z3unbYyh14iZRGt Ci5ooBKdSgGeNn+91hGYiLGVC+9HOvcpDqVnwYWSELBRzbbE0gbguvs313VOhs/urEKk DbfPwleCZEXq9fRxUxVl8yFa9wK7z+wHefV0RbGNU0buOMP3gi+pH0/gpgrieo9E499C pfeTuns5b1Q/T4JLafB+iz0852/hVeC9jU30VD5J/PCvPR/tbsjbbyfvIT+XsF2p3+PM vtLg== X-Gm-Message-State: AO0yUKWenD8jK0UIwbsIqU/e32XtTN1uUIJjsBQmDKrq252scGWexJck hUN/zw3e4qCZkovEutDAWNzGzg== X-Google-Smtp-Source: AK7set8h4+hsoLy5T3/JD6xdGPxFqv6a3VOB7IL+KpQMvfnOj+90dWvkkyB4VFJoObht4fS0rgBaOA== X-Received: by 2002:a62:38d7:0:b0:5de:7ef1:d03a with SMTP id f206-20020a6238d7000000b005de7ef1d03amr2054923pfa.19.1677854045367; Fri, 03 Mar 2023 06:34:05 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:55e5:8423:31ee:83dd]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm1767214pfn.15.2023.03.03.06.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:34:05 -0800 (PST) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck Cc: Xin Ji , Javier Martinez Canillas , Lyude Paul , linux-kernel@vger.kernel.org, Pin-yen Lin , AngeloGioacchino Del Regno , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , Marek Vasut , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Stephen Boyd , linux-acpi@vger.kernel.org Subject: [PATCH v13 01/10] device property: Add remote endpoint to devcon matcher Date: Fri, 3 Mar 2023 22:33:41 +0800 Message-Id: <20230303143350.815623-2-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303143350.815623-1-treapking@chromium.org> References: <20230303143350.815623-1-treapking@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Prashant Malani When searching the device graph for device matches, check the remote-endpoint itself for a match. Some drivers register devices for individual endpoints. This allows the matcher code to evaluate those for a match too, instead of only looking at the remote parent devices. This is required when a device supports two mode switches in its endpoints, so we can't simply register the mode switch with the parent node. Signed-off-by: Prashant Malani Signed-off-by: Pin-yen Lin --- Changes in v13: - Update the kernel doc of fwnode_connection_find_match Changes in v12: - Check the availability of the device node in fwnode_graph_devcon_matches - Ensured valid access to "matches" in fwnode_graph_devcon_matches - Updated the documentation in fwnode_connection_find_match(es) - Dropped collected tags due to the new changes Changes in v11: - Added missing fwnode_handle_put in drivers/base/property.c Changes in v10: - Collected Reviewed-by and Tested-by tags Changes in v6: - New in v6 drivers/base/property.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 083a95791d3b..4426ac2b16ca 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -1243,6 +1243,23 @@ static unsigned int fwnode_graph_devcon_matches(const struct fwnode_handle *fwno continue; } + ret = match(node, con_id, data); + fwnode_handle_put(node); + if (ret) { + if (matches) + matches[count] = ret; + count++; + + if (matches && count >= matches_len) + break; + } + + /* + * Some drivers may register devices for endpoints. Check + * the remote-endpoints for matches in addition to the remote + * port parent. + */ + node = fwnode_graph_get_remote_endpoint(ep); ret = match(node, con_id, data); fwnode_handle_put(node); if (ret) { @@ -1293,8 +1310,11 @@ static unsigned int fwnode_devcon_matches(const struct fwnode_handle *fwnode, * @match: Function to check and convert the connection description * * Find a connection with unique identifier @con_id between @fwnode and another - * device node. @match will be used to convert the connection description to - * data the caller is expecting to be returned. + * device node. For fwnode graph connections, the graph endpoints are also + * checked. @match will be used to convert the connection description to data + * the caller is expecting to be returned. + * + * Return: The pointer to the matched node, or NULL on error. */ void *fwnode_connection_find_match(const struct fwnode_handle *fwnode, const char *con_id, void *data, @@ -1325,9 +1345,10 @@ EXPORT_SYMBOL_GPL(fwnode_connection_find_match); * @matches_len: Length of @matches * * Find up to @matches_len connections with unique identifier @con_id between - * @fwnode and other device nodes. @match will be used to convert the - * connection description to data the caller is expecting to be returned - * through the @matches array. + * @fwnode and other device nodes. For fwnode graph connections, the graph + * endpoints are also checked. @match will be used to convert the connection + * description to data the caller is expecting to be returned through the + * @matches array. * If @matches is NULL @matches_len is ignored and the total number of resolved * matches is returned. * From patchwork Fri Mar 3 14:33:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 658582 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D4F6C64EC4 for ; Fri, 3 Mar 2023 14:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230511AbjCCOeo (ORCPT ); Fri, 3 Mar 2023 09:34:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbjCCOeZ (ORCPT ); Fri, 3 Mar 2023 09:34:25 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58F6B35264 for ; Fri, 3 Mar 2023 06:34:17 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id x20-20020a17090a8a9400b00233ba727724so5744638pjn.1 for ; Fri, 03 Mar 2023 06:34:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677854057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AAe1qBjWtdED9AstXrt9rv3n4n6WXsj4dKOkEJMZEYk=; b=BcMXu/PzVPLm7t9ercrELihthPFjuDJ7bqkzgcAMc84wyKJWRHCw6cLYfmadop3imw gMolLKY7rV7MrHF2xTSzgLQPP5M1PiBbr3Nikel8CUsnn5sAVB4YijvpZNFfL/QSKBAJ K6qkOUCKdHwNvJGelP3mAJl28Re7jkJ6/0Cb0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677854057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AAe1qBjWtdED9AstXrt9rv3n4n6WXsj4dKOkEJMZEYk=; b=bQdYrxHfdIsW+CXaKW/M2w3ilL1kRmtx4A0EXPun7gMZo/lBRa+TmmEEZJiTFhZ8HF ZFv0lZR5gYEqcGpnMrzTm3QoHol+r3Vp63dFofE3BQ463CFvd2cMRfjlhTb/pm/7NwMj 0gComGTU6A6Zx4+fAMJCgp55Sny+/6/RQHXIGH7h/UcMGyLaJojWSjO6Cdj1Ko/zLs3i io8HFu1uidFY/Ph3WCDgYMTKBrNE6tmmK0E5qmrJbmP1HTfZHTSfeJHfLbWLvhKzP4K2 Ucu/e9l1c15WgYfA7WlNnFLTl36B3frOj1UEXxb0nO8dq/POvCyeW4cgqswK2ISptBcy sOkA== X-Gm-Message-State: AO0yUKWoIekVvbhT4DAxdlUbjTZyWIZrbKshEzGbAGxCEr2NgOSoLw5y MzDcChZoc4yVVB/A+MuQQh2kTQ== X-Google-Smtp-Source: AK7set+651dq/DtmSSdzZ+LNxna1IkAVHhBLtFi25i3gdC22UNoityhet+tKs2JR4bnIyIyjcEkiZg== X-Received: by 2002:a05:6a20:748b:b0:cd:83b1:4236 with SMTP id p11-20020a056a20748b00b000cd83b14236mr2145117pzd.36.1677854056777; Fri, 03 Mar 2023 06:34:16 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:55e5:8423:31ee:83dd]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm1767214pfn.15.2023.03.03.06.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:34:16 -0800 (PST) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck Cc: Xin Ji , Javier Martinez Canillas , Lyude Paul , linux-kernel@vger.kernel.org, Pin-yen Lin , AngeloGioacchino Del Regno , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , Marek Vasut , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Stephen Boyd , linux-acpi@vger.kernel.org, Alex Deucher , Douglas Anderson , Imre Deak , Jani Nikula , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= Subject: [PATCH v13 03/10] drm/display: Add Type-C switch helpers Date: Fri, 3 Mar 2023 22:33:43 +0800 Message-Id: <20230303143350.815623-4-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303143350.815623-1-treapking@chromium.org> References: <20230303143350.815623-1-treapking@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add helpers to register and unregister Type-C "switches" for bridges capable of switching their output between two downstream devices. The helper registers USB Type-C mode switches when the "mode-switch" and the "reg" properties are available in Device Tree. Signed-off-by: Pin-yen Lin --- Changes in v13: - Add typec_mode_switch_node_count helper - Fix style issues Changes in v12: - Add fwnode_for_each_typec_mode_switch macro - Remove a duplicated dmesg in the helper - Used IS_REACHABLE instead to guard the function signatures Changes in v11: - Use fwnode helpers instead of DT - Moved the helpers to a new file - Use "reg" instead of "data-lanes" to determine the port number - Dropped collected tags due to new changes Changes in v10: - Collected Reviewed-by and Tested-by tags - Replaced "void *" with "typec_mux_set_fn_t" for mux_set callbacks - Print out the node name when errors on parsing DT - Use dev_dbg instead of dev_warn when no Type-C switch nodes available - Made the return path of drm_dp_register_mode_switch clearer Changes in v8: - Fixed the build issue when CONFIG_TYPEC=m - Fixed some style issues Changes in v7: - Extracted the common codes to a helper function - New in v7 drivers/gpu/drm/display/Makefile | 1 + drivers/gpu/drm/display/drm_dp_typec_helper.c | 105 ++++++++++++++++++ include/drm/display/drm_dp_helper.h | 46 ++++++++ 3 files changed, 152 insertions(+) create mode 100644 drivers/gpu/drm/display/drm_dp_typec_helper.c diff --git a/drivers/gpu/drm/display/Makefile b/drivers/gpu/drm/display/Makefile index 17ac4a1006a8..ef80b9fde615 100644 --- a/drivers/gpu/drm/display/Makefile +++ b/drivers/gpu/drm/display/Makefile @@ -14,5 +14,6 @@ drm_display_helper-$(CONFIG_DRM_DISPLAY_HDMI_HELPER) += \ drm_scdc_helper.o drm_display_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o drm_display_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o +drm_display_helper-$(CONFIG_TYPEC) += drm_dp_typec_helper.o obj-$(CONFIG_DRM_DISPLAY_HELPER) += drm_display_helper.o diff --git a/drivers/gpu/drm/display/drm_dp_typec_helper.c b/drivers/gpu/drm/display/drm_dp_typec_helper.c new file mode 100644 index 000000000000..0c705a4bca24 --- /dev/null +++ b/drivers/gpu/drm/display/drm_dp_typec_helper.c @@ -0,0 +1,105 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +static int drm_dp_register_mode_switch(struct device *dev, + struct fwnode_handle *fwnode, + struct drm_dp_typec_switch_desc *switch_desc, + void *data, typec_mux_set_fn_t mux_set) +{ + struct drm_dp_typec_port_data *port_data; + struct typec_mux_desc mux_desc = {}; + char name[32]; + u32 port_num; + int ret; + + ret = fwnode_property_read_u32(fwnode, "reg", &port_num); + if (ret) { + dev_err(dev, "Failed to read reg property: %d\n", ret); + return ret; + } + + port_data = &switch_desc->typec_ports[port_num]; + port_data->data = data; + port_data->port_num = port_num; + port_data->fwnode = fwnode; + mux_desc.fwnode = fwnode; + mux_desc.drvdata = port_data; + snprintf(name, sizeof(name), "%pfwP-%u", fwnode, port_num); + mux_desc.name = name; + mux_desc.set = mux_set; + + port_data->typec_mux = typec_mux_register(dev, &mux_desc); + if (IS_ERR(port_data->typec_mux)) { + ret = PTR_ERR(port_data->typec_mux); + dev_err(dev, "Mode switch register for port %d failed: %d\n", + port_num, ret); + return ret; + } + + return 0; +} + +/** + * drm_dp_register_typec_switches() - register Type-C switches + * @dev: Device that registers Type-C switches + * @port: Device node for the switch + * @switch_desc: A Type-C switch descriptor + * @data: Private data for the switches + * @mux_set: Callback function for typec_mux_set + * + * This function registers USB Type-C switches for DP bridges that can switch + * the output signal between their output pins. + * + * Currently only mode switches are implemented, and the function assumes the + * given @port device node has endpoints with "mode-switch" property. + * The port number is determined by the "reg" property of the endpoint. + */ +int drm_dp_register_typec_switches(struct device *dev, struct fwnode_handle *port, + struct drm_dp_typec_switch_desc *switch_desc, + void *data, typec_mux_set_fn_t mux_set) +{ + struct fwnode_handle *sw; + int ret; + + switch_desc->num_typec_switches = typec_mode_switch_node_count(port); + if (!switch_desc->num_typec_switches) { + dev_dbg(dev, "No Type-C switches node found\n"); + return 0; + } + + switch_desc->typec_ports = devm_kcalloc(dev, switch_desc->num_typec_switches, + sizeof(struct drm_dp_typec_port_data), + GFP_KERNEL); + if (!switch_desc->typec_ports) + return -ENOMEM; + + /* Register switches for each connector. */ + for_each_typec_mode_switch_node(port, sw) { + ret = drm_dp_register_mode_switch(dev, sw, switch_desc, data, mux_set); + if (ret) + goto err_unregister_typec_switches; + } + + return 0; + +err_unregister_typec_switches: + fwnode_handle_put(sw); + drm_dp_unregister_typec_switches(switch_desc); + return ret; +} +EXPORT_SYMBOL(drm_dp_register_typec_switches); + +/** + * drm_dp_unregister_typec_switches() - unregister Type-C switches + * @switch_desc: A Type-C switch descriptor + */ +void drm_dp_unregister_typec_switches(struct drm_dp_typec_switch_desc *switch_desc) +{ + unsigned int i; + + for (i = 0; i < switch_desc->num_typec_switches; i++) + typec_mux_unregister(switch_desc->typec_ports[i].typec_mux); +} +EXPORT_SYMBOL(drm_dp_unregister_typec_switches); diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index ab55453f2d2c..fb359b0cc8e8 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -763,4 +764,49 @@ bool drm_dp_downstream_rgb_to_ycbcr_conversion(const u8 dpcd[DP_RECEIVER_CAP_SIZ const u8 port_cap[4], u8 color_spc); int drm_dp_pcon_convert_rgb_to_ycbcr(struct drm_dp_aux *aux, u8 color_spc); +struct drm_dp_typec_port_data { + struct typec_mux_dev *typec_mux; + int port_num; + struct fwnode_handle *fwnode; + void *data; +}; + +struct drm_dp_typec_switch_desc { + int num_typec_switches; + struct drm_dp_typec_port_data *typec_ports; +}; + +#define for_each_typec_mode_switch_node(port, sw) \ + fwnode_for_each_child_node((port), (sw)) \ + for_each_if(fwnode_property_present((sw), "mode-switch")) + +static inline unsigned int typec_mode_switch_node_count(struct fwnode_handle *port) +{ + struct fwnode_handle *sw; + unsigned int count = 0; + + for_each_typec_mode_switch_node(port, sw) + count++; + + return count; +} + +#if IS_REACHABLE(CONFIG_TYPEC) +void drm_dp_unregister_typec_switches(struct drm_dp_typec_switch_desc *switch_desc); +int drm_dp_register_typec_switches(struct device *dev, struct fwnode_handle *port, + struct drm_dp_typec_switch_desc *switch_desc, + void *data, typec_mux_set_fn_t mux_set); +#else +static inline void drm_dp_unregister_typec_switches(struct drm_dp_typec_switch_desc *switch_desc) +{ +} +static inline int drm_dp_register_typec_switches( + struct device *dev, struct fwnode_handle *port, + struct drm_dp_typec_switch_desc *switch_desc, void *data, + typec_mux_set_fn_t mux_set) +{ + return -EOPNOTSUPP; +} +#endif + #endif /* _DRM_DP_HELPER_H_ */ From patchwork Fri Mar 3 14:33:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 658581 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 406E8C7EE2F for ; Fri, 3 Mar 2023 14:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231336AbjCCOez (ORCPT ); Fri, 3 Mar 2023 09:34:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231342AbjCCOea (ORCPT ); Fri, 3 Mar 2023 09:34:30 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 174D718150 for ; Fri, 3 Mar 2023 06:34:22 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id y2so2694642pjg.3 for ; Fri, 03 Mar 2023 06:34:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677854062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PNqMvcSR7fV+nG4ZpLQQUo4Z8GgUt8riFBleH8/sH1g=; b=nWCY+/r+PntjVztOGkJni/Ez3spDswwLiOFy1qRlJrK83UNi106FOIFCL1li20iWty sa1izZWEFHMZvo8002X0asfckemO5ECxdEfk9nNP4WMyneD1BTHUw6X9Yol7M4gZsJyb EPAGGlg8Mj1ZICR8ALvx2fyf4FL33lMcdrMYE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677854062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PNqMvcSR7fV+nG4ZpLQQUo4Z8GgUt8riFBleH8/sH1g=; b=My3JcpvfW8EQ8PlXBiLnFd6xeO35qBfJEokIwCA5rl5HwoGqpEjRwZ4TUIw85732p9 qRBXGSs/iKyDF4PC0fR4Iwg6lxMIy6bQPYJSmRgFtOhyQb5lKigElMiTXyTWPZ7XUyb6 ASvVxp4BN/a8J2dJUD9PdBVK0PXA/s0OU4qBzlWl9ZnUVVehVdVklCDN4FPvYP3I47u6 WmQmtKbntWBXTWjRfZEQdCXx/LgthN1KzUGQ9/tVaRqvvhdYZsY3g8K2ryNfVJ3dzQmE bgrAwPCRvxZRrLLdjE0gSYctNabldT36UtyxsJEPYwM6lSkVF9xjlNWmzsVgCuTQy5aL dtYw== X-Gm-Message-State: AO0yUKV326eo7mW0+e+kBZUCvPZVYnTmoiNhFduPYHdNxMxH8KRjE7KX nvVgXjKszlpq5kuJcoE3ilNSOg== X-Google-Smtp-Source: AK7set9oFzLH3hNjbl5lfcSdc9akwuwCWoaFqmzxW4YbUPSiVYr94sjMS2KS1hXyfXLc/Uk/s24Rnw== X-Received: by 2002:a05:6a20:918a:b0:c7:249:cd8c with SMTP id v10-20020a056a20918a00b000c70249cd8cmr2040436pzd.5.1677854062290; Fri, 03 Mar 2023 06:34:22 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:55e5:8423:31ee:83dd]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm1767214pfn.15.2023.03.03.06.34.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:34:22 -0800 (PST) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck Cc: Xin Ji , Javier Martinez Canillas , Lyude Paul , linux-kernel@vger.kernel.org, Pin-yen Lin , AngeloGioacchino Del Regno , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , Marek Vasut , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Stephen Boyd , linux-acpi@vger.kernel.org, Krzysztof Kozlowski , Chen-Yu Tsai Subject: [PATCH v13 04/10] dt-bindings: display: bridge: anx7625: Add mode-switch support Date: Fri, 3 Mar 2023 22:33:44 +0800 Message-Id: <20230303143350.815623-5-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303143350.815623-1-treapking@chromium.org> References: <20230303143350.815623-1-treapking@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Analogix 7625 can be used in systems to switch the DP traffic between two downstreams, which can be USB Type-C DisplayPort alternate mode lane or regular DisplayPort output ports. Update the binding to accommodate this usage by introducing a data-lanes and a mode-switch property on endpoints. Also include the link to the product brief in the bindings. Signed-off-by: Pin-yen Lin Reviewed-by: Krzysztof Kozlowski Reviewed-by: Chen-Yu Tsai Tested-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- (no changes since v12) Changes in v12: - Removed the 4-lane binding in analogix,anx7625.yaml - Reworded the description for the mode-switch property Changes in v11: - Updated the description of the endpoints - Referenced video-interfaces.yaml instead for the endpoints Changes in v10: - Collected Reviewed-by and Tested-by tags Changes in v9: - Collected Reviewed-by tag Changes in v8: - Updated anx7625 bindings for data-lane property - Fixed the subject prefix Changes in v7: - Fixed issues reported by dt_binding_check - Updated the schema and the example dts for data-lanes. - Changed to generic naming for the example dts node. Changes in v6: - Remove switches node and use endpoints and data-lanes property to describe the connections. .../display/bridge/analogix,anx7625.yaml | 88 ++++++++++++++++++- 1 file changed, 85 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml index 4590186c4a0b..a50de536cffd 100644 --- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml +++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml @@ -12,7 +12,8 @@ maintainers: description: | The ANX7625 is an ultra-low power 4K Mobile HD Transmitter - designed for portable devices. + designed for portable devices. Product brief is available at + https://www.analogix.com/en/system/files/AA-002291-PB-6-ANX7625_ProductBrief.pdf properties: compatible: @@ -112,9 +113,40 @@ properties: data-lanes: true port@1: - $ref: /schemas/graph.yaml#/properties/port + $ref: /schemas/graph.yaml#/$defs/port-base description: - Video port for panel or connector. + Video port for panel or connector. Each endpoint connects to a video + output downstream, and the "data-lanes" property is used to describe + the pin connections. 0, 1, 2, 3 in "data-lanes" maps to SSRX1, SSTX1, + SSRX2, SSTX2, respectively. + + patternProperties: + "^endpoint@[01]$": + $ref: /schemas/media/video-interfaces.yaml# + properties: + reg: true + + remote-endpoint: true + + data-lanes: + oneOf: + - items: + - enum: [0, 1, 2, 3] + + - items: + - const: 0 + - const: 1 + + - items: + - const: 2 + - const: 3 + + mode-switch: + type: boolean + description: Serves as Type-C mode switch if present. + + required: + - remote-endpoint required: - port@0 @@ -186,3 +218,53 @@ examples: }; }; }; + - | + i2c3 { + #address-cells = <1>; + #size-cells = <0>; + + encoder@58 { + compatible = "analogix,anx7625"; + reg = <0x58>; + pinctrl-names = "default"; + pinctrl-0 = <&anx7625_dp_pins>; + enable-gpios = <&pio 176 GPIO_ACTIVE_HIGH>; + reset-gpios = <&pio 177 GPIO_ACTIVE_HIGH>; + vdd10-supply = <&pp1100_dpbrdg>; + vdd18-supply = <&pp1800_dpbrdg_dx>; + vdd33-supply = <&pp3300_dpbrdg_dx>; + analogix,audio-enable; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + anx7625_dp_in: endpoint { + bus-type = <7>; + remote-endpoint = <&dpi_out>; + }; + }; + + port@1 { + #address-cells = <1>; + #size-cells = <0>; + + reg = <1>; + anx_typec0: endpoint@0 { + reg = <0>; + mode-switch; + data-lanes = <0 1>; + remote-endpoint = <&typec_port0>; + }; + anx_typec1: endpoint@1 { + reg = <1>; + mode-switch; + data-lanes = <2 3>; + remote-endpoint = <&typec_port1>; + }; + }; + }; + }; + }; From patchwork Fri Mar 3 14:33:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 658580 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AD09C678D4 for ; Fri, 3 Mar 2023 14:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231181AbjCCOfa (ORCPT ); Fri, 3 Mar 2023 09:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231345AbjCCOe4 (ORCPT ); Fri, 3 Mar 2023 09:34:56 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8602618BB for ; Fri, 3 Mar 2023 06:34:38 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id u20so1665887pfm.7 for ; Fri, 03 Mar 2023 06:34:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677854078; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0WQCtIpN0vW3WeC5J5/ZzTqRVNK29lVBlXhY9t+k/LI=; b=WwoRWkTcB2W4tKlj1LYD5nnZ94byFgmumF3L2Q7QqpApUreQ2UjyT9oi6O6cxdYiEn LVQx0TtD9P9Vwtf/Auf/pfhU5xJieOtM3OaOJtefjH2BIWfx6H5pFcM6dklGwA4JP+oU 7OqdHoOcQ2X3qnOhO+IN+4xe7pOr3SVqgF1IU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677854078; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0WQCtIpN0vW3WeC5J5/ZzTqRVNK29lVBlXhY9t+k/LI=; b=CGSBZQ+06Na9TaYhDSSKAQomMsU4xyRCmPbyXlmXy8GnTh4qq+gHRY+xc8dp+EQCGA iwWeVboFj+NfEQrmkOqBLA4IJbqDjEK1ZAlFwM9zV99umDoN3/xopI82GpxHCeI5y0Ok HMvg9rv+8qyDK8vlbV4GQcaMLp/kfN5R6Xa8K3vUXDkEUGw9o9kAFma8KbbF2HS8cw7E 0mIWTbsDiZt9C8y5pm0GImvY90vfxjek/9v/ICV37pAkMITqaJO1Md1SAg/xRoTrzGQy vvKxNBcP5qWUf+IXycv+EcdR4WxNPkWnDHjmex6B7Sz0U/LAommgm2aG41MjrZKtWSFU RDcQ== X-Gm-Message-State: AO0yUKWV7sTHg/QAxXLTsNbsUg9ceZgDH7yBpQINRtZxT6is9YFeuNau mMoeARMOuvXDQ8XN5H/2S4qBzg== X-Google-Smtp-Source: AK7set8lHxrfx1f8LS/n8x57HZE/Gn3Ooy9p99N0eXD+ex9Itry+Gas99FXNlgDRrzWXe8DnsjUx2A== X-Received: by 2002:a62:1814:0:b0:5ef:6f18:9d55 with SMTP id 20-20020a621814000000b005ef6f189d55mr1851837pfy.28.1677854078458; Fri, 03 Mar 2023 06:34:38 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:55e5:8423:31ee:83dd]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm1767214pfn.15.2023.03.03.06.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:34:38 -0800 (PST) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck Cc: Xin Ji , Javier Martinez Canillas , Lyude Paul , linux-kernel@vger.kernel.org, Pin-yen Lin , AngeloGioacchino Del Regno , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , Marek Vasut , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Stephen Boyd , linux-acpi@vger.kernel.org Subject: [PATCH v13 07/10] drm/bridge: anx7625: Register Type C mode switches Date: Fri, 3 Mar 2023 22:33:47 +0800 Message-Id: <20230303143350.815623-8-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303143350.815623-1-treapking@chromium.org> References: <20230303143350.815623-1-treapking@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Register USB Type-C mode switches when the "mode-switch" property and relevant ports are available in Device Tree. Configure the crosspoint switch based on the entered alternate mode for a specific Type-C connector. Crosspoint switch can also be used for switching the output signal for different orientations of a single USB Type-C connector, but the orientation switch is not implemented yet. A TODO is added for this. Signed-off-by: Pin-yen Lin --- (no changes since v12) Changes in v12: - Fixed style issues in anx7625 driver - Fixed the inverted orientation setting in anx7625 driver - Changed "&ctx->client->dev" to "ctx->dev" - Fix style issues - Updated the error logs when parsing data-lanes property Changes in v11: - Added back "data-lanes" parsing logics - Removed Kconfig dependency - Updated the usage of the private data - Dropped Tested-by tag because of the new changes Changes in v10: - Added a TODO for implementing orientation switch for anx7625 - Updated the commit message for the absence of orientation switch - Fixed typo in the commit message - Collected Tested-by tag Changes in v7: - Fixed style issues in anx7625 driver - Removed DT property validation in anx7625 driver. - Extracted common codes to another commit. Changes in v6: - Squashed to a single patch drivers/gpu/drm/bridge/analogix/anx7625.c | 149 ++++++++++++++++++++++ drivers/gpu/drm/bridge/analogix/anx7625.h | 20 +++ 2 files changed, 169 insertions(+) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 76d46db3f8dc..4361a1b52a67 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include @@ -2570,6 +2572,146 @@ static void anx7625_runtime_disable(void *data) pm_runtime_disable(data); } +static void anx7625_set_crosspoint_switch(struct anx7625_data *ctx, + enum typec_orientation orientation) +{ + if (orientation == TYPEC_ORIENTATION_NORMAL) { + anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_0, + SW_SEL1_SSRX_RX1 | SW_SEL1_DPTX0_RX2); + anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_1, + SW_SEL2_SSTX_TX1 | SW_SEL2_DPTX1_TX2); + } else if (orientation == TYPEC_ORIENTATION_REVERSE) { + anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_0, + SW_SEL1_SSRX_RX2 | SW_SEL1_DPTX0_RX1); + anx7625_reg_write(ctx, ctx->i2c.tcpc_client, TCPC_SWITCH_1, + SW_SEL2_SSTX_TX2 | SW_SEL2_DPTX1_TX1); + } +} + +static void anx7625_typec_two_ports_update(struct anx7625_data *ctx) +{ + unsigned int i; + + /* Check if both ports available and do nothing to retain the current one */ + if (ctx->port_data[0].dp_connected && ctx->port_data[1].dp_connected) + return; + + for (i = 0; i < 2; i++) { + if (ctx->port_data[i].dp_connected) + anx7625_set_crosspoint_switch(ctx, + ctx->port_data[i].orientation); + } +} + +static int anx7625_typec_mux_set(struct typec_mux_dev *mux, + struct typec_mux_state *state) +{ + struct drm_dp_typec_port_data *port = typec_mux_get_drvdata(mux); + struct anx7625_data *ctx = port->data; + struct device *dev = ctx->dev; + struct drm_dp_typec_switch_desc switch_desc = ctx->switch_desc; + bool new_dp_connected, old_dp_connected; + + if (switch_desc.num_typec_switches == 1) + return 0; + + wait_for_completion(&ctx->mux_register); + + old_dp_connected = ctx->port_data[0].dp_connected || + ctx->port_data[1].dp_connected; + + ctx->port_data[port->port_num].dp_connected = + state->alt && + state->alt->svid == USB_TYPEC_DP_SID && + state->alt->mode == USB_TYPEC_DP_MODE; + + dev_dbg(dev, "mux_set dp_connected: c0=%d, c1=%d\n", + ctx->port_data[0].dp_connected, ctx->port_data[1].dp_connected); + + new_dp_connected = ctx->port_data[0].dp_connected || + ctx->port_data[1].dp_connected; + + /* DP on, power on first */ + if (!old_dp_connected && new_dp_connected) + pm_runtime_get_sync(dev); + + anx7625_typec_two_ports_update(ctx); + + /* DP off, power off last */ + if (old_dp_connected && !new_dp_connected) + pm_runtime_put_sync(dev); + + return 0; +} + +static void anx7625_unregister_typec_switches(struct anx7625_data *ctx) +{ + drm_dp_unregister_typec_switches(&ctx->switch_desc); +} + +static int anx7625_register_typec_switches(struct device *dev, struct anx7625_data *ctx) +{ + struct device_node *port_node = of_graph_get_port_by_id(dev->of_node, 1); + struct drm_dp_typec_switch_desc *switch_desc = &ctx->switch_desc; + int ret; + u32 dp_lanes[4]; + unsigned int i, num_lanes; + + /* + * Currently, only mode switch is implemented. + * TODO: Implement Type-C orientation switch for anx7625. + */ + ret = drm_dp_register_typec_switches(dev, &port_node->fwnode, + &ctx->switch_desc, ctx, + anx7625_typec_mux_set); + if (ret) + return ret; + + ctx->port_data = devm_kcalloc( + dev, switch_desc->num_typec_switches, + sizeof(struct anx7625_typec_port_data), GFP_KERNEL); + + if (!ctx->port_data) { + ret = -ENOMEM; + goto unregister_mux; + } + + for (i = 0; i < switch_desc->num_typec_switches; i++) { + struct drm_dp_typec_port_data *port = &switch_desc->typec_ports[i]; + struct fwnode_handle *fwnode = port->fwnode; + + ret = fwnode_property_count_u32(fwnode, "data-lanes"); + if (ret < 0) { + dev_err(dev, + "Error on getting data lanes count from %pfwP: %d\n", + fwnode, ret); + goto unregister_mux; + } + num_lanes = ret; + + ret = fwnode_property_read_u32_array(fwnode, "data-lanes", + dp_lanes, num_lanes); + if (ret) { + dev_err(dev, + "Failed to read the data-lanes variable: %d\n", + ret); + goto unregister_mux; + } + + ctx->port_data[i].orientation = (dp_lanes[0] / 2 == 0) ? + TYPEC_ORIENTATION_REVERSE : TYPEC_ORIENTATION_NORMAL; + ctx->port_data[i].dp_connected = false; + } + complete_all(&ctx->mux_register); + + return 0; + +unregister_mux: + complete_all(&ctx->mux_register); + anx7625_unregister_typec_switches(ctx); + return ret; +} + static int anx7625_i2c_probe(struct i2c_client *client) { struct anx7625_data *platform; @@ -2607,6 +2749,7 @@ static int anx7625_i2c_probe(struct i2c_client *client) mutex_init(&platform->lock); mutex_init(&platform->hdcp_wq_lock); + init_completion(&platform->mux_register); INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func); platform->hdcp_workqueue = create_workqueue("hdcp workqueue"); @@ -2677,6 +2820,10 @@ static int anx7625_i2c_probe(struct i2c_client *client) if (platform->pdata.intp_irq) queue_work(platform->workqueue, &platform->work); + ret = anx7625_register_typec_switches(dev, platform); + if (ret && ret != -ENODEV) + dev_warn(dev, "Didn't register Type-C switches, err: %d\n", ret); + platform->bridge.funcs = &anx7625_bridge_funcs; platform->bridge.of_node = client->dev.of_node; if (!anx7625_of_panel_on_aux_bus(&client->dev)) @@ -2728,6 +2875,8 @@ static void anx7625_i2c_remove(struct i2c_client *client) drm_bridge_remove(&platform->bridge); + anx7625_unregister_typec_switches(platform); + if (platform->pdata.intp_irq) destroy_workqueue(platform->workqueue); diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h index 5af819611ebc..5a200da34800 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.h +++ b/drivers/gpu/drm/bridge/analogix/anx7625.h @@ -55,6 +55,18 @@ #define HPD_STATUS_CHANGE 0x80 #define HPD_STATUS 0x80 +#define TCPC_SWITCH_0 0xB4 +#define SW_SEL1_DPTX0_RX2 BIT(0) +#define SW_SEL1_DPTX0_RX1 BIT(1) +#define SW_SEL1_SSRX_RX2 BIT(4) +#define SW_SEL1_SSRX_RX1 BIT(5) + +#define TCPC_SWITCH_1 0xB5 +#define SW_SEL2_DPTX1_TX2 BIT(0) +#define SW_SEL2_DPTX1_TX1 BIT(1) +#define SW_SEL2_SSTX_TX2 BIT(4) +#define SW_SEL2_SSTX_TX1 BIT(5) + /******** END of I2C Address 0x58 ********/ /***************************************************************/ @@ -449,6 +461,11 @@ struct anx7625_i2c_client { struct i2c_client *tcpc_client; }; +struct anx7625_typec_port_data { + bool dp_connected; + enum typec_orientation orientation; +}; + struct anx7625_data { struct anx7625_platform_data pdata; struct platform_device *audio_pdev; @@ -479,6 +496,9 @@ struct anx7625_data { struct drm_connector *connector; struct mipi_dsi_device *dsi; struct drm_dp_aux aux; + struct completion mux_register; + struct drm_dp_typec_switch_desc switch_desc; + struct anx7625_typec_port_data *port_data; }; #endif /* __ANX7625_H__ */ From patchwork Fri Mar 3 14:33:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 658579 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C9C1C7EE2F for ; Fri, 3 Mar 2023 14:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231415AbjCCOfv (ORCPT ); Fri, 3 Mar 2023 09:35:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231410AbjCCOfQ (ORCPT ); Fri, 3 Mar 2023 09:35:16 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D274C36092 for ; Fri, 3 Mar 2023 06:34:53 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id y10so1666721pfi.8 for ; Fri, 03 Mar 2023 06:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677854089; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CHVZ+VnNQY1VzPPlDo4RAP9i6Qbo3Pi6kDQ9LweBh7g=; b=kZ0gy0TVDYVpEyx5k1fBhAVMme5rXgg/SwT+VwriFqd/bnnTL0q+8vDp6ehCEg2aY6 xelzU7n+xvy2CnzEIM1bUOfnR9xJ/KpPJodkmQtBBr8SDXcLEgw/PnBMBy5jUziK6O0s IPzeB+jIzMOp+jhYirvAYNkhS7ZPGea2ftW8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677854089; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CHVZ+VnNQY1VzPPlDo4RAP9i6Qbo3Pi6kDQ9LweBh7g=; b=cT2TRwCg5cwrT8i8Y/dYmma83nspAkZDeJjawaH8DY2aTIke6KeQj5HIDYhGtvdfKa K6exIcCXib3xCCfSsGFqJLrmKt81pcWxjUSWQfUqa+wgGfwenUX27da4bmLzfbVBsuRC FlvwOaW0qXbt6YksM7dVGdw54wViqFhxBeAAI87S4Sz+6X3D1tFxwf28BmZgr9v7TQVV txxwBOHok4SYIJFqBYETsBNlRBvi3uF91XEqv+FuefqPbkM3SVV/IWD5iixsu5dXHNCb a2BhJwdmSTskmqX2624sndjoI4qUcbh7EQ2BmF+O5A/0KiCzspTkyJkRFlaJh/mVjs2p l+eA== X-Gm-Message-State: AO0yUKWhuj7t//DH9Lh3NkuPFzf2XpnkJrHbxim0pRq7bJHUfiEjglM/ yfZ5yoZWEFdz70DG6TRopN/8Ug== X-Google-Smtp-Source: AK7set/Su9/qxF3FX+QXeLLKhYKjpjcqzHxNBx3i8bX87evueJgBJYEN/za47i65oUATzsME96OaTA== X-Received: by 2002:a62:1882:0:b0:60d:461a:d03c with SMTP id 124-20020a621882000000b0060d461ad03cmr2228523pfy.27.1677854089079; Fri, 03 Mar 2023 06:34:49 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:55e5:8423:31ee:83dd]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm1767214pfn.15.2023.03.03.06.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:34:48 -0800 (PST) From: Pin-yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck Cc: Xin Ji , Javier Martinez Canillas , Lyude Paul , linux-kernel@vger.kernel.org, Pin-yen Lin , AngeloGioacchino Del Regno , chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= , Marek Vasut , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Stephen Boyd , linux-acpi@vger.kernel.org Subject: [PATCH v13 09/10] drm/bridge: it6505: Fix Kconfig indentation Date: Fri, 3 Mar 2023 22:33:49 +0800 Message-Id: <20230303143350.815623-10-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303143350.815623-1-treapking@chromium.org> References: <20230303143350.815623-1-treapking@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Replace the spaces with tab characters in the Kconfig file. Signed-off-by: Pin-yen Lin Reviewed-by: AngeloGioacchino Del Regno --- (no changes since v10) Changes in v10: - Collected Reviewed-by tag Changes in v7: - New in v7 drivers/gpu/drm/bridge/Kconfig | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 12e8f30c65f7..28dc7711bf5f 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -74,19 +74,19 @@ config DRM_FSL_LDB Support for i.MX8MP DPI-to-LVDS on-SoC encoder. config DRM_ITE_IT6505 - tristate "ITE IT6505 DisplayPort bridge" - depends on OF + tristate "ITE IT6505 DisplayPort bridge" + depends on OF select DRM_DISPLAY_DP_HELPER select DRM_DISPLAY_HDCP_HELPER select DRM_DISPLAY_HELPER - select DRM_DP_AUX_BUS - select DRM_KMS_HELPER - select DRM_DP_HELPER - select EXTCON - select CRYPTO - select CRYPTO_HASH - help - ITE IT6505 DisplayPort bridge chip driver. + select DRM_DP_AUX_BUS + select DRM_KMS_HELPER + select DRM_DP_HELPER + select EXTCON + select CRYPTO + select CRYPTO_HASH + help + ITE IT6505 DisplayPort bridge chip driver. config DRM_LONTIUM_LT8912B tristate "Lontium LT8912B DSI/HDMI bridge"