drm/bridge: analogix_dp: Split the platform-specific poweron in two parts
authorDouglas Anderson <dianders@chromium.org>
Mon, 23 Apr 2018 10:49:58 +0000 (12:49 +0200)
committerAndrzej Hajda <a.hajda@samsung.com>
Tue, 24 Apr 2018 06:34:49 +0000 (08:34 +0200)
Some of the platform-specific stuff in rockchip_dp_poweron() needs to
happen before the generic code.  Some needs to happen after.  Let's
split the callback in two.

Specifically we can't start doing PSR work until _after_ the whole
controller is up, so don't set the enable until the end.

Cc: Kristian H. Kristensen <hoegsberg@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
[seanpaul added exynos change]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180423105003.9004-23-enric.balletbo@collabora.com
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
drivers/gpu/drm/exynos/exynos_dp.c
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
include/drm/bridge/analogix_dp.h

index a260de4f0bd88ad647fb0b147016fc588201ebcc..2bcbfadb6ac5535782f8a78e0934365abe0796f8 100644 (file)
@@ -1260,8 +1260,8 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
                goto out_dp_clk_pre;
        }
 
-       if (dp->plat_data->power_on)
-               dp->plat_data->power_on(dp->plat_data);
+       if (dp->plat_data->power_on_start)
+               dp->plat_data->power_on_start(dp->plat_data);
 
        phy_power_on(dp->phy);
 
@@ -1286,6 +1286,9 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
                goto out_dp_init;
        }
 
+       if (dp->plat_data->power_on_end)
+               dp->plat_data->power_on_end(dp->plat_data);
+
        enable_irq(dp->irq);
        return 0;
 
index 964831dab1025f976e3c033cf17e0324cc5abc23..86330f396784ddb8ecc0ba277ebefd0fe3ec50d7 100644 (file)
@@ -162,7 +162,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
        dp->drm_dev = drm_dev;
 
        dp->plat_data.dev_type = EXYNOS_DP;
-       dp->plat_data.power_on = exynos_dp_poweron;
+       dp->plat_data.power_on_start = exynos_dp_poweron;
        dp->plat_data.power_off = exynos_dp_poweroff;
        dp->plat_data.attach = exynos_dp_bridge_attach;
        dp->plat_data.get_modes = exynos_dp_get_modes;
index b3f46ed24cdc047dcf49c3709158f746db5e6821..23317a2269e13a10b5e84a8b7d9be4b018337b9e 100644 (file)
@@ -109,7 +109,7 @@ static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
        return 0;
 }
 
-static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data)
+static int rockchip_dp_poweron_start(struct analogix_dp_plat_data *plat_data)
 {
        struct rockchip_dp_device *dp = to_dp(plat_data);
        int ret;
@@ -127,6 +127,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data)
                return ret;
        }
 
+       return ret;
+}
+
+static int rockchip_dp_poweron_end(struct analogix_dp_plat_data *plat_data)
+{
+       struct rockchip_dp_device *dp = to_dp(plat_data);
+
        return rockchip_drm_psr_activate(&dp->encoder);
 }
 
@@ -330,7 +337,8 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
        dp->plat_data.encoder = &dp->encoder;
 
        dp->plat_data.dev_type = dp->data->chip_type;
-       dp->plat_data.power_on = rockchip_dp_poweron;
+       dp->plat_data.power_on_start = rockchip_dp_poweron_start;
+       dp->plat_data.power_on_end = rockchip_dp_poweron_end;
        dp->plat_data.power_off = rockchip_dp_powerdown;
        dp->plat_data.get_modes = rockchip_dp_get_modes;
 
index e9a1116d2f8e602734450cea57ebd105f4c7d759..475b706b49de2a9fe663fb34ae2ed26dffa2ce66 100644 (file)
@@ -33,7 +33,8 @@ struct analogix_dp_plat_data {
        struct drm_connector *connector;
        bool skip_connector;
 
-       int (*power_on)(struct analogix_dp_plat_data *);
+       int (*power_on_start)(struct analogix_dp_plat_data *);
+       int (*power_on_end)(struct analogix_dp_plat_data *);
        int (*power_off)(struct analogix_dp_plat_data *);
        int (*attach)(struct analogix_dp_plat_data *, struct drm_bridge *,
                      struct drm_connector *);