linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] ADC: Mediatek auxadc driver for mt7622
@ 2017-06-26  6:11 Zhiyong Tao
  2017-06-26  6:11 ` [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Zhiyong Tao @ 2017-06-26  6:11 UTC (permalink / raw)
  To: robh+dt, jic23, knaack.h, lars, pmeerw
  Cc: srv_heupstream, liguo.zhang, yingjoe.chen, sean.wang,
	matthias.bgg, s.hauer, devicetree, linux-kernel,
	linux-arm-kernel, linux-iio, linux-mediatek

This series includes three patches:
1.Add mt7622 compatible node in binding document.
2.Add support for suspend/resume.
3.Add mt7622 compatible node in auxadc driver.

Changes in patch v2:
1).Change compatible node as numeric order perhaps.
2).Add "CONFIG_PM_SLEEP" and "__maybe_unused" for suspend/resume.
3).Change "dev_pm_ops" to "SIMPLE_DEV_PM_OPS".

Zhiyong Tao (3):
  dt-bindings: adc: mt7622: add binding document
  iio: adc: mt7622: add support for suspend/resume.
  iio: adc: mt7622: Add compatible node for mt7622.

 .../devicetree/bindings/iio/adc/mt6577_auxadc.txt  |    1 +
 drivers/iio/adc/mt6577_auxadc.c                    |   39 ++++++++++++++++++++
 2 files changed, 40 insertions(+)

--
1.7.9.5

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document
  2017-06-26  6:11 [PATCH v2 0/3] ADC: Mediatek auxadc driver for mt7622 Zhiyong Tao
@ 2017-06-26  6:11 ` Zhiyong Tao
  2017-06-28 16:46   ` Rob Herring
  2017-06-26  6:11 ` [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume Zhiyong Tao
  2017-06-26  6:11 ` [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for mt7622 Zhiyong Tao
  2 siblings, 1 reply; 8+ messages in thread
From: Zhiyong Tao @ 2017-06-26  6:11 UTC (permalink / raw)
  To: robh+dt, jic23, knaack.h, lars, pmeerw
  Cc: srv_heupstream, liguo.zhang, yingjoe.chen, sean.wang,
	matthias.bgg, s.hauer, devicetree, linux-kernel,
	linux-arm-kernel, linux-iio, linux-mediatek, Zhiyong Tao

The commit adds mt7622 compatible node in binding document.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
---
 .../devicetree/bindings/iio/adc/mt6577_auxadc.txt  |    1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt
index 68c45cb..64dc484 100644
--- a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt
+++ b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt
@@ -12,6 +12,7 @@ for the Thermal Controller which holds a phandle to the AUXADC.
 Required properties:
   - compatible: Should be one of:
     - "mediatek,mt2701-auxadc": For MT2701 family of SoCs
+    - "mediatek,mt7622-auxadc": For MT7622 family of SoCs
     - "mediatek,mt8173-auxadc": For MT8173 family of SoCs
   - reg: Address range of the AUXADC unit.
   - clocks: Should contain a clock specifier for each entry in clock-names
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume.
  2017-06-26  6:11 [PATCH v2 0/3] ADC: Mediatek auxadc driver for mt7622 Zhiyong Tao
  2017-06-26  6:11 ` [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao
@ 2017-06-26  6:11 ` Zhiyong Tao
  2017-07-01  9:19   ` Jonathan Cameron
  2017-06-26  6:11 ` [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for mt7622 Zhiyong Tao
  2 siblings, 1 reply; 8+ messages in thread
From: Zhiyong Tao @ 2017-06-26  6:11 UTC (permalink / raw)
  To: robh+dt, jic23, knaack.h, lars, pmeerw
  Cc: srv_heupstream, liguo.zhang, yingjoe.chen, sean.wang,
	matthias.bgg, s.hauer, devicetree, linux-kernel,
	linux-arm-kernel, linux-iio, linux-mediatek, Zhiyong Tao

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>
---
 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
+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,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for mt7622.
  2017-06-26  6:11 [PATCH v2 0/3] ADC: Mediatek auxadc driver for mt7622 Zhiyong Tao
  2017-06-26  6:11 ` [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao
  2017-06-26  6:11 ` [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume Zhiyong Tao
@ 2017-06-26  6:11 ` Zhiyong Tao
  2017-07-01  9:21   ` Jonathan Cameron
  2 siblings, 1 reply; 8+ messages in thread
From: Zhiyong Tao @ 2017-06-26  6:11 UTC (permalink / raw)
  To: robh+dt, jic23, knaack.h, lars, pmeerw
  Cc: srv_heupstream, liguo.zhang, yingjoe.chen, sean.wang,
	matthias.bgg, s.hauer, devicetree, linux-kernel,
	linux-arm-kernel, linux-iio, linux-mediatek, Zhiyong Tao

This commit adds mt7622 compatible node.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
---
 drivers/iio/adc/mt6577_auxadc.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
index c174b73..4224fc0 100644
--- a/drivers/iio/adc/mt6577_auxadc.c
+++ b/drivers/iio/adc/mt6577_auxadc.c
@@ -308,6 +308,7 @@ static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
 
 static const struct of_device_id mt6577_auxadc_of_match[] = {
 	{ .compatible = "mediatek,mt2701-auxadc", },
+	{ .compatible = "mediatek,mt7622-auxadc", },
 	{ .compatible = "mediatek,mt8173-auxadc", },
 	{ }
 };
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document
  2017-06-26  6:11 ` [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao
@ 2017-06-28 16:46   ` Rob Herring
  2017-07-01  9:18     ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2017-06-28 16:46 UTC (permalink / raw)
  To: Zhiyong Tao
  Cc: jic23, knaack.h, lars, pmeerw, srv_heupstream, liguo.zhang,
	yingjoe.chen, sean.wang, matthias.bgg, s.hauer, devicetree,
	linux-kernel, linux-arm-kernel, linux-iio, linux-mediatek

On Mon, Jun 26, 2017 at 02:11:40PM +0800, Zhiyong Tao wrote:
> The commit adds mt7622 compatible node in binding document.
> 
> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> ---
>  .../devicetree/bindings/iio/adc/mt6577_auxadc.txt  |    1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document
  2017-06-28 16:46   ` Rob Herring
@ 2017-07-01  9:18     ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2017-07-01  9:18 UTC (permalink / raw)
  To: Rob Herring
  Cc: Zhiyong Tao, knaack.h, lars, pmeerw, srv_heupstream, liguo.zhang,
	yingjoe.chen, sean.wang, matthias.bgg, s.hauer, devicetree,
	linux-kernel, linux-arm-kernel, linux-iio, linux-mediatek

On Wed, 28 Jun 2017 11:46:22 -0500
Rob Herring <robh@kernel.org> wrote:

> On Mon, Jun 26, 2017 at 02:11:40PM +0800, Zhiyong Tao wrote:
> > The commit adds mt7622 compatible node in binding document.
> > 
> > Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
> > ---
> >  .../devicetree/bindings/iio/adc/mt6577_auxadc.txt  |    1 +
> >  1 file changed, 1 insertion(+)  
> 
> Acked-by: Rob Herring <robh@kernel.org>

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

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume.
  2017-06-26  6:11 ` [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume Zhiyong Tao
@ 2017-07-01  9:19   ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2017-07-01  9:19 UTC (permalink / raw)
  To: Zhiyong Tao
  Cc: robh+dt, knaack.h, lars, pmeerw, srv_heupstream, liguo.zhang,
	yingjoe.chen, sean.wang, matthias.bgg, s.hauer, devicetree,
	linux-kernel, linux-arm-kernel, linux-iio, linux-mediatek

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,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for mt7622.
  2017-06-26  6:11 ` [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for mt7622 Zhiyong Tao
@ 2017-07-01  9:21   ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2017-07-01  9:21 UTC (permalink / raw)
  To: Zhiyong Tao
  Cc: robh+dt, knaack.h, lars, pmeerw, srv_heupstream, liguo.zhang,
	yingjoe.chen, sean.wang, matthias.bgg, s.hauer, devicetree,
	linux-kernel, linux-arm-kernel, linux-iio, linux-mediatek

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

> This commit adds mt7622 compatible node.
> 
> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Applied.

Thanks,

Jonathan
> ---
>  drivers/iio/adc/mt6577_auxadc.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
> index c174b73..4224fc0 100644
> --- a/drivers/iio/adc/mt6577_auxadc.c
> +++ b/drivers/iio/adc/mt6577_auxadc.c
> @@ -308,6 +308,7 @@ static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops,
>  
>  static const struct of_device_id mt6577_auxadc_of_match[] = {
>  	{ .compatible = "mediatek,mt2701-auxadc", },
> +	{ .compatible = "mediatek,mt7622-auxadc", },
>  	{ .compatible = "mediatek,mt8173-auxadc", },
>  	{ }
>  };

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-01  9:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26  6:11 [PATCH v2 0/3] ADC: Mediatek auxadc driver for mt7622 Zhiyong Tao
2017-06-26  6:11 ` [PATCH v2 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao
2017-06-28 16:46   ` Rob Herring
2017-07-01  9:18     ` Jonathan Cameron
2017-06-26  6:11 ` [PATCH v2 2/3] iio: adc: mt7622: add support for suspend/resume Zhiyong Tao
2017-07-01  9:19   ` Jonathan Cameron
2017-06-26  6:11 ` [PATCH v2 3/3] iio: adc: mt7622: Add compatible node for mt7622 Zhiyong Tao
2017-07-01  9:21   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).