mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys
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> Link: https://patch.msgid.link/20260711-samsung-kp-v3-6-b2fcaba77aff@gmail.com Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
This commit is contained in:
parent
235cb99d39
commit
c67c110d14
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/input/matrix_keypad.h>
|
||||
#include <linux/gpio/legacy.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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user