Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ARM: spitz: Use software nodes/properties for the matrix keypad

Convert the Spitz to use software nodes and static properties to
describe GPIOs and other parameters of its matrix keypad.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240805014710.1961677-5-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+41 -23
+41 -23
arch/arm/mach-pxa/spitz.c
··· 378 378 KEY(6, 8, KEY_RIGHT), 379 379 }; 380 380 381 - static const struct matrix_keymap_data spitz_keymap_data = { 382 - .keymap = spitz_keymap, 383 - .keymap_size = ARRAY_SIZE(spitz_keymap), 381 + static const struct software_node_ref_args spitz_mkp_row_gpios[] = { 382 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 12, GPIO_ACTIVE_HIGH), 383 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 17, GPIO_ACTIVE_HIGH), 384 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 91, GPIO_ACTIVE_HIGH), 385 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 34, GPIO_ACTIVE_HIGH), 386 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 36, GPIO_ACTIVE_HIGH), 387 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 38, GPIO_ACTIVE_HIGH), 388 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 39, GPIO_ACTIVE_HIGH), 384 389 }; 385 390 386 - static const uint32_t spitz_row_gpios[] = 387 - { 12, 17, 91, 34, 36, 38, 39 }; 388 - static const uint32_t spitz_col_gpios[] = 389 - { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 }; 390 - 391 - static struct matrix_keypad_platform_data spitz_mkp_pdata = { 392 - .keymap_data = &spitz_keymap_data, 393 - .row_gpios = spitz_row_gpios, 394 - .col_gpios = spitz_col_gpios, 395 - .num_row_gpios = ARRAY_SIZE(spitz_row_gpios), 396 - .num_col_gpios = ARRAY_SIZE(spitz_col_gpios), 397 - .col_scan_delay_us = 10, 398 - .debounce_ms = 10, 399 - .wakeup = 1, 391 + static const struct software_node_ref_args spitz_mkp_col_gpios[] = { 392 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 88, GPIO_ACTIVE_HIGH), 393 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 23, GPIO_ACTIVE_HIGH), 394 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 24, GPIO_ACTIVE_HIGH), 395 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 25, GPIO_ACTIVE_HIGH), 396 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 26, GPIO_ACTIVE_HIGH), 397 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 27, GPIO_ACTIVE_HIGH), 398 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 52, GPIO_ACTIVE_HIGH), 399 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 103, GPIO_ACTIVE_HIGH), 400 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 107, GPIO_ACTIVE_HIGH), 401 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 108, GPIO_ACTIVE_HIGH), 402 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, 114, GPIO_ACTIVE_HIGH), 400 403 }; 401 404 402 - static struct platform_device spitz_mkp_device = { 405 + static const struct property_entry spitz_mkp_properties[] = { 406 + PROPERTY_ENTRY_ARRAY_U32("linux,keymap", spitz_keymap), 407 + PROPERTY_ENTRY_REF_ARRAY("row-gpios", spitz_mkp_row_gpios), 408 + PROPERTY_ENTRY_REF_ARRAY("col-gpios", spitz_mkp_col_gpios), 409 + PROPERTY_ENTRY_U32("col-scan-delay-us", 10), 410 + PROPERTY_ENTRY_U32("debounce-delay-ms", 10), 411 + PROPERTY_ENTRY_BOOL("wakeup-source"), 412 + { } 413 + }; 414 + 415 + static const struct platform_device_info spitz_mkp_info __initconst = { 403 416 .name = "matrix-keypad", 404 - .id = -1, 405 - .dev = { 406 - .platform_data = &spitz_mkp_pdata, 407 - }, 417 + .id = PLATFORM_DEVID_NONE, 418 + .properties = spitz_mkp_properties, 408 419 }; 420 + 409 421 410 422 static void __init spitz_mkp_init(void) 411 423 { 412 - platform_device_register(&spitz_mkp_device); 424 + struct platform_device *pd; 425 + int err; 426 + 427 + pd = platform_device_register_full(&spitz_mkp_info); 428 + err = PTR_ERR_OR_ZERO(pd); 429 + if (err) 430 + pr_err("failed to create keypad device: %d\n", err); 413 431 } 414 432 #else 415 433 static inline void spitz_mkp_init(void) {}