lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 Jul 2010 16:03:14 +0200
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Anton Vorontsov <cbouatmailru@...il.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Woodhouse <dwmw2@...radead.org>,
	Ben Hutchings <ben@...adent.org.uk>,
	linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL] battery-2.6.35.git

On Tue, Jul 27, 2010 at 15:51, Anton Vorontsov <cbouatmailru@...il.com> wrote:
> diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
> index d762a0c..9b3b4b7 100644
> --- a/drivers/power/ds2782_battery.c
> +++ b/drivers/power/ds2782_battery.c
> @@ -43,10 +43,9 @@
>  struct ds278x_info;
>
>  struct ds278x_battery_ops {
> -       int     (*get_current)(struct ds278x_info *info, int *current_uA);
> -       int     (*get_voltage)(struct ds278x_info *info, int *voltage_uA);
> -       int     (*get_capacity)(struct ds278x_info *info, int *capacity_uA);
> -
> +       int (*get_battery_current)(struct ds278x_info *info, int *current_uA);
> +       int (*get_battery_voltage)(struct ds278x_info *info, int *voltage_uA);
> +       int (*get_battery_capacity)(struct ds278x_info *info, int *capacity_uA);

What's the meaning of these `uA' namings? At first I thought `micro Ampère', but
that can't be correct for voltage (`uV'?) and capacity (`uAh'?).

So I had a look at the sources, and noticed:

| static int ds2782_get_voltage(struct ds278x_info *info, int *voltage_uA)
| {
|       s16 raw;
|       int err;
|
|       /*
|        * Voltage is measured in units of 4.88mV. The voltage is stored as
                                           ^^^^
|        * a 10-bit number plus sign, in the upper bits of a 16-bit register
|        */
|       err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw);
|       if (err)
|               return err;
|       *voltage_uA = (raw / 32) * 4800;
                                   ^^^^
These don't match?

So the voltage_uA unit is 1 mV?

|       return 0;
| }
|
| static int ds2786_get_voltage(struct ds278x_info *info, int *voltage_uA)
| {
|       s16 raw;
|       int err;
|
|       /*
|        * Voltage is measured in units of 1.22mV. The voltage is stored as
|        * a 10-bit number plus sign, in the upper bits of a 16-bit register
|        */
|       err = ds278x_read_reg16(info, DS278x_REG_VOLT_MSB, &raw);
|       if (err)
|               return err;
|       *voltage_uA = (raw / 8) * 1220;
                             ^
32? Or the comments above are wrong.

|       return 0;
| }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ