Commit fa7f78e0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gpio-v3.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

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
...@@ -2065,7 +2065,7 @@ S: Supported ...@@ -2065,7 +2065,7 @@ S: Supported
F: drivers/scsi/bnx2i/ F: drivers/scsi/bnx2i/
BROADCOM KONA GPIO DRIVER BROADCOM KONA GPIO DRIVER
M: Markus Mayer <markus.mayer@linaro.org> M: Ray Jui <rjui@broadcom.com>
L: bcm-kernel-feedback-list@broadcom.com L: bcm-kernel-feedback-list@broadcom.com
S: Supported S: Supported
F: drivers/gpio/gpio-bcm-kona.c F: drivers/gpio/gpio-bcm-kona.c
......
...@@ -90,7 +90,7 @@ struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, ...@@ -90,7 +90,7 @@ struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
struct gpio_desc **dr; struct gpio_desc **dr;
struct gpio_desc *desc; 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); GFP_KERNEL);
if (!dr) if (!dr)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
...@@ -407,9 +407,27 @@ static int lp_gpio_runtime_resume(struct device *dev) ...@@ -407,9 +407,27 @@ static int lp_gpio_runtime_resume(struct device *dev)
return 0; 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 = { static const struct dev_pm_ops lp_gpio_pm_ops = {
.runtime_suspend = lp_gpio_runtime_suspend, .runtime_suspend = lp_gpio_runtime_suspend,
.runtime_resume = lp_gpio_runtime_resume, .runtime_resume = lp_gpio_runtime_resume,
.resume = lp_gpio_resume,
}; };
static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = { static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = {
......
...@@ -95,6 +95,9 @@ struct zynq_gpio { ...@@ -95,6 +95,9 @@ struct zynq_gpio {
struct clk *clk; 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 * zynq_gpio_get_bank_pin - Get the bank number and pin number within that bank
* for a given pin in the GPIO device * 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) ...@@ -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)); gpio->base_addr + ZYNQ_GPIO_INTPOL_OFFSET(bank_num));
writel_relaxed(int_any, writel_relaxed(int_any,
gpio->base_addr + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); 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; return 0;
} }
...@@ -424,9 +436,21 @@ static int zynq_gpio_set_wake(struct irq_data *data, unsigned int on) ...@@ -424,9 +436,21 @@ static int zynq_gpio_set_wake(struct irq_data *data, unsigned int on)
} }
/* irq chip descriptor */ /* irq chip descriptor */
static struct irq_chip zynq_gpio_irqchip = { static struct irq_chip zynq_gpio_level_irqchip = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.irq_enable = zynq_gpio_irq_enable, .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_mask = zynq_gpio_irq_mask,
.irq_unmask = zynq_gpio_irq_unmask, .irq_unmask = zynq_gpio_irq_unmask,
.irq_set_type = zynq_gpio_set_irq_type, .irq_set_type = zynq_gpio_set_irq_type,
...@@ -469,10 +493,6 @@ static void zynq_gpio_irqhandler(unsigned int irq, struct irq_desc *desc) ...@@ -469,10 +493,6 @@ static void zynq_gpio_irqhandler(unsigned int irq, struct irq_desc *desc)
offset); offset);
generic_handle_irq(gpio_irq); 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) ...@@ -610,14 +630,14 @@ static int zynq_gpio_probe(struct platform_device *pdev)
writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr +
ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); ZYNQ_GPIO_INTDIS_OFFSET(bank_num));
ret = gpiochip_irqchip_add(chip, &zynq_gpio_irqchip, 0, ret = gpiochip_irqchip_add(chip, &zynq_gpio_edge_irqchip, 0,
handle_simple_irq, IRQ_TYPE_NONE); handle_level_irq, IRQ_TYPE_NONE);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to add irq chip\n"); dev_err(&pdev->dev, "Failed to add irq chip\n");
goto err_rm_gpiochip; 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); zynq_gpio_irqhandler);
pm_runtime_set_active(&pdev->dev); pm_runtime_set_active(&pdev->dev);
......
...@@ -307,7 +307,5 @@ void of_gpiochip_add(struct gpio_chip *chip) ...@@ -307,7 +307,5 @@ void of_gpiochip_add(struct gpio_chip *chip)
void of_gpiochip_remove(struct gpio_chip *chip) void of_gpiochip_remove(struct gpio_chip *chip)
{ {
gpiochip_remove_pin_ranges(chip); gpiochip_remove_pin_ranges(chip);
of_node_put(chip->of_node);
if (chip->of_node)
of_node_put(chip->of_node);
} }
...@@ -16,8 +16,6 @@ struct device; ...@@ -16,8 +16,6 @@ struct device;
*/ */
struct gpio_desc; struct gpio_desc;
#ifdef CONFIG_GPIOLIB
#define GPIOD_FLAGS_BIT_DIR_SET BIT(0) #define GPIOD_FLAGS_BIT_DIR_SET BIT(0)
#define GPIOD_FLAGS_BIT_DIR_OUT BIT(1) #define GPIOD_FLAGS_BIT_DIR_OUT BIT(1)
#define GPIOD_FLAGS_BIT_DIR_VAL BIT(2) #define GPIOD_FLAGS_BIT_DIR_VAL BIT(2)
...@@ -34,6 +32,8 @@ enum gpiod_flags { ...@@ -34,6 +32,8 @@ enum gpiod_flags {
GPIOD_FLAGS_BIT_DIR_VAL, GPIOD_FLAGS_BIT_DIR_VAL,
}; };
#ifdef CONFIG_GPIOLIB
/* Acquire and dispose GPIOs */ /* Acquire and dispose GPIOs */
struct gpio_desc *__must_check __gpiod_get(struct device *dev, struct gpio_desc *__must_check __gpiod_get(struct device *dev,
const char *con_id, const char *con_id,
......
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