All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lei YU <mine260309@gmail.com>
To: "Tanous, Ed" <ed.tanous@intel.com>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>
Subject: Re: What is the proper way to read RTC battery voltage
Date: Mon, 6 Aug 2018 13:51:23 +0800	[thread overview]
Message-ID: <CAARXrtkx00w-5D98nhooV+XB1OsaFWqVSdEn6ikHMAk753d=Kg@mail.gmail.com> (raw)
In-Reply-To: <fe3a6c3b-28cf-0af7-5c9d-5ac4dcaa3363@intel.com>

> > 3. We could use gpio-mux and io-channel-mux driver, that let kernel to
> >     automatically pull the GPIO while reading the sensor. (See
> >     https://github.com/mine260309/linux/commit/8e60647389e5400a85c705685ca2f6b875856c99
> >     for example).
> >     However, it requires some delay between GPIO pulled high and reading the ADC
> >     channel, if the delay is too small, the ADC channel reading becomes
> >     incorrect, e.g. it gets 0 or a lower value than expected.
> >
>
> This sounds like a cleaner solution, but more difficult to execute in
> practice.  I think either 2 or 3 would solve it.  Is there an easy way
> to delay in the driver without blocking?  It doesn't need to be terribly
> deterministic to work correctly.

I did not know a way to delay without blocking, I was thinking:
1. Is it reasonable to do udelay/mdelay in driver?
2. If yes, which driver should use the delay? The io-channel-mux driver,
   or adc driver?

> Another thing to note is that even with this, your battery life is
> affected by how often you poll the voltage, so in general we reduce the
> scan rate of the battery voltage readings compared to other sensors to
> keep the battery life more sustainable over the long term.

Yup, current phosphor-hwmon is able to config the sensor read interval, in
practice we probably read the battery voltage once every day.

      reply	other threads:[~2018-08-06  5:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03  6:14 What is the proper way to read RTC battery voltage Lei YU
2018-08-03 17:26 ` Ed Tanous
2018-08-06  5:51   ` Lei YU [this message]

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='CAARXrtkx00w-5D98nhooV+XB1OsaFWqVSdEn6ikHMAk753d=Kg@mail.gmail.com' \
    --to=mine260309@gmail.com \
    --cc=ed.tanous@intel.com \
    --cc=openbmc@lists.ozlabs.org \
    /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.