mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 02:21:39 -04:00
ARM: sa1100: h3xxx: convert gpio-keys to use software nodes
Convert the legacy gpio-keys platform device on the StrongARM SA-1100 HP iPAQ H3xxx series boards to use software nodes and device properties. This helps progress the removal of platform data support from the gpio-keys driver. Define static software nodes for the gpio-keys device and the power and action button child nodes at file scope, referencing the SA-1100 GPIO controller node directly. In h3xxx_mach_init(), register the software node group and use platform_device_register_full() to register the device. Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20260706-sa1100-swnode-v1-4-332759bbd930@gmail.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
committed by
Arnd Bergmann
parent
d26a0f79ee
commit
ab1c3ab445
@@ -10,7 +10,10 @@
|
||||
#include <linux/gpio/machine.h>
|
||||
#include <linux/gpio/legacy.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/gpio/property.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/platform_data/gpio-htc-egpio.h>
|
||||
@@ -168,35 +171,48 @@ static struct platform_device h3xxx_egpio = {
|
||||
* GPIO keys
|
||||
*/
|
||||
|
||||
static struct gpio_keys_button h3xxx_button_table[] = {
|
||||
{
|
||||
.code = KEY_POWER,
|
||||
.gpio = H3XXX_GPIO_PWR_BUTTON,
|
||||
.desc = "Power Button",
|
||||
.active_low = 1,
|
||||
.type = EV_KEY,
|
||||
.wakeup = 1,
|
||||
}, {
|
||||
.code = KEY_ENTER,
|
||||
.gpio = H3XXX_GPIO_ACTION_BUTTON,
|
||||
.active_low = 1,
|
||||
.desc = "Action button",
|
||||
.type = EV_KEY,
|
||||
.wakeup = 0,
|
||||
},
|
||||
static const struct software_node h3xxx_gpio_keys_node = {
|
||||
.name = "h3xxx-gpio-keys",
|
||||
};
|
||||
|
||||
static struct gpio_keys_platform_data h3xxx_keys_data = {
|
||||
.buttons = h3xxx_button_table,
|
||||
.nbuttons = ARRAY_SIZE(h3xxx_button_table),
|
||||
static const struct property_entry h3xxx_power_key_props[] = {
|
||||
PROPERTY_ENTRY_U32("linux,code", KEY_POWER),
|
||||
PROPERTY_ENTRY_GPIO("gpios", &sa1100_gpiochip_node,
|
||||
H3XXX_GPIO_PWR_BUTTON, GPIO_ACTIVE_LOW),
|
||||
PROPERTY_ENTRY_STRING("label", "Power Button"),
|
||||
PROPERTY_ENTRY_BOOL("wakeup-source"),
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_device h3xxx_keys = {
|
||||
.name = "gpio-keys",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &h3xxx_keys_data,
|
||||
},
|
||||
static const struct software_node h3xxx_power_key_node = {
|
||||
.parent = &h3xxx_gpio_keys_node,
|
||||
.properties = h3xxx_power_key_props,
|
||||
};
|
||||
|
||||
static const struct property_entry h3xxx_action_key_props[] = {
|
||||
PROPERTY_ENTRY_U32("linux,code", KEY_ENTER),
|
||||
PROPERTY_ENTRY_GPIO("gpios", &sa1100_gpiochip_node,
|
||||
H3XXX_GPIO_ACTION_BUTTON, GPIO_ACTIVE_LOW),
|
||||
PROPERTY_ENTRY_STRING("label", "Action button"),
|
||||
{ }
|
||||
};
|
||||
|
||||
static const struct software_node h3xxx_action_key_node = {
|
||||
.parent = &h3xxx_gpio_keys_node,
|
||||
.properties = h3xxx_action_key_props,
|
||||
};
|
||||
|
||||
static const struct software_node * const h3xxx_gpio_keys_swnodes[] __initconst = {
|
||||
&h3xxx_gpio_keys_node,
|
||||
&h3xxx_power_key_node,
|
||||
&h3xxx_action_key_node,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const struct platform_device_info h3xxx_gpio_keys_dev_info __initconst = {
|
||||
.name = "gpio-keys",
|
||||
.id = PLATFORM_DEVID_NONE,
|
||||
.swnode = &h3xxx_gpio_keys_node,
|
||||
};
|
||||
|
||||
static struct resource h3xxx_micro_resources[] = {
|
||||
@@ -214,7 +230,6 @@ struct platform_device h3xxx_micro_asic = {
|
||||
|
||||
static struct platform_device *h3xxx_devices[] = {
|
||||
&h3xxx_egpio,
|
||||
&h3xxx_keys,
|
||||
&h3xxx_micro_asic,
|
||||
};
|
||||
|
||||
@@ -240,6 +255,8 @@ void __init h3xxx_mach_init(void)
|
||||
sa1100_register_uart_fns(&h3xxx_port_fns);
|
||||
sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
|
||||
platform_add_devices(h3xxx_devices, ARRAY_SIZE(h3xxx_devices));
|
||||
software_node_register_node_group(h3xxx_gpio_keys_swnodes);
|
||||
platform_device_register_full(&h3xxx_gpio_keys_dev_info);
|
||||
}
|
||||
|
||||
static struct map_desc h3600_io_desc[] __initdata = {
|
||||
|
||||
Reference in New Issue
Block a user