summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-apple-gpio.c
Commit message (Collapse)AuthorAgeFilesLines
* pinctrl: apple: Use a raw spinlock for the regmapHector Martin2022-05-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The irqchip ops are called with a raw spinlock held, so the subsequent regmap usage cannot use a plain spinlock. spi-hid-apple-of spi0.0: spihid_apple_of_probe:74 ============================= [ BUG: Invalid wait context ] 5.18.0-asahi-00176-g0fa3ab03bdea #1337 Not tainted ----------------------------- kworker/u20:3/86 is trying to lock: ffff8000166b5018 (pinctrl_apple_gpio:462:(&regmap_config)->lock){....}-{3:3}, at: regmap_lock_spinlock+0x18/0x30 other info that might help us debug this: context-{5:5} 7 locks held by kworker/u20:3/86: #0: ffff800017725d48 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x1c8/0x670 #1: ffff80001e33bdd0 (deferred_probe_work){+.+.}-{0:0}, at: process_one_work+0x1c8/0x670 #2: ffff800017d629a0 (&dev->mutex){....}-{4:4}, at: __device_attach+0x30/0x17c #3: ffff80002414e618 (&ctlr->add_lock){+.+.}-{4:4}, at: spi_add_device+0x40/0x80 #4: ffff800024116990 (&dev->mutex){....}-{4:4}, at: __device_attach+0x30/0x17c #5: ffff800022d4be58 (request_class){+.+.}-{4:4}, at: __setup_irq+0xa8/0x720 #6: ffff800022d4bcc8 (lock_class){....}-{2:2}, at: __setup_irq+0xcc/0x720 Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs") Signed-off-by: Hector Martin <marcan@marcan.st> Link: https://lore.kernel.org/r/20220524142206.18833-1-marcan@marcan.st Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* Merge branch 'irq/gpio-immutable' of ↵Linus Walleij2022-05-051-13/+16
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into devel
| * pinctrl: apple-gpio: Make the irqchip immutableMarc Zyngier2022-04-191-13/+16
| | | | | | | | | | | | | | | | | | Prevent gpiolib from messing with the irqchip by advertising the irq_chip structure as immutable, making it const, and adding the various calls that gpiolib relies upon. Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220419141846.598305-7-maz@kernel.org
* | pinctrl: apple: Make it work as a moduleHector Martin2022-05-051-0/+1
|/ | | | | | | | We need MODULE_DEVICE_TABLE for module autoloading to work. Signed-off-by: Hector Martin <marcan@marcan.st> Link: https://lore.kernel.org/r/20220502092335.30670-1-marcan@marcan.st Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple-gpio: fix flexible_array.cocci warningskernel test robot2021-12-021-1/+1
| | | | | | | | | | | | | | | Zero-length and one-element arrays are deprecated, see Documentation/process/deprecated.rst Flexible-array members should be used instead. Generated by: scripts/coccinelle/misc/flexible_array.cocci CC: Joey Gouly <joey.gouly@arm.com> Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: kernel test robot <lkp@intel.com> Signed-off-by: Julia Lawall <julia.lawall@inria.fr> Link: https://lore.kernel.org/r/alpine.DEB.2.22.394.2111271859250.2864@hadrien Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: return an error if pinmux is missing in the DTJoey Gouly2021-11-271-1/+1
| | | | | | | | | | | If of_property_count_u32_elems returned 0, return -EINVAL to indicate a failure. Previously this would return 0. Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs") Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-12-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: use modulo rather than bitwise andJoey Gouly2021-11-271-1/+1
| | | | | | | | | This expresses the intention clearer. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-11-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: don't set gpio_chip.of_nodeJoey Gouly2021-11-271-1/+0
| | | | | | | | | The gpio core code sets of_node, so no need to do it here. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-10-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: remove gpio-controller checkJoey Gouly2021-11-271-4/+0
| | | | | | | | | | Having this missing, but everything else valid shouldn't result in a failure. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-9-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: give error label a specific nameJoey Gouly2021-11-271-3/+4
| | | | | | | Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-8-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: make apple_gpio_get_direction more readableJoey Gouly2021-11-271-2/+3
| | | | | | | | | | Try to make this more readable by not using a long line with a ternary operator. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-7-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: handle regmap_read errorsJoey Gouly2021-11-271-3/+7
| | | | | | | | | | Explicitly return 0 if the regmap_read fails. Also change a uint32_t to a u32. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-6-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: add missing bits.h headerJoey Gouly2021-11-271-0/+1
| | | | | | | | | This is needed for the BIT(n) macro. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-5-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: use C style commentJoey Gouly2021-11-271-1/+1
| | | | | | | | | This is the preferred comment style. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-4-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: add missing commaJoey Gouly2021-11-271-1/+1
| | | | | | | | | Add a missing comma at the end of the regmap initialisation. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-3-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: fix some formatting issuesJoey Gouly2021-11-271-41/+28
| | | | | | | | | Reflow some of the code now that the extra '_gpio' was removed. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20211121165642.27883-2-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: apple: Always return valid type in apple_gpio_irq_typeSven Peter2021-11-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | apple_gpio_irq_type can possibly return -EINVAL which triggers the following compile error with gcc 9 because the type no longer fits into the mask. drivers/pinctrl/pinctrl-apple-gpio.c: In function 'apple_gpio_irq_set_type': ././include/linux/compiler_types.h:335:38: error: call to '__compiletime_assert_289' declared with attribute error: FIELD_PREP: value too large for the field 335 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ [...] drivers/pinctrl/pinctrl-apple-gpio.c:294:7: note: in expansion of macro 'FIELD_PREP' 294 | FIELD_PREP(REG_GPIOx_MODE, irqtype)); | ^~~~~~~~~~ Fix this by making the return value always valid and instead checking for REG_GPIOx_IN_IRQ_OFF in apple_gpio_irq_set_type and return -EINVAL from there. Fixes: a0f160ffcb83 ("pinctrl: add pinctrl/GPIO driver for Apple SoCs") Signed-off-by: Sven Peter <sven@svenpeter.dev> Reviewed-by: Joey Gouly <joey.gouly@arm.com> Link: https://lore.kernel.org/r/20211101150640.46553-1-sven@svenpeter.dev Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pinctrl: add pinctrl/GPIO driver for Apple SoCsJoey Gouly2021-10-271-0/+534
This driver adds support for the pinctrl / GPIO hardware found on some Apple SoCs. Co-developed-by: Stan Skowronek <stan@corellium.com> Signed-off-by: Stan Skowronek <stan@corellium.com> Signed-off-by: Joey Gouly <joey.gouly@arm.com> Acked-by: Hector Martin <marcan@marcan.st> Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20211026175815.52703-5-joey.gouly@arm.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>