From 38ef1b452cc3138157b92d02b31cad439d12d0ca Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov Date: Wed, 9 Jan 2008 02:03:34 +0300 Subject: [PATCH 51/64] fix sound/soc/pxa/tosa.c to new gpio api Signed-off-by: Dmitry Baryshkov --- sound/soc/pxa/tosa.c | 33 ++++++++++++++++++++++++++------- 1 files changed, 26 insertions(+), 7 deletions(-) diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 21c51b5..b758de8 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "../codecs/wm9712.h" #include "pxa2xx-pcm.h" @@ -137,11 +138,11 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol, /* tosa dapm event handlers */ static int tosa_hp_event(struct snd_soc_dapm_widget *w, int event) { -#if 0 +#ifdef CONFIG_MFD_TC6393XB if (SND_SOC_DAPM_EVENT_ON(event)) - set_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE); + gpio_set_value(TOSA_TC6393XB_L_MUTE, 1); else - reset_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE); + gpio_set_value(TOSA_TC6393XB_L_MUTE, 0); #endif return 0; } @@ -262,16 +263,31 @@ static int __init tosa_init(void) if (!machine_is_tosa()) return -ENODEV; +#ifdef CONFIG_MFD_TC6393XB + ret = gpio_request(TOSA_TC6393XB_L_MUTE, "Headphone Jack"); + if (ret) + return ret; + gpio_direction_output(TOSA_TC6393XB_L_MUTE, 0); +#endif tosa_snd_device = platform_device_alloc("soc-audio", -1); - if (!tosa_snd_device) - return -ENOMEM; + if (!tosa_snd_device) { + ret = -ENOMEM; + goto err_alloc; + } platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata); tosa_snd_devdata.dev = &tosa_snd_device->dev; ret = platform_device_add(tosa_snd_device); - if (ret) - platform_device_put(tosa_snd_device); + if (!ret) + return 0; + + platform_device_put(tosa_snd_device); + +err_alloc: +#ifdef CONFIG_MFD_TC6393XB + gpio_free(TOSA_TC6393XB_L_MUTE); +#endif return ret; } @@ -279,6 +295,9 @@ static int __init tosa_init(void) static void __exit tosa_exit(void) { platform_device_unregister(tosa_snd_device); +#ifdef CONFIG_MFD_TC6393XB + gpio_free(TOSA_TC6393XB_L_MUTE); +#endif } module_init(tosa_init); -- 1.5.3.8