From: Pavel Machek <pavel@ucw.cz>
To: Anton Vorontsov <cbou@mail.ru>
Cc: linux-kernel@vger.kernel.org, kernel-discuss@handhelds.org,
dwmw2@infradead.org
Subject: Re: [PATCH 3/7] [RFC] Battery monitoring class
Date: Sun, 15 Apr 2007 19:56:56 +0000 [thread overview]
Message-ID: <20070415195655.GG10097@ucw.cz> (raw)
In-Reply-To: <20070411232503.GC20095@zarina>
Hi!
> * It insists on reusing its predefined attributes *and* their units.
> So, userspace getting expected values for any battery.
>
> Also common units is required for APM/ACPI emulation.
>
> Though our battery class insisting on re-usage, but not forces it. If some
> battery driver can't convert its own raw values (can't imagine why), then
> driver is free to implement its own attributes *and* additional _units
> attribute. Though, this scheme is discouraged.
>
> * LEDs support. Each battery register its trigger, and gadgets with LEDs
> can quickly bind to battery-charging / battery-full triggers.
>
> Here how it looks like from user space:
>
> # ls /sys/class/battery/main-battery/
> capacity max_capacity max_voltage min_current power subsystem uevent
> current max_current min_capacity min_voltage status temp voltage
> # cat /sys/class/battery/main-battery/status
> Full
> # cat /sys/class/leds/h5400\:green-right/trigger
> none h5400-radio timer hwtimer main-battery-charging [main-battery-full]
> # cat /sys/class/leds/h5400\:green-right/brightness
> 255
Can we get few lines in Documentation? I guess min_capacity is
shutdown capacity at current temperature, but its surely non-obvious.
Will min_capacity increase as batery gets old? Or will max_capacity
decrease? (Should we introduce design_capacity for ACPI systems that
know the difference?)
What is min_current? Granularity of amper meter?
And min_voltage is shutdown voltage?
Otherwise it looks good to me. Something like this is really needed.
> + * All voltages, currents, capacities and temperatures in mV, mA, mAh and
> + * tenths of a degree unless otherwise stated. It's driver's job to convert
tenths of degree Celsius?
Pavel
> +#define BATTERY_STATUS_UNKNOWN 0
> +#define BATTERY_STATUS_CHARGING 1
> +#define BATTERY_STATUS_DISCHARGING 2
> +#define BATTERY_STATUS_NOT_CHARGING 3
> +#define BATTERY_STATUS_FULL 4
Perhaps we need STATUS_ERROR? At least on some machines it is
different from STATUS_NOT_CHARGING.
> + /* private */
> + struct power_supplicant pst;
> +
> + #ifdef CONFIG_LEDS_TRIGGERS
> + struct led_trigger *charging_trig;
> + char *charging_trig_name;
> + struct led_trigger *full_trig;
> + char *full_trig_name;
> + #endif
> +};
#ifdefs need to be at column 0?
> +/*
> + * This is recommended structure to specify static battery parameters.
> + * Generic one, parametrizable for different batteries. Battery device
> + * itself does bot use it, but that's what implementing most drivers,
'does not'?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2007-04-15 19:58 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 23:25 [PATCH 3/7] [RFC] Battery monitoring class Anton Vorontsov
2007-04-12 2:53 ` Randy Dunlap
2007-04-12 16:51 ` Anton Vorontsov
2007-04-12 3:43 ` Greg KH
2007-04-12 12:25 ` Henrique de Moraes Holschuh
2007-04-12 13:43 ` Anton Vorontsov
2007-04-12 13:08 ` Matthew Garrett
2007-04-12 14:15 ` Anton Vorontsov
2007-04-12 14:24 ` Matthew Garrett
2007-04-12 14:36 ` [Kernel-discuss] " Paul Sokolovsky
2007-04-12 18:56 ` Henrique de Moraes Holschuh
2007-04-12 20:44 ` Anton Vorontsov
2007-04-13 0:51 ` Henrique de Moraes Holschuh
2007-04-13 2:15 ` Anton Vorontsov
2007-04-24 19:36 ` Pavel Machek
2007-04-13 2:34 ` Shem Multinymous
2007-04-13 2:36 ` Anton Vorontsov
2007-04-13 13:51 ` Henrique de Moraes Holschuh
2007-04-12 15:00 ` Shem Multinymous
2007-04-12 15:18 ` Anton Vorontsov
2007-04-12 17:23 ` Shem Multinymous
2007-04-13 13:49 ` Anton Vorontsov
2007-04-15 0:43 ` Anton Vorontsov
2007-05-04 9:59 ` Pavel Machek
2007-04-15 19:56 ` Pavel Machek [this message]
2007-04-15 22:10 ` [Kernel-discuss] " Anton Vorontsov
2007-04-15 22:08 ` Ondrej Zajicek
2007-04-15 22:50 ` Anton Vorontsov
2007-04-16 0:57 ` Henrique de Moraes Holschuh
2007-04-16 1:57 ` Anton Vorontsov
2007-04-16 14:34 ` Henrique de Moraes Holschuh
2007-04-16 2:32 ` [Kernel-discuss] " ian
2007-04-16 3:12 ` Anton Vorontsov
2007-04-16 8:28 ` ian
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=20070415195655.GG10097@ucw.cz \
--to=pavel@ucw.cz \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=kernel-discuss@handhelds.org \
--cc=linux-kernel@vger.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