Re: [PATCH v4 1/5] usb: dwc3: separate dev_pm_ops for each pm_event

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

 



On Wed, Oct 09, 2024 at 05:42:55AM +0000, Guan-Yu Lin wrote:
> Separate dev_pm_ops for different power events such as suspend, thaw,
> and hibernation. This is crucial when dwc3 driver needs to adapt its
> behavior based on different power state changes.
> 
> Signed-off-by: Guan-Yu Lin <guanyulin@xxxxxxxxxx>
> ---
>  drivers/usb/dwc3/core.c | 77 ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 76 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index b25d80f318a9..2fdafbcbe44c 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -2582,6 +2582,76 @@ static int dwc3_resume(struct device *dev)
>  	return 0;
>  }
>  
> +static int dwc3_freeze(struct device *dev)
> +{
> +	struct dwc3	*dwc = dev_get_drvdata(dev);
> +	int		ret;
> +
> +	ret = dwc3_suspend_common(dwc, PMSG_FREEZE);
> +	if (ret)
> +		return ret;
> +
> +	pinctrl_pm_select_sleep_state(dev);
> +
> +	return 0;
> +}
> +
> +static int dwc3_thaw(struct device *dev)
> +{
> +	struct dwc3	*dwc = dev_get_drvdata(dev);
> +	int		ret;
> +
> +	pinctrl_pm_select_default_state(dev);
> +
> +	pm_runtime_disable(dev);
> +	pm_runtime_set_active(dev);
> +
> +	ret = dwc3_resume_common(dwc, PMSG_THAW);
> +	if (ret) {
> +		pm_runtime_set_suspended(dev);
> +		return ret;
> +	}
> +
> +	pm_runtime_enable(dev);
> +
> +	return 0;
> +}
> +
> +static int dwc3_poweroff(struct device *dev)
> +{
> +	struct dwc3	*dwc = dev_get_drvdata(dev);
> +	int		ret;
> +
> +	ret = dwc3_suspend_common(dwc, PMSG_HIBERNATE);

Why is power off hibernate?

This needs an ack from the dwc3 maintainer as I can't determine if it's
correct at all...

thanks,

greg k-h




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux