public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Starikovskiy <astarikovskiy@suse.de>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: LenBrown <lenb@kernel.org>, Linux-acpi@vger.kernel.org
Subject: Re: [RFC][PATCH] ACPI: battery: add power_{now, avg} properties to power_class
Date: Tue, 16 Dec 2008 11:53:29 +0300	[thread overview]
Message-ID: <49476C89.3050707@suse.de> (raw)
In-Reply-To: <20081216012204.GF10767@khazad-dum.debian.net>

Henrique de Moraes Holschuh wrote:
> On Tue, 16 Dec 2008, Alexey Starikovskiy wrote:
>> @@ -224,10 +224,12 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy,
>>  				acpi_battery_vscale(battery) * 1000;
>>  		break;
>>  	case POWER_SUPPLY_PROP_CURRENT_NOW:
>> +	case POWER_SUPPLY_PROP_POWER_NOW:
>>  		val->intval = abs(battery->current_now) *
>>  				acpi_battery_ipscale(battery) * 1000;
>>  		break;
>>  	case POWER_SUPPLY_PROP_CURRENT_AVG:
>> +	case POWER_SUPPLY_PROP_POWER_AVG:
>>  		val->intval = abs(battery->current_avg) *
>>  				acpi_battery_ipscale(battery) * 1000;
>>  		break;
> 
> Excuse me if I am talking nonsense (I have looked over just the patch,
> not the entire file), but how can that be correct?  It is either power
> or current, it cannot be both, so the CURRENT case should be dropped.
file name under /sys depends on property, so if we want some variable to
be named as current_now, it should be returned by case POWER_SUPPLY_PROP_CURRENT_NOW.
Then we register with power_supply, we say which set of properties (either charge or energy) we support,
so for one battery we will receive request for either CURRENT_AVG or POWER_AVG, not both.
> And if it is power, why have fields named current_now... or is
> ipscale() a voltage, and not a scaling factor?
ipscale stands for I/P scaling, as opposed to V scaling -- it depends on units returned by actual battery.
All energy/charge fields are reused, so battery->current_now contains either power_now or current_now from battery.
 


  reply	other threads:[~2008-12-16  8:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 21:38 [RFC][PATCH] ACPI: battery: add power_{now, avg} properties to power_class Alexey Starikovskiy
2008-12-16  1:22 ` Henrique de Moraes Holschuh
2008-12-16  8:53   ` Alexey Starikovskiy [this message]
2008-12-16 14:18     ` Henrique de Moraes Holschuh
2008-12-16 15:19       ` Rafael J. Wysocki
2008-12-16 15:17 ` Rafael J. Wysocki
2008-12-16 15:28   ` Alexey Starikovskiy
2008-12-16 15:51     ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2008-12-16 16:27 Alexey Starikovskiy
2008-12-16 17:41 ` Len Brown
2008-12-16 20:49   ` Rafael J. Wysocki

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=49476C89.3050707@suse.de \
    --to=astarikovskiy@suse.de \
    --cc=Linux-acpi@vger.kernel.org \
    --cc=hmh@hmh.eng.br \
    --cc=lenb@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox