Skip to contentSkip to conversation

dt-bindings: msm: disp: Add Display Port HPD GPIO bindings

PATCH In review Tanmay Shah 2 participants 4 messages Apr 7, 2020 – Apr 27, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: msm: disp: Add Display Port HPD GPIO bindings

Add Display Port HPD GPIO description in bindings

This Patch depends on:

	https://patchwork.kernel.org/patch/11468505/
---
 Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +7 -0
index 761a01d..003f5f7 100644
@@ -155,6 +155,11 @@ properties:
      data-lanes:
        description: Maximum number of lanes that can be used for Display port.
 
+     dp-hpd-gpio:
+       maxItems: 1
+       description: Specifies HPD gpio for DP connector without
+                    USB PHY or AUX switch.
+
      usbplug-cc-gpio:
        maxItems: 1
        description: Specifies the usbplug orientation gpio.
@@ -282,6 +287,8 @@ examples:
         aux-sel-gpio = <&msmgpio 110 1>;
         usbplug-cc-gpio = <&msmgpio 90 1>;
 
+        dp-hpd-gpio = <&msmgpio 117 0>;
+
         ports {
             #address-cells = <1>;
             #size-cells = <0>;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH 2/2 drm/msm/dp: Add Hot Plug Detect feature

Configure HPD registers and interrupts to detect connect and disconnect pulses on HPD pin and issue hot plug accordingly.

This patch depends on:

	https://patchwork.kernel.org/patch/11468511
	https://patchwork.kernel.org/patch/11468715
	https://patchwork.kernel.org/patch/11468519
	https://patchwork.kernel.org/patch/11468515
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  18 ++++++
 drivers/gpu/drm/msm/dp/dp_catalog.c     |  69 +++++++++++++-------
 drivers/gpu/drm/msm/dp/dp_catalog.h     |   5 +-
 drivers/gpu/drm/msm/dp/dp_ctrl.c        |   1 -
 drivers/gpu/drm/msm/dp/dp_display.c     | 110 +++++++++++++++++++++++++++++---
 drivers/gpu/drm/msm/dp/dp_hpd.h         |   3 +
 drivers/gpu/drm/msm/dp/dp_parser.c      |  28 ++++++++
 drivers/gpu/drm/msm/dp/dp_parser.h      |   7 +-
 drivers/gpu/drm/msm/dp/dp_reg.h         |  12 ++++
 drivers/gpu/drm/msm/msm_drv.h           |   6 ++
 10 files changed, 222 insertions(+), 37 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +18 -0
index 3440566..31d53be 100644
@@ -765,6 +765,23 @@ static void dpu_irq_preinstall(struct msm_kms *kms)
 	dpu_core_irq_preinstall(dpu_kms);
 }
 
+static int dpu_irq_postinstall(struct msm_kms *kms)
+{
+	struct msm_drm_private *priv;
+	struct dpu_kms *dpu_kms = to_dpu_kms(kms);
+
+	if (!dpu_kms || !dpu_kms->dev)
+		return -EINVAL;
+
+	priv = dpu_kms->dev->dev_private;
+	if (!priv)
+		return -EINVAL;
+
+	msm_dp_irq_postinstall(priv->dp);
+
+	return 0;
+}
+
 static void dpu_irq_uninstall(struct msm_kms *kms)
 {
 	struct dpu_kms *dpu_kms = to_dpu_kms(kms);
@@ -775,6 +792,7 @@ static void dpu_irq_uninstall(struct msm_kms *kms)
 static const struct msm_kms_funcs kms_funcs = {
 	.hw_init         = dpu_kms_hw_init,
 	.irq_preinstall  = dpu_irq_preinstall,
+	.irq_postinstall = dpu_irq_postinstall,
 	.irq_uninstall   = dpu_irq_uninstall,
 	.irq             = dpu_irq,
 	.enable_commit   = dpu_kms_enable_commit,
drivers/gpu/drm/msm/dp/dp_catalog.c +45 -24

87 lines not on this page · raw message

drivers/gpu/drm/msm/dp/dp_catalog.h +4 -1
index 86b82d4..23d1cec 100644
@@ -60,7 +60,10 @@ void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, u32 rate,
 void dp_catalog_ctrl_usb_reset(struct dp_catalog *dp_catalog, bool flip);
 bool dp_catalog_ctrl_mainlink_ready(struct dp_catalog *dp_catalog);
 void dp_catalog_ctrl_enable_irq(struct dp_catalog *dp_catalog, bool enable);
-void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog, bool enable);
+void dp_catalog_hpd_config_intr(struct dp_catalog *dp_catalog,
+			u32 intr_mask, bool en);
+void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog);
+u32 dp_catalog_hpd_get_intr_status(struct dp_catalog *dp_catalog);
 void dp_catalog_ctrl_phy_reset(struct dp_catalog *dp_catalog);
 void dp_catalog_ctrl_phy_lane_cfg(struct dp_catalog *dp_catalog, bool flipped,
 				u8 lane_cnt);
drivers/gpu/drm/msm/dp/dp_ctrl.c +0 -1
index aaa7bc8..fa15d65 100644
@@ -1568,7 +1568,6 @@ int dp_ctrl_on(struct dp_ctrl *dp_ctrl)
 	rate = ctrl->panel->link_info.rate;
 
 	dp_power_clk_enable(ctrl->power, DP_CORE_PM, true);
-	dp_catalog_ctrl_hpd_config(ctrl->catalog, true);
 
 	if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN) {
 		DRM_DEBUG_DP("using phy test link parameters\n");
drivers/gpu/drm/msm/dp/dp_display.c +102 -8

170 lines not on this page · raw message

drivers/gpu/drm/msm/dp/dp_hpd.h +3 -0
index c0178524..d06a0b7 100644
@@ -10,6 +10,9 @@
 
 #include <linux/types.h>
 #include <linux/device.h>
+#include <linux/of_gpio.h>
+
+#include "dp_parser.h"
 
 enum plug_orientation {
 	ORIENTATION_NONE,
drivers/gpu/drm/msm/dp/dp_parser.c +28 -0
index dbf64ee..08c1abe 100644
@@ -241,6 +241,19 @@ static int dp_parser_pinctrl(struct dp_parser *parser)
 		return -EINVAL;
 	}
 
+	if (parser->hpd_gpio) {
+		pinctrl->state_hpd_active = pinctrl_lookup_state(pinctrl->pin,
+					"mdss_dp_hpd_ctrl");
+		if (IS_ERR_OR_NULL(pinctrl->state_hpd_active)) {
+			DRM_ERROR("failed to get dp hpd pinctrl state %d\n",
+				PTR_ERR_OR_ZERO(pinctrl->state_hpd_active));
+			return -EINVAL;
+		}
+
+		return pinctrl_select_state(pinctrl->pin,
+				 pinctrl->state_hpd_active);
+	}
+
 	pinctrl->state_active = pinctrl_lookup_state(pinctrl->pin,
 					"mdss_dp_active");
 	if (IS_ERR(pinctrl->state_active)) {
@@ -265,6 +278,15 @@ static int dp_parser_gpio(struct dp_parser *parser)
 	struct device *dev = &parser->pdev->dev;
 	struct device_node *of_node = dev->of_node;
 
+	if (of_find_property(of_node, "qcom,dp-hpd-gpio", NULL)) {
+		parser->hpd_gpio = of_get_named_gpio(of_node,
+					"qcom,dp-hpd-gpio", 0);
+		parser->usbplug_cc_gpio = -EINVAL;
+		parser->aux_en_gpio = -EINVAL;
+		parser->aux_sel_gpio = -EINVAL;
+		return 0;
+	}
+
 	parser->usbplug_cc_gpio = of_get_named_gpio(of_node,
 					"usbplug-cc-gpio", 0);
 	if (!gpio_is_valid(parser->usbplug_cc_gpio)) {
@@ -455,6 +477,12 @@ static int dp_parser_parse(struct dp_parser *parser)
 	}
 
 	rc = dp_parser_pinctrl(parser);
+
+	if (rc)
+		parser->hpd_gpio = -EINVAL;
+	else if (parser->hpd_gpio >= 0)
+		parser->combo_phy_en = false;
+
 	return rc;
 }
 
drivers/gpu/drm/msm/dp/dp_parser.h +4 -3
index 1539866..f9c572e 100644
@@ -187,9 +187,10 @@ struct dp_parser {
 	struct platform_device *pdev;
 	struct dss_module_power mp[DP_MAX_PM];
 	struct dp_pinctrl pinctrl;
-	unsigned int aux_en_gpio;
-	unsigned int aux_sel_gpio;
-	unsigned int usbplug_cc_gpio;
+	int aux_en_gpio;
+	int aux_sel_gpio;
+	int usbplug_cc_gpio;
+	int hpd_gpio;
 	bool combo_phy_en;
 	struct dp_io io;
 	struct dp_display_data disp_data;
drivers/gpu/drm/msm/dp/dp_reg.h +12 -0
index 28c1682..fbc1874 100644
@@ -38,10 +38,22 @@
 #define DP_DP_IRQ_HPD_INT_MASK			(0x00000002)
 #define DP_DP_HPD_REPLUG_INT_MASK		(0x00000004)
 #define DP_DP_HPD_UNPLUG_INT_MASK		(0x00000008)
+#define DP_DP_HPD_INT_MASK			(DP_DP_HPD_PLUG_INT_MASK | \
+						DP_DP_IRQ_HPD_INT_MASK | \
+						DP_DP_HPD_REPLUG_INT_MASK | \
+						DP_DP_HPD_UNPLUG_INT_MASK)
+#define DP_DP_HPD_STATE_STATUS_CONNECTED	(0x40000000)
+#define DP_DP_HPD_STATE_STATUS_PENDING		(0x20000000)
+#define DP_DP_HPD_STATE_STATUS_DISCONNECTED	(0x00000000)
+#define DP_DP_HPD_STATE_STATUS_MASK		(0xE0000000)
 
 #define REG_DP_DP_HPD_REFTIMER			(0x00000018)
+#define DP_DP_HPD_REFTIMER_ENABLE		(1 << 16)
+
 #define REG_DP_DP_HPD_EVENT_TIME_0		(0x0000001C)
 #define REG_DP_DP_HPD_EVENT_TIME_1		(0x00000020)
+#define DP_DP_HPD_EVENT_TIME_0_VAL		(0x3E800FA)
+#define DP_DP_HPD_EVENT_TIME_1_VAL		(0x1F407D0)
 
 #define REG_DP_AUX_CTRL				(0x00000030)
 #define DP_AUX_CTRL_ENABLE			(0x00000001)
drivers/gpu/drm/msm/msm_drv.h +6 -0
index d72694c..15a33b2 100644
@@ -387,6 +387,7 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
 void msm_dp_display_mode_set(struct msm_dp *dp, struct drm_encoder *encoder,
 				struct drm_display_mode *mode,
 				struct drm_display_mode *adjusted_mode);
+void msm_dp_irq_postinstall(struct msm_dp *dp_display);
 
 #else
 static inline int __init msm_dp_register(void)
@@ -418,6 +419,11 @@ static inline void msm_dp_display_mode_set(struct msm_dp *dp,
 				struct drm_display_mode *adjusted_mode)
 {
 }
+
+static void msm_dp_irq_postinstall(struct msm_dp *dp_display)
+{
+}
+
 #endif
 
 void __init msm_mdp_register(void);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#2 lore raw
In reply to Tanmay Shah
Quoted 4 lines · Tanmay Shah

Add Display Port HPD GPIO description in bindings

This Patch depends on:

	https://patchwork.kernel.org/patch/11468505/

This belongs below the '---' and probably means you should send all this as one series.

Quoted 11 lines
---
 Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +0 -0
index 761a01d..003f5f7 100644

Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml properties: · line 158

Quoted 4 lines
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +1 -0
@@ -155,6 +155,11 @@ properties:
      data-lanes:
        description: Maximum number of lanes that can be used for Display port.
 
+     dp-hpd-gpio:

We already have a standard property for this. Use it.

It belongs in the connector node as HPD is part of the connector.

Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml properties: · line 163

Quoted 5 lines
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +4 -0
+       maxItems: 1
+       description: Specifies HPD gpio for DP connector without
+                    USB PHY or AUX switch.
+
      usbplug-cc-gpio:

Note that this too should be in a connector node.

Quoted 14 lines
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +2 -0
        maxItems: 1
        description: Specifies the usbplug orientation gpio.
@@ -282,6 +287,8 @@ examples:
         aux-sel-gpio = <&msmgpio 110 1>;
         usbplug-cc-gpio = <&msmgpio 90 1>;
 
+        dp-hpd-gpio = <&msmgpio 117 0>;
+
         ports {
             #address-cells = <1>;
             #size-cells = <0>;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Thanks Rob for reviews.

We are using Display Port Controller block to detect hot plug. So we won't be using that pin as GPIO.

I found now that we don't need any bindings for that pin in such case. So I am abandoning this patch series and upload new patch.

Thanks.

Quoted 60 lines · Rob Herring
Quoted 4 lines · Tanmay Shah

Add Display Port HPD GPIO description in bindings

This Patch depends on:

	https://patchwork.kernel.org/patch/11468505/

This belongs below the '---' and probably means you should send all this as one series.

Quoted 4 lines
---
 Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml | 7

+++++++

Quoted 3 lines
 1 file changed, 7 insertions(+)

diff --git

a/Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml b/Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml

Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml properties: · line 156

Quoted 6 lines

index 761a01d..003f5f7 100644

Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +0 -0
@@ -155,6 +155,11 @@ properties:
      data-lanes:
        description: Maximum number of lanes that can be used for

Display port.

Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml properties: · line 158

Quoted 2 lines
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +1 -0
+     dp-hpd-gpio:

We already have a standard property for this. Use it.

It belongs in the connector node as HPD is part of the connector.

Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml properties: · line 163

Quoted 5 lines
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +4 -0
+       maxItems: 1
+       description: Specifies HPD gpio for DP connector without
+                    USB PHY or AUX switch.
+
      usbplug-cc-gpio:

Note that this too should be in a connector node.

Quoted 12 lines
Documentation/devicetree/bindings/display/msm/dp-sc7180.yaml +2 -1
        maxItems: 1
        description: Specifies the usbplug orientation gpio.
@@ -282,6 +287,8 @@ examples:
         aux-sel-gpio = <&msmgpio 110 1>;
         usbplug-cc-gpio = <&msmgpio 90 1>;
 
+        dp-hpd-gpio = <&msmgpio 117 0>;
+
         ports {
             #address-cells = <1>;
             #size-cells = <0>;
--
Quoted 1 line

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora

Forum,

Quoted 1 line

a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel