diff options
author | Arnd Bergmann <arnd@arndb.de> | 2014-07-09 09:09:42 (GMT) |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2015-12-01 20:50:24 (GMT) |
commit | df0cc2d1e15f739a428f630feb62ce6f040a4e19 (patch) | |
tree | 7c0144ec3d6b25346177c41a70d2e0378fcda198 /arch/arm | |
parent | 94eb81ad43cedbb8354a14130329f06853b31a60 (diff) | |
download | linux-df0cc2d1e15f739a428f630feb62ce6f040a4e19.tar.xz |
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 <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-s3c64xx/mach-smartq.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c index acdfb5f..96784e7 100644 --- a/arch/arm/mach-s3c64xx/mach-smartq.c +++ b/arch/arm/mach-s3c64xx/mach-smartq.c @@ -12,6 +12,7 @@ #include <linux/delay.h> #include <linux/fb.h> #include <linux/gpio.h> +#include <linux/gpio/machine.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/pwm.h> @@ -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); } |