From 13b3dce7dab5cf515cbf43c1d9305269e891c5f4 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 11 Jun 2026 08:48:25 -0700 Subject: [PATCH 01/14] mfd: rohm-bd71828: Use software nodes for gpio-keys Refactor the rohm-bd71828 MFD driver to use software nodes for instantiating the gpio-keys child device, replacing the old platform_data mechanism. The power key's properties are now defined using software nodes and property entries. The IRQ is passed as a resource attached to the platform device. This will allow dropping support for using platform data for configuring gpio-keys in the future. Signed-off-by: Dmitry Torokhov Link: https://patch.msgid.link/20260611-rohm-software-nodes-v5-1-0244664a3b65@gmail.com Signed-off-by: Lee Jones --- drivers/mfd/rohm-bd71828.c | 125 +++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 32 deletions(-) diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c index a79f354bf5cb..5fb6142cf087 100644 --- a/drivers/mfd/rohm-bd71828.c +++ b/drivers/mfd/rohm-bd71828.c @@ -5,7 +5,8 @@ * ROHM BD718[15/28/79] and BD72720 PMIC driver */ -#include +#include +#include #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include #include @@ -37,19 +39,6 @@ }, \ } -static struct gpio_keys_button button = { - .code = KEY_POWER, - .gpio = -1, - .type = EV_KEY, - .wakeup = 1, -}; - -static const struct gpio_keys_platform_data bd71828_powerkey_data = { - .buttons = &button, - .nbuttons = 1, - .name = "bd71828-pwrkey", -}; - static const struct resource bd71815_rtc_irqs[] = { DEFINE_RES_IRQ_NAMED(BD71815_INT_RTC0, "bd70528-rtc-alm-0"), DEFINE_RES_IRQ_NAMED(BD71815_INT_RTC1, "bd70528-rtc-alm-1"), @@ -174,10 +163,6 @@ static struct mfd_cell bd71828_mfd_cells[] = { .name = "bd71828-rtc", .resources = bd71828_rtc_irqs, .num_resources = ARRAY_SIZE(bd71828_rtc_irqs), - }, { - .name = "gpio-keys", - .platform_data = &bd71828_powerkey_data, - .pdata_size = sizeof(bd71828_powerkey_data), }, }; @@ -242,11 +227,8 @@ static const struct mfd_cell bd72720_mfd_cells[] = { .name = "bd72720-rtc", .resources = bd72720_rtc_irqs, .num_resources = ARRAY_SIZE(bd72720_rtc_irqs), - }, { - .name = "gpio-keys", - .platform_data = &bd71828_powerkey_data, - .pdata_size = sizeof(bd71828_powerkey_data), }, + /* Power button is registered separately */ }; static const struct regmap_range bd71815_volatile_ranges[] = { @@ -877,6 +859,84 @@ static int set_clk_mode(struct device *dev, struct regmap *regmap, OUT32K_MODE_CMOS); } +static const struct property_entry bd71828_powerkey_parent_props[] = { + PROPERTY_ENTRY_STRING("label", "bd71828-pwrkey"), + { } +}; + +static const struct property_entry bd71828_powerkey_props[] = { + PROPERTY_ENTRY_U32("linux,code", KEY_POWER), + PROPERTY_ENTRY_BOOL("wakeup-source"), + { } +}; + +#define GPIO_KEYS 0 /* Node corresponding to gpio-keys device itself */ +#define PWRON_KEY 1 /* Node describing power button in gpio-keys */ + +static int bd71828_i2c_register_swnodes(const struct software_node *nodes) +{ + const struct software_node * const node_group[] = { + &nodes[GPIO_KEYS], &nodes[PWRON_KEY], NULL + }; + + return software_node_register_node_group(node_group); +} + +static void bd71828_i2c_unregister_swnodes(void *data) +{ + const struct software_node *nodes = data; + const struct software_node * const node_group[] = { + &nodes[GPIO_KEYS], &nodes[PWRON_KEY], NULL + }; + + software_node_unregister_node_group(node_group); +} + +static int bd71828_i2c_register_pwrbutton(struct device *dev, int button_irq, + struct irq_domain *irq_domain) +{ + const struct resource res[] = { + DEFINE_RES_IRQ_NAMED(button_irq, "bd71828-pwrkey"), + }; + struct mfd_cell gpio_keys_cell = { + .name = "gpio-keys", + .resources = res, + .num_resources = ARRAY_SIZE(res), + }; + struct software_node *nodes; + int ret; + + nodes = devm_kcalloc(dev, 2, sizeof(*nodes), GFP_KERNEL); + if (!nodes) + return -ENOMEM; + + nodes[GPIO_KEYS].name = devm_kasprintf(dev, GFP_KERNEL, "%s-power-key", dev_name(dev)); + if (!nodes[GPIO_KEYS].name) + return -ENOMEM; + + nodes[GPIO_KEYS].properties = bd71828_powerkey_parent_props; + + nodes[PWRON_KEY].parent = &nodes[GPIO_KEYS]; + nodes[PWRON_KEY].properties = bd71828_powerkey_props; + + ret = bd71828_i2c_register_swnodes(nodes); + if (ret) + return ret; + + ret = devm_add_action_or_reset(dev, bd71828_i2c_unregister_swnodes, nodes); + if (ret) + return ret; + + gpio_keys_cell.swnode = &nodes[GPIO_KEYS]; + + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, &gpio_keys_cell, 1, + NULL, 0, irq_domain); + if (ret) + return dev_err_probe(dev, ret, "Failed to register power-button"); + + return 0; +} + static struct i2c_client *bd71828_dev; static void bd71828_power_off(void) { @@ -929,6 +989,7 @@ static struct regmap *bd72720_do_regmaps(struct i2c_client *i2c) static int bd71828_i2c_probe(struct i2c_client *i2c) { struct regmap_irq_chip_data *irq_data; + struct irq_domain *irq_domain; int ret; struct regmap *regmap = NULL; const struct regmap_config *regmap_config; @@ -1022,23 +1083,23 @@ static int bd71828_i2c_probe(struct i2c_client *i2c) "Failed to enable main level IRQs\n"); } } - if (button_irq) { - ret = regmap_irq_get_virq(irq_data, button_irq); - if (ret < 0) - return dev_err_probe(&i2c->dev, ret, - "Failed to get the power-key IRQ\n"); - - button.irq = ret; - } ret = set_clk_mode(&i2c->dev, regmap, clkmode_reg); if (ret) return ret; + irq_domain = regmap_irq_get_domain(irq_data); + ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, mfd, cells, - NULL, 0, regmap_irq_get_domain(irq_data)); + NULL, 0, irq_domain); if (ret) - return dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); + return dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); + + if (button_irq) { + ret = bd71828_i2c_register_pwrbutton(&i2c->dev, button_irq, irq_domain); + if (ret) + return ret; + } if (of_device_is_system_power_controller(i2c->dev.of_node) && chip_type == ROHM_CHIP_TYPE_BD71828) { From 6c0c972cacb5e78df02d44b5e89ed40779d26bba Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 11 Jun 2026 08:48:26 -0700 Subject: [PATCH 02/14] mfd: rohm-bd718x7: Use software nodes for gpio-keys Refactor the rohm-bd7182x7 MFD driver to use software nodes for instantiating the gpio-keys child device, replacing the old platform_data mechanism. The power key's properties are now defined using software nodes and property entries. The IRQ is passed as a resource attached to the platform device. This will allow dropping support for using platform data for configuring gpio-keys in the future. Signed-off-by: Dmitry Torokhov Link: https://patch.msgid.link/20260611-rohm-software-nodes-v5-2-0244664a3b65@gmail.com Signed-off-by: Lee Jones --- drivers/mfd/rohm-bd718x7.c | 123 +++++++++++++++++++++++++++---------- 1 file changed, 90 insertions(+), 33 deletions(-) diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c index ff714fd4f54d..be2acc429fe3 100644 --- a/drivers/mfd/rohm-bd718x7.c +++ b/drivers/mfd/rohm-bd718x7.c @@ -7,7 +7,8 @@ // Datasheet for BD71837MWV available from // https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e -#include +#include +#include #include #include #include @@ -15,37 +16,16 @@ #include #include #include +#include #include #include -static struct gpio_keys_button button = { - .code = KEY_POWER, - .gpio = -1, - .type = EV_KEY, -}; - -static struct gpio_keys_platform_data bd718xx_powerkey_data = { - .buttons = &button, - .nbuttons = 1, - .name = "bd718xx-pwrkey", -}; - static struct mfd_cell bd71837_mfd_cells[] = { - { - .name = "gpio-keys", - .platform_data = &bd718xx_powerkey_data, - .pdata_size = sizeof(bd718xx_powerkey_data), - }, { .name = "bd71837-clk", }, { .name = "bd71837-pmic", }, }; static struct mfd_cell bd71847_mfd_cells[] = { - { - .name = "gpio-keys", - .platform_data = &bd718xx_powerkey_data, - .pdata_size = sizeof(bd718xx_powerkey_data), - }, { .name = "bd71847-clk", }, { .name = "bd71847-pmic", }, }; @@ -125,10 +105,89 @@ static int bd718xx_init_press_duration(struct regmap *regmap, return 0; } +static const struct property_entry bd718xx_powerkey_parent_props[] = { + PROPERTY_ENTRY_STRING("label", "bd718xx-pwrkey"), + { } +}; + +static const struct property_entry bd718xx_powerkey_props[] = { + PROPERTY_ENTRY_U32("linux,code", KEY_POWER), + { } +}; + +static const struct resource bd718xx_powerkey_resources[] = { + DEFINE_RES_IRQ_NAMED(BD718XX_INT_PWRBTN_S, "bd718xx-pwrkey"), +}; + +#define GPIO_KEYS 0 /* Node corresponding to gpio-keys device itself */ +#define PWRON_KEY 1 /* Node describing power button in gpio-keys */ + +static int bd718xx_i2c_register_swnodes(const struct software_node *nodes) +{ + const struct software_node * const node_group[] = { + &nodes[GPIO_KEYS], &nodes[PWRON_KEY], NULL + }; + + return software_node_register_node_group(node_group); +} + +static void bd718xx_i2c_unregister_swnodes(void *data) +{ + const struct software_node *nodes = data; + const struct software_node * const node_group[] = { + &nodes[GPIO_KEYS], &nodes[PWRON_KEY], NULL + }; + + software_node_unregister_node_group(node_group); +} + +static int bd718xx_i2c_register_pwrbutton(struct device *dev, + struct irq_domain *irq_domain) +{ + struct mfd_cell gpio_keys_cell = { + .name = "gpio-keys", + .resources = bd718xx_powerkey_resources, + .num_resources = ARRAY_SIZE(bd718xx_powerkey_resources), + }; + struct software_node *nodes; + int ret; + + nodes = devm_kcalloc(dev, 2, sizeof(*nodes), GFP_KERNEL); + if (!nodes) + return -ENOMEM; + + nodes[GPIO_KEYS].name = devm_kasprintf(dev, GFP_KERNEL, "%s-power-key", dev_name(dev)); + if (!nodes[GPIO_KEYS].name) + return -ENOMEM; + + nodes[GPIO_KEYS].properties = bd718xx_powerkey_parent_props; + + nodes[PWRON_KEY].parent = &nodes[GPIO_KEYS]; + nodes[PWRON_KEY].properties = bd718xx_powerkey_props; + + ret = bd718xx_i2c_register_swnodes(nodes); + if (ret) + return ret; + + ret = devm_add_action_or_reset(dev, bd718xx_i2c_unregister_swnodes, nodes); + if (ret) + return ret; + + gpio_keys_cell.swnode = &nodes[GPIO_KEYS]; + + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, &gpio_keys_cell, 1, + NULL, 0, irq_domain); + if (ret) + return dev_err_probe(dev, ret, "Failed to register power-button"); + + return 0; +} + static int bd718xx_i2c_probe(struct i2c_client *i2c) { struct regmap *regmap; struct regmap_irq_chip_data *irq_data; + struct irq_domain *irq_domain; int ret; unsigned int chip_type; struct mfd_cell *mfd; @@ -169,20 +228,18 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c) if (ret) return ret; - ret = regmap_irq_get_virq(irq_data, BD718XX_INT_PWRBTN_S); - - if (ret < 0) - return dev_err_probe(&i2c->dev, ret, "Failed to get the IRQ\n"); - - button.irq = ret; + irq_domain = regmap_irq_get_domain(irq_data); ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, - mfd, cells, NULL, 0, - regmap_irq_get_domain(irq_data)); + mfd, cells, NULL, 0, irq_domain); if (ret) - dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); + return dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n"); - return ret; + ret = bd718xx_i2c_register_pwrbutton(&i2c->dev, irq_domain); + if (ret) + return ret; + + return 0; } static const struct of_device_id bd718xx_of_match[] = { From bde4905c102f19151228c86f82a7fcf50f11b160 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 21 Jul 2025 21:56:49 +0200 Subject: [PATCH 03/14] Input: soc_button_array - select CONFIG_GPIOLIB_LEGACY This driver converts information from ACPI in x86 based tablets and laptops into platform_data for the gpio_keys driver, using the obsolete gpio number based interfaces. This should really be converted to some other method, but since the conversion is nontrivial, have this one select GPIOLIB_LEGACY for the time being. This enables turning GPIOLIB_LEGACY off by default on most kernel builds. Since the driver is only used on x86 portables, add a CONFIG_X86 dependency, which means non-x86 allmodconfig builds usuallly build without the legacy gpio support. Link: https://lore.kernel.org/all/ah-1z9LhVG0wtfBw@google.com/ Acked-by: Bartosz Golaszewski Acked-by: Dmitry Torokhov # for input Signed-off-by: Arnd Bergmann --- drivers/input/misc/Kconfig | 3 +++ drivers/input/misc/soc_button_array.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 1f6c57dba030..9c66e3a67127 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -892,6 +892,9 @@ config INPUT_IDEAPAD_SLIDEBAR config INPUT_SOC_BUTTON_ARRAY tristate "Windows-compatible SoC Button Array" depends on KEYBOARD_GPIO && ACPI + depends on X86 + depends on GPIOLIB + select GPIOLIB_LEGACY help Say Y here if you have a SoC-based tablet that originally runs Windows 8 or a Microsoft Surface Book 2, Pro 5, Laptop 1 or later. diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index b8cad415c62c..a6c984205123 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -15,7 +15,6 @@ #include #include #include -#include #include static bool use_low_level_irq; From 0b333ae1a530e304a5677497c849179cacb9ea92 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 21 Jul 2025 21:54:21 +0200 Subject: [PATCH 04/14] Input: gpio-keys: make legacy gpiolib optional Most users of gpio-keys and gpio-keys-polled use modern gpiolib interfaces, but there are still number of ancient sh, arm32 and x86 machines that have never been converted. Add an #ifdef block for the parts of the driver that are only used on those legacy machines. Link: https://lore.kernel.org/all/b3c94552-c104-42e3-be15-7e8362e8039e@gmail.com/ Link: https://lore.kernel.org/all/afJXG4_rtaj3l2Dk@google.com/ Link: https://lore.kernel.org/all/ajQ-CtU131FAJ9ES@google.com/ Acked-by: Bartosz Golaszewski Acked-by: Dmitry Torokhov # for input Signed-off-by: Arnd Bergmann --- drivers/input/keyboard/gpio_keys.c | 7 ++++--- drivers/input/keyboard/gpio_keys_polled.c | 4 +++- include/linux/gpio_keys.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index e19617485679..129fc4212a5e 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -23,8 +23,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -528,6 +528,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev, */ bdata->gpiod = NULL; } +#ifdef CONFIG_GPIOLIB_LEGACY } else if (gpio_is_valid(button->gpio)) { /* * Legacy GPIO number, so request the GPIO here and @@ -546,6 +547,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev, if (button->active_low ^ gpiod_is_active_low(bdata->gpiod)) gpiod_toggle_active_low(bdata->gpiod); +#endif } if (bdata->gpiod) { @@ -583,8 +585,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev, if (irq < 0) { error = irq; dev_err_probe(dev, error, - "Unable to get irq number for GPIO %d\n", - button->gpio); + "Unable to get irq number for GPIO\n"); return error; } bdata->irq = irq; diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index e6707d72210e..4e7a366ff05b 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c @@ -18,8 +18,8 @@ #include #include #include -#include #include +#include #include #include @@ -301,6 +301,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(bdata->gpiod), "failed to get gpio\n"); } +#ifdef CONFIG_GPIOLIB_LEGACY } else if (gpio_is_valid(button->gpio)) { /* * Legacy GPIO number so request the GPIO here and @@ -323,6 +324,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) if (button->active_low ^ gpiod_is_active_low(bdata->gpiod)) gpiod_toggle_active_low(bdata->gpiod); +#endif } bdata->last_state = -1; diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index 80fa930b04c6..e8d6dc290efb 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h @@ -25,7 +25,9 @@ struct device; */ struct gpio_keys_button { unsigned int code; +#ifdef CONFIG_GPIOLIB_LEGACY int gpio; +#endif int active_low; const char *desc; unsigned int type; From 9906ce2473f6f1db619208b25ce87273232b00e3 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 21 Jul 2025 21:56:49 +0200 Subject: [PATCH 05/14] sh: select legacy gpiolib interface Many board files on sh reference the legacy gpiolib interfaces that are becoming optional. To ensure the boards can keep building, select CONFIG_GPIOLIB_LEGACY on each of the boards that have one of the hardcoded calls. Cc: John Paul Adrian Glaubitz Acked-by: Bartosz Golaszewski Acked-by: Dmitry Torokhov # for input Signed-off-by: Arnd Bergmann --- arch/sh/Kconfig | 1 + arch/sh/boards/Kconfig | 8 ++++++++ arch/sh/boards/mach-highlander/Kconfig | 1 + arch/sh/boards/mach-rsk/Kconfig | 3 +++ 4 files changed, 13 insertions(+) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index d5795067befa..d60f1d5a94c0 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -462,6 +462,7 @@ config CPU_SUBTYPE_SHX3 select CPU_SHX3 select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GPIOLIB + select GPIOLIB_LEGACY select PINCTRL # SH4AL-DSP Processor Support diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig index 1af93be61b1f..d89b74177233 100644 --- a/arch/sh/boards/Kconfig +++ b/arch/sh/boards/Kconfig @@ -80,6 +80,7 @@ config SH_7724_SOLUTION_ENGINE select SOLUTION_ENGINE depends on CPU_SUBTYPE_SH7724 select GPIOLIB + select GPIOLIB_LEGACY select REGULATOR_FIXED_VOLTAGE if REGULATOR imply SND_SOC_AK4642 if SND_SIMPLE_CARD help @@ -199,6 +200,7 @@ config SH_SH7757LCR bool "SH7757LCR" depends on CPU_SUBTYPE_SH7757 select GPIOLIB + select GPIOLIB_LEGACY select REGULATOR_FIXED_VOLTAGE if REGULATOR config SH_SH7785LCR @@ -226,6 +228,7 @@ config SH_URQUELL bool "Urquell" depends on CPU_SUBTYPE_SH7786 select GPIOLIB + select GPIOLIB_LEGACY select HAVE_PCI select NO_IOPORT_MAP if !PCI @@ -233,6 +236,7 @@ config SH_MIGOR bool "Migo-R" depends on CPU_SUBTYPE_SH7722 select GPIOLIB + select GPIOLIB_LEGACY select REGULATOR_FIXED_VOLTAGE if REGULATOR help Select Migo-R if configuring for the SH7722 Migo-R platform @@ -242,6 +246,7 @@ config SH_AP325RXA bool "AP-325RXA" depends on CPU_SUBTYPE_SH7723 select GPIOLIB + select GPIOLIB_LEGACY select REGULATOR_FIXED_VOLTAGE if REGULATOR help Renesas "AP-325RXA" support. @@ -251,6 +256,7 @@ config SH_KFR2R09 bool "KFR2R09" depends on CPU_SUBTYPE_SH7724 select GPIOLIB + select GPIOLIB_LEGACY select REGULATOR_FIXED_VOLTAGE if REGULATOR help "Kit For R2R for 2009" support. @@ -259,6 +265,7 @@ config SH_ECOVEC bool "EcoVec" depends on CPU_SUBTYPE_SH7724 select GPIOLIB + select GPIOLIB_LEGACY select REGULATOR_FIXED_VOLTAGE if REGULATOR imply SND_SOC_DA7210 if SND_SIMPLE_CARD help @@ -329,6 +336,7 @@ config SH_MAGIC_PANEL_R2 bool "Magic Panel R2" depends on CPU_SUBTYPE_SH7720 select GPIOLIB + select GPIOLIB_LEGACY select REGULATOR_FIXED_VOLTAGE if REGULATOR help Select Magic Panel R2 if configuring for Magic Panel R2. diff --git a/arch/sh/boards/mach-highlander/Kconfig b/arch/sh/boards/mach-highlander/Kconfig index b0abd03cac4e..cd3a553ce30c 100644 --- a/arch/sh/boards/mach-highlander/Kconfig +++ b/arch/sh/boards/mach-highlander/Kconfig @@ -20,6 +20,7 @@ config SH_R7785RP bool "R7785RP board support" depends on CPU_SUBTYPE_SH7785 select GPIOLIB + select GPIOLIB_LEGACY endchoice diff --git a/arch/sh/boards/mach-rsk/Kconfig b/arch/sh/boards/mach-rsk/Kconfig index f0299bc4416f..3810937aa5d4 100644 --- a/arch/sh/boards/mach-rsk/Kconfig +++ b/arch/sh/boards/mach-rsk/Kconfig @@ -12,16 +12,19 @@ config SH_RSK7201 config SH_RSK7203 bool "RSK7203" select GPIOLIB + select GPIOLIB_LEGACY depends on CPU_SUBTYPE_SH7203 config SH_RSK7264 bool "RSK2+SH7264" select GPIOLIB + select GPIOLIB_LEGACY depends on CPU_SUBTYPE_SH7264 config SH_RSK7269 bool "RSK2+SH7269" select GPIOLIB + select GPIOLIB_LEGACY depends on CPU_SUBTYPE_SH7269 endchoice From 6b5edc71aac6ff45f555172b9cdae10c4294707b Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Jul 2025 15:41:21 +0200 Subject: [PATCH 06/14] x86/olpc: select GPIOLIB_LEGACY The OLPC GPIO controller sets up a fixed number space that is used by at least two drivers: arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'setup_ec_sci': arch/x86/platform/olpc/olpc-xo1-sci.c:358:13: error: implicit declaration of function 'gpio_request' [-Wimplicit-function-declaration] 358 | r = gpio_request(OLPC_GPIO_ECSCI, "OLPC-ECSCI"); | ^~~~~~~~~~~~ sound/pci/cs5535audio/cs5535audio_olpc.c: In function 'olpc_analog_input': sound/pci/cs5535audio/cs5535audio_olpc.c:41:9: error: implicit declaration of function 'gpio_set_value'; did you mean 'gpiod_set_value'? [-Wimplicit-function-declaration] 41 | gpio_set_value(OLPC_GPIO_MIC_AC, on); The AMD Geode platform that this is based on is now marked as 'Orphaned' in Kconfig, and it is likely that there are no XO1 users on modern kernels, but so far there is no consensus on removing it entirely. Select CONFIG_GPIOLIB_LEGACY for this platform and make sure the sound driver portion cannot be compiled without this. Acked-by: Borislav Petkov (AMD) Acked-by: Takashi Iwai Reviewed-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Acked-by: Dmitry Torokhov # for input Signed-off-by: Arnd Bergmann --- arch/x86/Kconfig | 1 + arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +- sound/pci/Kconfig | 1 + sound/pci/cs5535audio/cs5535audio_olpc.c | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index bdad90f210e4..4ad8a7bbd93d 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2976,6 +2976,7 @@ config OLPC bool "One Laptop Per Child support" depends on !X86_PAE select GPIOLIB + select GPIOLIB_LEGACY select OF select OF_PROMTREE select IRQ_DOMAIN diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c index 30751b42d54e..a5b47960ba32 100644 --- a/arch/x86/platform/olpc/olpc-xo1-sci.c +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index e0996a9d90b0..6366f72b3667 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -300,6 +300,7 @@ config SND_CS5535AUDIO tristate "CS5535/CS5536 Audio" depends on X86_32 || MIPS || COMPILE_TEST depends on HAS_IOPORT + depends on GPIOLIB_LEGACY || !OLPC select SND_PCM select SND_AC97_CODEC help diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c index 122170a410d9..cfdcc5bf4341 100644 --- a/sound/pci/cs5535audio/cs5535audio_olpc.c +++ b/sound/pci/cs5535audio/cs5535audio_olpc.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include "cs5535audio.h" From 8fd460518c48056f1f5df32bf0bd3b4550262d6f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 12 Jun 2026 11:22:13 +0200 Subject: [PATCH 07/14] mips: replace linux/gpio.h inclusions linux/gpio.h should no longer be used, convert these instead to either linux/gpio/consumer.h or linux/gpio/legacy.h as needed. Acked-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Signed-off-by: Arnd Bergmann --- arch/mips/alchemy/board-xxs1500.c | 2 +- arch/mips/alchemy/devboards/db1000.c | 2 +- arch/mips/alchemy/devboards/db1200.c | 2 +- arch/mips/alchemy/devboards/db1550.c | 2 +- arch/mips/bcm47xx/workarounds.c | 2 +- arch/mips/bcm63xx/boards/board_bcm963xx.c | 1 + arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/mips/alchemy/board-xxs1500.c b/arch/mips/alchemy/board-xxs1500.c index f175bce2987f..a03762dde4e7 100644 --- a/arch/mips/alchemy/board-xxs1500.c +++ b/arch/mips/alchemy/board-xxs1500.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 8fb24b220e3a..5eff34a8683b 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c index de2a9083ed9a..539b311fc8af 100644 --- a/arch/mips/alchemy/devboards/db1200.c +++ b/arch/mips/alchemy/devboards/db1200.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c index b8295a5c2e9a..579fc8f1eaed 100644 --- a/arch/mips/alchemy/devboards/db1550.c +++ b/arch/mips/alchemy/devboards/db1550.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/mips/bcm47xx/workarounds.c b/arch/mips/bcm47xx/workarounds.c index 745c6228eb2c..dc9e5483347d 100644 --- a/arch/mips/bcm47xx/workarounds.c +++ b/arch/mips/bcm47xx/workarounds.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "bcm47xx_private.h" -#include +#include #include #include diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index c5617b889b1c..71628dac6c26 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include diff --git a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h index 830f53f28e3f..428cf4508f9a 100644 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h @@ -3,7 +3,7 @@ #define BOARD_BCM963XX_H_ #include -#include +#include #include #include #include From 752ce1fecd55b507329689c928703e3591bc9c2f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 12 Jun 2026 11:22:13 +0200 Subject: [PATCH 08/14] sh: replace linux/gpio.h inclusions linux/gpio.h should no longer be used, convert these instead to linux/gpio/legacy.h for the sh boards using the legacy interfaces, or remove it where it is not needed at all. Acked-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Signed-off-by: Arnd Bergmann --- arch/sh/boards/board-magicpanelr2.c | 2 +- arch/sh/boards/board-sh7757lcr.c | 2 +- arch/sh/boards/board-urquell.c | 2 +- arch/sh/boards/mach-ap325rxa/setup.c | 2 +- arch/sh/boards/mach-ecovec24/setup.c | 2 +- arch/sh/boards/mach-highlander/pinmux-r7785rp.c | 2 +- arch/sh/boards/mach-kfr2r09/lcd_wqvga.c | 2 +- arch/sh/boards/mach-kfr2r09/setup.c | 2 +- arch/sh/boards/mach-migor/lcd_qvga.c | 2 +- arch/sh/boards/mach-migor/setup.c | 2 +- arch/sh/boards/mach-rsk/devices-rsk7269.c | 1 - arch/sh/boards/mach-se/7724/setup.c | 2 +- arch/sh/include/mach-common/mach/magicpanelr2.h | 2 -- arch/sh/kernel/cpu/sh4a/setup-shx3.c | 2 +- 14 files changed, 12 insertions(+), 15 deletions(-) diff --git a/arch/sh/boards/board-magicpanelr2.c b/arch/sh/boards/board-magicpanelr2.c index 75de893152af..3f14118a1015 100644 --- a/arch/sh/boards/board-magicpanelr2.c +++ b/arch/sh/boards/board-magicpanelr2.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c index bca54e489e11..6d18f59ef261 100644 --- a/arch/sh/boards/board-sh7757lcr.c +++ b/arch/sh/boards/board-sh7757lcr.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/sh/boards/board-urquell.c b/arch/sh/boards/board-urquell.c index dad2b3b40735..1f73c04d341f 100644 --- a/arch/sh/boards/board-urquell.c +++ b/arch/sh/boards/board-urquell.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c index bb5004a8ac02..17c3f568d92e 100644 --- a/arch/sh/boards/mach-ap325rxa/setup.c +++ b/arch/sh/boards/mach-ap325rxa/setup.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index a641e26f8fdf..ca4b4dd1ddef 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/sh/boards/mach-highlander/pinmux-r7785rp.c b/arch/sh/boards/mach-highlander/pinmux-r7785rp.c index 689bd8732d9e..3a1057ee9ace 100644 --- a/arch/sh/boards/mach-highlander/pinmux-r7785rp.c +++ b/arch/sh/boards/mach-highlander/pinmux-r7785rp.c @@ -3,7 +3,7 @@ * Copyright (C) 2008 Paul Mundt */ #include -#include +#include #include #include diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c index f6bbac106d13..68716660de34 100644 --- a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c +++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include