Re: [PATCH 2/2] spi/s3c64xx: Implement runtime PM support

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

 



On Mon, Dec 5, 2011 at 5:50 PM, Mark Brown
<broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> Enable and disable the clocks to the SPI controller using runtime PM. This
> serves the dual purpose of reducing power consumption a little and letting
> the core know when the device is idle.
(...)
> +#ifdef CONFIG_PM_RUNTIME
> +static int s3c64xx_spi_runtime_suspend(struct device *dev)
> +{
> +       struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> +       struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> +
> +       clk_disable(sdd->clk);
> +       clk_disable(sdd->src_clk);
> +
> +       return 0;
> +}
> +
> +static int s3c64xx_spi_runtime_resume(struct device *dev)
> +{
> +       struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
> +       struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
> +
> +       clk_enable(sdd->src_clk);
> +       clk_enable(sdd->clk);
> +
> +       return 0;
> +}
> +#endif /* CONFIG_PM_RUNTIME */

This is similar to how I'm doing things in my drivers so this looks
good to me, Acked-by.

Just wanted to mention that I had this discussion with Magnus Damm
about how they do this in shmobile: in there their central runtime PM
policy in arch/arm/mach-shmobile/pm_runtime.c adds in the
pm_clk_notifier from drivers/base/power/clock_ops.c to gate/ungate
the clocks centrally acting on bus notifiers without any per-driver
hooks like these.

I clearly see that in this platform it's *not* going to work since
for this one driver atleast, there are two clocks, not just one,
that need to be managed for the device.

So I guess that some platforms will do central clock
management and some will do driver-local management.

I fear for the day one of these devices turn up in two platforms:
one using central clock management and one using
distributed clock management ...

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux