Re: [PATCH] Add support for power_supply on tosa

From: Andrew Morton
Date: Tue Jul 01 2008 - 17:33:01 EST


On Fri, 20 Jun 2008 12:49:17 +0400
Dmitry Baryshkov <dbaryshkov@xxxxxxxxx> 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)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/