From 3a242b3d5130f55bb857dd319da895b19159e513 Mon Sep 17 00:00:00 2001 From: lars Date: Thu, 30 Jul 2009 12:04:01 +0000 Subject: [s3c24xx] glamo: Implement gpiolib for the glamo. Get rid of glamo-spi-gpio and use the generic spi-gpio driver instead. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17048 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../files-2.6.30/sound/soc/s3c24xx/gta02_wm8753.c | 48 ++++++++++++++++------ 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'target/linux/s3c24xx/files-2.6.30/sound') diff --git a/target/linux/s3c24xx/files-2.6.30/sound/soc/s3c24xx/gta02_wm8753.c b/target/linux/s3c24xx/files-2.6.30/sound/soc/s3c24xx/gta02_wm8753.c index 1f8f9db9b..5f9ea7e42 100644 --- a/target/linux/s3c24xx/files-2.6.30/sound/soc/s3c24xx/gta02_wm8753.c +++ b/target/linux/s3c24xx/files-2.6.30/sound/soc/s3c24xx/gta02_wm8753.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -28,8 +29,6 @@ #include #include -#include -#include #include #include #include @@ -243,10 +242,10 @@ static int lm4853_set_spk(struct snd_kcontrol *kcontrol, if (val) { lm4853_state |= LM4853_SPK; - s3c2410_gpio_setpin(GTA02_GPIO_HP_IN, 0); + gpio_set_value(GTA02_GPIO_HP_IN, 0); } else { lm4853_state &= ~LM4853_SPK; - s3c2410_gpio_setpin(GTA02_GPIO_HP_IN, 1); + gpio_set_value(GTA02_GPIO_HP_IN, 1); } return 0; @@ -265,10 +264,10 @@ static int lm4853_event(struct snd_soc_dapm_widget *w, int event) { if (SND_SOC_DAPM_EVENT_ON(event)) - s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 0); + gpio_set_value(GTA02_GPIO_AMP_SHUT, 0); if (SND_SOC_DAPM_EVENT_OFF(event)) - s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 1); + gpio_set_value(GTA02_GPIO_AMP_SHUT, 1); return 0; } @@ -449,19 +448,40 @@ static int __init neo1973_gta02_init(void) if (ret) { platform_device_put(neo1973_gta02_snd_device); - return ret; + return 0; } /* Initialise GPIOs used by amp */ - s3c2410_gpio_cfgpin(GTA02_GPIO_HP_IN, S3C2410_GPIO_OUTPUT); - s3c2410_gpio_cfgpin(GTA02_GPIO_AMP_SHUT, S3C2410_GPIO_OUTPUT); + ret = gpio_request(GTA02_GPIO_HP_IN, "GTA02_HP_IN"); + if (ret) { + pr_err("%s: Failed to register GPIO %d\n", __func__, GTA02_GPIO_HP_IN); + goto err_unregister_device; + } - /* Amp off by default */ - s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 1); + ret = gpio_direction_output(GTA02_GPIO_HP_IN, 1); + if (ret) { + pr_err("%s: Failed to configure GPIO %d\n", __func__, GTA02_GPIO_HP_IN); + goto err_unregister_device; + } - /* Speaker off by default */ - s3c2410_gpio_setpin(GTA02_GPIO_HP_IN, 1); + ret = gpio_request(GTA02_GPIO_AMP_SHUT, "GTA02_AMP_SHUT"); + if (ret) { + pr_err("%s: Failed to register GPIO %d\n", __func__, GTA02_GPIO_AMP_SHUT); + goto err_free_gpio_hp_in; + } + ret = gpio_direction_output(GTA02_GPIO_AMP_SHUT, 1); + if (ret) { + pr_err("%s: Failed to configure GPIO %d\n", __func__, GTA02_GPIO_AMP_SHUT); + goto err_free_gpio_hp_in; + } + + + return 0; +err_free_gpio_hp_in: + gpio_free(GTA02_GPIO_HP_IN); +err_unregister_device: + platform_device_unregister(neo1973_gta02_snd_device); return ret; } module_init(neo1973_gta02_init); @@ -470,6 +490,8 @@ static void __exit neo1973_gta02_exit(void) { snd_soc_unregister_dai(&bt_dai); platform_device_unregister(neo1973_gta02_snd_device); + gpio_free(GTA02_GPIO_HP_IN); + gpio_free(GTA02_GPIO_AMP_SHUT); } module_exit(neo1973_gta02_exit); -- cgit v1.2.3