@@ -130,6 +130,20 @@ static unsigned long spitz_pin_config[] __initdata = {
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
******************************************************************************/
@@ -950,37 +964,39 @@ static void __init spitz_i2c_init(void)
950
964
static inline void spitz_i2c_init (void ) {}
951
965
#endif
952
966
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
+ { }
961
975
};
962
976
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
+ { }
971
985
};
972
986
973
987
/******************************************************************************
974
988
* Audio devices
975
989
******************************************************************************/
976
990
static inline void spitz_audio_init (void )
977
991
{
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 );
984
1000
}
985
1001
986
1002
/******************************************************************************
@@ -1003,6 +1019,12 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
1003
1019
1004
1020
static void __init spitz_init (void )
1005
1021
{
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
+
1006
1028
init_gpio_reset (SPITZ_GPIO_ON_RESET , 1 , 0 );
1007
1029
pm_power_off = spitz_poweroff ;
1008
1030
0 commit comments