Add support for HPD coming from somewhere else in the drm_bridge chain.
Skip signaling HPD sate when "no-hpd" is present in the DT node backing
the dp_typec bridge.

Add this support because some EC firmwares on Trogdor/Strongbad boards
don't properly indicate the state of the DP HPD level on a type-c port.
The EC only indicates that DP mode is entered or exited for a type-c
port. The HPD level is expressed to the DP controller via a pin on the
AP that the EC drives high or low when the type-c port partner (i.e.
monitor) asserts or deasserts HPD.

Cc: Prashant Malani <pmal...@chromium.org>
Cc: Benson Leung <ble...@chromium.org>
Cc: Tzung-Bi Shih <tzun...@kernel.org>
Cc: <chrome-platf...@lists.linux.dev>
Cc: Pin-yen Lin <treapk...@chromium.org>
Cc: Dmitry Baryshkov <dmitry.barysh...@linaro.org>
Signed-off-by: Stephen Boyd <swb...@chromium.org>
---
 drivers/gpu/drm/bridge/aux-hpd-bridge.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/aux-hpd-bridge.c 
b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
index d2832e6481d7..52db36aa190b 100644
--- a/drivers/gpu/drm/bridge/aux-hpd-bridge.c
+++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
@@ -22,6 +22,7 @@ static DEFINE_IDA(drm_aux_hpd_bridge_ida);
 struct drm_aux_hpd_bridge_data {
        struct drm_bridge bridge;
        struct device *dev;
+       bool no_hpd;
 };
 
 enum dp_lane {
@@ -355,6 +356,8 @@ void drm_aux_hpd_bridge_notify(struct device *dev, enum 
drm_connector_status sta
 
        if (!data)
                return;
+       if (data->no_hpd)
+               return;
 
        drm_bridge_hpd_notify(&data->bridge, status);
 }
@@ -672,6 +675,7 @@ static int drm_aux_hpd_bridge_probe(struct auxiliary_device 
*auxdev,
                        return -ENOMEM;
                bridge = &hpd_data->bridge;
                bridge->funcs = &drm_aux_hpd_bridge_funcs;
+               bridge->ops = DRM_BRIDGE_OP_HPD;
        } else if (id->driver_data == DRM_AUX_TYPEC_BRIDGE) {
                typec_data = devm_kzalloc(dev, sizeof(*typec_data), GFP_KERNEL);
                if (!typec_data)
@@ -680,6 +684,9 @@ static int drm_aux_hpd_bridge_probe(struct auxiliary_device 
*auxdev,
                bridge = &hpd_data->bridge;
                bridge->funcs = &drm_dp_typec_bridge_funcs;
                typec_bridge_dev = to_drm_dp_typec_bridge_dev(dev);
+               hpd_data->no_hpd = of_property_read_bool(np, "no-hpd");
+               if (!hpd_data->no_hpd)
+                       bridge->ops = DRM_BRIDGE_OP_HPD;
                memcpy(typec_data->dp_lanes, dp_lanes, 
sizeof(typec_data->dp_lanes));
                ret = drm_dp_typec_bridge_probe_typec_ports(typec_data, 
typec_bridge_dev, np);
                if (ret)
@@ -689,8 +696,7 @@ static int drm_aux_hpd_bridge_probe(struct auxiliary_device 
*auxdev,
        }
 
        hpd_data->dev = dev;
-       bridge->of_node = dev_get_platdata(dev);
-       bridge->ops = DRM_BRIDGE_OP_HPD;
+       bridge->of_node = np;
        bridge->type = DRM_MODE_CONNECTOR_DisplayPort;
 
        auxiliary_set_drvdata(auxdev, hpd_data);
-- 
https://chromeos.dev

Reply via email to