From 577e8c4548de397eff8947eb842df18a9d77c7c7 Mon Sep 17 00:00:00 2001 From: Chen Shunqing Date: Thu, 10 Feb 2022 16:46:33 +0800 Subject: [PATCH] power: supply: bq25890: fix warning of pd notifier call pc : rcu_note_context_switch+0x358/0x5a0 lr : __schedule+0x80/0x794 sp : ffffffc013233880 x29: ffffffc013233880 x28: 0000000000000002 x27: 0000000000000001 x26: ffffff81fe734c40 x25: ffffffc011ef1c40 x24: ffffff8102d5b590 x23: ffffffc011edc000 x22: 0000000000000002 x21: ffffffc1ec843000 x20: 0000000000000000 x19: ffffff8102909280 x18: ffffffc0130f10a0 x17: 0000000001000000 x16: 0000000000000002 x15: ffffff8102d9f100 x14: 0000000000000001 x13: 0000000000000001 x12: 0000000000000000 x11: 0000000000000001 x10: 0000000000000001 x9 : dead0000000005f6 x8 : 0000000000000001 x7 : 6eff726462687564 x6 : 00001cef92349520 x5 : 0000000000000000 x4 : 0000000000000001 x3 : 00000000fffea2c8 x2 : 0000000000000001 x1 : ffffffc011c34096 x0 : 0000000000000000 Call trace: rcu_note_context_switch+0x358/0x5a0 __schedule+0x80/0x794 schedule+0xa0/0xe8 schedule_timeout+0x84/0x124 rk3x_i2c_xfer_common+0x3cc/0x630 rk3x_i2c_xfer+0x18/0x28 __i2c_transfer+0x254/0x79c i2c_transfer+0xa4/0x100 regmap_i2c_read+0x58/0x98 _regmap_raw_read+0x290/0x42c _regmap_bus_read+0x48/0x84 _regmap_read+0x188/0x24c _regmap_update_bits+0x90/0x10c regmap_field_update_bits_base+0x70/0xa4 bq25890_pd_notifier_call+0x148/0x168 atomic_notifier_call_chain+0x50/0x90 power_supply_changed_work+0x80/0xd0 process_one_work+0x1f4/0x490 worker_thread+0x278/0x4dc kthread+0x13c/0x344 ret_from_fork+0x10/0x30 Signed-off-by: Chen Shunqing Change-Id: I2d42e2115daa99196bb77da577eafa0a94a91008 --- drivers/power/supply/bq25890_charger.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c index 9b98589525e0..af7733c097d7 100644 --- a/drivers/power/supply/bq25890_charger.c +++ b/drivers/power/supply/bq25890_charger.c @@ -960,6 +960,11 @@ static void bq25890_set_pd_param(struct bq25890_device *bq, int vol, int cur) i++; } + if (cur <= 500000) + bq25890_field_write(bq, F_AUTO_DPDM_EN, 1); + else + bq25890_field_write(bq, F_AUTO_DPDM_EN, 0); + bq25890_field_write(bq, F_IILIM, iilim); bq25890_field_write(bq, F_VINDPM_OFS, vindpm); bq25890_field_write(bq, F_ICHG, ichg); @@ -996,7 +1001,6 @@ static int bq25890_pd_notifier_call(struct notifier_block *nb, if (prop.intval == 0) { bq->pd_cur = 450000; bq->pd_vol = 5000000; - bq25890_field_write(bq, F_AUTO_DPDM_EN, 1); queue_delayed_work(bq->charger_wq, &bq->pd_work, msecs_to_jiffies(10)); return NOTIFY_OK; @@ -1013,7 +1017,6 @@ static int bq25890_pd_notifier_call(struct notifier_block *nb, return NOTIFY_OK; bq->pd_vol = prop.intval; - bq25890_field_write(bq, F_AUTO_DPDM_EN, 0); queue_delayed_work(bq->charger_wq, &bq->pd_work, msecs_to_jiffies(100)); }