Re: [PATCH 1/1] driver core: disable device's runtime pm duringshutdown

From: Alan Stern
Date: Sun Dec 04 2011 - 21:42:05 EST


On Mon, 5 Dec 2011, NeilBrown wrote:

> Hi,
> this patches causes a problem for me.
>
> Specifically it makes it impossible to power-down a device which uses twl4030
> for power control on an omap3 processor.
>
> To perform the shutdown we need to send a command over the i2c bus.
> The relevant bus is called omap_i2c.1 and this is normally in suspend mode.
> When a request is sent, omap_i2c_xfer uses pm_runtime_get_sync to wake it up,
> performs the transfer, then calls pm_runtime_put to let it go back to sleep.
>
> So it is asleep when the new pm_runtime_disable() call is made, so it stays
> asleep, omap_i2c_xfer cannot wake it, the transfer doesn't happen and the
> system doesn't get powered off.

In other words, to perform the system shutdown you need to send a
command over the i2c bus after the bus controller's shutdown routine
has been called?

> So here is a device that should *not* have pm disabled at shutdown.

Or maybe it shouldn't be shut down at all.

> So I feel this fix is a little too heavy-handed.
> I don't fully understand the problem scenario described above but it seems to
> me that if the auto-suspend timer can fire after the hardware has been shut
> down, then maybe the hardware-shutdown should be disabling that timer. Maybe?

That's not robust. The timer can be restarted, and there are other
ways of initiating runtime PM besides the timer.

> Suggestions?

Can the shutdown routine for the i2c controller simply call
pm_runtime_enable()?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/