Subject: Re: [PATCH net-next v6 12/13] net: wwan: t7xx: Device deep sleep lock/unlock

From: Ilpo Järvinen <[email-masked]>
Date: Thu, 21 Apr 2022 14:47:06 +0300 (EEST)

On Thu, 7 Apr 2022, Ricardo Martinez wrote:

> From: Haijun Liu <[email-masked]>
> 
> Introduce the mechanism to lock/unlock the device 'deep sleep' mode.
> When the PCIe link state is L1.2 or L2, the host side still can keep
> the device is in D0 state from the host side point of view. At the same
> time, if the device's 'deep sleep' mode is unlocked, the device will
> go to 'deep sleep' while it is still in D0 state on the host side.
> 
> Signed-off-by: Haijun Liu <[email-masked]>
> Signed-off-by: Chandrashekar Devegowda <[email-masked]>
> Co-developed-by: Ricardo Martinez <[email-masked]>
> Signed-off-by: Ricardo Martinez <[email-masked]>
> ---

> +void t7xx_pci_enable_sleep(struct t7xx_pci_dev *t7xx_dev)
> +{
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&t7xx_dev->md_pm_lock, flags);
> +	t7xx_dev->sleep_disable_count--;
> +	if (atomic_read(&t7xx_dev->md_pm_state) < MTK_PM_RESUMED) {

goto unlock;

> +		spin_unlock_irqrestore(&t7xx_dev->md_pm_lock, flags);
> +		return;
> +	}
> +
> +	if (t7xx_dev->sleep_disable_count == 0)
> +		t7xx_dev_set_sleep_capability(t7xx_dev, true);

unlock:

> +	spin_unlock_irqrestore(&t7xx_dev->md_pm_lock, flags);
> +}
> +
>  static int t7xx_send_pm_request(struct t7xx_pci_dev *t7xx_dev, u32 request)
>  {
>  	unsigned long wait_ret;

Reviewed-by: Ilpo Järvinen <[email-masked]>

-- 
 i.