* [PATCH v3 00/10] Remove support for platform data from samsung keypad
@ 2026-07-12 2:12 Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding Dmitry Torokhov
` (10 more replies)
0 siblings, 11 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Conor Dooley,
Bartosz Golaszewski, Krzysztof Kozlowski
Hi,
This series converts the Samsung keypad driver and the Cragganmore 6410
board to generic device properties, allowing the removal of legacy platform
data and GPIO lookup tables.
We rework the Samsung keypad driver to stop using platform data, utilizing
a new compact matrix keypad binding. To support this on the Cragganmore
board, we add infrastructure to associate software nodes with Samsung
gpio_chips, and add software node propagation support to the wm831x MFD
core to route DVS GPIO to the PMIC regulator.
Finally, we convert all peripherals on the Cragganmore board (including
keypad, GPIO keys, PMIC, WM1250, SPI0, basic-mmio-gpio, and LEDs) to
software properties. This allows us to eliminate all legacy GPIO lookup
tables and fixes incorrect GPIO chip names from previous conversions.
Mark, it would be great if you could give this a spin on Cragganmore.
The majority of changes are in arch/board code, with a couple of input
matches and one for MFD. If everyone agrees maybe we can merge it all
through the soc tree?
Thanks!
Changes in v3:
- Fixed legacy property handling regression in the keypad driver by
separating compact and verbose binding paths
- Removed redundant registration of crag6410_mmgpio_node from
mach-crag6410.c
- Removed dead S3C64XX_SETUP_KEYPAD Kconfig symbol definition and
selection
- Fixed missing newline in pr_err() message in mach-crag6410.c
- Redesigned PMIC DVS support to keep regulator driver changes minimal
(untouched) and only use software nodes for GPIO routing via MFD core
- Link to v2: https://patch.msgid.link/20260708-samsung-kp-v2-0-3c6ed4c9b3b6@gmail.com
Changes in v2:
- Patches 1-8 of v1 were merged into mainline, dropping them from this
series
- Rebased remaining patches (9-14 of v1) onto latest next
- Resolved conflicts in mach-crag6410.c
- Removed redundant "out of memory" error messages from the keypad
driver
- Added an infrastructure patch to register and attach software nodes
for Samsung gpio_chips
- Converted basic-mmio-gpio and LEDs on Cragganmore 6410 to software
properties in a new separate patch
- Addressed DT bindings feedback on the compact binding patch
- Fixed proximity switch event type for GPIO keys
- Added support for software nodes in wm831x regulator driver
- Converted PMIC DVS on Cragganmore 6410 to software properties using
the new driver support
- Removed legacy DVS platform data fields and cleaned up driver
fallback.
---
Dmitry Torokhov (10):
dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding
Input: samsung-keypad - handle compact binding
ARM: s3c: register and attach software nodes for Samsung gpio_chips
ARM: s3c: crag6410: switch keypad device to software properties
Input: samsung-keypad - remove support for platform data
ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys
mfd: wm831x: support software nodes for DCDC regulators
ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties
ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs to software properties
ARM: s3c: crag6410: convert remaining GPIO lookup tables to property entries
.../bindings/input/samsung,s3c6410-keypad.yaml | 53 ++-
arch/arm/mach-s3c/Kconfig | 5 -
arch/arm/mach-s3c/Kconfig.s3c64xx | 7 -
arch/arm/mach-s3c/Makefile.s3c64xx | 1 -
arch/arm/mach-s3c/devs.c | 62 ----
arch/arm/mach-s3c/devs.h | 2 -
arch/arm/mach-s3c/gpio-core.h | 3 +
arch/arm/mach-s3c/gpio-samsung-s3c64xx.h | 5 +
arch/arm/mach-s3c/gpio-samsung.c | 72 +++-
arch/arm/mach-s3c/keypad.h | 27 --
arch/arm/mach-s3c/mach-crag6410.c | 369 +++++++++++++--------
arch/arm/mach-s3c/setup-keypad-s3c64xx.c | 20 --
drivers/input/keyboard/samsung-keypad.c | 200 +++++------
drivers/mfd/wm831x-core.c | 47 ++-
include/linux/input/samsung-keypad.h | 39 ---
include/linux/mfd/wm831x/pdata.h | 2 +
16 files changed, 472 insertions(+), 442 deletions(-)
---
base-commit: 8e9685d3c41c35dd1b37df70d854137abcb2fbac
change-id: 20240819-samsung-kp-ceedd4f2f720
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:22 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 02/10] Input: samsung-keypad - handle " Dmitry Torokhov
` (9 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Conor Dooley,
Bartosz Golaszewski
The binding with a sub-node per each key is very verbose and is hard to
use with static device properties. Allow standard matrix keymap binding
in addition to the verbose one.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
.../bindings/input/samsung,s3c6410-keypad.yaml | 53 ++++++++++++++++++++--
1 file changed, 50 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml b/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml
index a53569aa0ee7..2498c62444a1 100644
--- a/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml
+++ b/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml
@@ -37,6 +37,10 @@ properties:
wakeup-source: true
+ keypad,num-columns: true
+ keypad,num-rows: true
+ linux,keymap: true
+
linux,input-no-autorepeat:
type: boolean
description:
@@ -81,12 +85,33 @@ patternProperties:
- keypad,row
- linux,code
+dependencies:
+ linux,keymap: [ "keypad,num-columns", "keypad,num-rows" ]
+
required:
- compatible
- reg
- interrupts
- - samsung,keypad-num-columns
- - samsung,keypad-num-rows
+
+allOf:
+ - $ref: input.yaml#
+ - $ref: matrix-keymap.yaml#
+ - if:
+ required:
+ - linux,keymap
+ then:
+ properties:
+ samsung,keypad-num-columns: false
+ samsung,keypad-num-rows: false
+ patternProperties:
+ '^key-[0-9a-z]+$': false
+ else:
+ properties:
+ keypad,num-columns: false
+ keypad,num-rows: false
+ required:
+ - samsung,keypad-num-columns
+ - samsung,keypad-num-rows
additionalProperties: false
@@ -94,8 +119,9 @@ examples:
- |
#include <dt-bindings/clock/exynos4.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/input/input.h>
- keypad@100a0000 {
+ keypad1@100a0000 {
compatible = "samsung,s5pv210-keypad";
reg = <0x100a0000 0x100>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
@@ -119,3 +145,24 @@ examples:
linux,code = <3>;
};
};
+ - |
+ #include <dt-bindings/clock/exynos4.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/input/input.h>
+
+ keypad2@100a0000 {
+ compatible = "samsung,s5pv210-keypad";
+ reg = <0x100a0000 0x100>;
+ interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clock CLK_KEYIF>;
+ clock-names = "keypad";
+
+ keypad,num-rows = <2>;
+ keypad,num-columns = <8>;
+ linux,keymap = <
+ MATRIX_KEY(0, 3, 2)
+ MATRIX_KEY(0, 4, 3)
+ >;
+ linux,input-no-autorepeat;
+ wakeup-source;
+ };
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 02/10] Input: samsung-keypad - handle compact binding
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:24 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 03/10] ARM: s3c: register and attach software nodes for Samsung gpio_chips Dmitry Torokhov
` (8 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Bartosz Golaszewski
Add support for standard matrix keymap binding (in addition to the
existing verbose binding with a sub-node for each key). This will
allow easier conversions from platform data to device properties when
using static device properties.
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/samsung-keypad.c | 134 +++++++++++++++++---------------
1 file changed, 71 insertions(+), 63 deletions(-)
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index 17127269e3f0..cc34f0146161 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -231,83 +231,89 @@ static void samsung_keypad_close(struct input_dev *input_dev)
samsung_keypad_stop(keypad);
}
-#ifdef CONFIG_OF
-static struct samsung_keypad_platdata *
-samsung_keypad_parse_dt(struct device *dev)
+static const struct matrix_keymap_data *
+samsung_parse_verbose_keymap(struct device *dev)
{
- struct samsung_keypad_platdata *pdata;
struct matrix_keymap_data *keymap_data;
- uint32_t *keymap, num_rows = 0, num_cols = 0;
- struct device_node *np = dev->of_node, *key_np;
+ struct fwnode_handle *child;
+ u32 *keymap;
unsigned int key_count;
- if (!np) {
- dev_err(dev, "missing device tree data\n");
- return ERR_PTR(-EINVAL);
+ keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL);
+ if (!keymap_data)
+ return ERR_PTR(-ENOMEM);
+
+ key_count = device_get_child_node_count(dev);
+ keymap = devm_kcalloc(dev, key_count, sizeof(*keymap), GFP_KERNEL);
+ if (!keymap)
+ return ERR_PTR(-ENOMEM);
+
+ keymap_data->keymap_size = key_count;
+ keymap_data->keymap = keymap;
+
+ device_for_each_child_node(dev, child) {
+ u32 row, col, key_code;
+
+ fwnode_property_read_u32(child, "keypad,row", &row);
+ fwnode_property_read_u32(child, "keypad,column", &col);
+ fwnode_property_read_u32(child, "linux,code", &key_code);
+
+ *keymap++ = KEY(row, col, key_code);
}
+ return keymap_data;
+}
+
+static const struct samsung_keypad_platdata *
+samsung_keypad_parse_properties(struct device *dev)
+{
+ const struct matrix_keymap_data *keymap_data;
+ struct samsung_keypad_platdata *pdata;
+ u32 num_rows = 0, num_cols = 0;
+ int error;
+
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- dev_err(dev, "could not allocate memory for platform data\n");
+ if (!pdata)
return ERR_PTR(-ENOMEM);
- }
- of_property_read_u32(np, "samsung,keypad-num-rows", &num_rows);
- of_property_read_u32(np, "samsung,keypad-num-columns", &num_cols);
- if (!num_rows || !num_cols) {
- dev_err(dev, "number of keypad rows/columns not specified\n");
- return ERR_PTR(-EINVAL);
+ if (device_property_present(dev, "linux,keymap")) {
+ error = matrix_keypad_parse_properties(dev, &num_rows, &num_cols);
+ if (error)
+ return ERR_PTR(error);
+ } else {
+ device_property_read_u32(dev, "samsung,keypad-num-rows", &num_rows);
+ device_property_read_u32(dev, "samsung,keypad-num-columns", &num_cols);
+ if (!num_rows || !num_cols) {
+ dev_err(dev, "number of keypad rows/columns not specified\n");
+ return ERR_PTR(-EINVAL);
+ }
}
+
pdata->rows = num_rows;
pdata->cols = num_cols;
- keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL);
- if (!keymap_data) {
- dev_err(dev, "could not allocate memory for keymap data\n");
- return ERR_PTR(-ENOMEM);
- }
- pdata->keymap_data = keymap_data;
+ if (!device_property_present(dev, "linux,keymap")) {
+ keymap_data = samsung_parse_verbose_keymap(dev);
+ if (IS_ERR(keymap_data))
+ return ERR_CAST(keymap_data);
- key_count = of_get_child_count(np);
- keymap_data->keymap_size = key_count;
- keymap = devm_kcalloc(dev, key_count, sizeof(uint32_t), GFP_KERNEL);
- if (!keymap) {
- dev_err(dev, "could not allocate memory for keymap\n");
- return ERR_PTR(-ENOMEM);
+ pdata->keymap_data = keymap_data;
}
- keymap_data->keymap = keymap;
- for_each_child_of_node(np, key_np) {
- u32 row, col, key_code;
- of_property_read_u32(key_np, "keypad,row", &row);
- of_property_read_u32(key_np, "keypad,column", &col);
- of_property_read_u32(key_np, "linux,code", &key_code);
- *keymap++ = KEY(row, col, key_code);
- }
- pdata->no_autorepeat = of_property_read_bool(np, "linux,input-no-autorepeat");
+ pdata->no_autorepeat =
+ device_property_read_bool(dev, "linux,input-no-autorepeat");
- pdata->wakeup = of_property_read_bool(np, "wakeup-source") ||
+ pdata->wakeup = device_property_read_bool(dev, "wakeup-source") ||
/* legacy name */
- of_property_read_bool(np, "linux,input-wakeup");
-
+ device_property_read_bool(dev, "linux,input-wakeup");
return pdata;
}
-#else
-static struct samsung_keypad_platdata *
-samsung_keypad_parse_dt(struct device *dev)
-{
- dev_err(dev, "no platform data defined\n");
-
- return ERR_PTR(-EINVAL);
-}
-#endif
static int samsung_keypad_probe(struct platform_device *pdev)
{
const struct samsung_keypad_platdata *pdata;
- const struct matrix_keymap_data *keymap_data;
const struct platform_device_id *id;
struct samsung_keypad *keypad;
struct resource *res;
@@ -316,18 +322,17 @@ static int samsung_keypad_probe(struct platform_device *pdev)
int error;
pdata = dev_get_platdata(&pdev->dev);
- if (!pdata) {
- pdata = samsung_keypad_parse_dt(&pdev->dev);
+ if (pdata) {
+ if (!pdata->keymap_data) {
+ dev_err(&pdev->dev, "no keymap data defined\n");
+ return -EINVAL;
+ }
+ } else {
+ pdata = samsung_keypad_parse_properties(&pdev->dev);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
}
- keymap_data = pdata->keymap_data;
- if (!keymap_data) {
- dev_err(&pdev->dev, "no keymap data defined\n");
- return -EINVAL;
- }
-
if (!pdata->rows || pdata->rows > SAMSUNG_MAX_ROWS)
return -EINVAL;
@@ -391,7 +396,7 @@ static int samsung_keypad_probe(struct platform_device *pdev)
input_dev->open = samsung_keypad_open;
input_dev->close = samsung_keypad_close;
- error = matrix_keypad_build_keymap(keymap_data, NULL,
+ error = matrix_keypad_build_keymap(pdata->keymap_data, NULL,
pdata->rows, pdata->cols,
keypad->keycodes, input_dev);
if (error) {
@@ -430,11 +435,14 @@ static int samsung_keypad_probe(struct platform_device *pdev)
if (error)
return error;
- if (pdev->dev.of_node) {
- devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
- devm_kfree(&pdev->dev, (void *)pdata->keymap_data);
+ if (!dev_get_platdata(&pdev->dev)) {
+ if (pdata->keymap_data) {
+ devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
+ devm_kfree(&pdev->dev, (void *)pdata->keymap_data);
+ }
devm_kfree(&pdev->dev, (void *)pdata);
}
+
return 0;
}
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 03/10] ARM: s3c: register and attach software nodes for Samsung gpio_chips
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 02/10] Input: samsung-keypad - handle " Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:24 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 04/10] ARM: s3c: crag6410: switch keypad device to software properties Dmitry Torokhov
` (7 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Bartosz Golaszewski
Define and register software nodes for the Samsung GPIO chips on legacy
(non-DT) platforms.
Attach the matching software node to each gpio_chip's fwnode during
registration, using the bank label to calculate the index.
This provides the infrastructure for converting board files and drivers
to use software nodes/properties instead of legacy platform data or GPIO
lookup tables.
Assisted-by: Antigravity:gemini-3.5-flash
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/arm/mach-s3c/gpio-core.h | 3 ++
arch/arm/mach-s3c/gpio-samsung-s3c64xx.h | 5 +++
arch/arm/mach-s3c/gpio-samsung.c | 72 ++++++++++++++++++++++++--------
3 files changed, 63 insertions(+), 17 deletions(-)
diff --git a/arch/arm/mach-s3c/gpio-core.h b/arch/arm/mach-s3c/gpio-core.h
index 6801c85fb9da..464b0d02f102 100644
--- a/arch/arm/mach-s3c/gpio-core.h
+++ b/arch/arm/mach-s3c/gpio-core.h
@@ -14,6 +14,8 @@
#include "gpio-samsung.h"
#include <linux/gpio/driver.h>
+struct software_node;
+
#define GPIOCON_OFF (0x00)
#define GPIODAT_OFF (0x04)
@@ -66,6 +68,7 @@ struct samsung_gpio_cfg;
*/
struct samsung_gpio_chip {
struct gpio_chip chip;
+ const struct software_node *swnode;
struct samsung_gpio_cfg *config;
struct samsung_gpio_pm *pm;
void __iomem *base;
diff --git a/arch/arm/mach-s3c/gpio-samsung-s3c64xx.h b/arch/arm/mach-s3c/gpio-samsung-s3c64xx.h
index 8ed144a0d474..fc21d3f50ce9 100644
--- a/arch/arm/mach-s3c/gpio-samsung-s3c64xx.h
+++ b/arch/arm/mach-s3c/gpio-samsung-s3c64xx.h
@@ -13,6 +13,8 @@
#ifdef CONFIG_GPIO_SAMSUNG
+#include <linux/property.h>
+
/* GPIO bank sizes */
#define S3C64XX_GPIO_A_NR (8)
#define S3C64XX_GPIO_B_NR (7)
@@ -89,6 +91,9 @@ enum s3c_gpio_number {
/* define the number of gpios we need to the one after the GPQ() range */
#define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
+extern const struct software_node samsung_gpiochip_nodes[];
+#define SAMSUNG_GPIO_NODE(node) (&samsung_gpiochip_nodes[(node) - 'A'])
+
#endif /* GPIO_SAMSUNG */
#endif /* GPIO_SAMSUNG_S3C64XX_H */
diff --git a/arch/arm/mach-s3c/gpio-samsung.c b/arch/arm/mach-s3c/gpio-samsung.c
index 81e198e5a6d3..b35cf62a9157 100644
--- a/arch/arm/mach-s3c/gpio-samsung.c
+++ b/arch/arm/mach-s3c/gpio-samsung.c
@@ -37,6 +37,28 @@
#include "gpio-cfg-helpers.h"
#include "pm.h"
+const struct software_node samsung_gpiochip_nodes[] = {
+ SOFTWARE_NODE("GPA", NULL, NULL),
+ SOFTWARE_NODE("GPB", NULL, NULL),
+ SOFTWARE_NODE("GPC", NULL, NULL),
+ SOFTWARE_NODE("GPD", NULL, NULL),
+ SOFTWARE_NODE("GPE", NULL, NULL),
+ SOFTWARE_NODE("GPF", NULL, NULL),
+ SOFTWARE_NODE("GPG", NULL, NULL),
+ SOFTWARE_NODE("GPH", NULL, NULL),
+ SOFTWARE_NODE("GPI", NULL, NULL),
+ SOFTWARE_NODE("GPJ", NULL, NULL),
+ SOFTWARE_NODE("GPK", NULL, NULL),
+ SOFTWARE_NODE("GPL", NULL, NULL),
+ SOFTWARE_NODE("GPM", NULL, NULL),
+ SOFTWARE_NODE("GPN", NULL, NULL),
+ SOFTWARE_NODE("GPO", NULL, NULL),
+ SOFTWARE_NODE("GPP", NULL, NULL),
+ SOFTWARE_NODE("GPQ", NULL, NULL),
+};
+
+#define NUM_SAMSUNG_GPIOCHIPS ARRAY_SIZE(samsung_gpiochip_nodes)
+
static int samsung_gpio_setpull_updown(struct samsung_gpio_chip *chip,
unsigned int off, samsung_gpio_pull_t pull)
{
@@ -491,6 +513,16 @@ static __init void s3c_gpiolib_track(struct samsung_gpio_chip *chip)
}
#endif /* CONFIG_S3C_GPIO_TRACK */
+static void __init samsung_setup_gpiochip_nodes(void)
+{
+ const struct software_node *group[NUM_SAMSUNG_GPIOCHIPS + 1] = { 0 };
+
+ for (unsigned int i = 0; i < NUM_SAMSUNG_GPIOCHIPS; i++)
+ group[i] = &samsung_gpiochip_nodes[i];
+
+ software_node_register_node_group(group);
+}
+
/*
* samsung_gpiolib_add() - add the Samsung gpio_chip.
* @chip: The chip to register
@@ -506,12 +538,16 @@ static void __init samsung_gpiolib_add(struct samsung_gpio_chip *chip)
struct gpio_chip *gc = &chip->chip;
int ret;
+ gc->label = chip->swnode->name;
+
BUG_ON(!chip->base);
BUG_ON(!gc->label);
BUG_ON(!gc->ngpio);
spin_lock_init(&chip->lock);
+ gc->fwnode = software_node_fwnode(chip->swnode);
+
if (!gc->direction_input)
gc->direction_input = samsung_gpiolib_2bit_input;
if (!gc->direction_output)
@@ -659,49 +695,49 @@ static struct samsung_gpio_chip s3c64xx_gpios_4bit[] = {
.chip = {
.base = S3C64XX_GPA(0),
.ngpio = S3C64XX_GPIO_A_NR,
- .label = "GPA",
},
+ .swnode = SAMSUNG_GPIO_NODE('A'),
}, {
.chip = {
.base = S3C64XX_GPB(0),
.ngpio = S3C64XX_GPIO_B_NR,
- .label = "GPB",
},
+ .swnode = SAMSUNG_GPIO_NODE('B'),
}, {
.chip = {
.base = S3C64XX_GPC(0),
.ngpio = S3C64XX_GPIO_C_NR,
- .label = "GPC",
},
+ .swnode = SAMSUNG_GPIO_NODE('C'),
}, {
.chip = {
.base = S3C64XX_GPD(0),
.ngpio = S3C64XX_GPIO_D_NR,
- .label = "GPD",
},
+ .swnode = SAMSUNG_GPIO_NODE('D'),
}, {
.config = &samsung_gpio_cfgs[0],
.chip = {
.base = S3C64XX_GPE(0),
.ngpio = S3C64XX_GPIO_E_NR,
- .label = "GPE",
},
+ .swnode = SAMSUNG_GPIO_NODE('E'),
}, {
.base = S3C64XX_GPG_BASE,
.chip = {
.base = S3C64XX_GPG(0),
.ngpio = S3C64XX_GPIO_G_NR,
- .label = "GPG",
},
+ .swnode = SAMSUNG_GPIO_NODE('G'),
}, {
.base = S3C64XX_GPM_BASE,
.config = &samsung_gpio_cfgs[1],
.chip = {
.base = S3C64XX_GPM(0),
.ngpio = S3C64XX_GPIO_M_NR,
- .label = "GPM",
.to_irq = s3c64xx_gpiolib_mbank_to_irq,
},
+ .swnode = SAMSUNG_GPIO_NODE('M'),
},
};
@@ -711,25 +747,25 @@ static struct samsung_gpio_chip s3c64xx_gpios_4bit2[] = {
.chip = {
.base = S3C64XX_GPH(0),
.ngpio = S3C64XX_GPIO_H_NR,
- .label = "GPH",
},
+ .swnode = SAMSUNG_GPIO_NODE('H'),
}, {
.base = S3C64XX_GPK_BASE + 0x4,
.config = &samsung_gpio_cfgs[0],
.chip = {
.base = S3C64XX_GPK(0),
.ngpio = S3C64XX_GPIO_K_NR,
- .label = "GPK",
},
+ .swnode = SAMSUNG_GPIO_NODE('K'),
}, {
.base = S3C64XX_GPL_BASE + 0x4,
.config = &samsung_gpio_cfgs[1],
.chip = {
.base = S3C64XX_GPL(0),
.ngpio = S3C64XX_GPIO_L_NR,
- .label = "GPL",
.to_irq = s3c64xx_gpiolib_lbank_to_irq,
},
+ .swnode = SAMSUNG_GPIO_NODE('L'),
},
};
@@ -740,43 +776,43 @@ static struct samsung_gpio_chip s3c64xx_gpios_2bit[] = {
.chip = {
.base = S3C64XX_GPF(0),
.ngpio = S3C64XX_GPIO_F_NR,
- .label = "GPF",
},
+ .swnode = SAMSUNG_GPIO_NODE('F'),
}, {
.config = &samsung_gpio_cfgs[7],
.chip = {
.base = S3C64XX_GPI(0),
.ngpio = S3C64XX_GPIO_I_NR,
- .label = "GPI",
},
+ .swnode = SAMSUNG_GPIO_NODE('I'),
}, {
.config = &samsung_gpio_cfgs[7],
.chip = {
.base = S3C64XX_GPJ(0),
.ngpio = S3C64XX_GPIO_J_NR,
- .label = "GPJ",
},
+ .swnode = SAMSUNG_GPIO_NODE('J'),
}, {
.config = &samsung_gpio_cfgs[6],
.chip = {
.base = S3C64XX_GPO(0),
.ngpio = S3C64XX_GPIO_O_NR,
- .label = "GPO",
},
+ .swnode = SAMSUNG_GPIO_NODE('O'),
}, {
.config = &samsung_gpio_cfgs[6],
.chip = {
.base = S3C64XX_GPP(0),
.ngpio = S3C64XX_GPIO_P_NR,
- .label = "GPP",
},
+ .swnode = SAMSUNG_GPIO_NODE('P'),
}, {
.config = &samsung_gpio_cfgs[6],
.chip = {
.base = S3C64XX_GPQ(0),
.ngpio = S3C64XX_GPIO_Q_NR,
- .label = "GPQ",
},
+ .swnode = SAMSUNG_GPIO_NODE('Q'),
}, {
.base = S3C64XX_GPN_BASE,
.irq_base = IRQ_EINT(0),
@@ -784,9 +820,9 @@ static struct samsung_gpio_chip s3c64xx_gpios_2bit[] = {
.chip = {
.base = S3C64XX_GPN(0),
.ngpio = S3C64XX_GPIO_N_NR,
- .label = "GPN",
.to_irq = samsung_gpiolib_to_irq,
},
+ .swnode = SAMSUNG_GPIO_NODE('N'),
},
};
@@ -803,6 +839,8 @@ static __init int samsung_gpiolib_init(void)
return 0;
if (soc_is_s3c64xx()) {
+ samsung_setup_gpiochip_nodes();
+
samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
ARRAY_SIZE(samsung_gpio_cfgs));
samsung_gpiolib_add_2bit_chips(s3c64xx_gpios_2bit,
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 04/10] ARM: s3c: crag6410: switch keypad device to software properties
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (2 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 03/10] ARM: s3c: register and attach software nodes for Samsung gpio_chips Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 05/10] Input: samsung-keypad - remove support for platform data Dmitry Torokhov
` (6 subsequent siblings)
10 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Krzysztof Kozlowski
Switch the keypad device to use software properties to describe the
keypad. This will allow dropping support for platform data from the
samsung-keypad driver.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/arm/mach-s3c/Kconfig | 5 ---
arch/arm/mach-s3c/Kconfig.s3c64xx | 7 ----
arch/arm/mach-s3c/Makefile.s3c64xx | 1 -
arch/arm/mach-s3c/devs.c | 27 ---------------
arch/arm/mach-s3c/devs.h | 1 -
arch/arm/mach-s3c/keypad.h | 27 ---------------
arch/arm/mach-s3c/mach-crag6410.c | 56 ++++++++++++++++++++++++--------
arch/arm/mach-s3c/setup-keypad-s3c64xx.c | 20 ------------
8 files changed, 42 insertions(+), 102 deletions(-)
diff --git a/arch/arm/mach-s3c/Kconfig b/arch/arm/mach-s3c/Kconfig
index b3656109f1f7..2e77bb4f3a8c 100644
--- a/arch/arm/mach-s3c/Kconfig
+++ b/arch/arm/mach-s3c/Kconfig
@@ -111,11 +111,6 @@ config S3C64XX_DEV_SPI0
Compile in platform device definitions for S3C64XX's type
SPI controller 0
-config SAMSUNG_DEV_KEYPAD
- bool
- help
- Compile in platform device definitions for keypad
-
config SAMSUNG_DEV_PWM
bool
help
diff --git a/arch/arm/mach-s3c/Kconfig.s3c64xx b/arch/arm/mach-s3c/Kconfig.s3c64xx
index 3f97fba8e4f5..aef97cc5d195 100644
--- a/arch/arm/mach-s3c/Kconfig.s3c64xx
+++ b/arch/arm/mach-s3c/Kconfig.s3c64xx
@@ -74,11 +74,6 @@ config S3C64XX_SETUP_FB_24BPP
help
Common setup code for S3C64XX with an 24bpp RGB display helper.
-config S3C64XX_SETUP_KEYPAD
- bool
- help
- Common setup code for S3C64XX KEYPAD GPIO configurations
-
config S3C64XX_SETUP_SDHCI_GPIO
bool
help
@@ -106,7 +101,6 @@ config MACH_WLF_CRAGG_6410
select S3C64XX_DEV_SPI0
select S3C64XX_SETUP_FB_24BPP
select S3C64XX_SETUP_I2C1
- select S3C64XX_SETUP_KEYPAD
select S3C64XX_SETUP_SDHCI
select S3C64XX_SETUP_SPI
select S3C64XX_SETUP_USB_PHY
@@ -117,7 +111,6 @@ config MACH_WLF_CRAGG_6410
select S3C_DEV_I2C1
select S3C_DEV_USB_HOST
select S3C_DEV_USB_HSOTG
- select SAMSUNG_DEV_KEYPAD
select SAMSUNG_DEV_PWM
help
Machine support for the Wolfson Cragganmore S3C6410 variant.
diff --git a/arch/arm/mach-s3c/Makefile.s3c64xx b/arch/arm/mach-s3c/Makefile.s3c64xx
index 61287ad2ea42..1686b1f344f8 100644
--- a/arch/arm/mach-s3c/Makefile.s3c64xx
+++ b/arch/arm/mach-s3c/Makefile.s3c64xx
@@ -32,7 +32,6 @@ obj-y += dev-audio-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_FB_24BPP) += setup-fb-24bpp-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_I2C0) += setup-i2c0-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_I2C1) += setup-i2c1-s3c64xx.o
-obj-$(CONFIG_S3C64XX_SETUP_KEYPAD) += setup-keypad-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_SPI) += setup-spi-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy-s3c64xx.o
diff --git a/arch/arm/mach-s3c/devs.c b/arch/arm/mach-s3c/devs.c
index bab2abd8a34a..0237307b9238 100644
--- a/arch/arm/mach-s3c/devs.c
+++ b/arch/arm/mach-s3c/devs.c
@@ -39,7 +39,6 @@
#include "devs.h"
#include "fb.h"
#include <linux/platform_data/i2c-s3c2410.h>
-#include "keypad.h"
#include "pwm-core.h"
#include "sdhci.h"
#include "usb-phy.h"
@@ -265,32 +264,6 @@ void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
}
#endif /* CONFIG_S3C_DEV_I2C1 */
-/* KEYPAD */
-
-#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
-static struct resource samsung_keypad_resources[] = {
- [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32),
- [1] = DEFINE_RES_IRQ(IRQ_KEYPAD),
-};
-
-struct platform_device samsung_device_keypad = {
- .name = "samsung-keypad",
- .id = -1,
- .num_resources = ARRAY_SIZE(samsung_keypad_resources),
- .resource = samsung_keypad_resources,
-};
-
-void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
-{
- struct samsung_keypad_platdata *npd;
-
- npd = s3c_set_platdata(pd, sizeof(*npd), &samsung_device_keypad);
-
- if (!npd->cfg_gpio)
- npd->cfg_gpio = samsung_keypad_cfg_gpio;
-}
-#endif /* CONFIG_SAMSUNG_DEV_KEYPAD */
-
/* PWM Timer */
#ifdef CONFIG_SAMSUNG_DEV_PWM
diff --git a/arch/arm/mach-s3c/devs.h b/arch/arm/mach-s3c/devs.h
index 21c00786c264..2737990063b1 100644
--- a/arch/arm/mach-s3c/devs.h
+++ b/arch/arm/mach-s3c/devs.h
@@ -39,7 +39,6 @@ extern struct platform_device s3c_device_i2c1;
extern struct platform_device s3c_device_ohci;
extern struct platform_device s3c_device_usb_hsotg;
-extern struct platform_device samsung_device_keypad;
extern struct platform_device samsung_device_pwm;
/**
diff --git a/arch/arm/mach-s3c/keypad.h b/arch/arm/mach-s3c/keypad.h
deleted file mode 100644
index 9754b9a29945..000000000000
--- a/arch/arm/mach-s3c/keypad.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Samsung Platform - Keypad platform data definitions
- *
- * Copyright (C) 2010 Samsung Electronics Co.Ltd
- * Author: Joonyoung Shim <jy0922.shim@samsung.com>
- */
-
-#ifndef __PLAT_SAMSUNG_KEYPAD_H
-#define __PLAT_SAMSUNG_KEYPAD_H
-
-#include <linux/input/samsung-keypad.h>
-
-/**
- * samsung_keypad_set_platdata - Set platform data for Samsung Keypad device.
- * @pd: Platform data to register to device.
- *
- * Register the given platform data for use with Samsung Keypad device.
- * The call will copy the platform data, so the board definitions can
- * make the structure itself __initdata.
- */
-extern void samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd);
-
-/* defined by architecture to configure gpio. */
-extern void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols);
-
-#endif /* __PLAT_SAMSUNG_KEYPAD_H */
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
index c4040aad1ed3..c2df5dcb3368 100644
--- a/arch/arm/mach-s3c/mach-crag6410.c
+++ b/arch/arm/mach-s3c/mach-crag6410.c
@@ -15,6 +15,7 @@
#include <linux/io.h>
#include <linux/init.h>
#include <linux/input-event-codes.h>
+#include <linux/input/matrix_keypad.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/leds.h>
@@ -22,6 +23,7 @@
#include <linux/mmc/host.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
+#include <linux/property.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/dm9000.h>
@@ -53,7 +55,6 @@
#include "gpio-cfg.h"
#include <linux/platform_data/spi-s3c64xx.h>
-#include "keypad.h"
#include "devs.h"
#include "cpu.h"
#include <linux/platform_data/i2c-s3c2410.h>
@@ -176,7 +177,7 @@ static struct s3c_fb_platdata crag6410_lcd_pdata = {
/* 2x6 keypad */
-static uint32_t crag6410_keymap[] = {
+static const u32 crag6410_keymap[] __initconst = {
/* KEY(row, col, keycode) */
KEY(0, 0, KEY_VOLUMEUP),
KEY(0, 1, KEY_HOME),
@@ -192,17 +193,41 @@ static uint32_t crag6410_keymap[] = {
KEY(1, 5, KEY_CAMERA),
};
-static struct matrix_keymap_data crag6410_keymap_data = {
- .keymap = crag6410_keymap,
- .keymap_size = ARRAY_SIZE(crag6410_keymap),
+static const struct property_entry crag6410_keypad_props[] __initconst = {
+ PROPERTY_ENTRY_U32("keypad,num-columns", 6),
+ PROPERTY_ENTRY_U32("keypad,num-rows", 2),
+ PROPERTY_ENTRY_U32_ARRAY("linux,keymap", crag6410_keymap),
+ { }
+};
+
+static const struct resource crag6410_keypad_resources[] __initconst = {
+ [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32),
+ [1] = DEFINE_RES_IRQ(IRQ_KEYPAD),
};
-static struct samsung_keypad_platdata crag6410_keypad_data = {
- .keymap_data = &crag6410_keymap_data,
- .rows = 2,
- .cols = 6,
+static const struct platform_device_info crag6410_keypad_info __initconst = {
+ .name = "samsung-keypad",
+ .id = PLATFORM_DEVID_NONE,
+ .res = crag6410_keypad_resources,
+ .num_res = ARRAY_SIZE(crag6410_keypad_resources),
+ .properties = crag6410_keypad_props,
};
+static void __init crag6410_setup_keypad(void)
+{
+ struct platform_device *pd;
+
+ /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */
+ s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), 2, S3C_GPIO_SFN(3));
+
+ /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */
+ s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), 6, S3C_GPIO_SFN(3));
+
+ pd = platform_device_register_full(&crag6410_keypad_info);
+ if (IS_ERR(pd))
+ pr_err("failed to instantiate keypad device\n");
+}
+
static struct gpio_keys_button crag6410_gpio_keys[] = {
[0] = {
.code = KEY_SUSPEND,
@@ -361,7 +386,7 @@ static struct platform_device wallvdd_device = {
},
};
-static struct platform_device *crag6410_devices[] __initdata = {
+static struct platform_device *crag6410_devs0[] __initdata = {
&s3c_device_hsmmc0,
&s3c_device_hsmmc2,
&s3c_device_i2c0,
@@ -372,8 +397,10 @@ static struct platform_device *crag6410_devices[] __initdata = {
&samsung_device_pwm,
&s3c64xx_device_iis0,
&s3c64xx_device_iis1,
- &samsung_device_keypad,
&crag6410_gpio_keydev,
+};
+
+static struct platform_device *crag6410_devs1[] __initdata = {
&crag6410_dm9k_device,
&s3c64xx_device_spi0,
&crag6410_lcd_powerdev,
@@ -873,16 +900,17 @@ static void __init crag6410_machine_init(void)
gpiod_add_lookup_table(&crag_wm1250_ev1_gpiod_table);
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
- samsung_keypad_set_platdata(&crag6410_keypad_data);
-
gpiod_add_lookup_table(&crag_spi0_gpiod_table);
s3c64xx_spi0_set_platdata(0, 2);
pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
- platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
+ platform_add_devices(crag6410_devs0, ARRAY_SIZE(crag6410_devs0));
platform_device_register_full(&crag6410_mmgpio_devinfo);
gpiod_add_lookup_table(&crag_leds_table);
+ crag6410_setup_keypad();
+
+ platform_add_devices(crag6410_devs1, ARRAY_SIZE(crag6410_devs1));
gpio_led_register_device(-1, &gpio_leds_pdata);
regulator_has_full_constraints();
diff --git a/arch/arm/mach-s3c/setup-keypad-s3c64xx.c b/arch/arm/mach-s3c/setup-keypad-s3c64xx.c
deleted file mode 100644
index 8463ad37c6ab..000000000000
--- a/arch/arm/mach-s3c/setup-keypad-s3c64xx.c
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-//
-// Copyright (c) 2010 Samsung Electronics Co., Ltd.
-// http://www.samsung.com/
-//
-// GPIO configuration for S3C64XX KeyPad device
-
-#include <linux/gpio.h>
-#include "gpio-cfg.h"
-#include "keypad.h"
-#include "gpio-samsung.h"
-
-void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
-{
- /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */
- s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), rows, S3C_GPIO_SFN(3));
-
- /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */
- s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3));
-}
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 05/10] Input: samsung-keypad - remove support for platform data
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (3 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 04/10] ARM: s3c: crag6410: switch keypad device to software properties Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:22 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 06/10] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys Dmitry Torokhov
` (5 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Bartosz Golaszewski
Because there are no more users of samsung_keypad_platdata left in
the kernel remove support for it from the driver.
The driver supports generic device properties so all configuration
should be done using them instead of a custom platform data.
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/samsung-keypad.c | 184 +++++++++++++-------------------
include/linux/input/samsung-keypad.h | 39 -------
2 files changed, 72 insertions(+), 151 deletions(-)
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index cc34f0146161..e54b3b9f2cf2 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -12,6 +12,7 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
@@ -21,7 +22,9 @@
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/sched.h>
-#include <linux/input/samsung-keypad.h>
+
+#define SAMSUNG_MAX_ROWS 8
+#define SAMSUNG_MAX_COLS 8
#define SAMSUNG_KEYIFCON 0x00
#define SAMSUNG_KEYIFSTSCLR 0x04
@@ -231,26 +234,22 @@ static void samsung_keypad_close(struct input_dev *input_dev)
samsung_keypad_stop(keypad);
}
-static const struct matrix_keymap_data *
-samsung_parse_verbose_keymap(struct device *dev)
+static int samsung_parse_verbose_keymap(struct samsung_keypad *keypad)
{
- struct matrix_keymap_data *keymap_data;
+ struct matrix_keymap_data keymap_data = { 0 };
+ struct device *dev = &keypad->pdev->dev;
struct fwnode_handle *child;
- u32 *keymap;
- unsigned int key_count;
-
- keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL);
- if (!keymap_data)
- return ERR_PTR(-ENOMEM);
+ unsigned int key_count = device_get_child_node_count(dev);
+ unsigned int i;
- key_count = device_get_child_node_count(dev);
- keymap = devm_kcalloc(dev, key_count, sizeof(*keymap), GFP_KERNEL);
+ u32 *keymap __free(kfree) = kcalloc(key_count, sizeof(*keymap), GFP_KERNEL);
if (!keymap)
- return ERR_PTR(-ENOMEM);
+ return -ENOMEM;
- keymap_data->keymap_size = key_count;
- keymap_data->keymap = keymap;
+ keymap_data.keymap_size = key_count;
+ keymap_data.keymap = keymap;
+ i = 0;
device_for_each_child_node(dev, child) {
u32 row, col, key_code;
@@ -258,123 +257,69 @@ samsung_parse_verbose_keymap(struct device *dev)
fwnode_property_read_u32(child, "keypad,column", &col);
fwnode_property_read_u32(child, "linux,code", &key_code);
- *keymap++ = KEY(row, col, key_code);
+ keymap[i++] = KEY(row, col, key_code);
}
- return keymap_data;
+ return matrix_keypad_build_keymap(&keymap_data, NULL,
+ keypad->rows, keypad->cols,
+ keypad->keycodes,
+ keypad->input_dev);
}
-static const struct samsung_keypad_platdata *
-samsung_keypad_parse_properties(struct device *dev)
+static int samsung_keypad_parse_keymap(struct samsung_keypad *keypad)
{
- const struct matrix_keymap_data *keymap_data;
- struct samsung_keypad_platdata *pdata;
- u32 num_rows = 0, num_cols = 0;
- int error;
-
- pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata)
- return ERR_PTR(-ENOMEM);
-
- if (device_property_present(dev, "linux,keymap")) {
- error = matrix_keypad_parse_properties(dev, &num_rows, &num_cols);
- if (error)
- return ERR_PTR(error);
- } else {
- device_property_read_u32(dev, "samsung,keypad-num-rows", &num_rows);
- device_property_read_u32(dev, "samsung,keypad-num-columns", &num_cols);
- if (!num_rows || !num_cols) {
- dev_err(dev, "number of keypad rows/columns not specified\n");
- return ERR_PTR(-EINVAL);
- }
- }
-
- pdata->rows = num_rows;
- pdata->cols = num_cols;
-
- if (!device_property_present(dev, "linux,keymap")) {
- keymap_data = samsung_parse_verbose_keymap(dev);
- if (IS_ERR(keymap_data))
- return ERR_CAST(keymap_data);
-
- pdata->keymap_data = keymap_data;
- }
-
-
- pdata->no_autorepeat =
- device_property_read_bool(dev, "linux,input-no-autorepeat");
+ struct device *dev = &keypad->pdev->dev;
- pdata->wakeup = device_property_read_bool(dev, "wakeup-source") ||
- /* legacy name */
- device_property_read_bool(dev, "linux,input-wakeup");
+ if (device_property_present(dev, "linux,keymap"))
+ return matrix_keypad_build_keymap(NULL, NULL,
+ keypad->rows, keypad->cols,
+ keypad->keycodes,
+ keypad->input_dev);
- return pdata;
+ return samsung_parse_verbose_keymap(keypad);
}
static int samsung_keypad_probe(struct platform_device *pdev)
{
- const struct samsung_keypad_platdata *pdata;
const struct platform_device_id *id;
+ struct device *dev = &pdev->dev;
struct samsung_keypad *keypad;
struct resource *res;
struct input_dev *input_dev;
unsigned int row_shift;
+ u32 num_rows = 0, num_cols = 0;
+ bool wakeup;
int error;
- pdata = dev_get_platdata(&pdev->dev);
- if (pdata) {
- if (!pdata->keymap_data) {
- dev_err(&pdev->dev, "no keymap data defined\n");
+ if (device_property_present(dev, "linux,keymap")) {
+ error = matrix_keypad_parse_properties(dev, &num_rows, &num_cols);
+ if (error)
+ return error;
+ } else {
+ device_property_read_u32(dev, "samsung,keypad-num-rows", &num_rows);
+ device_property_read_u32(dev, "samsung,keypad-num-columns", &num_cols);
+ if (!num_rows || !num_cols) {
+ dev_err(dev, "number of keypad rows/columns not specified\n");
return -EINVAL;
}
- } else {
- pdata = samsung_keypad_parse_properties(&pdev->dev);
- if (IS_ERR(pdata))
- return PTR_ERR(pdata);
}
- if (!pdata->rows || pdata->rows > SAMSUNG_MAX_ROWS)
- return -EINVAL;
-
- if (!pdata->cols || pdata->cols > SAMSUNG_MAX_COLS)
+ if (num_rows > SAMSUNG_MAX_ROWS || num_cols > SAMSUNG_MAX_COLS)
return -EINVAL;
- /* initialize the gpio */
- if (pdata->cfg_gpio)
- pdata->cfg_gpio(pdata->rows, pdata->cols);
-
- row_shift = get_count_order(pdata->cols);
+ row_shift = get_count_order(num_cols);
keypad = devm_kzalloc(&pdev->dev,
struct_size(keypad, keycodes,
- pdata->rows << row_shift),
+ num_rows << row_shift),
GFP_KERNEL);
if (!keypad)
return -ENOMEM;
- input_dev = devm_input_allocate_device(&pdev->dev);
- if (!input_dev)
- return -ENOMEM;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
- keypad->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (!keypad->base)
- return -EBUSY;
-
- keypad->clk = devm_clk_get_prepared(&pdev->dev, "keypad");
- if (IS_ERR(keypad->clk)) {
- dev_err(&pdev->dev, "failed to get keypad clk\n");
- return PTR_ERR(keypad->clk);
- }
-
- keypad->input_dev = input_dev;
keypad->pdev = pdev;
keypad->row_shift = row_shift;
- keypad->rows = pdata->rows;
- keypad->cols = pdata->cols;
+ keypad->rows = num_rows;
+ keypad->cols = num_cols;
keypad->stopped = true;
init_waitqueue_head(&keypad->wait);
@@ -390,26 +335,45 @@ static int samsung_keypad_probe(struct platform_device *pdev)
return -EINVAL;
}
+ input_dev = devm_input_allocate_device(&pdev->dev);
+ if (!input_dev)
+ return -ENOMEM;
+
+ keypad->input_dev = input_dev;
+
input_dev->name = pdev->name;
input_dev->id.bustype = BUS_HOST;
input_dev->open = samsung_keypad_open;
input_dev->close = samsung_keypad_close;
- error = matrix_keypad_build_keymap(pdata->keymap_data, NULL,
- pdata->rows, pdata->cols,
- keypad->keycodes, input_dev);
+ error = samsung_keypad_parse_keymap(keypad);
if (error) {
dev_err(&pdev->dev, "failed to build keymap\n");
return error;
}
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
- if (!pdata->no_autorepeat)
+
+ if (!device_property_read_bool(&pdev->dev, "linux,input-no-autorepeat"))
__set_bit(EV_REP, input_dev->evbit);
input_set_drvdata(input_dev, keypad);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+
+ keypad->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+ if (!keypad->base)
+ return -EBUSY;
+
+ keypad->clk = devm_clk_get_prepared(&pdev->dev, "keypad");
+ if (IS_ERR(keypad->clk)) {
+ dev_err(&pdev->dev, "failed to get keypad clk\n");
+ return PTR_ERR(keypad->clk);
+ }
+
keypad->irq = platform_get_irq(pdev, 0);
if (keypad->irq < 0) {
error = keypad->irq;
@@ -424,7 +388,11 @@ static int samsung_keypad_probe(struct platform_device *pdev)
return error;
}
- device_init_wakeup(&pdev->dev, pdata->wakeup);
+ wakeup = device_property_read_bool(dev, "wakeup-source") ||
+ /* legacy name */
+ device_property_read_bool(dev, "linux,input-wakeup");
+ device_init_wakeup(&pdev->dev, wakeup);
+
platform_set_drvdata(pdev, keypad);
error = devm_pm_runtime_enable(&pdev->dev);
@@ -435,14 +403,6 @@ static int samsung_keypad_probe(struct platform_device *pdev)
if (error)
return error;
- if (!dev_get_platdata(&pdev->dev)) {
- if (pdata->keymap_data) {
- devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
- devm_kfree(&pdev->dev, (void *)pdata->keymap_data);
- }
- devm_kfree(&pdev->dev, (void *)pdata);
- }
-
return 0;
}
diff --git a/include/linux/input/samsung-keypad.h b/include/linux/input/samsung-keypad.h
deleted file mode 100644
index ab6b97114c08..000000000000
--- a/include/linux/input/samsung-keypad.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Samsung Keypad platform data definitions
- *
- * Copyright (C) 2010 Samsung Electronics Co.Ltd
- * Author: Joonyoung Shim <jy0922.shim@samsung.com>
- */
-
-#ifndef __SAMSUNG_KEYPAD_H
-#define __SAMSUNG_KEYPAD_H
-
-#include <linux/input/matrix_keypad.h>
-
-#define SAMSUNG_MAX_ROWS 8
-#define SAMSUNG_MAX_COLS 8
-
-/**
- * struct samsung_keypad_platdata - Platform device data for Samsung Keypad.
- * @keymap_data: pointer to &matrix_keymap_data.
- * @rows: number of keypad row supported.
- * @cols: number of keypad col supported.
- * @no_autorepeat: disable key autorepeat.
- * @wakeup: controls whether the device should be set up as wakeup source.
- * @cfg_gpio: configure the GPIO.
- *
- * Initialisation data specific to either the machine or the platform
- * for the device driver to use or call-back when configuring gpio.
- */
-struct samsung_keypad_platdata {
- const struct matrix_keymap_data *keymap_data;
- unsigned int rows;
- unsigned int cols;
- bool no_autorepeat;
- bool wakeup;
-
- void (*cfg_gpio)(unsigned int rows, unsigned int cols);
-};
-
-#endif /* __SAMSUNG_KEYPAD_H */
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 06/10] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (4 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 05/10] Input: samsung-keypad - remove support for platform data Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:21 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 07/10] mfd: wm831x: support software nodes for DCDC regulators Dmitry Torokhov
` (4 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Krzysztof Kozlowski
Switch the gpio-keys device to use software nodes/properties to
describe the buttons and switches. This will allow dropping support
for platform data from the gpio-keys driver in the future.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/arm/mach-s3c/mach-crag6410.c | 79 ++++++++++++++++++++++++++++-----------
1 file changed, 58 insertions(+), 21 deletions(-)
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
index c2df5dcb3368..757c0f383ff1 100644
--- a/arch/arm/mach-s3c/mach-crag6410.c
+++ b/arch/arm/mach-s3c/mach-crag6410.c
@@ -18,6 +18,7 @@
#include <linux/input/matrix_keypad.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
+#include <linux/gpio/property.h>
#include <linux/leds.h>
#include <linux/delay.h>
#include <linux/mmc/host.h>
@@ -228,32 +229,68 @@ static void __init crag6410_setup_keypad(void)
pr_err("failed to instantiate keypad device\n");
}
-static struct gpio_keys_button crag6410_gpio_keys[] = {
- [0] = {
- .code = KEY_SUSPEND,
- .gpio = S3C64XX_GPL(10), /* EINT 18 */
- .type = EV_KEY,
- .wakeup = 1,
- .active_low = 1,
- },
- [1] = {
- .code = SW_FRONT_PROXIMITY,
- .gpio = S3C64XX_GPN(11), /* EINT 11 */
- .type = EV_SW,
- },
+static const struct software_node crag6410_gpio_keys_node = {
+ .name = "crag6410-gpio-keys",
};
-static struct gpio_keys_platform_data crag6410_gpio_keydata = {
- .buttons = crag6410_gpio_keys,
- .nbuttons = ARRAY_SIZE(crag6410_gpio_keys),
+static const struct property_entry crag6410_suspend_key_props[] = {
+ PROPERTY_ENTRY_U32("linux,code", KEY_SUSPEND),
+ PROPERTY_ENTRY_GPIO("gpios",
+ SAMSUNG_GPIO_NODE('L'), 10, /* EINT 18 */
+ GPIO_ACTIVE_LOW),
+ PROPERTY_ENTRY_BOOL("wakeup-source"),
+ { }
};
-static struct platform_device crag6410_gpio_keydev = {
- .name = "gpio-keys",
- .id = 0,
- .dev.platform_data = &crag6410_gpio_keydata,
+static const struct software_node crag6410_suspend_key_node = {
+ .parent = &crag6410_gpio_keys_node,
+ .properties = crag6410_suspend_key_props,
+};
+
+static const struct property_entry crag6410_prox_sw_props[] = {
+ PROPERTY_ENTRY_U32("linux,input-type", EV_SW),
+ PROPERTY_ENTRY_U32("linux,code", SW_FRONT_PROXIMITY),
+ PROPERTY_ENTRY_GPIO("gpios",
+ SAMSUNG_GPIO_NODE('N'), 11, /* EINT 11 */
+ GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node crag6410_prox_sw_node = {
+ .parent = &crag6410_gpio_keys_node,
+ .properties = crag6410_prox_sw_props,
};
+static const struct software_node *crag6410_gpio_keys_swnodes[] = {
+ &crag6410_gpio_keys_node,
+ &crag6410_suspend_key_node,
+ &crag6410_prox_sw_node,
+ NULL
+};
+
+static void __init crag6410_setup_gpio_keys(void)
+{
+ struct platform_device_info keys_info = {
+ .name = "gpio-keys",
+ .id = 0,
+ };
+ struct platform_device *pd;
+ int err;
+
+ err = software_node_register_node_group(crag6410_gpio_keys_swnodes);
+ if (err) {
+ pr_err("failed to register gpio-keys software nodes: %d\n", err);
+ return;
+ }
+
+ keys_info.fwnode = software_node_fwnode(&crag6410_gpio_keys_node);
+
+ pd = platform_device_register_full(&keys_info);
+ err = PTR_ERR_OR_ZERO(pd);
+ if (err)
+ pr_err("failed to create gpio-keys device: %d\n", err);
+}
+
static struct resource crag6410_dm9k_resource[] = {
[0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5, 2),
[1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5 + (1 << 8), 2),
@@ -397,7 +434,6 @@ static struct platform_device *crag6410_devs0[] __initdata = {
&samsung_device_pwm,
&s3c64xx_device_iis0,
&s3c64xx_device_iis1,
- &crag6410_gpio_keydev,
};
static struct platform_device *crag6410_devs1[] __initdata = {
@@ -909,6 +945,7 @@ static void __init crag6410_machine_init(void)
gpiod_add_lookup_table(&crag_leds_table);
crag6410_setup_keypad();
+ crag6410_setup_gpio_keys();
platform_add_devices(crag6410_devs1, ARRAY_SIZE(crag6410_devs1));
gpio_led_register_device(-1, &gpio_leds_pdata);
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 07/10] mfd: wm831x: support software nodes for DCDC regulators
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (5 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 06/10] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:20 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 08/10] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties Dmitry Torokhov
` (3 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches
Allow passing software nodes to wm831x DCDC regulators via PMIC platform
data. This is useful for non-DT/non-ACPI platforms that want to
associate device properties (like DVS GPIOs) with the regulator devices
using software nodes.
We add 'dcdc_swnodes' to the PMIC platform data 'struct wm831x_pdata' and
have the MFD core assign these software nodes to the buckv cells.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/mfd/wm831x-core.c | 47 ++++++++++++++++++++++++++++++----------
include/linux/mfd/wm831x/pdata.h | 2 ++
2 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index df8e76e000cc..c4793be419ba 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -14,6 +14,7 @@
#include <linux/delay.h>
#include <linux/mfd/core.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <linux/err.h>
#include <linux/mfd/wm831x/core.h>
@@ -1449,6 +1450,32 @@ const struct of_device_id wm831x_of_match[] = {
};
EXPORT_SYMBOL_GPL(wm831x_of_match);
+static int wm831x_add_devices(struct wm831x *wm831x, int wm831x_num,
+ const struct mfd_cell *cells, int num_cells)
+{
+ struct wm831x_pdata *pdata = &wm831x->pdata;
+ int i;
+
+ struct mfd_cell *local_cells __free(kfree) =
+ kmemdup_array(cells, num_cells, sizeof(*cells), GFP_KERNEL);
+ if (!local_cells)
+ return -ENOMEM;
+
+ for (i = 0; i < num_cells; i++) {
+ struct mfd_cell *cell = &local_cells[i];
+
+ if (strcmp(cell->name, "wm831x-buckv") == 0) {
+ int id = cell->id - 1;
+
+ if (id >= 0 && id < WM831X_MAX_DCDC)
+ cell->swnode = pdata->dcdc_swnodes[id];
+ }
+ }
+
+ return mfd_add_devices(wm831x->dev, wm831x_num, local_cells, num_cells,
+ NULL, 0, NULL);
+}
+
/*
* Instantiate the generic non-control parts of the device.
*/
@@ -1620,15 +1647,13 @@ int wm831x_device_init(struct wm831x *wm831x, int irq)
/* The core device is up, instantiate the subdevices. */
switch (parent) {
case WM8310:
- ret = mfd_add_devices(wm831x->dev, wm831x_num,
- wm8310_devs, ARRAY_SIZE(wm8310_devs),
- NULL, 0, NULL);
+ ret = wm831x_add_devices(wm831x, wm831x_num,
+ wm8310_devs, ARRAY_SIZE(wm8310_devs));
break;
case WM8311:
- ret = mfd_add_devices(wm831x->dev, wm831x_num,
- wm8311_devs, ARRAY_SIZE(wm8311_devs),
- NULL, 0, NULL);
+ ret = wm831x_add_devices(wm831x, wm831x_num,
+ wm8311_devs, ARRAY_SIZE(wm8311_devs));
if (!pdata->disable_touch)
mfd_add_devices(wm831x->dev, wm831x_num,
touch_devs, ARRAY_SIZE(touch_devs),
@@ -1636,9 +1661,8 @@ int wm831x_device_init(struct wm831x *wm831x, int irq)
break;
case WM8312:
- ret = mfd_add_devices(wm831x->dev, wm831x_num,
- wm8312_devs, ARRAY_SIZE(wm8312_devs),
- NULL, 0, NULL);
+ ret = wm831x_add_devices(wm831x, wm831x_num,
+ wm8312_devs, ARRAY_SIZE(wm8312_devs));
if (!pdata->disable_touch)
mfd_add_devices(wm831x->dev, wm831x_num,
touch_devs, ARRAY_SIZE(touch_devs),
@@ -1649,9 +1673,8 @@ int wm831x_device_init(struct wm831x *wm831x, int irq)
case WM8321:
case WM8325:
case WM8326:
- ret = mfd_add_devices(wm831x->dev, wm831x_num,
- wm8320_devs, ARRAY_SIZE(wm8320_devs),
- NULL, 0, NULL);
+ ret = wm831x_add_devices(wm831x, wm831x_num,
+ wm8320_devs, ARRAY_SIZE(wm8320_devs));
break;
default:
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index 75aa94dadf1c..d5d9d9600756 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -12,6 +12,7 @@
struct wm831x;
struct regulator_init_data;
+struct software_node;
struct wm831x_backlight_pdata {
int isink; /** ISINK to use, 1 or 2 */
@@ -132,6 +133,7 @@ struct wm831x_pdata {
struct wm831x_status_pdata *status[WM831X_MAX_STATUS];
/** DCDC1 = 0 and so on */
struct regulator_init_data *dcdc[WM831X_MAX_DCDC];
+ const struct software_node *dcdc_swnodes[WM831X_MAX_DCDC];
/** EPE1 = 0 and so on */
struct regulator_init_data *epe[WM831X_MAX_EPE];
/** LDO1 = 0 and so on */
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 08/10] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (6 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 07/10] mfd: wm831x: support software nodes for DCDC regulators Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:32 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 09/10] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs " Dmitry Torokhov
` (2 subsequent siblings)
10 siblings, 1 reply; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches
Convert the PMIC DVS GPIO configuration from a legacy lookup table to
software properties. We use the new 'dcdc_swnodes' field in 'struct
wm831x_pdata' to pass the software node to the regulator driver.
We keep the DVS configuration parameters (control source, startup
state) in the platform data.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/arm/mach-s3c/mach-crag6410.c | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
index 757c0f383ff1..1abf08fdb543 100644
--- a/arch/arm/mach-s3c/mach-crag6410.c
+++ b/arch/arm/mach-s3c/mach-crag6410.c
@@ -456,6 +456,17 @@ static struct pca953x_platform_data crag6410_pca_data = {
.irq_base = -1,
};
+static const struct property_entry crag_dcdc1_properties[] = {
+ PROPERTY_ENTRY_GPIO("dvs-gpios",
+ SAMSUNG_GPIO_NODE('K'), 0, GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node crag_dcdc1_swnode = {
+ .name = "wm831x-buckv-dcdc1",
+ .properties = crag_dcdc1_properties,
+};
+
/* VDDARM is controlled by DVS1 connected to GPK(0) */
static struct wm831x_buckv_pdata vddarm_pdata = {
.dvs_control_src = 1,
@@ -633,6 +644,9 @@ static struct wm831x_pdata crag_pmic_pdata = {
&vddint, /* DCDC2 */
&vddmem, /* DCDC3 */
},
+ .dcdc_swnodes = {
+ &crag_dcdc1_swnode,
+ },
.ldo = {
&vddsys, /* LDO1 */
@@ -656,24 +670,6 @@ static struct wm831x_pdata crag_pmic_pdata = {
.touch = &touch_pdata,
};
-/*
- * VDDARM is eventually ending up as a regulator hanging on the MFD cell device
- * "wm831x-buckv.1" spawn from drivers/mfd/wm831x-core.c.
- *
- * From the note on the platform data we can see that this is clearly DVS1
- * and assigned as dcdc1 resource to the MFD core which sets .id of the cell
- * spawning the DVS1 platform device to 1, then the cell platform device
- * name is calculated from 10*instance + id resulting in the device name
- * "wm831x-buckv.11"
- */
-static struct gpiod_lookup_table crag_pmic_gpiod_table = {
- .dev_id = "wm831x-buckv.11",
- .table = {
- GPIO_LOOKUP("GPIOK", 0, "dvs", GPIO_ACTIVE_HIGH),
- { },
- },
-};
-
static struct i2c_board_info i2c_devs0[] = {
{ I2C_BOARD_INFO("24c08", 0x50), },
{ I2C_BOARD_INFO("tca6408", 0x20),
@@ -931,7 +927,7 @@ static void __init crag6410_machine_init(void)
s3c_fb_set_platdata(&crag6410_lcd_pdata);
dwc2_hsotg_set_platdata(&crag6410_hsotg_pdata);
- gpiod_add_lookup_table(&crag_pmic_gpiod_table);
+ software_node_register(&crag_dcdc1_swnode);
i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
gpiod_add_lookup_table(&crag_wm1250_ev1_gpiod_table);
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 09/10] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs to software properties
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (7 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 08/10] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 10/10] ARM: s3c: crag6410: convert remaining GPIO lookup tables to property entries Dmitry Torokhov
2026-07-12 12:30 ` [PATCH v3 00/10] Remove support for platform data from samsung keypad Krzysztof Kozlowski
10 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Bartosz Golaszewski
Convert the basic-mmio-gpio device and the GPIO-controlled LEDs on the
Cragganmore 6410 board to use software nodes/properties. This allows
removing the crag_leds_table GPIO lookup table.
Assisted-by: Antigravity:gemini-3.5-flash
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/arm/mach-s3c/mach-crag6410.c | 117 +++++++++++++++++++++-----------------
1 file changed, 64 insertions(+), 53 deletions(-)
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
index 1abf08fdb543..1ba3d47d85b7 100644
--- a/arch/arm/mach-s3c/mach-crag6410.c
+++ b/arch/arm/mach-s3c/mach-crag6410.c
@@ -319,12 +319,17 @@ static const struct property_entry crag6410_mmgpio_props[] = {
{ }
};
+static const struct software_node crag6410_mmgpio_node = {
+ .name = "basic-mmio-gpio",
+ .properties = crag6410_mmgpio_props,
+};
+
static struct platform_device_info crag6410_mmgpio_devinfo = {
.name = "basic-mmio-gpio",
.id = -1,
.res = crag6410_mmgpio_resource,
.num_res = ARRAY_SIZE(crag6410_mmgpio_resource),
- .properties = crag6410_mmgpio_props,
+ .swnode = &crag6410_mmgpio_node,
};
static struct platform_device speyside_device = {
@@ -835,61 +840,68 @@ static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
.host_caps = MMC_CAP_POWER_OFF_CARD,
};
-static const struct gpio_led gpio_leds[] = {
- {
- .name = "d13:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d14:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d15:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d16:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d17:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d18:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d19:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d20:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
+static const struct software_node crag6410_leds_node = {
+ .name = "leds-gpio",
};
-static struct gpiod_lookup_table crag_leds_table = {
- .dev_id = "leds-gpio",
- .table = {
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 0, "cs", 0, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 1, "cs", 1, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 2, "cs", 2, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 3, "cs", 3, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 4, "cs", 4, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 5, "cs", 5, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 6, "cs", 6, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 7, "cs", 7, GPIO_ACTIVE_LOW),
- { },
- },
-};
+#define CRAG6410_LED_NODE(_idx, _name) \
+static const struct property_entry crag6410_led##_idx##_props[] = { \
+ PROPERTY_ENTRY_STRING("label", _name), \
+ PROPERTY_ENTRY_GPIO("gpios", &crag6410_mmgpio_node, \
+ _idx, GPIO_ACTIVE_LOW), \
+ PROPERTY_ENTRY_STRING("default-state", "on"), \
+ { } \
+}; \
+static const struct software_node crag6410_led##_idx##_node = { \
+ .parent = &crag6410_leds_node, \
+ .properties = crag6410_led##_idx##_props, \
+}
-static const struct gpio_led_platform_data gpio_leds_pdata = {
- .leds = gpio_leds,
- .num_leds = ARRAY_SIZE(gpio_leds),
+CRAG6410_LED_NODE(0, "d13:green:");
+CRAG6410_LED_NODE(1, "d14:green:");
+CRAG6410_LED_NODE(2, "d15:green:");
+CRAG6410_LED_NODE(3, "d16:green:");
+CRAG6410_LED_NODE(4, "d17:green:");
+CRAG6410_LED_NODE(5, "d18:green:");
+CRAG6410_LED_NODE(6, "d19:green:");
+CRAG6410_LED_NODE(7, "d20:green:");
+
+static const struct software_node *crag6410_leds_swnodes[] = {
+ &crag6410_leds_node,
+ &crag6410_led0_node,
+ &crag6410_led1_node,
+ &crag6410_led2_node,
+ &crag6410_led3_node,
+ &crag6410_led4_node,
+ &crag6410_led5_node,
+ &crag6410_led6_node,
+ &crag6410_led7_node,
+ NULL
};
+static void __init crag6410_setup_leds(void)
+{
+ struct platform_device_info leds_info = {
+ .name = "leds-gpio",
+ .id = PLATFORM_DEVID_NONE,
+ };
+ struct platform_device *pd;
+ int err;
+
+ err = software_node_register_node_group(crag6410_leds_swnodes);
+ if (err) {
+ pr_err("failed to register leds software nodes: %d\n", err);
+ return;
+ }
+
+ leds_info.fwnode = software_node_fwnode(&crag6410_leds_node);
+
+ pd = platform_device_register_full(&leds_info);
+ err = PTR_ERR_OR_ZERO(pd);
+ if (err)
+ pr_err("failed to create leds-gpio device: %d\n", err);
+}
+
static struct dwc2_hsotg_plat crag6410_hsotg_pdata;
static struct gpiod_lookup_table crag_spi0_gpiod_table = {
@@ -939,12 +951,11 @@ static void __init crag6410_machine_init(void)
platform_add_devices(crag6410_devs0, ARRAY_SIZE(crag6410_devs0));
platform_device_register_full(&crag6410_mmgpio_devinfo);
- gpiod_add_lookup_table(&crag_leds_table);
crag6410_setup_keypad();
crag6410_setup_gpio_keys();
platform_add_devices(crag6410_devs1, ARRAY_SIZE(crag6410_devs1));
- gpio_led_register_device(-1, &gpio_leds_pdata);
+ crag6410_setup_leds();
regulator_has_full_constraints();
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v3 10/10] ARM: s3c: crag6410: convert remaining GPIO lookup tables to property entries
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (8 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 09/10] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs " Dmitry Torokhov
@ 2026-07-12 2:12 ` Dmitry Torokhov
2026-07-12 12:30 ` [PATCH v3 00/10] Remove support for platform data from samsung keypad Krzysztof Kozlowski
10 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2026-07-12 2:12 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski
Cc: Krzysztof Kozlowski, linux-input, devicetree, linux-kernel,
linux-arm-kernel, linux-samsung-soc, patches, Bartosz Golaszewski
Static property entries support defining GPIOs and are more similar to
device tree properties and are not prone to losing link between device
and a lookup table because of changes in device name. Convert the board
to use them for WM1250 and SPI0 devices.
This also fixes issue with recent conversion to GPIO descriptors
where GPIO lookup tables were specifying incorrect GPIO chip name
("GPIO<N>" vs "GP<N>").
Fixes: 10a366f36e2a ("ASoC: wm1250-ev1: Convert to GPIO descriptors")
Fixes: a45cf3cc72dd ("spi: s3c64xx: Convert to use GPIO descriptors")
Assisted-by: Antigravity:gemini-3.5-flash
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/arm/mach-s3c/devs.c | 35 -----------------
arch/arm/mach-s3c/devs.h | 1 -
arch/arm/mach-s3c/mach-crag6410.c | 83 ++++++++++++++++++++++++++++-----------
3 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/arch/arm/mach-s3c/devs.c b/arch/arm/mach-s3c/devs.c
index 0237307b9238..d1125316043b 100644
--- a/arch/arm/mach-s3c/devs.c
+++ b/arch/arm/mach-s3c/devs.c
@@ -335,38 +335,3 @@ void __init dwc2_hsotg_set_platdata(struct dwc2_hsotg_plat *pd)
npd->phy_exit = s3c_usb_phy_exit;
}
#endif /* CONFIG_S3C_DEV_USB_HSOTG */
-
-#ifdef CONFIG_S3C64XX_DEV_SPI0
-static struct resource s3c64xx_spi0_resource[] = {
- [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
- [1] = DEFINE_RES_IRQ(IRQ_SPI0),
-};
-
-struct platform_device s3c64xx_device_spi0 = {
- .name = "s3c6410-spi",
- .id = 0,
- .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
- .resource = s3c64xx_spi0_resource,
- .dev = {
- .dma_mask = &samsung_device_dma_mask,
- .coherent_dma_mask = DMA_BIT_MASK(32),
- },
-};
-
-void __init s3c64xx_spi0_set_platdata(int src_clk_nr, int num_cs)
-{
- struct s3c64xx_spi_info pd;
-
- /* Reject invalid configuration */
- if (!num_cs || src_clk_nr < 0) {
- pr_err("%s: Invalid SPI configuration\n", __func__);
- return;
- }
-
- pd.num_cs = num_cs;
- pd.src_clk_nr = src_clk_nr;
- pd.cfg_gpio = s3c64xx_spi0_cfg_gpio;
-
- s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
-}
-#endif /* CONFIG_S3C64XX_DEV_SPI0 */
diff --git a/arch/arm/mach-s3c/devs.h b/arch/arm/mach-s3c/devs.h
index 2737990063b1..90a86ade3570 100644
--- a/arch/arm/mach-s3c/devs.h
+++ b/arch/arm/mach-s3c/devs.h
@@ -27,7 +27,6 @@ extern struct platform_device *s3c24xx_uart_src[];
extern struct platform_device s3c64xx_device_iis0;
extern struct platform_device s3c64xx_device_iis1;
-extern struct platform_device s3c64xx_device_spi0;
extern struct platform_device s3c_device_fb;
extern struct platform_device s3c_device_hsmmc0;
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
index 1ba3d47d85b7..9f4756898a78 100644
--- a/arch/arm/mach-s3c/mach-crag6410.c
+++ b/arch/arm/mach-s3c/mach-crag6410.c
@@ -443,7 +443,6 @@ static struct platform_device *crag6410_devs0[] __initdata = {
static struct platform_device *crag6410_devs1[] __initdata = {
&crag6410_dm9k_device,
- &s3c64xx_device_spi0,
&crag6410_lcd_powerdev,
&crag6410_backlight_device,
&speyside_device,
@@ -777,17 +776,22 @@ static struct wm831x_pdata glenfarclas_pmic_pdata = {
.disable_touch = true,
};
-static struct gpiod_lookup_table crag_wm1250_ev1_gpiod_table = {
- /* The WM1250-EV1 is device 0027 on I2C bus 1 */
- .dev_id = "1-0027",
- .table = {
- GPIO_LOOKUP("GPION", 12, "clk-ena", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("GPIOL", 12, "clk-sel0", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("GPIOL", 13, "clk-sel1", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("GPIOL", 14, "osr", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("GPIOL", 8, "master", GPIO_ACTIVE_HIGH),
- { },
- },
+static const struct property_entry crag_wm1250_ev1_properties[] = {
+ PROPERTY_ENTRY_GPIO("clk-ena-gpios",
+ SAMSUNG_GPIO_NODE('N'), 12, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("clk-sel0-gpios",
+ SAMSUNG_GPIO_NODE('L'), 12, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("clk-sel1-gpios",
+ SAMSUNG_GPIO_NODE('L'), 13, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("osr-gpios",
+ SAMSUNG_GPIO_NODE('L'), 14, GPIO_ACTIVE_HIGH),
+ PROPERTY_ENTRY_GPIO("master-gpios",
+ SAMSUNG_GPIO_NODE('L'), 8, GPIO_ACTIVE_HIGH),
+ { }
+};
+
+static const struct software_node crag_wm1250_ev1_swnode = {
+ .properties = crag_wm1250_ev1_properties,
};
static struct i2c_board_info i2c_devs1[] = {
@@ -800,7 +804,8 @@ static struct i2c_board_info i2c_devs1[] = {
{ I2C_BOARD_INFO("wlf-gf-module", 0x24) },
{ I2C_BOARD_INFO("wlf-gf-module", 0x25) },
{ I2C_BOARD_INFO("wlf-gf-module", 0x26) },
- { I2C_BOARD_INFO("wm1250-ev1", 0x27), },
+ { I2C_BOARD_INFO("wm1250-ev1", 0x27),
+ .swnode = &crag_wm1250_ev1_swnode, },
};
static struct s3c2410_platform_i2c i2c1_pdata = {
@@ -904,15 +909,48 @@ static void __init crag6410_setup_leds(void)
static struct dwc2_hsotg_plat crag6410_hsotg_pdata;
-static struct gpiod_lookup_table crag_spi0_gpiod_table = {
- .dev_id = "s3c6410-spi.0",
- .table = {
- GPIO_LOOKUP_IDX("GPIOC", 3, "cs", 0, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("GPION", 5, "cs", 1, GPIO_ACTIVE_LOW),
- { },
- },
+static const struct software_node_ref_args crag6410_spi0_gpio_refs[] = {
+ SOFTWARE_NODE_REFERENCE(SAMSUNG_GPIO_NODE('C'), 3, GPIO_ACTIVE_LOW),
+ SOFTWARE_NODE_REFERENCE(SAMSUNG_GPIO_NODE('N'), 5, GPIO_ACTIVE_LOW),
+};
+
+static const struct property_entry crag6410_spi0_properties[] __initconst = {
+ PROPERTY_ENTRY_REF_ARRAY("cs-gpios", crag6410_spi0_gpio_refs),
+ { }
+};
+
+static const struct resource crag6410_spi0_resource[] __initconst = {
+ [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
+ [1] = DEFINE_RES_IRQ(IRQ_SPI0),
+};
+
+static const struct s3c64xx_spi_info crag6410_spi0_platform_data __initconst = {
+ .num_cs = 2,
+ .cfg_gpio = s3c64xx_spi0_cfg_gpio,
};
+static const struct platform_device_info crag6410_spi0_info __initconst = {
+ .name = "s3c6410-spi",
+ .id = 0,
+ .res = crag6410_spi0_resource,
+ .num_res = ARRAY_SIZE(crag6410_spi0_resource),
+ .data = &crag6410_spi0_platform_data,
+ .size_data = sizeof(crag6410_spi0_platform_data),
+ .dma_mask = DMA_BIT_MASK(32),
+ .properties = crag6410_spi0_properties,
+};
+
+static void __init crag6410_setup_spi0(void)
+{
+ struct platform_device *pd;
+ int err;
+
+ pd = platform_device_register_full(&crag6410_spi0_info);
+ err = PTR_ERR_OR_ZERO(pd);
+ if (err)
+ pr_err("failed to create spi0 device: %d\n", err);
+}
+
static void __init crag6410_machine_init(void)
{
/* Open drain IRQs need pullups */
@@ -941,18 +979,15 @@ static void __init crag6410_machine_init(void)
software_node_register(&crag_dcdc1_swnode);
i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
- gpiod_add_lookup_table(&crag_wm1250_ev1_gpiod_table);
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
- gpiod_add_lookup_table(&crag_spi0_gpiod_table);
- s3c64xx_spi0_set_platdata(0, 2);
-
pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
platform_add_devices(crag6410_devs0, ARRAY_SIZE(crag6410_devs0));
platform_device_register_full(&crag6410_mmgpio_devinfo);
crag6410_setup_keypad();
crag6410_setup_gpio_keys();
+ crag6410_setup_spi0();
platform_add_devices(crag6410_devs1, ARRAY_SIZE(crag6410_devs1));
crag6410_setup_leds();
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v3 07/10] mfd: wm831x: support software nodes for DCDC regulators
2026-07-12 2:12 ` [PATCH v3 07/10] mfd: wm831x: support software nodes for DCDC regulators Dmitry Torokhov
@ 2026-07-12 2:20 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-07-12 2:20 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: conor+dt, robh, dmitry.torokhov, linux-input, devicetree
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The patch dynamically duplicates and modifies an `mfd_cell` array to inject software nodes, directly violating MFD subsystem guidelines.
- [Low] The commit message description starts with a lowercase letter, violating MFD subsystem formatting rules.
--
--- Patch [7]: [PATCH v3 07/10] mfd: wm831x: support software nodes for DCDC regulators ---
commit 3d69bbb3a9fcf1555157438b7a85ed2a2744e94b
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
mfd: wm831x: support software nodes for DCDC regulators
This commit allows passing software nodes to wm831x DCDC regulators via PMIC
platform data. It adds dcdc_swnodes to the PMIC platform data and dynamically
assigns these software nodes to the buckv cells during device addition.
> mfd: wm831x: support software nodes for DCDC regulators
[Severity: Low]
This isn't a bug, but should the description after the subsystem prefix be
capitalized? The MFD subsystem conventions generally expect:
"mfd: wm831x: Support software nodes for DCDC regulators".
> diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
> --- a/drivers/mfd/wm831x-core.c
> +++ b/drivers/mfd/wm831x-core.c
[ ... ]
> @@ -1449,6 +1450,32 @@ const struct of_device_id wm831x_of_match[] = {
> };
> EXPORT_SYMBOL_GPL(wm831x_of_match);
>
> +static int wm831x_add_devices(struct wm831x *wm831x, int wm831x_num,
> + const struct mfd_cell *cells, int num_cells)
> +{
> + struct wm831x_pdata *pdata = &wm831x->pdata;
> + int i;
> +
> + struct mfd_cell *local_cells __free(kfree) =
> + kmemdup_array(cells, num_cells, sizeof(*cells), GFP_KERNEL);
[Severity: Medium]
Does this code dynamically duplicate the mfd_cell array to amend it?
The MFD subsystem guidelines advise that mfd_cell arrays should remain static
references, and we should avoid creating local copies for dynamic amendments.
Is there an alternative way to pass the software nodes without allocating and
modifying a duplicated cell array?
> + if (!local_cells)
> + return -ENOMEM;
> +
> + for (i = 0; i < num_cells; i++) {
> + struct mfd_cell *cell = &local_cells[i];
> +
> + if (strcmp(cell->name, "wm831x-buckv") == 0) {
> + int id = cell->id - 1;
> +
> + if (id >= 0 && id < WM831X_MAX_DCDC)
> + cell->swnode = pdata->dcdc_swnodes[id];
> + }
> + }
> +
> + return mfd_add_devices(wm831x->dev, wm831x_num, local_cells, num_cells,
> + NULL, 0, NULL);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711-samsung-kp-v3-0-b2fcaba77aff@gmail.com?part=7
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 06/10] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys
2026-07-12 2:12 ` [PATCH v3 06/10] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys Dmitry Torokhov
@ 2026-07-12 2:21 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-07-12 2:21 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, dmitry.torokhov, devicetree, conor+dt, robh
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The conversion to software nodes implicitly changes the default debounce interval for the keys from 0ms to 5ms.
--
--- Patch [6]: [PATCH v3 06/10] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys ---
commit 69f758b0d4bf8ffd63c5e52869f8e01a5ad69545
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys
This commit switches the gpio-keys device on crag6410 to use software
nodes and properties instead of platform data. This prepares the gpio-keys
driver for the removal of legacy platform data support.
> diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
> --- a/arch/arm/mach-s3c/mach-crag6410.c
> +++ b/arch/arm/mach-s3c/mach-crag6410.c
[ ... ]
> -static struct gpio_keys_button crag6410_gpio_keys[] = {
> - [0] = {
> - .code = KEY_SUSPEND,
> - .gpio = S3C64XX_GPL(10), /* EINT 18 */
> - .type = EV_KEY,
> - .wakeup = 1,
> - .active_low = 1,
> - },
> - [1] = {
> - .code = SW_FRONT_PROXIMITY,
> - .gpio = S3C64XX_GPN(11), /* EINT 11 */
> - .type = EV_SW,
> - },
> -};
[ ... ]
> +static const struct property_entry crag6410_suspend_key_props[] = {
> + PROPERTY_ENTRY_U32("linux,code", KEY_SUSPEND),
> + PROPERTY_ENTRY_GPIO("gpios",
> + SAMSUNG_GPIO_NODE('L'), 10, /* EINT 18 */
> + GPIO_ACTIVE_LOW),
> + PROPERTY_ENTRY_BOOL("wakeup-source"),
> + { }
> +};
[Severity: Low]
Does this conversion implicitly change the debounce interval?
In the old platform data, the debounce interval defaulted to 0 since the
struct field was zero-initialized. By not specifying a "debounce-interval"
property here, won't the gpio-keys fwnode parser apply a 5ms default to this
key?
> +
> +static const struct software_node crag6410_suspend_key_node = {
> + .parent = &crag6410_gpio_keys_node,
> + .properties = crag6410_suspend_key_props,
> +};
> +
> +static const struct property_entry crag6410_prox_sw_props[] = {
> + PROPERTY_ENTRY_U32("linux,input-type", EV_SW),
> + PROPERTY_ENTRY_U32("linux,code", SW_FRONT_PROXIMITY),
> + PROPERTY_ENTRY_GPIO("gpios",
> + SAMSUNG_GPIO_NODE('N'), 11, /* EINT 11 */
> + GPIO_ACTIVE_HIGH),
> + { }
> +};
[Severity: Low]
Similarly, does the proximity switch also unintentionally receive a 5ms
debounce interval because the property is omitted here?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711-samsung-kp-v3-0-b2fcaba77aff@gmail.com?part=6
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 05/10] Input: samsung-keypad - remove support for platform data
2026-07-12 2:12 ` [PATCH v3 05/10] Input: samsung-keypad - remove support for platform data Dmitry Torokhov
@ 2026-07-12 2:22 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-07-12 2:22 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: devicetree, conor+dt, linux-input, robh, dmitry.torokhov
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Premature IRQ enablement leads to unclocked hardware access and kernel panic.
--
--- Patch [5]: [PATCH v3 05/10] Input: samsung-keypad - remove support for platform data ---
commit 66287716c4c767b7655e9d4647ac5fd73fc2b713
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: samsung-keypad - remove support for platform data
This commit removes platform data support from the samsung-keypad driver,
as there are no remaining users in the kernel. The driver now relies entirely
on generic device properties for configuration.
> diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
> index cc34f0146161e..e54b3b9f2cf2e 100644
> --- a/drivers/input/keyboard/samsung-keypad.c
> +++ b/drivers/input/keyboard/samsung-keypad.c
[ ... ]
> @@ -424,7 +388,11 @@ static int samsung_keypad_probe(struct platform_device *pdev)
> return error;
> }
>
> - device_init_wakeup(&pdev->dev, pdata->wakeup);
> + wakeup = device_property_read_bool(dev, "wakeup-source") ||
> + /* legacy name */
> + device_property_read_bool(dev, "linux,input-wakeup");
> + device_init_wakeup(&pdev->dev, wakeup);
> +
> platform_set_drvdata(pdev, keypad);
>
> error = devm_pm_runtime_enable(&pdev->dev);
[Severity: High]
This is a pre-existing issue, but I noticed that the IRQ is requested
and unmasked before runtime PM is enabled.
In samsung_keypad_probe(), devm_request_threaded_irq() is called just before
this point without IRQF_NO_AUTOEN. If a pending interrupt is left by the
bootloader or a spurious interrupt occurs, it will fire immediately.
When samsung_keypad_irq() executes, it calls pm_runtime_get_sync() (which
skips enabling the clock because keypad->stopped is true at probe time) and
then accesses hardware registers:
drivers/input/keyboard/samsung-keypad.c:samsung_keypad_irq() {
...
do {
readl(keypad->base + SAMSUNG_KEYIFSTSCLR);
...
}
Can this unconditional access to unclocked peripheral registers trigger a
synchronous external abort and result in a kernel panic?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711-samsung-kp-v3-0-b2fcaba77aff@gmail.com?part=5
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding
2026-07-12 2:12 ` [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding Dmitry Torokhov
@ 2026-07-12 2:22 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-07-12 2:22 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: dmitry.torokhov, conor+dt, linux-input, robh, devicetree
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly introduced compact DT binding is completely unsupported by the driver, leading to guaranteed probe failure.
--
--- Patch [1]: [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding ---
commit c3ae19e70e1090e5ebc5290a0659633378fd46d7
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding
This commit updates the samsung,s3c6410-keypad devicetree binding to support
the standard matrix keymap binding. It makes the legacy
samsung,keypad-num-columns and samsung,keypad-num-rows properties mutually
exclusive with the standard linux,keymap property.
> diff --git a/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml b/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml
> --- a/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml
> +++ b/Documentation/devicetree/bindings/input/samsung,s3c6410-keypad.yaml
[ ... ]
> @@ -81,12 +85,33 @@ patternProperties:
> - keypad,row
> - linux,code
>
> +dependencies:
> + linux,keymap: [ "keypad,num-columns", "keypad,num-rows" ]
> +
> required:
> - compatible
> - reg
> - interrupts
> - - samsung,keypad-num-columns
> - - samsung,keypad-num-rows
> +
> +allOf:
> + - $ref: input.yaml#
> + - $ref: matrix-keymap.yaml#
> + - if:
> + required:
> + - linux,keymap
> + then:
> + properties:
> + samsung,keypad-num-columns: false
> + samsung,keypad-num-rows: false
[Severity: Medium]
Will device trees using this new compact binding fail to probe?
The new binding explicitly forbids the samsung,keypad-num-columns and
samsung,keypad-num-rows properties when linux,keymap is used. However, the
current driver code in drivers/input/keyboard/samsung-keypad.c unconditionally
requires them:
drivers/input/keyboard/samsung-keypad.c:samsung_keypad_parse_dt() {
...
of_property_read_u32(np, "samsung,keypad-num-rows", &num_rows);
of_property_read_u32(np, "samsung,keypad-num-columns", &num_cols);
if (!num_rows || !num_cols) {
dev_err(dev, "number of keypad rows/columns not specified\n");
return ERR_PTR(-EINVAL);
}
...
}
This means a device tree written with the new compact binding format will
cause the keypad hardware probe to fail immediately with -EINVAL.
Additionally, if that check were bypassed, does the driver's current keymap
initialization conflict with the standard matrix keypad parsing?
drivers/input/keyboard/samsung-keypad.c:samsung_keypad_probe() {
...
error = matrix_keypad_build_keymap(keymap_data, NULL,
pdata->rows, pdata->cols,
keypad->keycodes, input_dev);
...
}
Because samsung_keypad_parse_dt() currently unconditionally allocates an
empty keymap_data structure, passing a non-null pointer here prevents
matrix_keypad_build_keymap() from falling back to parsing the linux,keymap
property directly from the device tree.
Are there corresponding driver updates planned to support these new
properties alongside this binding change?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711-samsung-kp-v3-0-b2fcaba77aff@gmail.com?part=1
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 02/10] Input: samsung-keypad - handle compact binding
2026-07-12 2:12 ` [PATCH v3 02/10] Input: samsung-keypad - handle " Dmitry Torokhov
@ 2026-07-12 2:24 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-07-12 2:24 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: conor+dt, linux-input, dmitry.torokhov, devicetree, robh
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] IRQ handler is requested before runtime PM is enabled, leading to potential bus faults.
- [High] Uninitialized stack variables `row`, `col`, and `key_code` leak kernel stack memory and can cause out-of-bounds array access.
- [Medium] Time-of-Check to Time-of-Use (TOCTOU) race condition when parsing child nodes causes heap buffer overflow.
--
--- Patch [2]: [PATCH v3 02/10] Input: samsung-keypad - handle compact binding ---
commit df7d9c0ab9ce4671eb0b2980bb819cb1ac325753
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Input: samsung-keypad - handle compact binding
Add support for standard matrix keymap binding (in addition to the
existing verbose binding with a sub-node for each key). This will
allow easier conversions from platform data to device properties when
using static device properties.
> diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
> index 17127269e3f05..cc34f0146161e 100644
> --- a/drivers/input/keyboard/samsung-keypad.c
> +++ b/drivers/input/keyboard/samsung-keypad.c
> @@ -231,83 +231,89 @@ static void samsung_keypad_close(struct input_dev *input_dev)
> samsung_keypad_stop(keypad);
> }
>
> -#ifdef CONFIG_OF
> -static struct samsung_keypad_platdata *
> -samsung_keypad_parse_dt(struct device *dev)
[ ... ]
> +static const struct matrix_keymap_data *
> +samsung_parse_verbose_keymap(struct device *dev)
> +{
> + struct matrix_keymap_data *keymap_data;
> + struct fwnode_handle *child;
> + u32 *keymap;
> + unsigned int key_count;
> +
> + keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL);
> + if (!keymap_data)
> + return ERR_PTR(-ENOMEM);
> +
> + key_count = device_get_child_node_count(dev);
> + keymap = devm_kcalloc(dev, key_count, sizeof(*keymap), GFP_KERNEL);
> + if (!keymap)
> + return ERR_PTR(-ENOMEM);
> +
> + keymap_data->keymap_size = key_count;
> + keymap_data->keymap = keymap;
> +
> + device_for_each_child_node(dev, child) {
> + u32 row, col, key_code;
> +
> + fwnode_property_read_u32(child, "keypad,row", &row);
> + fwnode_property_read_u32(child, "keypad,column", &col);
> + fwnode_property_read_u32(child, "linux,code", &key_code);
> +
> + *keymap++ = KEY(row, col, key_code);
[Severity: Medium]
This is a pre-existing issue, but could this loop overflow the allocated
keymap array?
The array size is determined earlier:
key_count = device_get_child_node_count(dev);
keymap = devm_kcalloc(dev, key_count, sizeof(*keymap), GFP_KERNEL);
Because there is no synchronization explicitly held, if a concurrent device
tree overlay adds a child node to the keypad between the count and the
iteration here in device_for_each_child_node(), could the loop execute more
times than allocated and cause an out-of-bounds heap write?
[Severity: High]
This isn't a bug introduced by this patch, but what happens if the device
tree child node is missing properties?
If fwnode_property_read_u32() fails for "keypad,row", "keypad,column", or
"linux,code", it leaves the output variables uninitialized.
Since the return values are ignored, the uninitialized stack variables row,
col, and key_code are passed into the KEY() macro and written to the keymap.
Could this leak kernel stack memory to userspace via the EVIOCGKEYCODE ioctl,
or create incorrect key mappings?
> }
>
> + return keymap_data;
> +}
[ ... ]
> @@ -430,11 +435,14 @@ static int samsung_keypad_probe(struct platform_device *pdev)
> if (error)
> return error;
>
> - if (pdev->dev.of_node) {
> - devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
> - devm_kfree(&pdev->dev, (void *)pdata->keymap_data);
> + if (!dev_get_platdata(&pdev->dev)) {
> + if (pdata->keymap_data) {
> + devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
> + devm_kfree(&pdev->dev, (void *)pdata->keymap_data);
> + }
> devm_kfree(&pdev->dev, (void *)pdata);
> }
> +
[Severity: High]
This is a pre-existing issue, but could the IRQ handler run before runtime PM
is enabled?
In samsung_keypad_probe(), devm_request_threaded_irq() is called to unmask
the IRQ before devm_pm_runtime_enable() is called:
error = devm_request_threaded_irq(&pdev->dev, keypad->irq, NULL,
samsung_keypad_irq, IRQF_ONESHOT,
dev_name(&pdev->dev), keypad);
[ ... ]
error = devm_pm_runtime_enable(&pdev->dev);
If an interrupt is pending (for example, left over from the bootloader),
samsung_keypad_irq() could fire immediately. The handler calls
pm_runtime_get_sync(), which would return -EACCES because runtime PM is not
yet enabled.
If the handler then reads from keypad->base with a disabled clock, could
this cause a bus fault?
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711-samsung-kp-v3-0-b2fcaba77aff@gmail.com?part=2
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 03/10] ARM: s3c: register and attach software nodes for Samsung gpio_chips
2026-07-12 2:12 ` [PATCH v3 03/10] ARM: s3c: register and attach software nodes for Samsung gpio_chips Dmitry Torokhov
@ 2026-07-12 2:24 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-07-12 2:24 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: conor+dt, robh, linux-input, devicetree, dmitry.torokhov
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The 4-bit and 4-bit2 GPIO direction configuration functions perform read-modify-write operations on shared configuration registers without holding the chip's spinlock, leading to race conditions.
--
--- Patch [3]: [PATCH v3 03/10] ARM: s3c: register and attach software nodes for Samsung gpio_chips ---
commit 8053fb79cb15e3c5c2e66691008b5adc30b3e152
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
ARM: s3c: register and attach software nodes for Samsung gpio_chips
This commit defines and registers software nodes for the Samsung GPIO chips on
legacy platforms. It attaches the matching software node to each gpio_chip's
fwnode during registration, providing the infrastructure to convert board files
and drivers to use software nodes instead of legacy platform data.
> diff --git a/arch/arm/mach-s3c/gpio-samsung.c b/arch/arm/mach-s3c/gpio-samsung.c
> --- a/arch/arm/mach-s3c/gpio-samsung.c
> +++ b/arch/arm/mach-s3c/gpio-samsung.c
[ ... ]
> @@ -659,49 +695,49 @@ static struct samsung_gpio_chip s3c64xx_gpios_4bit[] = {
> .chip = {
> .base = S3C64XX_GPA(0),
> .ngpio = S3C64XX_GPIO_A_NR,
> - .label = "GPA",
> },
> + .swnode = SAMSUNG_GPIO_NODE('A'),
[Severity: High]
This is a pre-existing issue, but since we are updating the 4-bit GPIO chip
registrations here, should the underlying 4-bit configuration functions be
updated to use the chip->lock?
Currently, functions like samsung_gpiolib_4bit_input() perform
read-modify-write operations on shared configuration registers without locking:
samsung_gpiolib_4bit_input() {
...
con = __raw_readl(base + GPIOCON_OFF);
if (ourchip->bitmap_gpio_int & BIT(offset))
con |= 0xf << con_4bit_shift(offset);
else
con &= ~(0xf << con_4bit_shift(offset));
__raw_writel(con, base + GPIOCON_OFF);
...
}
Similar unprotected read-modify-write sequences exist in
samsung_gpiolib_4bit_output() (for both GPIOCON and GPIODAT) and
samsung_gpiolib_4bit2_input().
If two threads concurrently attempt to change the direction of different
GPIO pins in the same bank, could this lead to lost or corrupted
configuration updates?
> }, {
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711-samsung-kp-v3-0-b2fcaba77aff@gmail.com?part=3
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 08/10] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties
2026-07-12 2:12 ` [PATCH v3 08/10] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties Dmitry Torokhov
@ 2026-07-12 2:32 ` sashiko-bot
0 siblings, 0 replies; 19+ messages in thread
From: sashiko-bot @ 2026-07-12 2:32 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: dmitry.torokhov, conor+dt, linux-input, devicetree, robh
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Dynamic amendment of mfd_cell array using kmemdup_array violates MFD guidelines.
--
--- Patch [8]: [PATCH v3 08/10] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties ---
commit 71a506655ae9f68a5ef7d764d51d6d48703e4dcb
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>
ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties
Convert the PMIC DVS GPIO configuration from a legacy lookup table to
software properties. We use the new 'dcdc_swnodes' field in 'struct
wm831x_pdata' to pass the software node to the regulator driver.
> diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
> index 757c0f383ff1e..1abf08fdb543c 100644
> --- a/arch/arm/mach-s3c/mach-crag6410.c
> +++ b/arch/arm/mach-s3c/mach-crag6410.c
[ ... ]
> @@ -633,6 +644,9 @@ static struct wm831x_pdata crag_pmic_pdata = {
> &vddint, /* DCDC2 */
> &vddmem, /* DCDC3 */
> },
> + .dcdc_swnodes = {
> + &crag_dcdc1_swnode,
> + },
[Severity: Medium]
Is it possible that populating the new 'dcdc_swnodes' field relies on the MFD
core dynamically allocating and amending the mfd_cell array at runtime?
Looking at wm831x_add_devices() in drivers/mfd/wm831x-core.c, passing
these software nodes causes the core driver to dynamically copy the cell
array to inject the pointers:
drivers/mfd/wm831x-core.c:wm831x_add_devices() {
...
struct mfd_cell *local_cells __free(kfree) =
kmemdup_array(cells, num_cells, sizeof(*cells), GFP_KERNEL);
...
}
The MFD subsystem guidelines explicitly state: "For mfd_cells, do not create
local copies for dynamic amendments; always use static references." Could this
approach be violating the subsystem's architectural rules against dynamic cell
amendments?
>
> .ldo = {
> &vddsys, /* LDO1 */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260711-samsung-kp-v3-0-b2fcaba77aff@gmail.com?part=8
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 00/10] Remove support for platform data from samsung keypad
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
` (9 preceding siblings ...)
2026-07-12 2:12 ` [PATCH v3 10/10] ARM: s3c: crag6410: convert remaining GPIO lookup tables to property entries Dmitry Torokhov
@ 2026-07-12 12:30 ` Krzysztof Kozlowski
10 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-12 12:30 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Griffin,
Alim Akhtar, Russell King, Mark Brown, Linus Walleij,
Charles Keepax, Sam Protsenko, Arnd Bergmann, Bartosz Golaszewski,
linux-input, devicetree, linux-kernel, linux-arm-kernel,
linux-samsung-soc, patches, Conor Dooley, Bartosz Golaszewski
On Sat, Jul 11, 2026 at 07:12:41PM -0700, Dmitry Torokhov wrote:
> Hi,
>
> This series converts the Samsung keypad driver and the Cragganmore 6410
> board to generic device properties, allowing the removal of legacy platform
> data and GPIO lookup tables.
>
> We rework the Samsung keypad driver to stop using platform data, utilizing
> a new compact matrix keypad binding. To support this on the Cragganmore
> board, we add infrastructure to associate software nodes with Samsung
> gpio_chips, and add software node propagation support to the wm831x MFD
> core to route DVS GPIO to the PMIC regulator.
>
> Finally, we convert all peripherals on the Cragganmore board (including
> keypad, GPIO keys, PMIC, WM1250, SPI0, basic-mmio-gpio, and LEDs) to
> software properties. This allows us to eliminate all legacy GPIO lookup
> tables and fixes incorrect GPIO chip names from previous conversions.
>
> Mark, it would be great if you could give this a spin on Cragganmore.
>
> The majority of changes are in arch/board code, with a couple of input
> matches and one for MFD. If everyone agrees maybe we can merge it all
> through the soc tree?
Yes, I could take it via samsung-soc. I assume I have your acks for
unput parts.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2026-07-12 12:30 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12 2:12 [PATCH v3 00/10] Remove support for platform data from samsung keypad Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 01/10] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding Dmitry Torokhov
2026-07-12 2:22 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 02/10] Input: samsung-keypad - handle " Dmitry Torokhov
2026-07-12 2:24 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 03/10] ARM: s3c: register and attach software nodes for Samsung gpio_chips Dmitry Torokhov
2026-07-12 2:24 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 04/10] ARM: s3c: crag6410: switch keypad device to software properties Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 05/10] Input: samsung-keypad - remove support for platform data Dmitry Torokhov
2026-07-12 2:22 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 06/10] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys Dmitry Torokhov
2026-07-12 2:21 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 07/10] mfd: wm831x: support software nodes for DCDC regulators Dmitry Torokhov
2026-07-12 2:20 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 08/10] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties Dmitry Torokhov
2026-07-12 2:32 ` sashiko-bot
2026-07-12 2:12 ` [PATCH v3 09/10] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs " Dmitry Torokhov
2026-07-12 2:12 ` [PATCH v3 10/10] ARM: s3c: crag6410: convert remaining GPIO lookup tables to property entries Dmitry Torokhov
2026-07-12 12:30 ` [PATCH v3 00/10] Remove support for platform data from samsung keypad Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox