Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa7f78e0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull gpio fixes from Linus Walleij:

 - a largeish fix for the IRQ handling in the new Zynq driver.  The
   quite verbose commit message gives the exact details.
 - move some defines for gpiod flags outside an ifdef to make stub
   functions work again.
 - various minor fixes that we can accept for -rc1.

* tag 'gpio-v3.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio-lynxpoint: enable input sensing in resume
  gpio: move GPIOD flags outside #ifdef
  gpio: delete unneeded test before of_node_put
  gpio: zynq: Fix IRQ handlers
  gpiolib: devres: use correct structure type name in sizeof
  MAINTAINERS: Change maintainer for gpio-bcm-kona.c
parents 5e30ca1e 8117bd53
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2065,7 +2065,7 @@ S: Supported
F:	drivers/scsi/bnx2i/

BROADCOM KONA GPIO DRIVER
M:	Markus Mayer <markus.mayer@linaro.org>
M:	Ray Jui <rjui@broadcom.com>
L:	bcm-kernel-feedback-list@broadcom.com
S:	Supported
F:	drivers/gpio/gpio-bcm-kona.c
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
	struct gpio_desc **dr;
	struct gpio_desc *desc;

	dr = devres_alloc(devm_gpiod_release, sizeof(struct gpiod_desc *),
	dr = devres_alloc(devm_gpiod_release, sizeof(struct gpio_desc *),
			  GFP_KERNEL);
	if (!dr)
		return ERR_PTR(-ENOMEM);
+18 −0
Original line number Diff line number Diff line
@@ -407,9 +407,27 @@ static int lp_gpio_runtime_resume(struct device *dev)
	return 0;
}

static int lp_gpio_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct lp_gpio *lg = platform_get_drvdata(pdev);
	unsigned long reg;
	int i;

	/* on some hardware suspend clears input sensing, re-enable it here */
	for (i = 0; i < lg->chip.ngpio; i++) {
		if (gpiochip_is_requested(&lg->chip, i) != NULL) {
			reg = lp_gpio_reg(&lg->chip, i, LP_CONFIG2);
			outl(inl(reg) & ~GPINDIS_BIT, reg);
		}
	}
	return 0;
}

static const struct dev_pm_ops lp_gpio_pm_ops = {
	.runtime_suspend = lp_gpio_runtime_suspend,
	.runtime_resume = lp_gpio_runtime_resume,
	.resume = lp_gpio_resume,
};

static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = {
+28 −8
Original line number Diff line number Diff line
@@ -95,6 +95,9 @@ struct zynq_gpio {
	struct clk *clk;
};

static struct irq_chip zynq_gpio_level_irqchip;
static struct irq_chip zynq_gpio_edge_irqchip;

/**
 * zynq_gpio_get_bank_pin - Get the bank number and pin number within that bank
 * for a given pin in the GPIO device
@@ -410,6 +413,15 @@ static int zynq_gpio_set_irq_type(struct irq_data *irq_data, unsigned int type)
		       gpio->base_addr + ZYNQ_GPIO_INTPOL_OFFSET(bank_num));
	writel_relaxed(int_any,
		       gpio->base_addr + ZYNQ_GPIO_INTANY_OFFSET(bank_num));

	if (type & IRQ_TYPE_LEVEL_MASK) {
		__irq_set_chip_handler_name_locked(irq_data->irq,
			&zynq_gpio_level_irqchip, handle_fasteoi_irq, NULL);
	} else {
		__irq_set_chip_handler_name_locked(irq_data->irq,
			&zynq_gpio_edge_irqchip, handle_level_irq, NULL);
	}

	return 0;
}

@@ -424,9 +436,21 @@ static int zynq_gpio_set_wake(struct irq_data *data, unsigned int on)
}

/* irq chip descriptor */
static struct irq_chip zynq_gpio_irqchip = {
static struct irq_chip zynq_gpio_level_irqchip = {
	.name		= DRIVER_NAME,
	.irq_enable	= zynq_gpio_irq_enable,
	.irq_eoi	= zynq_gpio_irq_ack,
	.irq_mask	= zynq_gpio_irq_mask,
	.irq_unmask	= zynq_gpio_irq_unmask,
	.irq_set_type	= zynq_gpio_set_irq_type,
	.irq_set_wake	= zynq_gpio_set_wake,
	.flags		= IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED,
};

static struct irq_chip zynq_gpio_edge_irqchip = {
	.name		= DRIVER_NAME,
	.irq_enable	= zynq_gpio_irq_enable,
	.irq_ack	= zynq_gpio_irq_ack,
	.irq_mask	= zynq_gpio_irq_mask,
	.irq_unmask	= zynq_gpio_irq_unmask,
	.irq_set_type	= zynq_gpio_set_irq_type,
@@ -469,10 +493,6 @@ static void zynq_gpio_irqhandler(unsigned int irq, struct irq_desc *desc)
							offset);
				generic_handle_irq(gpio_irq);
			}

			/* clear IRQ in HW */
			writel_relaxed(int_sts, gpio->base_addr +
					ZYNQ_GPIO_INTSTS_OFFSET(bank_num));
		}
	}

@@ -610,14 +630,14 @@ static int zynq_gpio_probe(struct platform_device *pdev)
		writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr +
			       ZYNQ_GPIO_INTDIS_OFFSET(bank_num));

	ret = gpiochip_irqchip_add(chip, &zynq_gpio_irqchip, 0,
				   handle_simple_irq, IRQ_TYPE_NONE);
	ret = gpiochip_irqchip_add(chip, &zynq_gpio_edge_irqchip, 0,
				   handle_level_irq, IRQ_TYPE_NONE);
	if (ret) {
		dev_err(&pdev->dev, "Failed to add irq chip\n");
		goto err_rm_gpiochip;
	}

	gpiochip_set_chained_irqchip(chip, &zynq_gpio_irqchip, irq,
	gpiochip_set_chained_irqchip(chip, &zynq_gpio_edge_irqchip, irq,
				     zynq_gpio_irqhandler);

	pm_runtime_set_active(&pdev->dev);
+1 −3
Original line number Diff line number Diff line
@@ -307,7 +307,5 @@ void of_gpiochip_add(struct gpio_chip *chip)
void of_gpiochip_remove(struct gpio_chip *chip)
{
	gpiochip_remove_pin_ranges(chip);

	if (chip->of_node)
	of_node_put(chip->of_node);
}
Loading