Re: [PATCH] drm/exynos: defer hdmi probe when fail to get regulators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2014년 06월 18일 22:42, Rahul Sharma wrote:
> HDMI probe proceeds with dummy regulators when the regulators
> are not provided in DT node or regulator provider has not get
> probed or failed to register the regulators.
> 
> This patch modify hdmi driver to defer the probe in case the
> regulators are not available.

No, already available. See the below comments.

> 
> Signed-off-by: Rahul Sharma <rahul.sharma@xxxxxxxxxxx>
> ---
> Based on exynos-drm-fixes branch in Inki dae's tree.
>  drivers/gpu/drm/exynos/exynos_hdmi.c |   69 ++++++++++++++++++++++++----------
>  1 file changed, 50 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index aa259b0..3f24c49 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -83,7 +83,7 @@ struct hdmi_resources {
>  	struct clk			*sclk_pixel;
>  	struct clk			*sclk_hdmiphy;
>  	struct clk			*mout_hdmi;
> -	struct regulator_bulk_data	*regul_bulk;
> +	struct regulator		**regulators;
>  	int				regul_count;
>  };
>  
> @@ -2022,6 +2022,36 @@ static void hdmi_commit(struct exynos_drm_display *display)
>  	hdmi_conf_apply(hdata);
>  }
>  
> +int hdmi_regulator_enable(struct hdmi_context *hdata)
> +{
> +	struct hdmi_resources *res = &hdata->res;
> +	int i, ret;
> +
> +	for (i = 0; i < res->regul_count; ++i) {
> +		ret = regulator_enable(res->regulators[i]);
> +		if (ret < 0) {
> +			DRM_ERROR("fail to enable regulators.\n");
> +			return ret;
> +		}
> +	}
> +	return 0;
> +}
> +
> +int hdmi_regulator_disable(struct hdmi_context *hdata)
> +{
> +	struct hdmi_resources *res = &hdata->res;
> +	int i, ret;
> +
> +	for (i = 0; i < res->regul_count; ++i) {
> +		ret = regulator_disable(res->regulators[i]);
> +		if (ret < 0) {
> +			DRM_ERROR("fail to disable regulators.\n");
> +			return ret;
> +		}
> +	}
> +	return 0;
> +}
> +
>  static void hdmi_poweron(struct exynos_drm_display *display)
>  {
>  	struct hdmi_context *hdata = display->ctx;
> @@ -2039,8 +2069,8 @@ static void hdmi_poweron(struct exynos_drm_display *display)
>  
>  	pm_runtime_get_sync(hdata->dev);
>  
> -	if (regulator_bulk_enable(res->regul_count, res->regul_bulk))
> -		DRM_DEBUG_KMS("failed to enable regulator bulk\n");
> +	if (hdmi_regulator_enable(hdata))
> +		DRM_DEBUG_KMS("failed to enable regulators\n");
>  
>  	/* set pmu hdmiphy control bit to enable hdmiphy */
>  	regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
> @@ -2077,7 +2107,8 @@ static void hdmi_poweroff(struct exynos_drm_display *display)
>  	regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
>  			PMU_HDMI_PHY_ENABLE_BIT, 0);
>  
> -	regulator_bulk_disable(res->regul_count, res->regul_bulk);
> +	if (hdmi_regulator_disable(hdata))
> +		DRM_DEBUG_KMS("failed to disable regulators\n");
>  
>  	pm_runtime_put_sync(hdata->dev);
>  
> @@ -2211,24 +2242,24 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
>  
>  	clk_set_parent(res->mout_hdmi, res->sclk_pixel);
>  
> -	res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
> -		sizeof(res->regul_bulk[0]), GFP_KERNEL);
> -	if (!res->regul_bulk) {
> -		ret = -ENOMEM;
> -		goto fail;
> -	}
> +	res->regul_count = ARRAY_SIZE(supply);
> +
> +	res->regulators = devm_kzalloc(dev, res->regul_count *
> +		sizeof(res->regulators[0]), GFP_KERNEL);
> +	if (!res->regulators)
> +		return -ENOMEM;
> +
>  	for (i = 0; i < ARRAY_SIZE(supply); ++i) {
> -		res->regul_bulk[i].supply = supply[i];
> -		res->regul_bulk[i].consumer = NULL;
> -	}
> -	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
> -	if (ret) {
> -		DRM_ERROR("failed to get regulators\n");
> -		return ret;
> +		res->regulators[i] =
> +			devm_regulator_get_optional(dev, supply[i]);
> +		if (IS_ERR(res->regulators[i])) {
> +			DRM_ERROR("fail to get regulator: %s.\n",
> +				supply[i]);
> +			return -EPROBE_DEFER;

devm_regulator_get_optional function would return -EPROBE_DEFER if
needed. So it's not good to force returning -EPROBE_DEFER in case of all
errors.

Thanks,
Inki Dae

> +		}
>  	}
> -	res->regul_count = ARRAY_SIZE(supply);
>  
> -	return ret;
> +	return 0;
>  fail:
>  	DRM_ERROR("HDMI resource init - failed\n");
>  	return ret;
> 

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux