Re: [PATCH v3 2/3] power: supply: bq27xxx: autodetect bq27411 and bq27541

From: Konrad Dybcio

Date: Thu Sep 10 2026 - 03:49:22 EST


On 9/10/26 1:47 AM, Rinat Muhamedgaliev wrote:
> Some replaceable battery packs used by OnePlus 6 and OnePlus 6T
> phones contain a bq27411, while others contain a bq27541. These
> devices require different register maps.
>
> Add support for the generic ti,bq27xxx compatible. At probe time,
> issue the DeviceType control command and select the bq27411 or bq27541
> register map from the returned value.
>
> Signed-off-by: Rinat Muhamedgaliev <rinat.muhamedgaliev@xxxxxxxxx>
> ---

[...]

First off, please don't send new revisions as a reply to the
previous one, this creates very messy thread structures and confuses
tooling. You may use the b4 tool for easy management:

https://b4.docs.kernel.org/en/latest/


> static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
> + { "bq27xxx", 0 },
> { "bq27200", BQ27000 },
> { "bq27210", BQ27010 },
> { "bq27500", BQ2750X },
> @@ -262,6 +300,7 @@ MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);
>
> #ifdef CONFIG_OF
> static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
> + { .compatible = "ti,bq27xxx" },

I don't think we need a new compatible here, especially given wildcard
compatibles are very much not going to be accepted by the dt folks.

I think it's fine to add a chip_id readback mechanism that would be in
place regardless of the compatible and would say something to the lines
of: "detected another chip, proceeding based on chip_id"

Konrad