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.

BQ27220: I look for Linux driver for bq27220

Part Number: BQ27220
Other Parts Discussed in Thread: BQ27200, BQ27210, BQ27500, BQ27510, BQ27541, BQ27426, BQ27Z561, BQ28Z610, BQ34Z100, BQ78Z100

I look for Linux driver for bq27220

The Linux driver BQ27XXX provided by TI does not include BQ27220.
Where should I get the Linux drivers for BQ27220?

thank you

  • The bq27xxx driver works for bq27220 (reading information). If you are looking to write to data memory, then it is not a part of the driver because of security risks. The datasheet is the best reference for the commands.

  • Dear Shlrish

    Is there a replacement that is compatible with bq27220 and supports Linux drivers?

    and

    What is correct value string for compatible field in device tree?
     
    To enable bq27220 in linux kernel, there are two things to do before compile kernel.
    1. Enable feature in kernel menu config.
      - CONFIG_BATTERY_BQ27XXX
      - CONFIG_BATTERY_BQ27XXX_I2C
     
    2. Add device tree as below.
     
    (Just an example of modification of my old driver)
    &i2c0 {
    ...
            bat: battery {
                    compatible = "simple-battery";
                    voltage-min-design-microvolt = <3200000>;
                    energy-full-design-microwatt-hours = <17787000>;
                    charge-full-design-microamp-hours = <4900000>;
            };
     
            bq27220@55 {
                    compatible = "ti,bq27220";
                    reg = <0x55>;
                    monitored-battery = <&bat>;
            };
    ...
    };
     
     
    But in the kernel source file, "drivers/power/supply/bq27xxx_battery_i2c.c", "bq27220" does not exist.
     
    (Code snipets of bq27xxx_battery_i2c.c)
    static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
        { .compatible = "ti,bq27200" },
        { .compatible = "ti,bq27210" },
        { .compatible = "ti,bq27500" },
        { .compatible = "ti,bq27510" },
        { .compatible = "ti,bq27520" },
        { .compatible = "ti,bq27500-1" },
        { .compatible = "ti,bq27510g1" },
        { .compatible = "ti,bq27510g2" },
        { .compatible = "ti,bq27510g3" },
        { .compatible = "ti,bq27520g1" },
        { .compatible = "ti,bq27520g2" },
        { .compatible = "ti,bq27520g3" },
        { .compatible = "ti,bq27520g4" },
        { .compatible = "ti,bq27521" },
        { .compatible = "ti,bq27530" },
        { .compatible = "ti,bq27531" },
        { .compatible = "ti,bq27541" },
        { .compatible = "ti,bq27542" },
        { .compatible = "ti,bq27546" },
        { .compatible = "ti,bq27742" },
        { .compatible = "ti,bq27545" },
        { .compatible = "ti,bq27411" },
        { .compatible = "ti,bq27421" },
        { .compatible = "ti,bq27425" },
        { .compatible = "ti,bq27426" },
        { .compatible = "ti,bq27441" },
        { .compatible = "ti,bq27621" },
        { .compatible = "ti,bq27z561" },
        { .compatible = "ti,bq28z610" },
        { .compatible = "ti,bq34z100" },
        { .compatible = "ti,bq78z100" },
        {},
    };
     
    As you replied, if linux kernel source support bq27220, then what is the value string for compatible field in device tree?

     

    thank you 

  • You can choose bq27210. The commands are the same

  • Dear Shirish, thank you about your kind answer.

    I think BQ27210 and BQ27220 are not compatible. Which means, linux driver for bq27210 is not comatible for bq27220.
    Register for SOC for bq27210, RSOC is at 0x0B and CSOC is at 0x2C.
    But, Commands for SOC for bq27220 are 0x2C and 0x2D.
    Register for Flag(Battery Status) for bq27210 is at 0x0A.
    But, Commands for Flag for bq27220 are 0x0A and 0x0B.
    Unit of temperature for bq27210 is 0.25 degree kelvin and for bq27220 is 0.1 degree kelvin.
    Please, check compatibility again.

    thank you.
  • Hello Hong,

    I will check and get back to you

  • Hello Hong,

    The bq27541 has the same commands as bq27220 for RSOC and Flags. Normally the device in the same series has same commands, but in this case it is not that way.