Skip to content

Commit 45ce36f

Browse files
krzkchanwoochoi
authored andcommitted
extcon: ptn5150: Use generic "interrupts" property
Interrupts do not have to be always GPIO based so instead of expecting "int-gpios" property and converting the GPIO to an interrupt, just accept any interrupt via generic "interrupts" property. Keep support for old "int-gpios" for backward compatibility. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 6aaad58 commit 45ce36f

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

‎drivers/extcon/extcon-ptn5150.c‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,6 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c,
239239

240240
info->dev = &i2c->dev;
241241
info->i2c = i2c;
242-
info->int_gpiod = devm_gpiod_get(&i2c->dev, "int", GPIOD_IN);
243-
if (IS_ERR(info->int_gpiod)) {
244-
dev_err(dev, "failed to get INT GPIO\n");
245-
return PTR_ERR(info->int_gpiod);
246-
}
247242
info->vbus_gpiod = devm_gpiod_get(&i2c->dev, "vbus", GPIOD_IN);
248243
if (IS_ERR(info->vbus_gpiod)) {
249244
dev_err(dev, "failed to get VBUS GPIO\n");
@@ -267,22 +262,30 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c,
267262
return ret;
268263
}
269264

270-
if (info->int_gpiod) {
265+
if (i2c->irq > 0) {
266+
info->irq = i2c->irq;
267+
} else {
268+
info->int_gpiod = devm_gpiod_get(&i2c->dev, "int", GPIOD_IN);
269+
if (IS_ERR(info->int_gpiod)) {
270+
dev_err(dev, "failed to get INT GPIO\n");
271+
return PTR_ERR(info->int_gpiod);
272+
}
273+
271274
info->irq = gpiod_to_irq(info->int_gpiod);
272275
if (info->irq < 0) {
273276
dev_err(dev, "failed to get INTB IRQ\n");
274277
return info->irq;
275278
}
279+
}
276280

277-
ret = devm_request_threaded_irq(dev, info->irq, NULL,
278-
ptn5150_irq_handler,
279-
IRQF_TRIGGER_FALLING |
280-
IRQF_ONESHOT,
281-
i2c->name, info);
282-
if (ret < 0) {
283-
dev_err(dev, "failed to request handler for INTB IRQ\n");
284-
return ret;
285-
}
281+
ret = devm_request_threaded_irq(dev, info->irq, NULL,
282+
ptn5150_irq_handler,
283+
IRQF_TRIGGER_FALLING |
284+
IRQF_ONESHOT,
285+
i2c->name, info);
286+
if (ret < 0) {
287+
dev_err(dev, "failed to request handler for INTB IRQ\n");
288+
return ret;
286289
}
287290

288291
/* Allocate extcon device */

0 commit comments

Comments
 (0)