dt-bindings: power: supply: bq256xx: Add ti,no-thermistor property
Subsystems (2)
PATCH v3 1/2 dt-bindings: power: supply: bq256xx: Add ti,no-thermistor property
Add a new property ti,no-thermistor to indicate that no thermistor is connected to the TS pin of the chip.
---
Notes:
v2: change property name to ti,no-thermistor
v3: drop "|" in property description
.../bindings/power/supply/bq256xx.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Documentation/devicetree/bindings/power/supply/bq256xx.yaml +18 -0
@@ -68,11 +68,29 @@ properties: Interrupt sends an active low, 256 μs pulse to host to report the charger device status and faults. + ti,no-thermistor: + type: boolean + description: Indicates that no thermistor is connected to the TS pin + required: - compatible - reg - monitored-battery +allOf: + - if: + properties: + compatible: + contains: + enum: + - ti,bq25600 + - ti,bq25601 + - ti,bq25600d + - ti,bq25601d + then: + properties: + ti,no-thermistor: false + additionalProperties: false examples:
Signature · 1 line
2.30.2
PATCH v3 2/2 power: supply: bq256xx: Apply TS_IGNORE from devicetree
TS_IGNORE is default off in bq256xx chip. For some HW which doesn't have the NTC, we need to set TS_IGNORE to 1 to make the charge work. The new "ti,no-thermistor" is introduced to toggle it.
---
Notes:
v2: change property name to ti,no-thermistor
v3: drop "|" in property description
drivers/power/supply/bq256xx_charger.c | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/power/supply/bq256xx_charger.c +28 -0
@@ -41,6 +41,9 @@#define BQ256XX_IINDPM_MAX_uA 3200000#define BQ256XX_IINDPM_DEF_uA 2400000 +#define BQ256XX_TS_IGNORE BIT(6) +#define BQ256XX_TS_IGNORE_SHIFT 6 +#define BQ256XX_VINDPM_MASK GENMASK(3, 0)#define BQ256XX_VINDPM_STEP_uV 100000#define BQ256XX_VINDPM_OFFSET_uV 3900000
@@ -153,6 +156,7 @@* @vindpm: input voltage limit * @ichg_max: maximum fast charge current * @vbatreg_max: maximum charge voltage +* @ts_ignore: TS_IGNORE flag */ struct bq256xx_init_data {u32 ichg;
@@ -163,6 +167,7 @@ struct bq256xx_init_data {u32 vindpm;u32 ichg_max;u32 vbatreg_max; +bool ts_ignore; };/**
@@ -259,6 +264,7 @@ struct bq256xx_device {* @bq256xx_set_iterm: pointer to instance specific set_iterm function * @bq256xx_set_iprechg: pointer to instance specific set_iprechg function * @bq256xx_set_vindpm: pointer to instance specific set_vindpm function +* @bq256xx_set_ts_ignore: pointer to instance specific set_ts_ignore function * * @bq256xx_def_ichg: default ichg value in microamps * @bq256xx_def_iindpm: default iindpm value in microamps
@@ -290,6 +296,7 @@ struct bq256xx_chip_info {int (*bq256xx_set_iterm)(struct bq256xx_device *bq,int iterm);int (*bq256xx_set_iprechg)(struct bq256xx_device *bq,int iprechg);int (*bq256xx_set_vindpm)(struct bq256xx_device *bq,int vindpm); +int (*bq256xx_set_ts_ignore)(struct bq256xx_device *bq,bool ts_ignore);int bq256xx_def_ichg;int bq256xx_def_iindpm;
@@ -670,6 +677,12 @@ static int bq25601d_set_chrg_volt(struct bq256xx_device *bq, int vbatreg) BQ256XX_VBATREG_BIT_SHIFT); } +static int bq256xx_set_ts_ignore (struct bq256xx_device *bq,bool ts_ignore) +{ +return regmap_update_bits (bq->regmap,BQ256XX_INPUT_CURRENT_LIMIT , +BQ256XX_TS_IGNORE , (ts_ignore ?1 :0 ) <<BQ256XX_TS_IGNORE_SHIFT ); +} +static int bq256xx_get_prechrg_curr (struct bq256xx_device *bq) {unsigned int prechg_and_term_curr_lim;
@@ -1279,6 +1292,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_get_iterm = bq256xx_get_term_curr, .bq256xx_get_iprechg = bq256xx_get_prechrg_curr, .bq256xx_get_vindpm = bq256xx_get_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_set_ichg = bq256xx_set_ichg_curr, .bq256xx_set_iindpm = bq256xx_set_input_curr_lim,
@@ -1316,6 +1330,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
@@ -1346,6 +1361,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
@@ -1376,6 +1392,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
@@ -1406,6 +1423,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = bq256xx_set_ts_ignore, .bq256xx_def_ichg = BQ25611D_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
@@ -1436,6 +1454,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq25618_619_set_term_curr, .bq256xx_set_iprechg = bq25618_619_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = bq256xx_set_ts_ignore, .bq256xx_def_ichg = BQ25618_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
@@ -1466,6 +1485,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq25618_619_set_term_curr, .bq256xx_set_iprechg = bq25618_619_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = bq256xx_set_ts_ignore, .bq256xx_def_ichg = BQ25618_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
@@ -1582,6 +1602,12 @@ static int bq256xx_hw_init(struct bq256xx_device *bq)if (ret)return ret; +if (bq->chip_info->bq256xx_set_ts_ignore) { + ret = bq->chip_info->bq256xx_set_ts_ignore (bq, bq->init_data.ts_ignore); +if (ret) +return ret; + } +power_supply_put_battery_info (bq->charger, bat_info);return 0 ;
@@ -1616,6 +1642,8 @@ static int bq256xx_parse_dt(struct bq256xx_device *bq,if (ret) bq->init_data.iindpm = bq->chip_info->bq256xx_def_iindpm; + bq->init_data.ts_ignore =device_property_read_bool (bq->dev,"ti,no-thermistor" ); +return 0 ; }
Signature · 1 line
2.30.2
Re: [PATCH v3 2/2] power: supply: bq256xx: Apply TS_IGNORE from devicetree
Hi,
Quoted 6 lines · Hermes Zhang
TS_IGNOREis default off in bq256xx chip. For some HW which doesn't have the NTC, we need to setTS_IGNOREto 1 to make the charge work. The new "ti,no-thermistor" is introduced to toggle it.Signed-off-by Hermes Zhang <[email protected]>---
Does not apply, please rebase against latest power-supply for-next branch.
-- Sebastian
Quoted 148 lines
Notes:
v2: change property name to ti,no-thermistorv3: drop "|" in property description
drivers/power/supply/bq256xx_charger.c | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)drivers/power/supply/bq256xx_charger.c +28
-0@@ -41,6 +41,9 @@#define BQ256XX_IINDPM_MAX_uA 3200000#define BQ256XX_IINDPM_DEF_uA 2400000 +#define BQ256XX_TS_IGNORE BIT(6) +#define BQ256XX_TS_IGNORE_SHIFT 6 +#define BQ256XX_VINDPM_MASK GENMASK(3, 0)#define BQ256XX_VINDPM_STEP_uV 100000#define BQ256XX_VINDPM_OFFSET_uV 3900000@@ -153,6 +156,7 @@* @vindpm: input voltage limit * @ichg_max: maximum fast charge current * @vbatreg_max: maximum charge voltage +* @ts_ignore: TS_IGNORE flag */ struct bq256xx_init_data {u32 ichg;@@ -163,6 +167,7 @@ struct bq256xx_init_data {u32 vindpm;u32 ichg_max;u32 vbatreg_max; +bool ts_ignore; };/** @@ -259,6 +264,7 @@ struct bq256xx_device {* @bq256xx_set_iterm: pointer to instance specific set_iterm function * @bq256xx_set_iprechg: pointer to instance specific set_iprechg function * @bq256xx_set_vindpm: pointer to instance specific set_vindpm function +* @bq256xx_set_ts_ignore: pointer to instance specific set_ts_ignore function * * @bq256xx_def_ichg: default ichg value in microamps * @bq256xx_def_iindpm: default iindpm value in microamps @@ -290,6 +296,7 @@ struct bq256xx_chip_info {int (*bq256xx_set_iterm)(struct bq256xx_device *bq,int iterm);int (*bq256xx_set_iprechg)(struct bq256xx_device *bq,int iprechg);int (*bq256xx_set_vindpm)(struct bq256xx_device *bq,int vindpm); +int (*bq256xx_set_ts_ignore)(struct bq256xx_device *bq,bool ts_ignore);int bq256xx_def_ichg;int bq256xx_def_iindpm;@@ -670,6 +677,12 @@ static int bq25601d_set_chrg_volt(struct bq256xx_device *bq, int vbatreg) BQ256XX_VBATREG_BIT_SHIFT); } +static int bq256xx_set_ts_ignore (struct bq256xx_device *bq,bool ts_ignore) +{ +return regmap_update_bits (bq->regmap,BQ256XX_INPUT_CURRENT_LIMIT , +BQ256XX_TS_IGNORE , (ts_ignore ?1 :0 ) <<BQ256XX_TS_IGNORE_SHIFT ); +} +static int bq256xx_get_prechrg_curr (struct bq256xx_device *bq) {unsigned int prechg_and_term_curr_lim;@@ -1279,6 +1292,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_get_iterm = bq256xx_get_term_curr, .bq256xx_get_iprechg = bq256xx_get_prechrg_curr, .bq256xx_get_vindpm = bq256xx_get_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_set_ichg = bq256xx_set_ichg_curr, .bq256xx_set_iindpm = bq256xx_set_input_curr_lim,@@ -1316,6 +1330,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,@@ -1346,6 +1361,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,@@ -1376,6 +1392,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = NULL, .bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,@@ -1406,6 +1423,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq256xx_set_term_curr, .bq256xx_set_iprechg = bq256xx_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = bq256xx_set_ts_ignore, .bq256xx_def_ichg = BQ25611D_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,@@ -1436,6 +1454,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq25618_619_set_term_curr, .bq256xx_set_iprechg = bq25618_619_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = bq256xx_set_ts_ignore, .bq256xx_def_ichg = BQ25618_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,@@ -1466,6 +1485,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = { .bq256xx_set_iterm = bq25618_619_set_term_curr, .bq256xx_set_iprechg = bq25618_619_set_prechrg_curr, .bq256xx_set_vindpm = bq256xx_set_input_volt_lim, + .bq256xx_set_ts_ignore = bq256xx_set_ts_ignore, .bq256xx_def_ichg = BQ25618_ICHG_DEF_uA, .bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,@@ -1582,6 +1602,12 @@ static int bq256xx_hw_init(struct bq256xx_device *bq)if (ret)return ret; +if (bq->chip_info->bq256xx_set_ts_ignore) { + ret = bq->chip_info->bq256xx_set_ts_ignore (bq, bq->init_data.ts_ignore); +if (ret) +return ret; + } +power_supply_put_battery_info (bq->charger, bat_info);return 0 ;@@ -1616,6 +1642,8 @@ static int bq256xx_parse_dt(struct bq256xx_device *bq,if (ret) bq->init_data.iindpm = bq->chip_info->bq256xx_def_iindpm; + bq->init_data.ts_ignore =device_property_read_bool (bq->dev,"ti,no-thermistor" ); +return 0 ; }Signature · 1 line
2.30.2
Quoted 8 lines · Hermes Zhang
Add a new property ti,no-thermistor to indicate that no thermistor is connected to the TS pin of the chip.
Signed-off-by Hermes Zhang <[email protected]>---
Notes:
v2: change property name to ti,no-thermistor
This is a friendly reminder during the review process.
It looks like you received a tag and forgot to add it.
If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.
https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540
If a tag was not added on purpose, please state why and what changed.
Best regards,
Krzysztof