diff mbox series

[08/14] drm/bridge: analogix_dp: move basic controller init into runtime PM

Message ID 20240503151129.3901815-9-l.stach@pengutronix.de
State New
Headers show
Series improve Analogix DP AUX channel handling | expand

Commit Message

Lucas Stach May 3, 2024, 3:11 p.m. UTC
Make sure the controller is in a basic working state after runtime
resume. Keep the analog function enable in the mode set path as this
enables parts of the PHY that are only required to be powered when
there is a data stream being sent out.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Comments

Robert Foss May 7, 2024, 1:05 p.m. UTC | #1
On Fri, May 3, 2024 at 5:12 PM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Make sure the controller is in a basic working state after runtime
> resume. Keep the analog function enable in the mode set path as this
> enables parts of the PHY that are only required to be powered when
> there is a data stream being sent out.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 3281c00a39cd..fdb2c2a2b69a 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -41,10 +41,8 @@ struct bridge_init {
>         struct device_node *node;
>  };
>
> -static int analogix_dp_init_dp(struct analogix_dp_device *dp)
> +static void analogix_dp_init_dp(struct analogix_dp_device *dp)
>  {
> -       int ret;
> -
>         analogix_dp_reset(dp);
>
>         analogix_dp_swreset(dp);
> @@ -56,13 +54,9 @@ static int analogix_dp_init_dp(struct analogix_dp_device *dp)
>         analogix_dp_enable_sw_function(dp);
>
>         analogix_dp_config_interrupt(dp);
> -       ret = analogix_dp_init_analog_func(dp);
> -       if (ret)
> -               return ret;
>
>         analogix_dp_init_hpd(dp);
>         analogix_dp_init_aux(dp);
> -       return 0;
>  }
>
>  static int analogix_dp_detect_hpd(struct analogix_dp_device *dp)
> @@ -1258,9 +1252,9 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
>
>         pm_runtime_get_sync(dp->dev);
>
> -       ret = analogix_dp_init_dp(dp);
> +       ret = analogix_dp_init_analog_func(dp);
>         if (ret)
> -               goto out_dp_init;
> +               return ret;
>
>         /*
>          * According to DP spec v1.3 chap 3.5.1.2 Link Training,
> @@ -1726,6 +1720,8 @@ int analogix_dp_resume(struct analogix_dp_device *dp)
>
>         phy_power_on(dp->phy);
>
> +       analogix_dp_init_dp(dp);
> +
>         return 0;
>  }
>  EXPORT_SYMBOL_GPL(analogix_dp_resume);
> --
> 2.39.2
>

Reviewed-by: Robert Foss <rfoss@kernel.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 3281c00a39cd..fdb2c2a2b69a 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -41,10 +41,8 @@  struct bridge_init {
 	struct device_node *node;
 };
 
-static int analogix_dp_init_dp(struct analogix_dp_device *dp)
+static void analogix_dp_init_dp(struct analogix_dp_device *dp)
 {
-	int ret;
-
 	analogix_dp_reset(dp);
 
 	analogix_dp_swreset(dp);
@@ -56,13 +54,9 @@  static int analogix_dp_init_dp(struct analogix_dp_device *dp)
 	analogix_dp_enable_sw_function(dp);
 
 	analogix_dp_config_interrupt(dp);
-	ret = analogix_dp_init_analog_func(dp);
-	if (ret)
-		return ret;
 
 	analogix_dp_init_hpd(dp);
 	analogix_dp_init_aux(dp);
-	return 0;
 }
 
 static int analogix_dp_detect_hpd(struct analogix_dp_device *dp)
@@ -1258,9 +1252,9 @@  static int analogix_dp_set_bridge(struct analogix_dp_device *dp)
 
 	pm_runtime_get_sync(dp->dev);
 
-	ret = analogix_dp_init_dp(dp);
+	ret = analogix_dp_init_analog_func(dp);
 	if (ret)
-		goto out_dp_init;
+		return ret;
 
 	/*
 	 * According to DP spec v1.3 chap 3.5.1.2 Link Training,
@@ -1726,6 +1720,8 @@  int analogix_dp_resume(struct analogix_dp_device *dp)
 
 	phy_power_on(dp->phy);
 
+	analogix_dp_init_dp(dp);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(analogix_dp_resume);