[PATCH 7/7] usb: dwc3: exynos: add pm_runtime support

Anton Tikhomirov av.tikhomirov at samsung.com
Fri Dec 13 00:01:32 EST 2013


Hi Felipe,

> -static int dwc3_exynos_suspend(struct device *dev)
> +static int __dwc3_exynos_suspend(struct dwc3_exynos *exynos)
>  {
> -	struct dwc3_exynos *exynos = dev_get_drvdata(dev);
> -
>  	clk_disable(exynos->clk);
> 
>  	return 0;
>  }
> 
> +static int __dwc3_exynos_resume(struct dwc3_exynos *exynos)
> +{
> +	return clk_enable(exynos->clk);
> +}
> +
> +static int dwc3_exynos_suspend(struct device *dev)
> +{
> +	struct dwc3_exynos *exynos = dev_get_drvdata(dev);
> +
> +	return __dwc3_exynos_suspend(exynos);

If dwc3-exynos is runtime suspended, the clock will be disabled
second time here (unbalanced clk_enable/clk_disable).

> +}
> +
>  static int dwc3_exynos_resume(struct device *dev)
>  {
>  	struct dwc3_exynos *exynos = dev_get_drvdata(dev);
> +	int ret;	
> 
> -	clk_enable(exynos->clk);
> +	ret = __dwc3_exynos_resume(exynos);
> +	if (ret)
> +		return ret;
> 
>  	/* runtime set active to reflect active state. */
>  	pm_runtime_disable(dev);
> @@ -207,8 +238,24 @@ static int dwc3_exynos_resume(struct device *dev)
>  	return 0;
>  }
> 
> +static int dwc3_exynos_runtime_suspend(struct device *dev)
> +{
> +	struct dwc3_exynos *exynos = dev_get_drvdata(dev);
> +
> +	return __dwc3_exynos_suspend(exynos);
> +}
> +
> +static int dwc3_exynos_runtime_resume(struct device *dev)
> +{
> +	struct dwc3_exynos *exynos = dev_get_drvdata(dev);
> +
> +	return __dwc3_exynos_resume(exynos);
> +}

Thanks




More information about the linux-arm-kernel mailing list