mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
power: supply: max77705_charger: rework interrupts
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: a6a494c8e3 ("power: supply: max77705: Add charger driver for Maxim 77705")
Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
baedd8be70
commit
12a1185a06
|
|
@ -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;
|
||||
|
||||
|
|
@ -608,7 +601,7 @@ static int max77705_charger_probe(struct i2c_client *i2c)
|
|||
|
||||
max77705_charger_irq_chip.irq_drv_data = chg;
|
||||
ret = devm_regmap_add_irq_chip(chg->dev, chg->regmap, i2c->irq,
|
||||
IRQF_ONESHOT | IRQF_SHARED, 0,
|
||||
IRQF_ONESHOT, 0,
|
||||
&max77705_charger_irq_chip,
|
||||
&irq_data);
|
||||
if (ret)
|
||||
|
|
@ -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_NONE,
|
||||
"chgin-irq", chg);
|
||||
if (ret) {
|
||||
dev_err_probe(dev, ret, "Failed to Request chgin IRQ\n");
|
||||
goto destroy_wq;
|
||||
}
|
||||
|
||||
ret = max77705_charger_enable(chg);
|
||||
if (ret) {
|
||||
dev_err_probe(dev, ret, "failed to enable charge\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user