* [PATCH 0/3] ADC: Mediatek auxadc driver for mt7622 @ 2017-06-22 5:44 Zhiyong Tao [not found] ` <1498110274-18678-1-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-06-22 5:44 ` [PATCH 3/3] iio: adc: mt7622: Add compatible node for mt7622 Zhiyong Tao 0 siblings, 2 replies; 11+ messages in thread From: Zhiyong Tao @ 2017-06-22 5:44 UTC (permalink / raw) To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, jic23-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg Cc: srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r These patches are first version of Mediatek auxadc driver for mt7622. These patches include three patches. The First patch adds mt7622 compatible node in binding document. The second patch adds support for suspend/resume. The last patch adds mt7622 compatible node in auxadc driver. 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 | 38 ++++++++++++++++++++ 2 files changed, 39 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <1498110274-18678-1-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* [PATCH 1/3] dt-bindings: adc: mt7622: add binding document [not found] ` <1498110274-18678-1-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2017-06-22 5:44 ` Zhiyong Tao [not found] ` <1498110274-18678-2-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-06-22 5:44 ` [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume Zhiyong Tao 1 sibling, 1 reply; 11+ messages in thread From: Zhiyong Tao @ 2017-06-22 5:44 UTC (permalink / raw) To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, jic23-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg Cc: srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Zhiyong Tao The commit adds mt7622 compatible node in binding document. Signed-off-by: Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> --- .../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..e6aa30a 100644 --- a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt +++ b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt @@ -13,6 +13,7 @@ Required properties: - compatible: Should be one of: - "mediatek,mt2701-auxadc": For MT2701 family of SoCs - "mediatek,mt8173-auxadc": For MT8173 family of SoCs + - "mediatek,mt7622-auxadc": For MT7622 family of SoCs - reg: Address range of the AUXADC unit. - clocks: Should contain a clock specifier for each entry in clock-names - clock-names: Should contain "main". -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1498110274-18678-2-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH 1/3] dt-bindings: adc: mt7622: add binding document [not found] ` <1498110274-18678-2-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2017-06-24 20:02 ` Jonathan Cameron 2017-06-26 10:45 ` Zhiyong Tao 0 siblings, 1 reply; 11+ messages in thread From: Jonathan Cameron @ 2017-06-24 20:02 UTC (permalink / raw) To: Zhiyong Tao Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Thu, 22 Jun 2017 13:44:32 +0800 Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote: > The commit adds mt7622 compatible node in binding document. > > Signed-off-by: Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> > --- > .../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..e6aa30a 100644 > --- a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt > +++ b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt > @@ -13,6 +13,7 @@ Required properties: > - compatible: Should be one of: > - "mediatek,mt2701-auxadc": For MT2701 family of SoCs > - "mediatek,mt8173-auxadc": For MT8173 family of SoCs > + - "mediatek,mt7622-auxadc": For MT7622 family of SoCs numeric order? > - reg: Address range of the AUXADC unit. > - clocks: Should contain a clock specifier for each entry in clock-names > - clock-names: Should contain "main". -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] dt-bindings: adc: mt7622: add binding document 2017-06-24 20:02 ` Jonathan Cameron @ 2017-06-26 10:45 ` Zhiyong Tao 0 siblings, 0 replies; 11+ messages in thread From: Zhiyong Tao @ 2017-06-26 10:45 UTC (permalink / raw) To: Jonathan Cameron 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 Sat, 2017-06-24 at 21:02 +0100, Jonathan Cameron wrote: > On Thu, 22 Jun 2017 13:44:32 +0800 > Zhiyong Tao <zhiyong.tao@mediatek.com> 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(+) > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt > > index 68c45cb..e6aa30a 100644 > > --- a/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt > > +++ b/Documentation/devicetree/bindings/iio/adc/mt6577_auxadc.txt > > @@ -13,6 +13,7 @@ Required properties: > > - compatible: Should be one of: > > - "mediatek,mt2701-auxadc": For MT2701 family of SoCs > > - "mediatek,mt8173-auxadc": For MT8173 family of SoCs > > + - "mediatek,mt7622-auxadc": For MT7622 family of SoCs > numeric order? ==> yes, we have changed it as numeric order in v2. Thanks. > > - reg: Address range of the AUXADC unit. > > - clocks: Should contain a clock specifier for each entry in clock-names > > - clock-names: Should contain "main". > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume. [not found] ` <1498110274-18678-1-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-06-22 5:44 ` [PATCH 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao @ 2017-06-22 5:44 ` Zhiyong Tao [not found] ` <1498110274-18678-3-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 1 sibling, 1 reply; 11+ messages in thread From: Zhiyong Tao @ 2017-06-22 5:44 UTC (permalink / raw) To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, jic23-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg Cc: srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, 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-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> --- drivers/iio/adc/mt6577_auxadc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index 2d104c8..2dd7c74 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -184,6 +184,37 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, .read_raw = &mt6577_auxadc_read_raw, }; +static int 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 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; +} + static int mt6577_auxadc_probe(struct platform_device *pdev) { struct mt6577_auxadc_device *adc_dev; @@ -269,6 +300,11 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) return 0; } +static const struct dev_pm_ops mt6577_auxadc_pm_ops = { + .suspend = mt6577_auxadc_suspend, + .resume = mt6577_auxadc_resume, +}; + static const struct of_device_id mt6577_auxadc_of_match[] = { { .compatible = "mediatek,mt2701-auxadc", }, { .compatible = "mediatek,mt8173-auxadc", }, @@ -280,6 +316,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] 11+ messages in thread
[parent not found: <1498110274-18678-3-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume. [not found] ` <1498110274-18678-3-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2017-06-24 20:00 ` Jonathan Cameron [not found] ` <20170624210043.29569f3a-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Jonathan Cameron @ 2017-06-24 20:00 UTC (permalink / raw) To: Zhiyong Tao Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Thu, 22 Jun 2017 13:44:33 +0800 Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 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-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> Worth handling the cases where power management is not configured into the kernel properly. So a few minor suggestions. Otherwise looks good to me. > --- > drivers/iio/adc/mt6577_auxadc.c | 37 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 37 insertions(+) > > diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c > index 2d104c8..2dd7c74 100644 > --- a/drivers/iio/adc/mt6577_auxadc.c > +++ b/drivers/iio/adc/mt6577_auxadc.c > @@ -184,6 +184,37 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, > .read_raw = &mt6577_auxadc_read_raw, > }; > > +static int 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 mt6577_auxadc_suspend(struct device *dev) Mark these __maybe_unused for the CONFIG_PM but not CONFIG_PM_SLEEP case. > +{ > + 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; > +} > + > static int mt6577_auxadc_probe(struct platform_device *pdev) > { > struct mt6577_auxadc_device *adc_dev; > @@ -269,6 +300,11 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) > return 0; > } > > +static const struct dev_pm_ops mt6577_auxadc_pm_ops = { > + .suspend = mt6577_auxadc_suspend, > + .resume = mt6577_auxadc_resume, > +}; > + Use the SIMPLE_SYSTEM_PM_OPS macro to make these assignments magically go away if PM_CONFIG_SLEEP is not defined. > static const struct of_device_id mt6577_auxadc_of_match[] = { > { .compatible = "mediatek,mt2701-auxadc", }, > { .compatible = "mediatek,mt8173-auxadc", }, > @@ -280,6 +316,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] 11+ messages in thread
[parent not found: <20170624210043.29569f3a-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume. [not found] ` <20170624210043.29569f3a-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> @ 2017-06-26 2:54 ` zhiyong tao 2017-06-26 5:01 ` Jonathan Cameron 0 siblings, 1 reply; 11+ messages in thread From: zhiyong tao @ 2017-06-26 2:54 UTC (permalink / raw) To: Jonathan Cameron Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Sat, 2017-06-24 at 21:00 +0100, Jonathan Cameron wrote: > On Thu, 22 Jun 2017 13:44:33 +0800 > Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 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-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> > Worth handling the cases where power management is not configured into the > kernel properly. > > So a few minor suggestions. Otherwise looks good to me. > > --- > > drivers/iio/adc/mt6577_auxadc.c | 37 +++++++++++++++++++++++++++++++++++++ > > 1 file changed, 37 insertions(+) > > > > diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c > > index 2d104c8..2dd7c74 100644 > > --- a/drivers/iio/adc/mt6577_auxadc.c > > +++ b/drivers/iio/adc/mt6577_auxadc.c > > @@ -184,6 +184,37 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev, > > .read_raw = &mt6577_auxadc_read_raw, > > }; > > > > +static int 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 mt6577_auxadc_suspend(struct device *dev) > Mark these __maybe_unused for the CONFIG_PM but not CONFIG_PM_SLEEP case. ==> ok, We will add CONFIG_PM_SLEEP for the suspend/resume case in v2. thanks! > > +{ > > + 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; > > +} > > + > > static int mt6577_auxadc_probe(struct platform_device *pdev) > > { > > struct mt6577_auxadc_device *adc_dev; > > @@ -269,6 +300,11 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) > > return 0; > > } > > > > +static const struct dev_pm_ops mt6577_auxadc_pm_ops = { > > + .suspend = mt6577_auxadc_suspend, > > + .resume = mt6577_auxadc_resume, > > +}; > > + > Use the SIMPLE_SYSTEM_PM_OPS macro to make these assignments magically go away > if PM_CONFIG_SLEEP is not defined. ==> ok, We will use SIMPLE_DEV_PM_OPS macro to change it in v2. Thanks. >> static const struct of_device_id mt6577_auxadc_of_match[] = { > > { .compatible = "mediatek,mt2701-auxadc", }, > > { .compatible = "mediatek,mt8173-auxadc", }, > > @@ -280,6 +316,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] 11+ messages in thread
* Re: [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume. 2017-06-26 2:54 ` zhiyong tao @ 2017-06-26 5:01 ` Jonathan Cameron 0 siblings, 0 replies; 11+ messages in thread From: Jonathan Cameron @ 2017-06-26 5:01 UTC (permalink / raw) To: zhiyong tao, Jonathan Cameron Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 26 June 2017 04:54:52 CEST, zhiyong tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote: >On Sat, 2017-06-24 at 21:00 +0100, Jonathan Cameron wrote: >> On Thu, 22 Jun 2017 13:44:33 +0800 >> Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 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-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> >> Worth handling the cases where power management is not configured >into the >> kernel properly. >> >> So a few minor suggestions. Otherwise looks good to me. >> > --- >> > drivers/iio/adc/mt6577_auxadc.c | 37 >+++++++++++++++++++++++++++++++++++++ >> > 1 file changed, 37 insertions(+) >> > >> > diff --git a/drivers/iio/adc/mt6577_auxadc.c >b/drivers/iio/adc/mt6577_auxadc.c >> > index 2d104c8..2dd7c74 100644 >> > --- a/drivers/iio/adc/mt6577_auxadc.c >> > +++ b/drivers/iio/adc/mt6577_auxadc.c >> > @@ -184,6 +184,37 @@ static int mt6577_auxadc_read_raw(struct >iio_dev *indio_dev, >> > .read_raw = &mt6577_auxadc_read_raw, >> > }; >> > >> > +static int 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 mt6577_auxadc_suspend(struct device *dev) >> Mark these __maybe_unused for the CONFIG_PM but not CONFIG_PM_SLEEP >case. Preferred to mark __maybe_unused and use the macro mentioned below. > >==> ok, We will add CONFIG_PM_SLEEP for the suspend/resume case in v2. >thanks! > >> > +{ >> > + 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; >> > +} >> > + >> > static int mt6577_auxadc_probe(struct platform_device *pdev) >> > { >> > struct mt6577_auxadc_device *adc_dev; >> > @@ -269,6 +300,11 @@ static int mt6577_auxadc_remove(struct >platform_device *pdev) >> > return 0; >> > } >> > >> > +static const struct dev_pm_ops mt6577_auxadc_pm_ops = { >> > + .suspend = mt6577_auxadc_suspend, >> > + .resume = mt6577_auxadc_resume, >> > +}; >> > + >> Use the SIMPLE_SYSTEM_PM_OPS macro to make these assignments >magically go away >> if PM_CONFIG_SLEEP is not defined. > >==> ok, We will use SIMPLE_DEV_PM_OPS macro to change it in v2. Thanks. >>> static const struct of_device_id mt6577_auxadc_of_match[] = { >> > { .compatible = "mediatek,mt2701-auxadc", }, >> > { .compatible = "mediatek,mt8173-auxadc", }, >> > @@ -280,6 +316,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, >> > > >-- >To unsubscribe from this list: send the line "unsubscribe linux-iio" in >the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >More majordomo info at http://vger.kernel.org/majordomo-info.html -- Sent from my Android device with K-9 Mail. Please excuse my brevity. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] iio: adc: mt7622: Add compatible node for mt7622. 2017-06-22 5:44 [PATCH 0/3] ADC: Mediatek auxadc driver for mt7622 Zhiyong Tao [not found] ` <1498110274-18678-1-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2017-06-22 5:44 ` Zhiyong Tao [not found] ` <1498110274-18678-4-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 1 sibling, 1 reply; 11+ messages in thread From: Zhiyong Tao @ 2017-06-22 5:44 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 2dd7c74..4a2cd9e 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -308,6 +308,7 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) static const struct of_device_id mt6577_auxadc_of_match[] = { { .compatible = "mediatek,mt2701-auxadc", }, { .compatible = "mediatek,mt8173-auxadc", }, + { .compatible = "mediatek,mt7622-auxadc", }, { } }; MODULE_DEVICE_TABLE(of, mt6577_auxadc_of_match); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
[parent not found: <1498110274-18678-4-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH 3/3] iio: adc: mt7622: Add compatible node for mt7622. [not found] ` <1498110274-18678-4-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> @ 2017-06-24 20:02 ` Jonathan Cameron [not found] ` <20170624210213.5e552e5c-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 0 siblings, 1 reply; 11+ messages in thread From: Jonathan Cameron @ 2017-06-24 20:02 UTC (permalink / raw) To: Zhiyong Tao Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Thu, 22 Jun 2017 13:44:34 +0800 Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote: > This commit adds mt7622 compatible node. > > Signed-off-by: Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> > --- > 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 2dd7c74..4a2cd9e 100644 > --- a/drivers/iio/adc/mt6577_auxadc.c > +++ b/drivers/iio/adc/mt6577_auxadc.c > @@ -308,6 +308,7 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) > static const struct of_device_id mt6577_auxadc_of_match[] = { > { .compatible = "mediatek,mt2701-auxadc", }, > { .compatible = "mediatek,mt8173-auxadc", }, > + { .compatible = "mediatek,mt7622-auxadc", }, Keep them in numeric order perhaps? Might become a worthwhile step if this logic gets used for lot more parts in future! Jonathan > { } > }; > MODULE_DEVICE_TABLE(of, mt6577_auxadc_of_match); ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20170624210213.5e552e5c-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>]
* Re: [PATCH 3/3] iio: adc: mt7622: Add compatible node for mt7622. [not found] ` <20170624210213.5e552e5c-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> @ 2017-06-26 1:55 ` zhiyong tao 0 siblings, 0 replies; 11+ messages in thread From: zhiyong tao @ 2017-06-26 1:55 UTC (permalink / raw) To: Jonathan Cameron Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, knaack.h-Mmb7MZpHnFY, lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg, srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, liguo.zhang-NuS5LvNUpcJWk0Htik3J/w, yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w, sean.wang-NuS5LvNUpcJWk0Htik3J/w, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-iio-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Sat, 2017-06-24 at 21:02 +0100, Jonathan Cameron wrote: > On Thu, 22 Jun 2017 13:44:34 +0800 > Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote: > > > This commit adds mt7622 compatible node. > > > > Signed-off-by: Zhiyong Tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> > > --- > > 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 2dd7c74..4a2cd9e 100644 > > --- a/drivers/iio/adc/mt6577_auxadc.c > > +++ b/drivers/iio/adc/mt6577_auxadc.c > > @@ -308,6 +308,7 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) > > static const struct of_device_id mt6577_auxadc_of_match[] = { > > { .compatible = "mediatek,mt2701-auxadc", }, > > { .compatible = "mediatek,mt8173-auxadc", }, > > + { .compatible = "mediatek,mt7622-auxadc", }, > Keep them in numeric order perhaps? > > Might become a worthwhile step if this logic gets used for lot more parts in future! > > Jonathan ==>Ok, we will change them in numeric order perhaps in v2. Thanks. > > { } > > }; > > MODULE_DEVICE_TABLE(of, mt6577_auxadc_of_match); > ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-06-26 10:45 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-06-22 5:44 [PATCH 0/3] ADC: Mediatek auxadc driver for mt7622 Zhiyong Tao [not found] ` <1498110274-18678-1-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-06-22 5:44 ` [PATCH 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao [not found] ` <1498110274-18678-2-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-06-24 20:02 ` Jonathan Cameron 2017-06-26 10:45 ` Zhiyong Tao 2017-06-22 5:44 ` [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume Zhiyong Tao [not found] ` <1498110274-18678-3-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-06-24 20:00 ` Jonathan Cameron [not found] ` <20170624210043.29569f3a-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 2017-06-26 2:54 ` zhiyong tao 2017-06-26 5:01 ` Jonathan Cameron 2017-06-22 5:44 ` [PATCH 3/3] iio: adc: mt7622: Add compatible node for mt7622 Zhiyong Tao [not found] ` <1498110274-18678-4-git-send-email-zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> 2017-06-24 20:02 ` Jonathan Cameron [not found] ` <20170624210213.5e552e5c-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> 2017-06-26 1:55 ` zhiyong tao
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).