137-1-pinctrl-create-irq-pin-mapping.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From 4c228d02d1339a286e259893062ea445be82b573 Mon Sep 17 00:00:00 2001
  2. From: Chen-Yu Tsai <wens@csie.org>
  3. Date: Tue, 7 Jan 2014 18:56:29 +0800
  4. Subject: [PATCH] pinctrl: sunxi: create irq/pin mapping during init
  5. The irq/pin mapping is used to lookup the pin to mux to the irq
  6. function when the irq is enabled. It is created when gpio_to_irq
  7. is called. Creating the mapping during init allows us to map the
  8. interrupts directly from the device tree.
  9. Signed-off-by: Chen-Yu Tsai <wens@csie.org>
  10. ---
  11. drivers/pinctrl/pinctrl-sunxi.c | 5 +++--
  12. 1 file changed, 3 insertions(+), 2 deletions(-)
  13. --- a/drivers/pinctrl/pinctrl-sunxi.c
  14. +++ b/drivers/pinctrl/pinctrl-sunxi.c
  15. @@ -531,8 +531,6 @@ static int sunxi_pinctrl_gpio_to_irq(str
  16. if (!desc)
  17. return -EINVAL;
  18. - pctl->irq_array[desc->irqnum] = offset;
  19. -
  20. dev_dbg(chip->dev, "%s: request IRQ for GPIO %d, return %d\n",
  21. chip->label, offset + chip->base, desc->irqnum);
  22. @@ -759,6 +757,9 @@ static int sunxi_pinctrl_build_state(str
  23. struct sunxi_desc_function *func = pin->functions;
  24. while (func->name) {
  25. + /* Create interrupt mapping while we're at it */
  26. + if (!strcmp(func->name, "irq"))
  27. + pctl->irq_array[func->irqnum] = pin->pin.number;
  28. sunxi_pinctrl_add_function(pctl, func->name);
  29. func++;
  30. }