Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1209871

[PATCH v3 11/14] drm: bridge: analogix_dp: try force hpd after plug in lookup failed

From Yakir Yang <ykk@rock-chips.com>
Newsgroups linux.kernel
Subject [PATCH v3 11/14] drm: bridge: analogix_dp: try force hpd after plug in lookup failed
Date 2015-08-19 17:00 +0200
Message-ID <pZd0m-BY-17@gated-at.bofh.it> (permalink)
References <pZcQF-qk-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Some edp screen do not have hpd signal, so we can't just return
failed when hpd plug in detect failed.

This is an hardware property, so we need add a devicetree property
"analogix,need-force-hpd" to indicate this sutiation.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
---
Changes in v3:
- Add "analogix,need-force-hpd" to indicate whether driver need foce
  hpd when hpd detect failed.

Changes in v2: None

 .../devicetree/bindings/drm/bridge/analogix_dp.txt |  3 ++
 .../bindings/video/analogix_dp-rockchip.txt        |  1 +
 .../devicetree/bindings/video/exynos_dp.txt        |  1 +
 drivers/gpu/drm/bridge/analogix_dp_core.c          | 36 +++++++++++++++++++---
 drivers/gpu/drm/bridge/analogix_dp_core.h          |  2 ++
 drivers/gpu/drm/bridge/analogix_dp_reg.c           |  9 ++++++
 6 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt
index 6127018..b043200 100644
--- a/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt
+++ b/Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt
@@ -40,6 +40,9 @@ Required properties for dp-controller:
 		* Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
 
 Optional properties for dp-controller:
+	-analogix,need-force-hpd:
+		Indicate driver need force hpd when hpd detect failed, this
+		is used for some eDP screen which don't have hpd signal.
 	-analogix,hpd-gpio:
 		Hotplug detect GPIO.
 			Indicates which GPIO should be used for hotplug
diff --git a/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
index 99fd421..752005e 100644
--- a/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
+++ b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
@@ -27,6 +27,7 @@ For the below properties, please refer to Analogix DP binding document:
 - analogix,color-depth (required)
 - analogix,link-rate (required)
 - analogix,lane-count (required)
+- analogix,need-force-hpd (optional)
 - analogix,hpd-gpio (optional)
 - video interfaces (optional)
 -------------------------------------------------------------------------------
diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt b/Documentation/devicetree/bindings/video/exynos_dp.txt
index 177506f..ba20416 100644
--- a/Documentation/devicetree/bindings/video/exynos_dp.txt
+++ b/Documentation/devicetree/bindings/video/exynos_dp.txt
@@ -53,6 +53,7 @@ For the below properties, please refer to Analogix DP binding document:
 	-analogix,color-depth (required)
 	-analogix,link-rate (required)
 	-analogix,lane-count (required)
+	-analogix,need-force-hpd (optional)
 	-analogix,hpd-gpio (optional)
 	-video interfaces (optional)
 -------------------------------------------------------------------------------
diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix_dp_core.c
index 1778e0a..99870f7 100644
--- a/drivers/gpu/drm/bridge/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix_dp_core.c
@@ -63,15 +63,38 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp)
 {
 	int timeout_loop = 0;
 
-	while (analogix_dp_get_plug_in_status(dp) != 0) {
+	while (timeout_loop < DP_TIMEOUT_LOOP_COUNT) {
+		if (analogix_dp_get_plug_in_status(dp) == 0)
+			return 0;
+
 		timeout_loop++;
-		if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) {
-			dev_err(dp->dev, "failed to get hpd plug status\n");
-			return -ETIMEDOUT;
-		}
 		usleep_range(10, 11);
 	}
 
+	/*
+	 * Some edp screen do not have hpd signal, so we can't just
+	 * return failed when hpd plug in detect failed, DT property
+	 * "need-force-hpd" would indicate whether driver need this.
+	 */
+	if (!dp->need_force_hpd)
+		return -ETIMEDOUT;
+
+	/*
+	 * The eDP TRM indicate that if HPD_STATUS(RO) is 0, AUX CH
+	 * will not work, so we need to give a force hpd action to
+	 * set HPD_STATUS manually.
+	 */
+	dev_dbg(dp->dev, "failed to get hpd plug status, try to force hpd\n");
+
+	analogix_dp_force_hpd(dp);
+
+	if (analogix_dp_get_plug_in_status(dp) != 0) {
+		dev_err(dp->dev, "failed to get hpd plug in status\n");
+		return -EINVAL;
+	}
+
+	dev_dbg(dp->dev, "success to get plug in status after force hpd\n");
+
 	return 0;
 }
 
@@ -1272,6 +1295,9 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
 	if (IS_ERR(dp->reg_base))
 		return PTR_ERR(dp->reg_base);
 
+	dp->need_force_hpd =
+		of_property_read_bool(dev->of_node, "analogix,need-force-hpd");
+
 	dp->hpd_gpio = of_get_named_gpio(dev->of_node, "analogix,hpd-gpio", 0);
 
 	if (gpio_is_valid(dp->hpd_gpio)) {
diff --git a/drivers/gpu/drm/bridge/analogix_dp_core.h b/drivers/gpu/drm/bridge/analogix_dp_core.h
index 941b34f..2405155 100644
--- a/drivers/gpu/drm/bridge/analogix_dp_core.h
+++ b/drivers/gpu/drm/bridge/analogix_dp_core.h
@@ -160,6 +160,7 @@ struct analogix_dp_device {
 	struct phy		*phy;
 	int			dpms_mode;
 	int			hpd_gpio;
+	bool                    need_force_hpd;
 
 	struct analogix_dp_plat_data *plat_data;
 };
@@ -180,6 +181,7 @@ void analogix_dp_set_analog_power_down(struct analogix_dp_device *dp,
 				       bool enable);
 void analogix_dp_init_analog_func(struct analogix_dp_device *dp);
 void analogix_dp_init_hpd(struct analogix_dp_device *dp);
+void analogix_dp_force_hpd(struct analogix_dp_device *dp);
 enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp);
 void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp);
 void analogix_dp_reset_aux(struct analogix_dp_device *dp);
diff --git a/drivers/gpu/drm/bridge/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix_dp_reg.c
index a0fc1fb..bf7cee1 100644
--- a/drivers/gpu/drm/bridge/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix_dp_reg.c
@@ -365,6 +365,15 @@ void analogix_dp_init_hpd(struct analogix_dp_device *dp)
 	writel(reg, dp->reg_base + ANALOGIX_DP_SYS_CTL_3);
 }
 
+void analogix_dp_force_hpd(struct analogix_dp_device *dp)
+{
+	u32 reg;
+
+	reg = readl(dp->reg_base + ANALOGIX_DP_SYS_CTL_3);
+	reg = (F_HPD | HPD_CTRL);
+	writel(reg, dp->reg_base + ANALOGIX_DP_SYS_CTL_3);
+}
+
 enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp)
 {
 	u32 reg;
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/14] Add Analogix Core Display Port Driver Yakir Yang <ykk@rock-chips.com> - 2015-08-19 16:50 +0200
  [PATCH v3 07/14] drm: rockchip/dp: add rockchip platform dp driver Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
    Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Rob Herring <robherring2@gmail.com> - 2015-08-24 01:30 +0200
      Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-24 02:50 +0200
        Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-24 04:50 +0200
          Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-24 06:30 +0200
            Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-24 14:50 +0200
              Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Heiko Stuebner <heiko@sntech.de> - 2015-08-24 15:10 +0200
                Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 03:40 +0200
              Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-25 02:00 +0200
                Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2015-08-25 03:40 +0200
                Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 03:40 +0200
        Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Jingoo Han <jingoohan1@gmail.com> - 2015-08-24 09:50 +0200
          Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-24 15:00 +0200
      Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-24 04:30 +0200
      Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-08-24 15:00 +0200
        Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Rob Herring <robherring2@gmail.com> - 2015-08-24 16:50 +0200
          Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Heiko Stuebner <heiko@sntech.de> - 2015-08-24 18:20 +0200
          Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 03:30 +0200
          Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Thierry Reding <treding@nvidia.com> - 2015-08-25 11:20 +0200
            Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-08-25 11:40 +0200
              Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Thierry Reding <treding@nvidia.com> - 2015-08-25 12:50 +0200
                Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-08-25 13:00 +0200
            Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 11:50 +0200
              Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Thierry Reding <treding@nvidia.com> - 2015-08-25 12:10 +0200
                Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 16:10 +0200
      Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Thierry Reding <treding@nvidia.com> - 2015-08-25 11:20 +0200
        Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 11:40 +0200
        Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp Rob Herring <robherring2@gmail.com> - 2015-08-25 15:30 +0200
          Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Thierry Reding <treding@nvidia.com> - 2015-08-25 16:20 +0200
            Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 16:30 +0200
    Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Thierry Reding <treding@nvidia.com> - 2015-08-25 12:00 +0200
      Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Yakir Yang <ykk@rock-chips.com> - 2015-08-25 16:10 +0200
        Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Thierry Reding <treding@nvidia.com> - 2015-08-25 16:30 +0200
          Re: [PATCH v3 06/14] Documentation: drm/bridge: add document for  analogix_dp Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-08-25 18:00 +0200
  [PATCH v3 14/14] drm: bridge/analogix_dp: add edid modes parse in get_modes method Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  [PATCH v3 08/14] phy: Add driver for rockchip Display Port PHY Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
    Re: [PATCH v3 08/14] phy: Add driver for rockchip Display Port PHY Kishon Vijay Abraham I <kishon@ti.com> - 2015-08-20 06:50 +0200
  [PATCH v3 11/14] drm: bridge: analogix_dp: try force hpd after plug in lookup failed Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  [PATCH v3 05/14] drm: bridge/analogix_dp: fix link_rate & lane_count bug Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
    Re: [PATCH v3 05/14] drm: bridge/analogix_dp: fix link_rate & lane_count bug Jingoo Han <jingoohan1@gmail.com> - 2015-08-20 09:30 +0200
      Re: [PATCH v3 05/14] drm: bridge/analogix_dp: fix link_rate & lane_count  bug Yakir Yang <ykk@rock-chips.com> - 2015-08-20 10:10 +0200
  [PATCH v3 12/14] drm: bridge/analogix_dp: expand the delay time for hpd detect Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
    Re: [PATCH v3 12/14] drm: bridge/analogix_dp: expand the delay time for hpd detect Jingoo Han <jingoohan1@gmail.com> - 2015-08-20 08:20 +0200
      Re: [PATCH v3 12/14] drm: bridge/analogix_dp: expand the delay time  for hpd detect Yakir Yang <ykk@rock-chips.com> - 2015-08-20 10:10 +0200
  [PATCH v3 04/14] drm: bridge/analogix_dp: dynamic parse sync_pol & interlace & colorimetry Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  [PATCH v3 02/14] drm: exynos/dp: convert to drm bridge mode Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  [PATCH v3 13/14] drm: bridge/analogix_dp: move hpd detect to connector detect function Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
    Re: [PATCH v3 13/14] drm: bridge/analogix_dp: move hpd detect to connector detect function Jingoo Han <jingoohan1@gmail.com> - 2015-08-20 09:50 +0200
      Re: [PATCH v3 13/14] drm: bridge/analogix_dp: move hpd detect to  connector detect function Yakir Yang <ykk@rock-chips.com> - 2015-08-20 10:20 +0200
  [PATCH v3 10/14] drm: bridge: analogix_dp: add some rk3288 special registers setting Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  [PATCH v3 09/14] drm: bridge/analogix_dp: add platform device type support Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  [PATCH v3 01/14] drm: exynos/dp: fix code style Yakir Yang <ykk@rock-chips.com> - 2015-08-19 17:00 +0200
  Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Dave Airlie <airlied@gmail.com> - 2015-08-20 02:00 +0200
    Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Yakir Yang <ykk@rock-chips.com> - 2015-08-20 03:10 +0200
  Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Archit Taneja <architt@codeaurora.org> - 2015-08-20 06:40 +0200
    Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Jingoo Han <jingoohan1@gmail.com> - 2015-08-20 08:00 +0200
      Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Yakir Yang <ykk@rock-chips.com> - 2015-08-20 08:30 +0200
        Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Jingoo Han <jingoohan1@gmail.com> - 2015-08-20 09:00 +0200
          Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Yakir Yang <ykk@rock-chips.com> - 2015-08-20 10:10 +0200
  Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Jingoo Han <jingoohan1@gmail.com> - 2015-08-21 10:30 +0200
    Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Thierry Reding <treding@nvidia.com> - 2015-08-21 15:20 +0200
      Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Romain Perier <romain.perier@gmail.com> - 2015-08-30 14:20 +0200
        Re: [PATCH v3 0/14] Add Analogix Core Display Port Driver Yakir Yang <ykk@rock-chips.com> - 2015-08-31 04:50 +0200

csiph-web