All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Breck <liam@networkimprov.net>
To: Tony Lindgren <tony@atomide.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	Liam Breck <kernel@networkimprov.net>,
	"Mark A . Greer" <mgreer@animalcreek.com>,
	linux-pm@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend
Date: Fri, 3 Feb 2017 13:00:51 -0800	[thread overview]
Message-ID: <CAKvHMgQs3YYtyMApYvdRAyzuzii_xA=ZKRfqG-zpFzrMef_qdg@mail.gmail.com> (raw)
In-Reply-To: <20170203185408.GB3721@atomide.com>

On Fri, Feb 3, 2017 at 10:54 AM, Tony Lindgren <tony@atomide.com> wrote:
> ...
> From: Tony Lindgren <tony@atomide.com>
> Date: Mon, 30 Jan 2017 07:10:31 -0800
> Subject: [PATCH] power: bq24190_charger: Use PM runtime autosuspend
>
> We can get quite a few interrupts when the battery is trickle charging.
> Let's enable PM runtime autosuspend to avoid constantly toggling device
> driver PM runtime state.
>
> Let's use a 600 ms timeout as that's how long the USB chager detection
> might take.
>
> Cc: Liam Breck <kernel@networkimprov.net>
> Acked-by: Mark Greer <mgreer@animalcreek.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  drivers/power/supply/bq24190_charger.c | 156 ++++++++++++++++++++++++---------
>  1 file changed, 114 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> --- a/drivers/power/supply/bq24190_charger.c
> +++ b/drivers/power/supply/bq24190_charger.c
>
> @@ -1234,11 +1267,18 @@ static void bq24190_check_status(struct bq24190_dev_info *bdi)
>  static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
>  {
>         struct bq24190_dev_info *bdi = data;
> +       int ret;
>
>         bdi->irq_event = true;
> -       pm_runtime_get_sync(bdi->dev);
> +       ret = pm_runtime_get_sync(bdi->dev);
> +       if (ret < 0) {
> +               dev_err(bdi->dev, "Runtime PM failed in %s: %i\n",
> +                       __func__, ret);
> +               return IRQ_NONE;
> +       }

Now this is a nitpick... Error msg should be consistent with suspend/resume:

> @@ -1480,10 +1532,20 @@ static int bq24190_pm_suspend(struct device *dev)
>  {
>         struct i2c_client *client = to_i2c_client(dev);
>         struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
> +       int error;
> +
> +       error = pm_runtime_get_sync(bdi->dev);
> +       if (error < 0) {
> +               dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", error);
> +               pm_runtime_put_noidle(bdi->dev);
> +       }

Like here.

> @@ -1492,15 +1554,25 @@ static int bq24190_pm_resume(struct device *dev)
>  {
>         struct i2c_client *client = to_i2c_client(dev);
>         struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
> +       int error;
>
>         bdi->f_reg = 0;
>         bdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state */
>
> -       pm_runtime_get_sync(bdi->dev);
> +       error = pm_runtime_get_sync(bdi->dev);
> +       if (error < 0) {
> +               pm_runtime_put_noidle(bdi->dev);
> +               dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", error);
> +       }

And here.

  reply	other threads:[~2017-02-03 21:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31  0:02 [PATCHv2 0/2] Two bq24190 PM improvments Tony Lindgren
2017-01-31  0:02 ` [PATCH 1/2] power: bq24190_charger: Check the interrupt status on resume Tony Lindgren
2017-02-03  0:32   ` Liam Breck
2017-01-31  0:02 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-01-31  0:14   ` Liam Breck
2017-01-31  0:36     ` Tony Lindgren
2017-02-03  1:43       ` Liam Breck
2017-02-03  3:44         ` Tony Lindgren
2017-02-03 10:38       ` Liam Breck
2017-02-03 18:54         ` Tony Lindgren
2017-02-03 21:00           ` Liam Breck [this message]
2017-02-03 21:17             ` Tony Lindgren
2017-02-03 21:44               ` Liam Breck
2017-02-03 22:28                 ` Tony Lindgren
2017-02-04  0:23               ` Liam Breck
2017-02-07 16:01                 ` Tony Lindgren
2017-02-07 18:20                   ` Liam Breck
  -- strict thread matches above, loose matches on Subject: below --
2017-02-08 23:12 [PATCHv4 0/2] Two bq24190 PM improvments Tony Lindgren
2017-02-08 23:13 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-02-03 23:09 [PATCHv3 0/2] Two bq24190 PM improvments Tony Lindgren
2017-02-03 23:09 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-02-08 21:32   ` Tony Lindgren
2017-01-20 22:04 [PATCH 0/2] Two bq24190 PM improvments Tony Lindgren
2017-01-20 22:04 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-01-21  0:47   ` Liam Breck
2017-01-24  1:27     ` Tony Lindgren
2017-01-24  3:34       ` Liam Breck
2017-01-24 18:29         ` Tony Lindgren
2017-01-24 23:05           ` Mark Greer
2017-01-26 16:20             ` Tony Lindgren
2017-01-26 23:56           ` Liam Breck
2017-01-30 23:55             ` Tony Lindgren
2017-01-31  0:01               ` Liam Breck
2017-01-31  0:04                 ` Tony Lindgren

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='CAKvHMgQs3YYtyMApYvdRAyzuzii_xA=ZKRfqG-zpFzrMef_qdg@mail.gmail.com' \
    --to=liam@networkimprov.net \
    --cc=kernel@networkimprov.net \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgreer@animalcreek.com \
    --cc=sre@kernel.org \
    --cc=tony@atomide.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.