Re: [PATCH v5] power: supply: max77705_charger: implement aicl feature

From: Dzmitry Sankouski
Date: Thu Sep 25 2025 - 13:24:06 EST


вт, 23 сент. 2025 г. в 01:28, Sebastian Reichel
<sebastian.reichel@xxxxxxxxxxxxx>:
>
>
> After looking at this again in this simpler version: Why do you
> need the delayed work at all? It seems you can simplify to this:
>
> static irqreturn_t max77705_aicl_irq(int irq, void *irq_drv_data)
> {
> struct max77705_charger_data *chg = irq_drv_data;
> unsigned int regval, irq_status;
> int err;
>
> do {
> regmap_read(chg->regmap, MAX77705_CHG_REG_INT_OK, &irq_status);
> if (!(irq_status & BIT(MAX77705_AICL_I))) {
> err = regmap_field_read(chg->rfield[MAX77705_CHG_CHGIN_LIM], &regval);
> if (err < 0)
> continue;
>
> regval--;
>
> err = regmap_field_write(chg->rfield[MAX77705_CHG_CHGIN_LIM], regval);
> if (err < 0)
> continue;
>
> msleep(AICL_WORK_DELAY_MS);
> }
> } while(irq_status & BIT(MAX77705_AICL_I));
>
> return IRQ_HANDLED;
> }
>

That long interrupt handler with sleep tricked me, because there's the
concept of
as short as possible irq handler. However, I realise now, this is a bottom
half threaded interrupt handler, so as short as possible may be ignored here.

--
Best regards and thanks for review,
Dzmitry