This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Application of bq27441-g1 with 3.X Linux kernel

Other Parts Discussed in Thread: BQ27441-G1, BQSTUDIO, BQ27500, BQ27000, BQ27510, BQEVSW

Hello!

I have a device with bq27441-1g IC. My device is Freescale i.MX6q-based which works with Linux 3.10.53 kernel. I am trying to add bq27441 driver into kernel.
I found bq27xxx-related menuentry in the "menuconfig", but I can't see a related files in the Linux sysfs.
Everything I see is

root@smartphone:~# find /sys/ -name "*bq*"
/sys/bus/i2c/drivers/bq27x00-battery
/sys/bus/platform/drivers/bq27000-battery
/sys/module/bq27x00_battery

root@smartphone:/sys/bus/platform/drivers/bq27000-battery# ls
bind  uevent  unbind

I tried to find driver at the product page ti.com/product/bq27441-g1, but there is a driver for Linux 4.X kernel. "Linux/Android Software Solutions for TI Single-cell Gas Gauges" document doesn't help me too.

Searches on the forum haven't helped me either.

Does anybody successfully used this IC with Linux 3.X kernel?

  • Hey Ivan,

    Did you make any progress with this ?

    I am trying to use the driver too, but havent been able to locate the necessary header files. Also, there is an andriod driver for bq-27441 as well, android.googlesource.com/.../bq27441_battery.c

    Do let the forum know, if and when you do proceed.

    Are you able to update the design capacity programmatically ? i.e. without the use of adapter and bqStudio.

    - Chintan Pathak
  • Hi Ivan!

    try use i2cdetect utility from i2c-tools package (apt-get install i2c-tools) for detect your bq27441on i2c bus.

    I look into kernel sources (3.10.17), but bq27x00.c have no support bq27441:

    #define DRIVER_VERSION            "1.2.0" 

    enum bq27x00_chip { BQ27000, BQ27500, BQ27425};

    You have variants:

    - rewrite/correct current driver

    - search driver in internet

    - if driver exist for new kernels (4.x) you may try make backport for you kernel

    In generic case:

    1. menuconfig to switch on support driver battery (better make to module)

    2. depend of - if dts file then write structure in i2c bus for you driver (name, address) OR if boardfile then write to boardfile..

    3. rebuild kernel with modules and reload system

    4. look modules (lsmod) or modprobe "you module"

    5. if success, then you should see files - /sys/class/power_supply/BAT0/

  • Hi Ivan,

    bq27441 has the same register mapping as bq27421, which is covered in the driver you mentioned above.
    If you go to this page: processors.wiki.ti.com/.../Android_Software_Solutions_for_TI_Single-cell_Gas_Gauges
    You can find a link to not only the driver, but also a utility called bqTool which you can use to configure the gauge from a .gm.fs Flashstream file, a special .gg.csv file or with other methods. You can use the Golden Image tab in bqStudio to generate a .gm.fs file.

    What it does:
     
    In addition to the regular reporting functions (Voltage(), Current(), SOC() etc.) this driver has APIs for reading and writing the DM of the gauge. These APIs are in turn used for initializing the DM of ROM based gauges.
    The initialization happens at startup(about ~65s into the the startup) After startup we poll the status of ITPOR every 6 minutes and repeat the DM initialization if it’s set. The polling happens along with the polling of other parameters such as Current(), SOC() etc and the period for this polling loop is customizable.
    The registers to initialized in the DM may be specified in the code in an array like this:
     
    static struct dm_reg bq274xx_dm_regs[] = { {82, 0, 2, 1000}, /* Qmax */ {82, 5, 1, 0x81}, /* Load Select */ {82, 10, 2, 1340}, /* Design Capacity */ {82, 12, 2, 3700}, /* Design Energy */ {82, 16, 2, 3250}, /* Terminate Voltage */ {82, 27, 2, 110}, /* Taper rate */ };
     
    What it doesn’t:
     
    It doesn’t have a mechanism to save and restore Ra values and Qmax as suggested in the Quick Start Guide. This means it will reload default values every time the battery is inserted.
  • Hello dMax!

    We decided to use BQ27510 instead of BQ27441.
    Could you please give me the link to the Flashstream tool which i can use with bqEVSW 0.9.92?

    Thank you.