[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHYPw2EPdmmbk+DM1SgFKa8LGAKQEp7ppX+0Zjpkdx7hOcwzJA@mail.gmail.com>
Date: Tue, 1 Nov 2011 13:23:40 +0100
From: Pali Rohár <pali.rohar@...il.com>
To: Lars-Peter Clausen <lars@...afoo.de>
Cc: linux-kernel@...r.kernel.org, Anton Vorontsov <cbou@...l.ru>,
syed rafiuddin <rafiuddin.sayed@...il.com>,
Rodolfo Giometti <giometti@...ux.it>,
David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH 8/9] bq27x00: Add miscdevice for each battery with ioctl
for reading registers
2011/11/1 Lars-Peter Clausen <lars@...afoo.de>:
> On 11/01/2011 01:43 AM, Pali Rohár wrote:
>> * When bq27x00_battery module is loaded it take control of bq27200 i2c battery chip and then it is not possible to use i2cget program from user space (returns -EBUSY)
>> * This patch adds new miscdevice for each battery which has ioctl BQ27X00_READ_REG for reading battery registers from user space
>>
>> * ioctl cmd:
>> #define BQ27X00_READ_REG _IO(MISC_MAJOR, 0)
>>
>> * ioctl arg:
>> struct bq27x00_reg_parms {
>> int reg; /* battery register (in) */
>> int single; /* 1 - 8bit register, 0 - 16bit register (in) */
>> int ret; /* register status, negative indicate error (out) */
>> };
>>
>> Signed-off-by: Pali Rohár <pali.rohar@...il.com>
>
> I'm not sure if this is such a good idea. Why do you need to read the registers
> from userspace? Shouldn't all relevant information be available in a
> standardized format through the power_supply userspace API? If you want to use
> it for debugging it might be a better idea to provide a debugfs file.
>
> - Lars
>
bq27200 chip has a lot of registers (for diagnostic) which is usefull
on Nokia N900. power_supply interface is not very abstract to handle
all of them. Also on Nokia N900 is needed proprietary pogram BME for
battery charging which need to access to bq27200 registers. A simple
LD_PRELOAD library which wrap i2c-dev access to this device provided
by this patch is here:
https://code.launchpad.net/~pali/+junk/maemo_libbqioctl
Other shell script which show all info from bq register is here:
http://enivax.net/jk/n900/bq.tar
--
Pali Rohár
pali.rohar@...il.com
--
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