[1/5] mfd: axp20x: Use IRQF_TRIGGER_LOW on the axp288
diff mbox

Message ID 20161214135209.16369-1-hdegoede@redhat.com
State Not Applicable
Headers show

Commit Message

Hans de Goede Dec. 14, 2016, 1:52 p.m. UTC
The interrupt line of the entire family of axp2xx pmics is active-low,
for devicetree enumerated irqs, this is dealt with in the devicetree.

ACPI irq resources have a flag field for this too, I tried using this
on my CUBE iwork8 Air tablet, but it does not contain the right data.

The dstd shows the irq listed as either ActiveLow or ActiveHigh,
depending on the OSID variable, which seems to be set by the
"OS IMAGE ID" in the BIOS/EFI setup screen.

Since the acpi-resource info is no good, simply pass in IRQF_TRIGGER_LOW
on the axp288.

Together with the other axp288 fixes in this series, this fixes the axp288
irq contineously triggering.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/mfd/axp20x.c       | 6 +++---
 include/linux/mfd/axp20x.h | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Chen-Yu Tsai Dec. 14, 2016, 2:19 p.m. UTC | #1
On Wed, Dec 14, 2016 at 9:52 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> The interrupt line of the entire family of axp2xx pmics is active-low,
> for devicetree enumerated irqs, this is dealt with in the devicetree.
>
> ACPI irq resources have a flag field for this too, I tried using this
> on my CUBE iwork8 Air tablet, but it does not contain the right data.
>
> The dstd shows the irq listed as either ActiveLow or ActiveHigh,
> depending on the OSID variable, which seems to be set by the
> "OS IMAGE ID" in the BIOS/EFI setup screen.
>
> Since the acpi-resource info is no good, simply pass in IRQF_TRIGGER_LOW
> on the axp288.
>
> Together with the other axp288 fixes in this series, this fixes the axp288
> irq contineously triggering.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

This patch looks good to me. However, I do not have any AXP288 hardware
to test it on, nor am I familiar with the ACPI stuff.

Acked-by: Chen-Yu Tsai <wens@csie.org>

P.S. I don't think we're handling IRQ trigger types at all. The hardware
default for the NMI interrupt in the Allwinner chips just happens to be
active low.
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lee Jones Jan. 3, 2017, 5:53 p.m. UTC | #2
On Wed, 14 Dec 2016, Hans de Goede wrote:

> The interrupt line of the entire family of axp2xx pmics is active-low,
> for devicetree enumerated irqs, this is dealt with in the devicetree.
> 
> ACPI irq resources have a flag field for this too, I tried using this
> on my CUBE iwork8 Air tablet, but it does not contain the right data.
> 
> The dstd shows the irq listed as either ActiveLow or ActiveHigh,
> depending on the OSID variable, which seems to be set by the
> "OS IMAGE ID" in the BIOS/EFI setup screen.
> 
> Since the acpi-resource info is no good, simply pass in IRQF_TRIGGER_LOW
> on the axp288.
> 
> Together with the other axp288 fixes in this series, this fixes the axp288
> irq contineously triggering.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/mfd/axp20x.c       | 6 +++---
>  include/linux/mfd/axp20x.h | 1 +
>  2 files changed, 4 insertions(+), 3 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index ba130be..3d76941 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -800,6 +800,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
>  		axp20x->nr_cells = ARRAY_SIZE(axp288_cells);
>  		axp20x->regmap_cfg = &axp288_regmap_config;
>  		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
> +		axp20x->irq_flags = IRQF_TRIGGER_LOW;
>  		break;
>  	case AXP806_ID:
>  		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
> @@ -829,9 +830,8 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
>  	int ret;
>  
>  	ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
> -				  IRQF_ONESHOT | IRQF_SHARED, -1,
> -				  axp20x->regmap_irq_chip,
> -				  &axp20x->regmap_irqc);
> +			  IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags,
> +			   -1, axp20x->regmap_irq_chip, &axp20x->regmap_irqc);
>  	if (ret) {
>  		dev_err(axp20x->dev, "failed to add irq chip: %d\n", ret);
>  		return ret;
> diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> index fec597f..199cce3 100644
> --- a/include/linux/mfd/axp20x.h
> +++ b/include/linux/mfd/axp20x.h
> @@ -517,6 +517,7 @@ enum axp809_irqs {
>  struct axp20x_dev {
>  	struct device			*dev;
>  	int				irq;
> +	unsigned long			irq_flags;
>  	struct regmap			*regmap;
>  	struct regmap_irq_chip_data	*regmap_irqc;
>  	long				variant;

Patch
diff mbox

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index ba130be..3d76941 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -800,6 +800,7 @@  int axp20x_match_device(struct axp20x_dev *axp20x)
 		axp20x->nr_cells = ARRAY_SIZE(axp288_cells);
 		axp20x->regmap_cfg = &axp288_regmap_config;
 		axp20x->regmap_irq_chip = &axp288_regmap_irq_chip;
+		axp20x->irq_flags = IRQF_TRIGGER_LOW;
 		break;
 	case AXP806_ID:
 		axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
@@ -829,9 +830,8 @@  int axp20x_device_probe(struct axp20x_dev *axp20x)
 	int ret;
 
 	ret = regmap_add_irq_chip(axp20x->regmap, axp20x->irq,
-				  IRQF_ONESHOT | IRQF_SHARED, -1,
-				  axp20x->regmap_irq_chip,
-				  &axp20x->regmap_irqc);
+			  IRQF_ONESHOT | IRQF_SHARED | axp20x->irq_flags,
+			   -1, axp20x->regmap_irq_chip, &axp20x->regmap_irqc);
 	if (ret) {
 		dev_err(axp20x->dev, "failed to add irq chip: %d\n", ret);
 		return ret;
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index fec597f..199cce3 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -517,6 +517,7 @@  enum axp809_irqs {
 struct axp20x_dev {
 	struct device			*dev;
 	int				irq;
+	unsigned long			irq_flags;
 	struct regmap			*regmap;
 	struct regmap_irq_chip_data	*regmap_irqc;
 	long				variant;