[Freedreno] [PATCH 3/3] drm/bridge: display-connector: handle hdmi-pwr supply

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon May 8 02:54:01 UTC 2023


Hi Dmitry,

Thank you for the patch.

On Sun, May 07, 2023 at 11:12:18PM +0300, Dmitry Baryshkov wrote:
> On some devices the 5V pin of the HDMI connector and/or the ESD
> protection logic is powered on by a separate regulator. Instead of
> declaring this regulator as always-on, make hdmi-connector support the
> additional hdmi-pwr supply.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
> ---
>  drivers/gpu/drm/bridge/display-connector.c | 37 +++++++++++++++++-----
>  1 file changed, 29 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c
> index 0d94e6edea50..037ba2eb5a2f 100644
> --- a/drivers/gpu/drm/bridge/display-connector.c
> +++ b/drivers/gpu/drm/bridge/display-connector.c
> @@ -337,18 +337,12 @@ static int display_connector_probe(struct platform_device *pdev)
>  				return ret;
>  			}
>  		}
> -
> -		if (conn->connector_pwr) {
> -			ret = regulator_enable(conn->connector_pwr);
> -			if (ret) {
> -				dev_err(&pdev->dev, "failed to enable DP PWR regulator: %d\n", ret);
> -				return ret;
> -			}
> -		}
>  	}
>  
>  	/* enable DDC */
>  	if (type == DRM_MODE_CONNECTOR_HDMIA) {
> +		int ret;
> +
>  		conn->ddc_en = devm_gpiod_get_optional(&pdev->dev, "ddc-en",
>  						       GPIOD_OUT_HIGH);
>  
> @@ -356,6 +350,33 @@ static int display_connector_probe(struct platform_device *pdev)
>  			dev_err(&pdev->dev, "Couldn't get ddc-en gpio\n");
>  			return PTR_ERR(conn->ddc_en);
>  		}
> +
> +		conn->connector_pwr = devm_regulator_get_optional(&pdev->dev, "hdmi-pwr");
> +
> +		if (IS_ERR(conn->connector_pwr)) {
> +			ret = PTR_ERR(conn->connector_pwr);
> +
> +			switch (ret) {
> +			case -ENODEV:
> +				conn->connector_pwr = NULL;
> +				break;
> +
> +			case -EPROBE_DEFER:
> +				return -EPROBE_DEFER;
> +
> +			default:
> +				dev_err(&pdev->dev, "failed to get HDMI PWR regulator: %d\n", ret);
> +				return ret;
> +			}
> +		}
> +	}

Please share this logic with the DP code. You can move it to a separate
function for instance, that would take the regulator name as a
parameter.

> +
> +	if (conn->connector_pwr) {
> +		ret = regulator_enable(conn->connector_pwr);
> +		if (ret) {
> +			dev_err(&pdev->dev, "failed to enable DP PWR regulator: %d\n", ret);
> +			return ret;
> +		}
>  	}
>  
>  	conn->bridge.funcs = &display_connector_bridge_funcs;

-- 
Regards,

Laurent Pinchart


More information about the Freedreno mailing list