Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 9d91c7c

Browse files
dtorarndb
authored andcommitted
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>
1 parent 224b932 commit 9d91c7c

File tree

1 file changed

+44
-22
lines changed

1 file changed

+44
-22
lines changed

arch/arm/mach-pxa/spitz.c

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ static unsigned long spitz_pin_config[] __initdata = {
130130
GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */
131131
};
132132

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+
133147
/******************************************************************************
134148
* Scoop GPIO expander
135149
******************************************************************************/
@@ -950,37 +964,39 @@ static void __init spitz_i2c_init(void)
950964
static inline void spitz_i2c_init(void) {}
951965
#endif
952966

953-
static struct gpiod_lookup_table spitz_audio_gpio_table = {
954-
.dev_id = "spitz-audio",
955-
.table = {
956-
GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH),
957-
GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH),
958-
GPIO_LOOKUP("sharp-scoop.1", 8, "mic", GPIO_ACTIVE_HIGH),
959-
{ },
960-
},
967+
static const struct property_entry spitz_audio_props[] = {
968+
PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3,
969+
GPIO_ACTIVE_HIGH),
970+
PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4,
971+
GPIO_ACTIVE_HIGH),
972+
PROPERTY_ENTRY_GPIO("mic-gpios", &spitz_scoop_2_gpiochip_node, 8,
973+
GPIO_ACTIVE_HIGH),
974+
{ }
961975
};
962976

963-
static struct gpiod_lookup_table akita_audio_gpio_table = {
964-
.dev_id = "spitz-audio",
965-
.table = {
966-
GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH),
967-
GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH),
968-
GPIO_LOOKUP("i2c-max7310", 2, "mic", GPIO_ACTIVE_HIGH),
969-
{ },
970-
},
977+
static const struct property_entry akita_audio_props[] = {
978+
PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3,
979+
GPIO_ACTIVE_HIGH),
980+
PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4,
981+
GPIO_ACTIVE_HIGH),
982+
PROPERTY_ENTRY_GPIO("mic-gpios", &akita_max7310_gpiochip_node, 2,
983+
GPIO_ACTIVE_HIGH),
984+
{ }
971985
};
972986

973987
/******************************************************************************
974988
* Audio devices
975989
******************************************************************************/
976990
static inline void spitz_audio_init(void)
977991
{
978-
if (machine_is_akita())
979-
gpiod_add_lookup_table(&akita_audio_gpio_table);
980-
else
981-
gpiod_add_lookup_table(&spitz_audio_gpio_table);
982-
983-
platform_device_register_simple("spitz-audio", -1, NULL, 0);
992+
struct platform_device_info audio_info = {
993+
.name = "spitz-audio",
994+
.id = PLATFORM_DEVID_NONE,
995+
.properties = machine_is_akita() ?
996+
akita_audio_props : spitz_audio_props,
997+
};
998+
999+
platform_device_register_full(&audio_info);
9841000
}
9851001

9861002
/******************************************************************************
@@ -1003,6 +1019,12 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
10031019

10041020
static void __init spitz_init(void)
10051021
{
1022+
software_node_register(&spitz_scoop_1_gpiochip_node);
1023+
if (machine_is_akita())
1024+
software_node_register(&akita_max7310_gpiochip_node);
1025+
else
1026+
software_node_register(&spitz_scoop_2_gpiochip_node);
1027+
10061028
init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
10071029
pm_power_off = spitz_poweroff;
10081030

0 commit comments

Comments
 (0)