diff mbox

[1/2] spi: rockchip: Convert to late and early system PM callbacks

Message ID 20171013100116.8271-1-jeffy.chen@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeffy Chen Oct. 13, 2017, 10:01 a.m. UTC
Currently we are suspending the spi master in it's ->suspend callback,
which is racy as some other drivers may still want to transmit messages
on the bus(e.g. spi based pwm backlight).

Convert to late and early system PM callbacks to avoid the race.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

 drivers/spi/spi-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Oct. 13, 2017, 10:17 a.m. UTC | #1
On Fri, Oct 13, 2017 at 06:01:15PM +0800, Jeffy Chen wrote:
> Currently we are suspending the spi master in it's ->suspend callback,
> which is racy as some other drivers may still want to transmit messages
> on the bus(e.g. spi based pwm backlight).

I'm missing patch 2/2.
Jeffy Chen Oct. 13, 2017, 10:47 a.m. UTC | #2
Hi Mark,

On 10/13/2017 06:17 PM, Mark Brown wrote:
> On Fri, Oct 13, 2017 at 06:01:15PM +0800, Jeffy Chen wrote:
>> Currently we are suspending the spi master in it's ->suspend callback,
>> which is racy as some other drivers may still want to transmit messages
>> on the bus(e.g. spi based pwm backlight).
>
> I'm missing patch 2/2.
>
Sorry, i'll resend them...

This patch is to defer suspend_spi_master to late suspend.

Since we put display-subsystem dt node above spi dt node, which makes 
spi suspend been called before display driver. Then the display driver 
would fail to set pwm backlight through spi in it's suspend/resume.
diff mbox

Patch

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index fdcf3076681b..ae539c735ea6 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -914,7 +914,7 @@  static int rockchip_spi_runtime_resume(struct device *dev)
 #endif /* CONFIG_PM */
 
 static const struct dev_pm_ops rockchip_spi_pm = {
-	SET_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume)
+	SET_LATE_SYSTEM_SLEEP_PM_OPS(rockchip_spi_suspend, rockchip_spi_resume)
 	SET_RUNTIME_PM_OPS(rockchip_spi_runtime_suspend,
 			   rockchip_spi_runtime_resume, NULL)
 };