@@ -293,6 +293,8 @@ static int palmas_set_pdata_irq_flag(struct i2c_client *i2c,
}
pdata->irq_flags = irqd_get_trigger_type(irq_data);
+ pdata->irq_external_inversion = of_property_read_bool(i2c->dev.of_node,
+ "ti,irq-externally-inverted");
dev_info(&i2c->dev, "Irq flag is 0x%08x\n", pdata->irq_flags);
return 0;
}
@@ -447,6 +449,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
reg = PALMAS_POLARITY_CTRL_INT_POLARITY;
else
reg = 0;
+ if (pdata->irq_external_inversion)
+ reg ^= PALMAS_POLARITY_CTRL_INT_POLARITY;
ret = palmas_update_bits(palmas, PALMAS_PU_PD_OD_BASE,
PALMAS_POLARITY_CTRL, PALMAS_POLARITY_CTRL_INT_POLARITY,
reg);
@@ -292,6 +292,7 @@ struct palmas_clk_platform_data {
struct palmas_platform_data {
int irq_flags;
+ bool irq_external_inversion;
int gpio_base;
/* bit value to be loaded to the POWER_CTRL register */