Messages in this thread Patch in this message | | | From | Yauhen Kharuzhy <> | Subject | [PATCH 2/4] bq25890: Add max input current limit property | Date | Sun, 7 Nov 2021 23:19:59 +0300 |
| |
Add property 'ti,input-max-current' to define input current limit if needed. It will be applied if automatic charger type detection is disabled and using of ILIM pin is disabled or such pin defines greater limit than IINLIM field.
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com> --- drivers/power/supply/bq25890_charger.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 34467bfb9537..1c43555d5bd8 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -85,6 +85,7 @@ struct bq25890_init_data { u8 treg; /* thermal regulation threshold */ u8 rbatcomp; /* IBAT sense resistor value */ u8 vclamp; /* IBAT compensation voltage limit */ + u8 iinlim_max; /* maximum input current limit allowed */ }; struct bq25890_state { @@ -657,6 +658,7 @@ static int bq25890_hw_init(struct bq25890_device *bq) {F_TREG, bq->init_data.treg}, {F_BATCMP, bq->init_data.rbatcomp}, {F_VCLAMP, bq->init_data.vclamp}, + {F_IINLIM, bq->init_data.iinlim_max}, }; ret = bq25890_chip_reset(bq); @@ -870,11 +872,13 @@ static int bq25890_fw_read_u32_props(struct bq25890_device *bq) {"ti,thermal-regulation-threshold", true, TBL_TREG, &init->treg}, {"ti,ibatcomp-micro-ohms", true, TBL_RBATCOMP, &init->rbatcomp}, {"ti,ibatcomp-clamp-microvolt", true, TBL_VBATCOMP, &init->vclamp}, + {"ti,input-max-current", true, TBL_IINLIM, &init->iinlim_max}, }; /* initialize data for optional properties */ init->treg = 3; /* 120 degrees Celsius */ init->rbatcomp = init->vclamp = 0; /* IBAT compensation disabled */ + init->iinlim_max = 0x3f; for (i = 0; i < ARRAY_SIZE(props); i++) { ret = device_property_read_u32(bq->dev, props[i].name, -- 2.33.1
| |