Other Parts Discussed in Thread: BQ27500, BQ27000, BQ27200, BQ27210, BQ27010, BQ27510, BQ27541
Tool/software: Linux
Hi, I have been trying to use the driver for this power monitor on a Debian system, Linaro 4.4.9 to be specific. I'm working on the DART SD410 devkit from Variscite. I have issued some direct i2c calls from with a bash shell to get information from the BQ27421-G1 and verified the data reported as accurate. So I know I have the device connected properly.
However, after following the steps to build the driver into the kernel, I haven't identified any way to make use of the driver. I followed the instructions to build the driver into my kernel by way of menuconfig as shown here.
Symbol: BATTERY_BQ27XXX [=y] Type : tristate Prompt: BQ27xxx battery driver Location: -> Device Drivers -> Power supply class support (POWER_SUPPLY [=y]) Defined at drivers/power/supply/Kconfig:167 Depends on: POWER_SUPPLY [=y] Symbol: BATTERY_BQ27XXX_I2C [=y] Type : tristate Prompt: BQ27xxx I2C support Location: -> Device Drivers -> Power supply class support (POWER_SUPPLY [=y]) -> BQ27xxx battery driver (BATTERY_BQ27XXX [=y]) Defined at drivers/power/supply/Kconfig:172 Depends on: POWER_SUPPLY [=y] && BATTERY_BQ27XXX [=y] && I2C [=y]
After flashing the boot image of the SOM, I would expect something like a file structure to exist where cat'ing the contents of a file reports things like temperature, battery level, etc. But I've found no such things. Also, the .ko file for the module is nowhere to be found on the file system. I would expect that it resides somewhere under /lib/modules/<linux version>/. I had to find the .ko in the source tree, scp it to the SOM, and manually insert it with insmod. But even after that, I didn't see any way to get information polled from the device.
I've read the both the quick start guide and the technical reference for this device, but it doesn't seem to have this information, so I'm trying to answer the following questions.
(1) How to I build the kernel such that it includes the driver and loads it upon boot? A kernel rebuild after making the kernel config changes does not result this. What further steps do I need to do?
(2) How do I tell the driver on which i2c I have the BQ27421-G2 connected?
(3) How do I extract information from the BQ27421-G2 from the driver?
(4) The technical reference makes mention of what looks like some API calls, e.g. Temperature(), Voltage(). Is there a library (.so or .a) against which a program can link to access information provided by the driver? Or perhaps does some header file exist that a program could include at compile time?
Thanks.