Skip to contentSkip to conversation

ASoC: samsung/smartq: use dynamic registration

PATCH New Arnd Bergmann 1 participant 1 message Jul 14, 2014

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: samsung/smartq: use dynamic registration

As a prerequisite for moving s3c64xx into multiplatform configurations, we need to change the smartq audio driver to stop using hardcoded gpio numbers from the header file, and instead pass the gpio data through platform_data.

In order to do that, we also move the code to use module_platform_driver and register the platform device using platform_device_register_simple and register the gpios through the gpiod API.

arch/arm/mach-s3c64xx/mach-smartq.c +13 -0
index b3d13537a7f0..deed4dd2d0e4 100644
@@ -12,6 +12,7 @@
 #include <linux/delay.h>
 #include <linux/fb.h>
 #include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/pwm_backlight.h>
@@ -379,6 +380,15 @@ void __init smartq_map_io(void)
 	smartq_lcd_mode_set();
 }
 
+static struct gpiod_lookup_table smartq_audio_gpios = {
+	.dev_id = "smartq-audio",
+	.table = {
+		GPIO_LOOKUP("GPL", 12, "headphone detect", 0),
+		GPIO_LOOKUP("GPK", 12, "amplifiers shutdown", GPIO_ACTIVE_HIGH),
+		{ },
+	},
+};
+
 void __init smartq_machine_init(void)
 {
 	s3c_i2c0_set_platdata(NULL);
@@ -397,4 +407,7 @@ void __init smartq_machine_init(void)
 	WARN_ON(smartq_wifi_init());
 
 	platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
+
+	gpiod_add_lookup_table(&smartq_audio_gpios);
+	platform_device_register_simple("smartq-audio", -1, NULL, 0);
 }
sound/soc/samsung/smartq_wm8987.c +26 -50

117 lines not on this page · raw message