From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] acpi: dptf_power: Add DPTF power participant
Date: Mon, 27 Jun 2016 11:09:05 -0700 [thread overview]
Message-ID: <1467050945.8970.86.camel@linux.intel.com> (raw)
In-Reply-To: <CAJZ5v0hR9E-pLkkvbSLwLG8A1ECCVa=+45YJ1+L1cjXHaPaLtg@mail.gmail.com>
On Mon, 2016-06-27 at 03:45 +0200, Rafael J. Wysocki wrote:
> On Mon, Jun 27, 2016 at 3:31 AM, Srinivas Pandruvada
> <srinivas.pandruvada@linux.intel.com> wrote:
> >
> > On Fri, 2016-06-24 at 02:26 +0200, Rafael J. Wysocki wrote:
> > >
> > > >
> > > > >
> > > > > >
> > > > > >
> > > On Fri, Jun 24, 2016 at 1:19 AM, Srinivas Pandruvada
> > > <srinivas.pandruvada@linux.intel.com> wrote:
> > > >
> > > > On Fri, 2016-06-24 at 00:31 +0200, Rafael J. Wysocki wrote:
> > > > >
> > > > > On Thu, Jun 23, 2016 at 11:42 PM, Srinivas Pandruvada
> > > > > <srinivas.pandruvada@linux.intel.com> wrote:
> > [...]
> >
> > >
> > > I think what you need is that if acpi_battery is bound to at
> > > least
> > > one
> > > device, you don't want to bind dptf_power to
> > > anything. Conversely,
> > > if
> > > dptf_power has been bound to at least one device, you don't want
> > > to
> > > bind acpi_battery to anything.
> > >
> > > That may be achieved with a lock and two counters, one (A)
> > > incremented
> > > only by acpi_battery and the other (B) incremented only by
> > > dptf_power
> > > and such that you can't increment A if B is different from 0 and
> > > you
> > > can't increment B if A is different from 0. Of course, each
> > > driver
> > > would need to specify which counter it wants to use (A or B), so
> > > that
> > > would take an additional argument to acpi_battery_common_add()
> > > and an
> > > additional field in struct acpi_battery (for the remove
> > > operation).
> > >
> > > With that, I think it should only be possible to build both
> > > acpi_battery and dptf_power if they are both modules. IOW,
> > > DPTF_POWER
> > > should depend on (!ACPI_BATTERY || ACPI_BATTERY=m) or
> > > similar. And
> > > if
> > > they are both modules, let user space manage that.
> > >
> > > And the waiting itself doesn't add any value then IMO.
> > Yes. I think the best solution is not to let define DPTF_POWER when
> > the
> > ACPI_BATTERY is defined same as my first version of the patch or
> > let
> > both add as there is no harm as they will show same levels. The
> > reason
> > is:
> > We have some devices with two ACPI_BATTERIES (primary and
> > secondary/backup) and they must be presented as two power supply
> > devices to user space. In those devices DPTF_POWER may be
> > equivalent to
> > only one of the ACPI_BATTERY (Will point to same battery for
> > Battery
> > levels). So we can't simply refuse to add ACPI_BATTERY device
> > addition
> > because DPTF_POWER device is registered before.
> OK
>
> Say dptf_power points to the same battery device as acpi_battery. Is
> there any way to tell when that happens?
May be we can memcmp the output of _BIX (Battery Information Extended).
If they are same it belongs to same battery.
If there are two ACPI batteries, hope atleast they have difference in
one element in the following package.
Package {
// ASCIIZ is ASCII character string terminated with a 0x00.
Revision
//Integer
Power Unit
//Integer (DWORD)
Design Capacity
//Integer (DWORD)
Last Full Charge Capacity
//Integer (DWORD)
Battery Technology
//Integer (DWORD)
Design Voltage
//Integer (DWORD)
Design Capacity of Warning
//Integer (DWORD)
Design Capacity of Low
//Integer (DWORD)
Cycle Count
//Integer (DWORD)
Measurement Accuracy
Max Sampling Time
Min Sampling Time
Max Averaging Interval
Min Averaging Interval //Integer
//Integer
//Integer
//Integer
//Integer
(DWORD)
(DWORD)
(DWORD)
(DWORD)
(DWORD)
Battery Capacity Granularity 1
Battery Capacity Granularity 2
Model Number
Serial Number
Battery Type
OEM Information
}
Thanks,
Srinivas
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-06-27 18:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 21:42 [PATCH v3 0/3] DPTF Platform power participant driver Srinivas Pandruvada
2016-06-23 21:42 ` [PATCH v3 1/3] acpi: battery: Split battery driver for reuse by DPTF power participant Srinivas Pandruvada
2016-06-23 21:42 ` [PATCH v3 2/3] acpi: dptf_power: Add " Srinivas Pandruvada
2016-06-23 22:31 ` Rafael J. Wysocki
2016-06-23 23:19 ` Srinivas Pandruvada
2016-06-24 0:26 ` Rafael J. Wysocki
2016-06-27 1:31 ` Srinivas Pandruvada
2016-06-27 1:45 ` Rafael J. Wysocki
2016-06-27 8:42 ` Zheng, Lv
2016-06-27 18:09 ` Srinivas Pandruvada [this message]
2016-06-23 21:42 ` [PATCH v3 3/3] acpi: battery_common: battery present status for INT3407 Srinivas Pandruvada
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=1467050945.8970.86.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
/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 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).