Re: [PATCH V2] clk: vc5: Add suspend/resume support

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

 



Hi Marex,

Thank you for the patch.

On Wednesday, 12 December 2018 03:41:30 EET Marek Vasut wrote:
> Add simple suspend/resume handlers to the driver to restore the chip
> configuration after resume. It is possible that the chip was configured
> with non-default values before suspend-resume cycle and that the chip
> is powered down during this cycle, so the configuration could get lost.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@xxxxxxxxx>
> Cc: Alexey Firago <alexey_firago@xxxxxxxxxx>
> Cc: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> Cc: Michael Turquette <mturquette@xxxxxxxxxxxx>
> Cc: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
> Cc: linux-renesas-soc@xxxxxxxxxxxxxxx
> ---
> V2: Replace ifdef with __maybe_unused
>     Simplify return value handling in resume
> ---
>  drivers/clk/clk-versaclock5.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
> index decffb3826ec..b66586a3abb7 100644
> --- a/drivers/clk/clk-versaclock5.c
> +++ b/drivers/clk/clk-versaclock5.c
> @@ -906,6 +906,34 @@ static int vc5_remove(struct i2c_client *client)
>  	return 0;
>  }
> 
> +static int __maybe_unused vc5_suspend(struct device *dev)
> +{
> +	struct vc5_driver_data *vc5 = dev_get_drvdata(dev);
> +	int ret;
> +
> +	ret = regcache_sync(vc5->regmap);

Didn't you say the sync here was unneeded and would be dropped ?

> +	if (ret != 0) {
> +		dev_err(dev, "Failed to save register map: %d\n", ret);
> +		return ret;
> +	}
> +	regcache_cache_only(vc5->regmap, true);
> +	regcache_mark_dirty(vc5->regmap);
> +
> +	return 0;
> +}
> +
> +static int __maybe_unused vc5_resume(struct device *dev)
> +{
> +	struct vc5_driver_data *vc5 = dev_get_drvdata(dev);
> +	int ret;
> +
> +	regcache_cache_only(vc5->regmap, false);
> +	ret = regcache_sync(vc5->regmap);
> +	if (ret)
> +		dev_err(dev, "Failed to restore register map: %d\n", ret);
> +	return ret;
> +}
> +
>  static const struct vc5_chip_info idt_5p49v5923_info = {
>  	.model = IDT_VC5_5P49V5923,
>  	.clk_fod_cnt = 2,
> @@ -961,9 +989,12 @@ static const struct of_device_id clk_vc5_of_match[] = {
> };
>  MODULE_DEVICE_TABLE(of, clk_vc5_of_match);
> 
> +static SIMPLE_DEV_PM_OPS(vc5_pm_ops, vc5_suspend, vc5_resume);
> +
>  static struct i2c_driver vc5_driver = {
>  	.driver = {
>  		.name = "vc5",
> +		.pm	= &vc5_pm_ops,
>  		.of_match_table = clk_vc5_of_match,
>  	},
>  	.probe		= vc5_probe,

-- 
Regards,

Laurent Pinchart






[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux