lkml.org 
[lkml]   [2010]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] power/ds2760_battery: make charge_now and charge_full writeable
On Tue, May 11, 2010 at 06:38:45PM +0200, Daniel Mack wrote:
[...]
> +static int ds2760_battery_set_property(struct power_supply *psy,
> + enum power_supply_property psp,
> + const union power_supply_propval *val)
> +{
> + int ret = -EPERM;
> + unsigned char tmp;
> + struct ds2760_device_info *di = to_ds2760_device_info(psy);
> +
> + switch (psp) {
> + case POWER_SUPPLY_PROP_CHARGE_FULL:
> + /* the interface counts in uAh, convert the value */
> + ds2760_battery_write_rated_capacity(di, (val->intval / 1000L) /
> + RATED_CAPACITY_FACTOR);

OK, Mark hinted that you should not change rated (design)
capacity, ever. You've made CHARGE_FULL writable, which now
actually changes CHARGE_FULL_DESIGN (which reports
rated_capacity). Obviously, this isn't acceptable.

I understand that you might want to change rated capacity for
your custom battery setups, and that's fine. After all, it's
your hardware, and you have a right to break it. :-)

But to do so,

1. Could you at least change this back to
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, so it'll be clear what
exactly this prop is actually changing, and

2. Can we introduce Kconfig symbol BATTERY_DS2760_UNSAFE_OPS,
and put an #ifdefs for this property? It should be
'default n', of course. Plus we can #ifdef the rated_capacity
module param as well.

Thanks!

--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2


\
 
 \ /
  Last update: 2010-05-12 10:17    [W:0.137 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site