[PATCH RFT v2 4/6] ARM: omap1: ams-delta: use generic device properties for gpio-mmio

Janusz Krzysztofik jmkrzyszt at gmail.com
Wed Jul 2 10:31:18 PDT 2025


On Tuesday, 1 July 2025 13:49:38 CEST Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>
> 
> The two latch GPIO devices in ams-delta are registered with struct
> bgpio_pdata passed as platform_data to the gpio-mmio driver. We want to
> remove the bgpio_pdata from the kernel and the gpio-mmio driver is now
> also able to get the relevant values from the software node. Set up
> device properties and switch to using platform_device_info to register
> the devices as platform_add_devices() doesn't allow us to pass device
> properties to the driver model.
> 
> Reviewed-by: Linus Walleij <linus.walleij at linaro.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>

Acked-by: Janusz Krzysztofik <jmkrzyszt at gmail.com>

> ---
>  arch/arm/mach-omap1/board-ams-delta.c | 42 +++++++++++++++++------------------
>  1 file changed, 20 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
> index 0daf6c5b5c1cbcfd5bd15203cad119d39aa95f19..16392720296cd224732450c85419c35bbab506f6 100644
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -19,6 +19,7 @@
>  #include <linux/mtd/nand-gpio.h>
>  #include <linux/mtd/partitions.h>
>  #include <linux/platform_device.h>
> +#include <linux/property.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/regulator/fixed.h>
>  #include <linux/regulator/machine.h>
> @@ -175,20 +176,18 @@ static struct resource latch1_resources[] = {
>  
>  #define LATCH1_LABEL	"latch1"
>  
> -static struct bgpio_pdata latch1_pdata = {
> -	.label	= LATCH1_LABEL,
> -	.base	= -1,
> -	.ngpio	= LATCH1_NGPIO,
> +static const struct property_entry latch1_gpio_props[] = {
> +	PROPERTY_ENTRY_STRING("label", LATCH1_LABEL),
> +	PROPERTY_ENTRY_U32("ngpios", LATCH1_NGPIO),
> +	{ }
>  };
>  
> -static struct platform_device latch1_gpio_device = {
> +static const struct platform_device_info latch1_gpio_devinfo = {
>  	.name		= "basic-mmio-gpio",
>  	.id		= 0,
> -	.resource	= latch1_resources,
> -	.num_resources	= ARRAY_SIZE(latch1_resources),
> -	.dev		= {
> -		.platform_data	= &latch1_pdata,
> -	},
> +	.res		= latch1_resources,
> +	.num_res	= ARRAY_SIZE(latch1_resources),
> +	.properties	= latch1_gpio_props,
>  };
>  
>  #define LATCH1_PIN_LED_CAMERA		0
> @@ -213,20 +212,18 @@ static struct resource latch2_resources[] = {
>  
>  #define LATCH2_LABEL	"latch2"
>  
> -static struct bgpio_pdata latch2_pdata = {
> -	.label	= LATCH2_LABEL,
> -	.base	= -1,
> -	.ngpio	= LATCH2_NGPIO,
> +static const struct property_entry latch2_gpio_props[] = {
> +	PROPERTY_ENTRY_STRING("label", LATCH2_LABEL),
> +	PROPERTY_ENTRY_U32("ngpios", LATCH2_NGPIO),
> +	{ }
>  };
>  
> -static struct platform_device latch2_gpio_device = {
> +static struct platform_device_info latch2_gpio_devinfo = {
>  	.name		= "basic-mmio-gpio",
>  	.id		= 1,
> -	.resource	= latch2_resources,
> -	.num_resources	= ARRAY_SIZE(latch2_resources),
> -	.dev		= {
> -		.platform_data	= &latch2_pdata,
> -	},
> +	.res		= latch2_resources,
> +	.num_res	= ARRAY_SIZE(latch2_resources),
> +	.properties	= latch2_gpio_props,
>  };
>  
>  #define LATCH2_PIN_LCD_VBLEN		0
> @@ -542,8 +539,6 @@ static struct gpiod_lookup_table keybrd_pwr_gpio_table = {
>  };
>  
>  static struct platform_device *ams_delta_devices[] __initdata = {
> -	&latch1_gpio_device,
> -	&latch2_gpio_device,
>  	&ams_delta_kp_device,
>  	&ams_delta_audio_device,
>  	&ams_delta_serio_device,
> @@ -697,6 +692,9 @@ static void __init ams_delta_init(void)
>  	omap1_usb_init(&ams_delta_usb_config);
>  	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
>  
> +	platform_device_register_full(&latch1_gpio_devinfo);
> +	platform_device_register_full(&latch2_gpio_devinfo);
> +
>  	/*
>  	 * As soon as regulator consumers have been registered, assign their
>  	 * dev_names to consumer supply entries of respective regulators.
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250702/b07852fd/attachment.sig>


More information about the linux-arm-kernel mailing list