Commit 2b40459b authored by Yadwinder Singh Brar's avatar Yadwinder Singh Brar Committed by Samuel Ortiz

mfd: Allow to specify max77686 interrupt through DT or platform file also

Presently driver expects irq_gpio pin in platform data and maps it to irq
itself. But we can also directly specify the interrupt in DT or platform file.
Signed-off-by: default avatarYadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 9bdf9b4e
...@@ -252,21 +252,28 @@ int max77686_irq_init(struct max77686_dev *max77686) ...@@ -252,21 +252,28 @@ int max77686_irq_init(struct max77686_dev *max77686)
mutex_init(&max77686->irqlock); mutex_init(&max77686->irqlock);
max77686->irq = gpio_to_irq(max77686->irq_gpio); if (max77686->irq_gpio && !max77686->irq) {
max77686->irq = gpio_to_irq(max77686->irq_gpio);
if (debug_mask & MAX77686_DEBUG_IRQ_INT) {
ret = gpio_request(max77686->irq_gpio, "pmic_irq"); if (debug_mask & MAX77686_DEBUG_IRQ_INT) {
if (ret < 0) { ret = gpio_request(max77686->irq_gpio, "pmic_irq");
dev_err(max77686->dev, if (ret < 0) {
"Failed to request gpio %d with ret: %d\n", dev_err(max77686->dev,
max77686->irq_gpio, ret); "Failed to request gpio %d with ret:"
return IRQ_NONE; "%d\n", max77686->irq_gpio, ret);
return IRQ_NONE;
}
gpio_direction_input(max77686->irq_gpio);
val = gpio_get_value(max77686->irq_gpio);
gpio_free(max77686->irq_gpio);
pr_info("%s: gpio_irq=%x\n", __func__, val);
} }
}
gpio_direction_input(max77686->irq_gpio); if (!max77686->irq) {
val = gpio_get_value(max77686->irq_gpio); dev_err(max77686->dev, "irq is not specified\n");
gpio_free(max77686->irq_gpio); return -ENODEV;
pr_info("%s: gpio_irq=%x\n", __func__, val);
} }
/* Mask individual interrupt sources */ /* Mask individual interrupt sources */
......
...@@ -77,6 +77,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c, ...@@ -77,6 +77,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
max77686->wakeup = pdata->wakeup; max77686->wakeup = pdata->wakeup;
max77686->irq_gpio = pdata->irq_gpio; max77686->irq_gpio = pdata->irq_gpio;
max77686->irq = i2c->irq;
if (regmap_read(max77686->regmap, if (regmap_read(max77686->regmap,
MAX77686_REG_DEVICE_ID, &data) < 0) { MAX77686_REG_DEVICE_ID, &data) < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment