[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <agaalpr6eo6we4yxdgdxccyjuw2zdl5qo5gqs7u3cqx73x73s3@a4hgn7pubon2>
Date: Mon, 15 Sep 2025 17:34:42 +0200
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Dzmitry Sankouski <dsankouski@...il.com>
Cc: Chanwoo Choi <cw00.choi@...sung.com>,
Krzysztof Kozlowski <krzk@...nel.org>, Lee Jones <lee@...nel.org>,
Luca Ceresoli <luca.ceresoli@...tlin.com>, Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: Re: [PATCH v3 6/9] power: supply: max77705_charger: rework interrupts
Hi,
On Thu, Sep 11, 2025 at 08:57:14PM +0300, Dzmitry Sankouski wrote:
> Current implementation uses handle_post_irq to actually handle chgin
> irq. This is not how things are meant to work in regmap-irq.
>
> Remove handle_post_irq, and request a threaded interrupt for chgin.
>
> Fixes: a6a494c8e3ce ("power: supply: max77705: Add charger driver for Maxim 77705")
>
There shouldn't be a newline between Fixes and SoB line.
> Signed-off-by: Dzmitry Sankouski <dsankouski@...il.com>
> ---
> Changes to v3:
> - move irq initialization after workqueue and charger initialization
> ---
> drivers/power/supply/max77705_charger.c | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/power/supply/max77705_charger.c b/drivers/power/supply/max77705_charger.c
> index d6a3cd98c898..5f831c25b150 100644
> --- a/drivers/power/supply/max77705_charger.c
> +++ b/drivers/power/supply/max77705_charger.c
> @@ -40,13 +40,13 @@ static enum power_supply_property max77705_charger_props[] = {
> POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
> };
>
> -static int max77705_chgin_irq(void *irq_drv_data)
> +static irqreturn_t max77705_chgin_irq(int irq, void *irq_drv_data)
> {
> struct max77705_charger_data *chg = irq_drv_data;
>
> queue_work(chg->wqueue, &chg->chgin_work);
>
> - return 0;
> + return IRQ_HANDLED;
> }
>
> static const struct regmap_irq max77705_charger_irqs[] = {
> @@ -64,7 +64,6 @@ static struct regmap_irq_chip max77705_charger_irq_chip = {
> .name = "max77705-charger",
> .status_base = MAX77705_CHG_REG_INT,
> .mask_base = MAX77705_CHG_REG_INT_MASK,
> - .handle_post_irq = max77705_chgin_irq,
> .num_regs = 1,
> .irqs = max77705_charger_irqs,
> .num_irqs = ARRAY_SIZE(max77705_charger_irqs),
> @@ -593,12 +592,6 @@ static int max77705_charger_probe(struct i2c_client *i2c)
> "cannot allocate regmap field\n");
> }
>
> - ret = regmap_update_bits(chg->regmap,
> - MAX77705_CHG_REG_INT_MASK,
> - MAX77705_CHGIN_IM, 0);
> - if (ret)
> - return ret;
> -
> pscfg.fwnode = dev_fwnode(dev);
> pscfg.drv_data = chg;
>
> @@ -630,6 +623,15 @@ static int max77705_charger_probe(struct i2c_client *i2c)
> goto destroy_wq;
> }
>
> + ret = devm_request_threaded_irq(dev, regmap_irq_get_virq(irq_data, MAX77705_CHGIN_I),
> + NULL, max77705_chgin_irq,
> + IRQF_TRIGGER_HIGH,
I guess IRQF_TRIGGER_NONE considering this is not a physical IRQ?
> + "chgin-irq", chg);
wrong indent
> + if (ret) {
> + pr_err("%s: Failed to Request IRQ (%d)\n", __func__, ret);
dev_err_probe() and no need to print __func__, see how it works in
other drivers.
Greetings,
-- Sebastian
> + goto destroy_wq;
> + }
> +
> ret = max77705_charger_enable(chg);
> if (ret) {
> dev_err_probe(dev, ret, "failed to enable charge\n");
>
> --
> 2.39.5
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists