All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Masney <masneyb@onstation.org>
To: Lorenzo BIANCONI <lorenzo.bianconi@st.com>
Cc: "jic23@kernel.org" <jic23@kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH] iio: humidity: hts221: add power management support
Date: Thu, 11 May 2017 06:55:04 -0400	[thread overview]
Message-ID: <20170511105503.GA22606@607924cbbc93> (raw)
In-Reply-To: <20170511093512.GA4932@ctocxl0005.oa.cto.st.com>

On Thu, May 11, 2017 at 09:35:12AM +0000, Lorenzo BIANCONI wrote:
> > If desired, one way to get rid of the enabled flag would be to
> > add support for runtime power management to automatically shutdown
> > the chip after a period of inactivity. See
> > https://lkml.org/lkml/2017/4/25/101 for an example.
> > 
> 
> I am not a pm_runtime expert but according to the documentation runtime_suspend
> callback is called when device's usage counter and counter of 'active' children
> of the device are equal to 0. Moreover device possible states are 'disabled'
> (HTS221_REG_CNTRL1_ADDR register set to 0) or 'active' (HTS221_REG_CNTRL1_ADDR
> register configured with a given sample rate). In the first condition
> runtime_suspend() will not take any effect whereas in the latter one the
> callback will not be called since device's usage counter is grater than 0.
> Moreover implement system-wide pm support through runtime pm support just to
> avoid a boolean flag seems a little bit overkill to me. What do you think?
> Is my understanding correct?

Sorry, I should have also said that I didn't think that runtime PM was
absolutely required. I also agree adding runtime PM just to remove the
flag is overkill. Runtime PM is nice to have if this sensor is hooked
up to something that may run off a battery (such as a weather station)
to help conserve power. The flag removal is a by product of this. :)

As for the runtime PM reference count, when your driver is initialized,
keep the device off so that the device usage count is initially zero.
Wrap your _write_raw() and _read_raw() functions with the runtime PM
calls and the device will power on and off as needed.

Brian

  reply	other threads:[~2017-05-11 10:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 20:40 [PATCH] iio: humidity: hts221: add power management support Lorenzo Bianconi
2017-05-10 20:57 ` Brian Masney
2017-05-11  9:35   ` Lorenzo BIANCONI
2017-05-11 10:55     ` Brian Masney [this message]
2017-05-11 11:10       ` Lorenzo BIANCONI
2017-05-11 12:28         ` Brian Masney
2017-05-14 15:08     ` Jonathan Cameron
2017-05-14 15:14       ` Lorenzo Bianconi

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=20170511105503.GA22606@607924cbbc93 \
    --to=masneyb@onstation.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi@st.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.