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 to describe audio GPIOs

Convert Spitz to use software nodes for specifying GPIOs for the audio
chip.

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

authored by

Dmitry Torokhov and committed by
Arnd Bergmann
9d91c7c3 224b9329

+43 -21
+43 -21
arch/arm/mach-pxa/spitz.c
··· 130 130 GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ 131 131 }; 132 132 133 + static const struct software_node spitz_scoop_1_gpiochip_node = { 134 + .name = "sharp-scoop.0", 135 + }; 136 + 137 + /* Only on Spitz */ 138 + static const struct software_node spitz_scoop_2_gpiochip_node = { 139 + .name = "sharp-scoop.1", 140 + }; 141 + 142 + /* Only on Akita */ 143 + static const struct software_node akita_max7310_gpiochip_node = { 144 + .name = "i2c-max7310", 145 + }; 146 + 133 147 /****************************************************************************** 134 148 * Scoop GPIO expander 135 149 ******************************************************************************/ ··· 964 950 static inline void spitz_i2c_init(void) {} 965 951 #endif 966 952 967 - static struct gpiod_lookup_table spitz_audio_gpio_table = { 968 - .dev_id = "spitz-audio", 969 - .table = { 970 - GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), 971 - GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), 972 - GPIO_LOOKUP("sharp-scoop.1", 8, "mic", GPIO_ACTIVE_HIGH), 973 - { }, 974 - }, 953 + static const struct property_entry spitz_audio_props[] = { 954 + PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3, 955 + GPIO_ACTIVE_HIGH), 956 + PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4, 957 + GPIO_ACTIVE_HIGH), 958 + PROPERTY_ENTRY_GPIO("mic-gpios", &spitz_scoop_2_gpiochip_node, 8, 959 + GPIO_ACTIVE_HIGH), 960 + { } 975 961 }; 976 962 977 - static struct gpiod_lookup_table akita_audio_gpio_table = { 978 - .dev_id = "spitz-audio", 979 - .table = { 980 - GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), 981 - GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), 982 - GPIO_LOOKUP("i2c-max7310", 2, "mic", GPIO_ACTIVE_HIGH), 983 - { }, 984 - }, 963 + static const struct property_entry akita_audio_props[] = { 964 + PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3, 965 + GPIO_ACTIVE_HIGH), 966 + PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4, 967 + GPIO_ACTIVE_HIGH), 968 + PROPERTY_ENTRY_GPIO("mic-gpios", &akita_max7310_gpiochip_node, 2, 969 + GPIO_ACTIVE_HIGH), 970 + { } 985 971 }; 986 972 987 973 /****************************************************************************** ··· 989 975 ******************************************************************************/ 990 976 static inline void spitz_audio_init(void) 991 977 { 992 - if (machine_is_akita()) 993 - gpiod_add_lookup_table(&akita_audio_gpio_table); 994 - else 995 - gpiod_add_lookup_table(&spitz_audio_gpio_table); 978 + struct platform_device_info audio_info = { 979 + .name = "spitz-audio", 980 + .id = PLATFORM_DEVID_NONE, 981 + .properties = machine_is_akita() ? 982 + akita_audio_props : spitz_audio_props, 983 + }; 996 984 997 - platform_device_register_simple("spitz-audio", -1, NULL, 0); 985 + platform_device_register_full(&audio_info); 998 986 } 999 987 1000 988 /****************************************************************************** ··· 1019 1003 1020 1004 static void __init spitz_init(void) 1021 1005 { 1006 + software_node_register(&spitz_scoop_1_gpiochip_node); 1007 + if (machine_is_akita()) 1008 + software_node_register(&akita_max7310_gpiochip_node); 1009 + else 1010 + software_node_register(&spitz_scoop_2_gpiochip_node); 1011 + 1022 1012 init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); 1023 1013 pm_power_off = spitz_poweroff; 1024 1014