[PATCH v3 2/4] mfd: timberdale: set up a software node for the GPIO cell

Bartosz Golaszewski
2026-03-27T10:49:25Z

Using generic device properties instead of custom platform data
structures is preferred due to the resulting unification of the way
properties are accessed in consumer drivers. There's no DT node for the
GPIO cell in this driver but we can create a software node with device
properties and attach it to all the GPIO cells.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/mfd/timberdale.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
index d79419215cc292b705031a6432e877b94f9a1805..0ab3da3d6818e2108694dcf73f32184a167b701a 100644
--- a/drivers/mfd/timberdale.c
+++ b/drivers/mfd/timberdale.c
@@ -38,6 +38,8 @@
#define DRIVER_NAME "timberdale"

#define GPIO_NR_PINS 16
+#define GPIO_BASE 0
+#define IRQ_BASE 200

struct timberdale_device {
resource_size_t ctl_mapbase;
@@ -183,6 +185,18 @@ static struct timbgpio_platform_data
.irq_base = 200,
};

+static const struct property_entry timberdale_gpio_properties[] = {
+ PROPERTY_ENTRY_U32("ngpios", GPIO_NR_PINS),
+ PROPERTY_ENTRY_U32("gpio-base", GPIO_BASE),
+ PROPERTY_ENTRY_U32("irq-base", IRQ_BASE),
+ { }
+};
+
+static const struct software_node timberdale_gpio_swnode = {
+ .name = "timb-gpio",
+ .properties = timberdale_gpio_properties,
+};
+
static const struct resource timberdale_gpio_resources[] = {
{
.start = GPIOOFFSET,
@@ -394,6 +408,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg0[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-video",
@@ -456,6 +471,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg1[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-mlogicore",
@@ -518,6 +534,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg2[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-video",
@@ -568,6 +585,7 @@ static const struct mfd_cell timberdale_cells_bar0_cfg3[] = {
.resources = timberdale_gpio_resources,
.platform_data = &timberdale_gpio_platform_data,
.pdata_size = sizeof(timberdale_gpio_platform_data),
+ .swnode = &timberdale_gpio_swnode,
},
{
.name = "timb-video",

--
2.47.3