Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1679316

Re: [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume.

From Jonathan Cameron <jic23@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume.
Date 2017-07-01 11:20 +0200
Message-ID <tYmJk-1az-3@gated-at.bofh.it> (permalink)
References <tWvxn-79X-1@gated-at.bofh.it> <tWvxo-79X-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 26 Jun 2017 14:11:41 +0800
Zhiyong Tao <zhiyong.tao@mediatek.com> wrote:

> This patch supports auxadc suspend/resume flow.
> Disable auxadc clk and power in suspend function.
> Enable axuadc clk and power in resume function.
> 
> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
small point inline.

Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/mt6577_auxadc.c |   38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
> index 2d104c8..c174b73 100644
> --- a/drivers/iio/adc/mt6577_auxadc.c
> +++ b/drivers/iio/adc/mt6577_auxadc.c
> @@ -184,6 +184,39 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev,
>  	.read_raw = &mt6577_auxadc_read_raw,
>  };
>  
> +#ifdef CONFIG_PM_SLEEP
There is no need to have the ifdefs as well as the __maybe_unused.
I'll drop them when applying.
> +static int __maybe_unused mt6577_auxadc_resume(struct device *dev)
> +{
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> +	struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev);
> +	int ret;
> +
> +	ret = clk_prepare_enable(adc_dev->adc_clk);
> +	if (ret) {
> +		pr_err("failed to enable auxadc clock\n");
> +		return ret;
> +	}
> +
> +	mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,
> +			      MT6577_AUXADC_PDN_EN, 0);
> +	mdelay(MT6577_AUXADC_POWER_READY_MS);
> +
> +	return 0;
> +}
> +
> +static int __maybe_unused mt6577_auxadc_suspend(struct device *dev)
> +{
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
> +	struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev);
> +
> +	mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,
> +			      0, MT6577_AUXADC_PDN_EN);
> +	clk_disable_unprepare(adc_dev->adc_clk);
> +
> +	return 0;
> +}
> +#endif
> +
>  static int mt6577_auxadc_probe(struct platform_device *pdev)
>  {
>  	struct mt6577_auxadc_device *adc_dev;
> @@ -269,6 +302,10 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
> +			 mt6577_auxadc_suspend,
> +			 mt6577_auxadc_resume);
> +
>  static const struct of_device_id mt6577_auxadc_of_match[] = {
>  	{ .compatible = "mediatek,mt2701-auxadc", },
>  	{ .compatible = "mediatek,mt8173-auxadc", },
> @@ -280,6 +317,7 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
>  	.driver = {
>  		.name   = "mt6577-auxadc",
>  		.of_match_table = mt6577_auxadc_of_match,
> +		.pm = &mt6577_auxadc_pm_ops,
>  	},
>  	.probe	= mt6577_auxadc_probe,
>  	.remove	= mt6577_auxadc_remove,

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] ADC: Mediatek auxadc driver for mt7622  Zhiyong Tao <zhiyong.tao@mediatek.com> - 2017-06-26 08:20 +0200
  [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for mt7622. Zhiyong Tao <zhiyong.tao@mediatek.com> - 2017-06-26 08:20 +0200
    Re: [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for  mt7622. Jonathan Cameron <jic23@kernel.org> - 2017-07-01 11:30 +0200
  [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume. Zhiyong Tao <zhiyong.tao@mediatek.com> - 2017-06-26 08:20 +0200
    Re: [PATCH v2 2/3] iio: adc: mt7622: add support for  suspend/resume. Jonathan Cameron <jic23@kernel.org> - 2017-07-01 11:20 +0200
  [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao <zhiyong.tao@mediatek.com> - 2017-06-26 08:20 +0200
    Re: [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Rob Herring <robh@kernel.org> - 2017-06-28 20:00 +0200
      Re: [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Jonathan Cameron <jic23@kernel.org> - 2017-07-01 11:20 +0200

csiph-web