All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhiyong tao <zhiyong.tao@mediatek.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: <robh+dt@kernel.org>, <knaack.h@gmx.de>, <lars@metafoo.de>,
	<pmeerw@pmeerw.net>, <srv_heupstream@mediatek.com>,
	<liguo.zhang@mediatek.com>, <yingjoe.chen@mediatek.com>,
	<sean.wang@mediatek.com>, <matthias.bgg@gmail.com>,
	<s.hauer@pengutronix.de>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-iio@vger.kernel.org>, <linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume.
Date: Mon, 26 Jun 2017 10:54:52 +0800	[thread overview]
Message-ID: <1498445692.844.5.camel@mhfsdcap03> (raw)
In-Reply-To: <20170624210043.29569f3a@kernel.org>

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@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>
> 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,
> 



WARNING: multiple messages have this Message-ID (diff)
From: zhiyong tao <zhiyong.tao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
To: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	knaack.h-Mmb7MZpHnFY@public.gmane.org,
	lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org,
	pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
	liguo.zhang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
	yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
	sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
	matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume.
Date: Mon, 26 Jun 2017 10:54:52 +0800	[thread overview]
Message-ID: <1498445692.844.5.camel@mhfsdcap03> (raw)
In-Reply-To: <20170624210043.29569f3a-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: zhiyong.tao@mediatek.com (zhiyong tao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] iio: adc: mt7622: add support for suspend/resume.
Date: Mon, 26 Jun 2017 10:54:52 +0800	[thread overview]
Message-ID: <1498445692.844.5.camel@mhfsdcap03> (raw)
In-Reply-To: <20170624210043.29569f3a@kernel.org>

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@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>
> 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,
> 

  reply	other threads:[~2017-06-26  2:54 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22  5:44 [PATCH 0/3] ADC: Mediatek auxadc driver for mt7622 Zhiyong Tao
2017-06-22  5:44 ` Zhiyong Tao
2017-06-22  5:44 ` Zhiyong Tao
2017-06-22  5:44 ` [PATCH 1/3] dt-bindings: adc: mt7622: add binding document Zhiyong Tao
2017-06-22  5:44   ` Zhiyong Tao
2017-06-22  5:44   ` Zhiyong Tao
2017-06-24 20:02   ` Jonathan Cameron
2017-06-24 20:02     ` Jonathan Cameron
2017-06-24 20:02     ` Jonathan Cameron
2017-06-26 10:45     ` Zhiyong Tao
2017-06-26 10:45       ` Zhiyong Tao
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
2017-06-22  5:44   ` Zhiyong Tao
2017-06-22  5:44   ` Zhiyong Tao
2017-06-24 20:00   ` Jonathan Cameron
2017-06-24 20:00     ` Jonathan Cameron
2017-06-24 20:00     ` Jonathan Cameron
2017-06-26  2:54     ` zhiyong tao [this message]
2017-06-26  2:54       ` zhiyong tao
2017-06-26  2:54       ` zhiyong tao
2017-06-26  5:01       ` Jonathan Cameron
2017-06-26  5:01         ` Jonathan Cameron
2017-06-26  5:01         ` Jonathan Cameron
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
2017-06-22  5:44   ` Zhiyong Tao
2017-06-22  5:44   ` Zhiyong Tao
2017-06-24 20:02   ` Jonathan Cameron
2017-06-24 20:02     ` Jonathan Cameron
2017-06-24 20:02     ` Jonathan Cameron
2017-06-26  1:55     ` zhiyong tao
2017-06-26  1:55       ` zhiyong tao
2017-06-26  1:55       ` zhiyong tao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498445692.844.5.camel@mhfsdcap03 \
    --to=zhiyong.tao@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=liguo.zhang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sean.wang@mediatek.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=yingjoe.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.