From patchwork Sun Dec 3 11:43:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 749808 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aubHynUW" Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30E58107 for ; Sun, 3 Dec 2023 03:43:38 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50bc053a9a7so4880276e87.1 for ; Sun, 03 Dec 2023 03:43:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701603816; x=1702208616; darn=vger.kernel.org; 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=Aam3IeZZYou7qOiCLTfYpnFJoW7z3fkJsLhT2kv0/so=; b=aubHynUWayLjEk/toIzXpDUGsLaop4D0ZeEQydzx4oSX1bBhe9k2d85a545W/cuao9 RgdzqLWgJxdG/6LKlAkQX3hFUF4Slh2pwYbFSbO/CK+QJnVyoxO+Yfxn/gKfCPuIBab/ jdmSOrkNxQo8O93KavUU0tOJOdwMQpgKMg+z+iTpT2SOrN2ngc494rDAIuXRtsSqOPF5 n92ffSh0y8oI+pSCOxP0opBwVmLQ1x8EDjQ7IHXrog61UceTGYT67PAmLG5SNCmw5hIM Ujkuws2pr04zo1CRngKsoHzBcDiQnIA0Bz2CoV1d/nduRNsJ8OgSrA9LB2VqePTqKeSX Y3dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701603816; x=1702208616; 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=Aam3IeZZYou7qOiCLTfYpnFJoW7z3fkJsLhT2kv0/so=; b=KWgqq6uM6v4/WcpGP2zOhqTK1zc7h1ekTdoYiie2Mk1BCU4J15CBDIsxlLmFWsK+ls o5TgKHxZzBmZ2imWCsI1aeLi7TKo/hCAYy6r6eTN8WYZRRS/+6Dg6asKarSLTDufBIZ/ nm0BGg+ma4+I49aJM6IpXaEKnSyS/TXAeJCXpUrEam08SxYpeFqaq5Bq3Evejz2tshrP /K8iKdBABDny5JAm2CJ6rckkeGh7W8Y0TV8143eBVll6tV1cS5iwZXW0Xt09lfOONlw2 0O0GtNlScV+cvpPYxYqC5Jzc5Bdbr9R7p3ML97MOBUv41Udtb5Ipv735p2ZV4mZmFR/K /E4w== X-Gm-Message-State: AOJu0YwH+osgjUcsUQmckAEPO6vo0I2XEefu4oVmJIdFDDOwPxhSFnFk OuQ8iAwvHV1CY/mvJcZWHSmeng== X-Google-Smtp-Source: AGHT+IGQOl1f6KMGAm7kO5TDXZyrRAW/4peDnzvo3+EM4Ij4eFCpMQ47UXHc7VDNe3+gkvzZ/FZ8Dg== X-Received: by 2002:a19:2d05:0:b0:50b:f0e5:70fd with SMTP id k5-20020a192d05000000b0050bf0e570fdmr191998lfj.103.1701603816108; Sun, 03 Dec 2023 03:43:36 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o17-20020a2e90d1000000b002c993c5d4c6sm894666ljg.105.2023.12.03.03.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:43:35 -0800 (PST) From: Dmitry Baryshkov To: Greg Kroah-Hartman , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, Vinod Koul Subject: [PATCH RESEND 2/6] phy: qcom: qmp-combo: switch to DRM_AUX_BRIDGE Date: Sun, 3 Dec 2023 14:43:29 +0300 Message-Id: <20231203114333.1305826-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> References: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Switch to using the new DRM_AUX_BRIDGE helper to create the transparent DRM bridge device instead of handcoding corresponding functionality. Acked-by: Vinod Koul Signed-off-by: Dmitry Baryshkov --- drivers/phy/qualcomm/Kconfig | 2 +- drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 44 ++--------------------- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/drivers/phy/qualcomm/Kconfig b/drivers/phy/qualcomm/Kconfig index d891058b7c39..846f8c99547f 100644 --- a/drivers/phy/qualcomm/Kconfig +++ b/drivers/phy/qualcomm/Kconfig @@ -63,7 +63,7 @@ config PHY_QCOM_QMP_COMBO depends on DRM || DRM=n select GENERIC_PHY select MFD_SYSCON - select DRM_PANEL_BRIDGE if DRM + select DRM_AUX_BRIDGE if DRM_BRIDGE help Enable this to support the QMP Combo PHY transceiver that is used with USB3 and DisplayPort controllers on Qualcomm chips. diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c index 0417856b8e7b..435cd849e82e 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include @@ -1419,8 +1419,6 @@ struct qmp_combo { struct clk_hw dp_link_hw; struct clk_hw dp_pixel_hw; - struct drm_bridge bridge; - struct typec_switch_dev *sw; enum typec_orientation orientation; }; @@ -3191,44 +3189,6 @@ static int qmp_combo_typec_switch_register(struct qmp_combo *qmp) } #endif -#if IS_ENABLED(CONFIG_DRM) -static int qmp_combo_bridge_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) -{ - struct qmp_combo *qmp = container_of(bridge, struct qmp_combo, bridge); - struct drm_bridge *next_bridge; - - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) - return -EINVAL; - - next_bridge = devm_drm_of_get_bridge(qmp->dev, qmp->dev->of_node, 0, 0); - if (IS_ERR(next_bridge)) { - dev_err(qmp->dev, "failed to acquire drm_bridge: %pe\n", next_bridge); - return PTR_ERR(next_bridge); - } - - return drm_bridge_attach(bridge->encoder, next_bridge, bridge, - DRM_BRIDGE_ATTACH_NO_CONNECTOR); -} - -static const struct drm_bridge_funcs qmp_combo_bridge_funcs = { - .attach = qmp_combo_bridge_attach, -}; - -static int qmp_combo_dp_register_bridge(struct qmp_combo *qmp) -{ - qmp->bridge.funcs = &qmp_combo_bridge_funcs; - qmp->bridge.of_node = qmp->dev->of_node; - - return devm_drm_bridge_add(qmp->dev, &qmp->bridge); -} -#else -static int qmp_combo_dp_register_bridge(struct qmp_combo *qmp) -{ - return 0; -} -#endif - static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, struct device_node *np) { struct device *dev = qmp->dev; @@ -3440,7 +3400,7 @@ static int qmp_combo_probe(struct platform_device *pdev) if (ret) return ret; - ret = qmp_combo_dp_register_bridge(qmp); + ret = drm_aux_bridge_register(dev); if (ret) return ret; From patchwork Sun Dec 3 11:43:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 749807 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZTldTEWj" Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9593C10E for ; Sun, 3 Dec 2023 03:43:38 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2c9fe0b5b28so2374891fa.1 for ; Sun, 03 Dec 2023 03:43:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701603817; x=1702208617; darn=vger.kernel.org; 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=Vgu14wOUYfk/aPZS3WEVtfQrsxZGJfAenmY4bb1CTCI=; b=ZTldTEWjWGqZvbGUdzbsS/7n6xPBHQ0Ok8MwF7aqrrgUdtL2XXSxDBqngAOs2XJXxE F/qr2JvgMWptJvtat6f+rmPDxrLIIj8lxyYRzI1TCyWISGFozLdYpOSLiNLeHkNf5MAx KZYV0+CG6uOjDNAhzvyV2Lbsmwcl8RYF4zujX4UHdqj36u1U085I/HBZSMHcLQOns7ca G84JHSMf2IHRvkKLZwepgbMQa6zNbfRAGXvEmgO6n1YNYY4lzBHI3Mc8TqCQaKKc2bAp AG9eI9fiDWDdLo9w4UfJB61SYCZU1faa/kHNzkZPn6xl4HGl9T6UTSnfF+UZUaplbkPU 9oWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701603817; x=1702208617; 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=Vgu14wOUYfk/aPZS3WEVtfQrsxZGJfAenmY4bb1CTCI=; b=JqdIa2YscBsFoRibt41XRNXitJpEQdn/IgIrtPSuCyrvBUVOH8bmak6T2Pzsoq9mnq RkfafElWWn+xj1BW0Hc3lW0I+MAAO51uHf3EqBwmYRVwYkvDTI5CoT4z4TZHTPej7emn CPerg/lchKhwPKyBrcma4NpAqkwGA8rrZnaIDxV+Jdf/7D+qDkps1Dp8s4VnN1OkJlQO YCl3zaAjvhxZEQVOm8RxJRcWEJy4gH8tY7q28f5unyI093xNeQh1GGUiV+PByqW5dHO9 et7QMDCrjCJHRjNyHDc4TGiLYvuZnEkhaoZRGbAEDDNbpSgpR9m+fHWTUnxZOtfEVuis A9VA== X-Gm-Message-State: AOJu0YyIm5g1r7uXPROaxEdytZsHdejUQp3L1yB77nyiCfGaUGKMSgiV VCSOjq9G1AwTMoMfohDkc75CFA== X-Google-Smtp-Source: AGHT+IGpdl7fWJQIGxRsBqrjE7aHBfv9IPEeR4THl/btbgpbWHaLxkg6rn7d/QZw8P7QZDpNwlZcTA== X-Received: by 2002:a2e:a3c6:0:b0:2c9:d862:c64a with SMTP id w6-20020a2ea3c6000000b002c9d862c64amr2041950lje.55.1701603816803; Sun, 03 Dec 2023 03:43:36 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o17-20020a2e90d1000000b002c993c5d4c6sm894666ljg.105.2023.12.03.03.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:43:36 -0800 (PST) From: Dmitry Baryshkov To: Greg Kroah-Hartman , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH RESEND 3/6] usb: typec: nb7vpq904m: switch to DRM_AUX_BRIDGE Date: Sun, 3 Dec 2023 14:43:30 +0300 Message-Id: <20231203114333.1305826-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> References: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Switch to using the new DRM_AUX_BRIDGE helper to create the transparent DRM bridge device instead of handcoding corresponding functionality. Reviewed-by: Heikki Krogerus Acked-by: Greg Kroah-Hartman Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/mux/Kconfig | 2 +- drivers/usb/typec/mux/nb7vpq904m.c | 44 ++---------------------------- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig index 816b9bd08355..5120942f309d 100644 --- a/drivers/usb/typec/mux/Kconfig +++ b/drivers/usb/typec/mux/Kconfig @@ -40,7 +40,7 @@ config TYPEC_MUX_NB7VPQ904M tristate "On Semiconductor NB7VPQ904M Type-C redriver driver" depends on I2C depends on DRM || DRM=n - select DRM_PANEL_BRIDGE if DRM + select DRM_AUX_BRIDGE if DRM_BRIDGE select REGMAP_I2C help Say Y or M if your system has a On Semiconductor NB7VPQ904M Type-C diff --git a/drivers/usb/typec/mux/nb7vpq904m.c b/drivers/usb/typec/mux/nb7vpq904m.c index cda206cf0c38..b17826713753 100644 --- a/drivers/usb/typec/mux/nb7vpq904m.c +++ b/drivers/usb/typec/mux/nb7vpq904m.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -70,8 +70,6 @@ struct nb7vpq904m { bool swap_data_lanes; struct typec_switch *typec_switch; - struct drm_bridge bridge; - struct mutex lock; /* protect non-concurrent retimer & switch */ enum typec_orientation orientation; @@ -297,44 +295,6 @@ static int nb7vpq904m_retimer_set(struct typec_retimer *retimer, struct typec_re return ret; } -#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE) -static int nb7vpq904m_bridge_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) -{ - struct nb7vpq904m *nb7 = container_of(bridge, struct nb7vpq904m, bridge); - struct drm_bridge *next_bridge; - - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) - return -EINVAL; - - next_bridge = devm_drm_of_get_bridge(&nb7->client->dev, nb7->client->dev.of_node, 0, 0); - if (IS_ERR(next_bridge)) { - dev_err(&nb7->client->dev, "failed to acquire drm_bridge: %pe\n", next_bridge); - return PTR_ERR(next_bridge); - } - - return drm_bridge_attach(bridge->encoder, next_bridge, bridge, - DRM_BRIDGE_ATTACH_NO_CONNECTOR); -} - -static const struct drm_bridge_funcs nb7vpq904m_bridge_funcs = { - .attach = nb7vpq904m_bridge_attach, -}; - -static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7) -{ - nb7->bridge.funcs = &nb7vpq904m_bridge_funcs; - nb7->bridge.of_node = nb7->client->dev.of_node; - - return devm_drm_bridge_add(&nb7->client->dev, &nb7->bridge); -} -#else -static int nb7vpq904m_register_bridge(struct nb7vpq904m *nb7) -{ - return 0; -} -#endif - static const struct regmap_config nb7_regmap = { .max_register = 0x1f, .reg_bits = 8, @@ -461,7 +421,7 @@ static int nb7vpq904m_probe(struct i2c_client *client) gpiod_set_value(nb7->enable_gpio, 1); - ret = nb7vpq904m_register_bridge(nb7); + ret = drm_aux_bridge_register(dev); if (ret) goto err_disable_gpio; From patchwork Sun Dec 3 11:43:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 749806 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="i1CtVHMj" Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3211DFE for ; Sun, 3 Dec 2023 03:43:41 -0800 (PST) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2c9b956c68cso37426331fa.1 for ; Sun, 03 Dec 2023 03:43:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701603819; x=1702208619; darn=vger.kernel.org; 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=UKrvC1va3zOXcp6YVKcTFgaHzs/W3SOKPJn+fUfNRVg=; b=i1CtVHMj1QPOlv60fO4WklXqp9md/WEZC/PBPskl+OMw7P6dtoPu5WYVA+h+/6fsJz wLb36uYV/PIhgsAogmCzM6NB6W1poUmKTcnU7FZwC/3LyqChWvMMBqF2uw/rXBzRrCDW +/v9pBOmTazCAp9iNPhthh/Bfvq/KOq/2Jt0TQm5y1Oo+XmBDxtnOLrIVyIbU8dzc6vH wRzLulK0RBIOAa/P2DE+WtzCsZ5qzYRJOzxKmxuJ5NzXbL4UudCS4+/o6lutqtOpLv71 AQlTEjG/X8acvHAEwlKjVmqDMVCYM8InhQKkZFU7wobczH9/SEFYn5GFw+aQH4j4bq39 H4AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701603819; x=1702208619; 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=UKrvC1va3zOXcp6YVKcTFgaHzs/W3SOKPJn+fUfNRVg=; b=kwUcMJdpBBt7iOALDs3l3bwx4hznjFfuuXMs1y9heL2ABLPJQYemjUZZeNGothDybF D2oj4msNfPkpd/34FFZho3jiwwiCzyHVXjNzaDnXjxU963ARIMSTGL8ZL0T5Pno6YN4+ fKhWBLAGCEoJVSjVqwQu/i+uQUv9qeoiSx36jkeudTPemZRmfOaZj8r1dgKXvy18dXTx my/I0+7GN4dtH8cbTOtqbqFAaQiA/m5lQQKXzArBEaDkI7L2XE40qKd0CC3IlzWm8Ahe sbJAvHcowcEc0rzXUnEupUoGc0UO+O2cp4N2RzfDaR1iGPug8f457MZ9nm7nb4J7a3Mm mNIw== X-Gm-Message-State: AOJu0YyrubH17TJfuTI9hTpNQ7H5BO+yp3SEHy9WZn7Nwn5oENpfiYkV djFbvvV6s2HJ1xxaKtmqFqFl6Q== X-Google-Smtp-Source: AGHT+IHlCnMXqlHuC6gKdZ/CQQO1yqOzIBskrtxlMb/o+gHL9SMYk7yhl6JtGqmZs37Q6toY2GUfug== X-Received: by 2002:a2e:8751:0:b0:2c9:f8fa:f1cb with SMTP id q17-20020a2e8751000000b002c9f8faf1cbmr520349ljj.23.1701603819537; Sun, 03 Dec 2023 03:43:39 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o17-20020a2e90d1000000b002c993c5d4c6sm894666ljg.105.2023.12.03.03.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 03:43:39 -0800 (PST) From: Dmitry Baryshkov To: Greg Kroah-Hartman , David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH RESEND 6/6] usb: typec: qcom-pmic-typec: switch to DRM_AUX_HPD_BRIDGE Date: Sun, 3 Dec 2023 14:43:33 +0300 Message-Id: <20231203114333.1305826-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> References: <20231203114333.1305826-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use the freshly defined DRM_AUX_HPD_BRIDGE instead of open-coding the same functionality for the DRM bridge chain termination. Acked-by: Bryan O'Donoghue Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/Kconfig | 1 + drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 41 +++---------------- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig index 0b2993fef564..64d5421c69e6 100644 --- a/drivers/usb/typec/tcpm/Kconfig +++ b/drivers/usb/typec/tcpm/Kconfig @@ -80,6 +80,7 @@ config TYPEC_QCOM_PMIC tristate "Qualcomm PMIC USB Type-C Port Controller Manager driver" depends on ARCH_QCOM || COMPILE_TEST depends on DRM || DRM=n + select DRM_AUX_HPD_BRIDGE if DRM_BRIDGE help A Type-C port and Power Delivery driver which aggregates two discrete pieces of silicon in the PM8150b PMIC block: the diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index 581199d37b49..1a2b4bddaa97 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -18,7 +18,7 @@ #include #include -#include +#include #include "qcom_pmic_typec_pdphy.h" #include "qcom_pmic_typec_port.h" @@ -36,7 +36,6 @@ struct pmic_typec { struct pmic_typec_port *pmic_typec_port; bool vbus_enabled; struct mutex lock; /* VBUS state serialization */ - struct drm_bridge bridge; }; #define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc) @@ -150,35 +149,6 @@ static int qcom_pmic_typec_init(struct tcpc_dev *tcpc) return 0; } -#if IS_ENABLED(CONFIG_DRM) -static int qcom_pmic_typec_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) -{ - return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL; -} - -static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = { - .attach = qcom_pmic_typec_attach, -}; - -static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) -{ - tcpm->bridge.funcs = &qcom_pmic_typec_bridge_funcs; -#ifdef CONFIG_OF - tcpm->bridge.of_node = of_get_child_by_name(tcpm->dev->of_node, "connector"); -#endif - tcpm->bridge.ops = DRM_BRIDGE_OP_HPD; - tcpm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; - - return devm_drm_bridge_add(tcpm->dev, &tcpm->bridge); -} -#else -static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) -{ - return 0; -} -#endif - static int qcom_pmic_typec_probe(struct platform_device *pdev) { struct pmic_typec *tcpm; @@ -186,6 +156,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; const struct pmic_typec_resources *res; struct regmap *regmap; + struct device *bridge_dev; u32 base[2]; int ret; @@ -241,14 +212,14 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) mutex_init(&tcpm->lock); platform_set_drvdata(pdev, tcpm); - ret = qcom_pmic_typec_init_drm(tcpm); - if (ret) - return ret; - tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector"); if (!tcpm->tcpc.fwnode) return -EINVAL; + bridge_dev = drm_dp_hpd_bridge_register(tcpm->dev, to_of_node(tcpm->tcpc.fwnode)); + if (IS_ERR(bridge_dev)) + return PTR_ERR(bridge_dev); + tcpm->tcpm_port = tcpm_register_port(tcpm->dev, &tcpm->tcpc); if (IS_ERR(tcpm->tcpm_port)) { ret = PTR_ERR(tcpm->tcpm_port);