On Thu, 7 Apr 2022, Ricardo Martinez wrote: > From: Haijun Liu <haijun.liu@xxxxxxxxxxxx> > > 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 <haijun.liu@xxxxxxxxxxxx> > Signed-off-by: Chandrashekar Devegowda <chandrashekar.devegowda@xxxxxxxxx> > Co-developed-by: Ricardo Martinez <ricardo.martinez@xxxxxxxxxxxxxxx> > Signed-off-by: Ricardo Martinez <ricardo.martinez@xxxxxxxxxxxxxxx> > --- > +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 <ilpo.jarvinen@xxxxxxxxxxxxxxx> -- i.