From df0cc2d1e15f739a428f630feb62ce6f040a4e19 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Wed, 9 Jul 2014 11:09:42 +0200 Subject: 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. Signed-off-by: Arnd Bergmann Acked-by: Mark Brown Reviewed-by: Krzysztof Kozlowski --- arch/arm/mach-s3c64xx/mach-smartq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'arch/arm/mach-s3c64xx') diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c index acdfb5fac40f..96784e7f894a 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq.c +++ b/arch/arm/mach-s3c64xx/mach-smartq.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -383,6 +384,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", 0), + { }, + }, +}; + void __init smartq_machine_init(void) { s3c_i2c0_set_platdata(NULL); @@ -402,4 +412,7 @@ void __init smartq_machine_init(void) pwm_add_table(smartq_pwm_lookup, ARRAY_SIZE(smartq_pwm_lookup)); 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); } -- cgit