From 06608bc2d9e6f5a24baf51951e9e2fff3ec78e54 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 25 Dec 2021 13:00:26 +0100 Subject: gpio: crystalcove: Set IRQ domain bus token to DOMAIN_BUS_WIRED For the CRC PMIC we end up with multiple irq-domains with the same fwnode. One for the irqchip which demultiplexes the actual PMIC interrupt into interrupts for the various cells (known as the level 1 interrupts); And 2 more for the irqchips which are part of the crystal_cove_gpio and crystal_cove_charger cells. This leads to the following error being printed when CONFIG_GENERIC_IRQ_DEBUGFS is enabled: debugfs: File '\_SB.I2C7.PMIC' in directory 'domains' already present! Set the bus token of the main IRQ domain to DOMAIN_BUS_WIRED to avoid this error, this also allows irq_find_matching_fwspec() to find the right domain if necessary. Note all 3 domain registering drivers need to set the IRQ domain bus token. This is necessary because the IRQ domain code defaults to creating the debugfs dir with just the fwnode name and then renames it when the bus token is set. So each one starts with the same default name and all 3 must be given a different name to avoid problems when one of the other drivers loads and starts with the same default name. Signed-off-by: Hans de Goede Acked-by: Andy Shevchenko Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-crystalcove.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/gpio/gpio-crystalcove.c b/drivers/gpio/gpio-crystalcove.c index 5a909f3c79e8..b55c74a5e064 100644 --- a/drivers/gpio/gpio-crystalcove.c +++ b/drivers/gpio/gpio-crystalcove.c @@ -370,7 +370,14 @@ static int crystalcove_gpio_probe(struct platform_device *pdev) return retval; } - return devm_gpiochip_add_data(&pdev->dev, &cg->chip, cg); + retval = devm_gpiochip_add_data(&pdev->dev, &cg->chip, cg); + if (retval) + return retval; + + /* Distuingish IRQ domain from others sharing (MFD) the same fwnode */ + irq_domain_update_bus_token(cg->chip.irq.domain, DOMAIN_BUS_WIRED); + + return 0; } static struct platform_driver crystalcove_gpio_driver = { -- cgit v1.2.3 From c84eab5850d11bea546491bb1798039448971141 Mon Sep 17 00:00:00 2001 From: Xiaoke Wang Date: Mon, 17 Jan 2022 15:06:06 +0800 Subject: gpio: merrifield: check the return value of devm_kstrdup() devm_kstrdup() returns pointer to allocated string on success, NULL on failure. So it is better to check the return value of it. Before, if devm_kstrdup() fails, pinctrl_dev_name will be NULL, then the retval below will be a negative error-code (inside gpiochip_add_pin_range(), pinctrl_find_and_add_gpio_range()->get_pinctrl_dev_from_devname() will finally check pinctrl_dev_name and return an error), so the failure of devm_kstrdup() can be only implicitly caught after a long call chain. While this patch is to explicitly catch the failure in time. Signed-off-by: Xiaoke Wang Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-merrifield.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-merrifield.c index 42c4d9d0cd50..f3d1baeacbe9 100644 --- a/drivers/gpio/gpio-merrifield.c +++ b/drivers/gpio/gpio-merrifield.c @@ -409,6 +409,9 @@ static int mrfld_gpio_add_pin_ranges(struct gpio_chip *chip) int retval; pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(priv); + if (!pinctrl_dev_name) + return -ENOMEM; + for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) { range = &mrfld_gpio_ranges[i]; retval = gpiochip_add_pin_range(&priv->chip, pinctrl_dev_name, -- cgit v1.2.3 From f473bdccb8775e8935cc08ca9800cae5f700a9b5 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 23 Dec 2021 14:27:33 +0200 Subject: gpio: altera-a10sr: Switch to use fwnode instead of of_node GPIO library now accepts fwnode as a firmware node, so switch the driver to use it. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/gpio/gpio-altera-a10sr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/gpio/gpio-altera-a10sr.c b/drivers/gpio/gpio-altera-a10sr.c index 6af51feda06f..be1ed7ee5225 100644 --- a/drivers/gpio/gpio-altera-a10sr.c +++ b/drivers/gpio/gpio-altera-a10sr.c @@ -10,6 +10,7 @@ #include #include #include +#include /** * struct altr_a10sr_gpio - Altera Max5 GPIO device private data structure @@ -88,7 +89,7 @@ static int altr_a10sr_gpio_probe(struct platform_device *pdev) gpio->gp = altr_a10sr_gc; gpio->gp.parent = pdev->dev.parent; - gpio->gp.of_node = pdev->dev.of_node; + gpio->gp.fwnode = dev_fwnode(&pdev->dev); return devm_gpiochip_add_data(&pdev->dev, &gpio->gp, gpio); } -- cgit v1.2.3 From b3376ed7d82f5937cecb17ff92d5d8dc0762e1c1 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 23 Dec 2021 14:26:39 +0200 Subject: gpio: tegra: Get rid of duplicate of_node assignment GPIO library does copy the of_node from the parent device of the GPIO chip, there is no need to repeat this in the individual drivers. Remove these assignment all at once. For the details one may look into the of_gpio_dev_init() implementation. Signed-off-by: Andy Shevchenko Reviewed-by: Thierry Reding Tested-by: Thierry Reding --- drivers/gpio/gpio-tegra.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers') diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 7f5bc10a6479..ff2d2a1f9c73 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -691,7 +691,6 @@ static int tegra_gpio_probe(struct platform_device *pdev) tgi->gc.base = 0; tgi->gc.ngpio = tgi->bank_count * 32; tgi->gc.parent = &pdev->dev; - tgi->gc.of_node = pdev->dev.of_node; tgi->ic.name = "GPIO"; tgi->ic.irq_ack = tegra_gpio_irq_ack; -- cgit v1.2.3 From a1ce76e89907a69713f729ff21db1efa00f3bb47 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 11 Jan 2022 11:56:32 +0100 Subject: gpio: tps68470: Allow building as module The gpio-tps68470 driver binds to a tps68470-gpio platform-device which itself gets instantiated by a special MFD driver from drivers/platform/x86/intel/int3472/tps68470.c This MFD driver itself can be built as a module, so it makes no sense to force the gpio-tps68470 driver to always be built-in. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/gpio/Kconfig | 6 +----- drivers/gpio/gpio-tps68470.c | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 1c211b4c63be..04c48f315b05 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -1380,7 +1380,7 @@ config GPIO_TPS65912 This driver supports TPS65912 GPIO chip. config GPIO_TPS68470 - bool "TPS68470 GPIO" + tristate "TPS68470 GPIO" depends on INTEL_SKL_INT3472 help Select this option to enable GPIO driver for the TPS68470 @@ -1390,10 +1390,6 @@ config GPIO_TPS68470 input or output as appropriate, the sensor related GPIOs are "output only" GPIOs. - This driver config is bool, as the GPIO functionality - of the TPS68470 must be available before dependent - drivers are loaded. - config GPIO_TQMX86 tristate "TQ-Systems QTMX86 GPIO" depends on MFD_TQMX86 || COMPILE_TEST diff --git a/drivers/gpio/gpio-tps68470.c b/drivers/gpio/gpio-tps68470.c index 423b7bc30ae8..aaddcabe9b35 100644 --- a/drivers/gpio/gpio-tps68470.c +++ b/drivers/gpio/gpio-tps68470.c @@ -154,5 +154,8 @@ static struct platform_driver tps68470_gpio_driver = { }, .probe = tps68470_gpio_probe, }; +module_platform_driver(tps68470_gpio_driver); -builtin_platform_driver(tps68470_gpio_driver) +MODULE_ALIAS("platform:tps68470-gpio"); +MODULE_DESCRIPTION("GPIO driver for TPS68470 PMIC"); +MODULE_LICENSE("GPL v2"); -- cgit v1.2.3