lkml.org 
[lkml]   [2008]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Add support for power_supply on tosa
On Fri, 20 Jun 2008 12:49:17 +0400
Dmitry Baryshkov <dbaryshkov@gmail.com> wrote:

> Support the battery management on Sharp Zaurus SL-6000.
>
> This patch depends on the tc6393xb support as found in the arm:devel
> or linux-next trees.

Which means that Anton can't really merge it into his tree, I guess.
I'll babysit it untilthe appropriate time.


> +static unsigned long tosa_read_bat(struct tosa_bat *bat)
> +{
> + unsigned long value = 0;
> +
> + if (bat->gpio_bat < 0 || bat->adc_bat < 0)
> + return 0;
> +
> + mutex_lock(&bat_lock);
> + gpio_set_value(bat->gpio_bat, 1);
> + mdelay(5);

msleep() is preferred over a busywait.

> + value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
> + bat->adc_bat);
> + gpio_set_value(bat->gpio_bat, 0);
> + mutex_unlock(&bat_lock);
> +
> + value = value * 1000000 / bat->adc_bat_divider;
> +
> + return value;
> +}
> +
> +static unsigned long tosa_read_temp(struct tosa_bat *bat)
> +{
> + unsigned long value = 0;
> +
> + if (bat->gpio_temp < 0 || bat->adc_temp < 0)
> + return 0;
> +
> + mutex_lock(&bat_lock);
> + gpio_set_value(bat->gpio_temp, 1);
> + mdelay(5);

ditto. (and elsewhere)



\
 
 \ /
  Last update: 2008-07-01 23:35    [W:1.177 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site