merge of '7393275c6ccce67cadeb49d4afb3459e56edf8a9'
[vuplus_openembedded] / packages / linux / linux-rp-2.6.24 / tosa / 0051-fix-sound-soc-pxa-tosa.c-to-new-gpio-api.patch
1 From 38ef1b452cc3138157b92d02b31cad439d12d0ca Mon Sep 17 00:00:00 2001
2 From: Dmitry Baryshkov <dbaryshkov@gmail.com>
3 Date: Wed, 9 Jan 2008 02:03:34 +0300
4 Subject: [PATCH 51/64] fix sound/soc/pxa/tosa.c to new gpio api
5
6 Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
7 ---
8  sound/soc/pxa/tosa.c |   33 ++++++++++++++++++++++++++-------
9  1 files changed, 26 insertions(+), 7 deletions(-)
10
11 diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
12 index 21c51b5..b758de8 100644
13 --- a/sound/soc/pxa/tosa.c
14 +++ b/sound/soc/pxa/tosa.c
15 @@ -36,6 +36,7 @@
16  #include <asm/arch/hardware.h>
17  #include <asm/arch/audio.h>
18  #include <asm/arch/tosa.h>
19 +#include <asm/gpio.h>
20  
21  #include "../codecs/wm9712.h"
22  #include "pxa2xx-pcm.h"
23 @@ -137,11 +138,11 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol,
24  /* tosa dapm event handlers */
25  static int tosa_hp_event(struct snd_soc_dapm_widget *w, int event)
26  {
27 -#if 0
28 +#ifdef CONFIG_MFD_TC6393XB
29         if (SND_SOC_DAPM_EVENT_ON(event))
30 -               set_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
31 +               gpio_set_value(TOSA_TC6393XB_L_MUTE, 1);
32         else
33 -               reset_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
34 +               gpio_set_value(TOSA_TC6393XB_L_MUTE, 0);
35  #endif
36         return 0;
37  }
38 @@ -262,16 +263,31 @@ static int __init tosa_init(void)
39         if (!machine_is_tosa())
40                 return -ENODEV;
41  
42 +#ifdef CONFIG_MFD_TC6393XB
43 +       ret = gpio_request(TOSA_TC6393XB_L_MUTE, "Headphone Jack");
44 +       if (ret)
45 +               return ret;
46 +       gpio_direction_output(TOSA_TC6393XB_L_MUTE, 0);
47 +#endif
48         tosa_snd_device = platform_device_alloc("soc-audio", -1);
49 -       if (!tosa_snd_device)
50 -               return -ENOMEM;
51 +       if (!tosa_snd_device) {
52 +               ret = -ENOMEM;
53 +               goto err_alloc;
54 +       }
55  
56         platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata);
57         tosa_snd_devdata.dev = &tosa_snd_device->dev;
58         ret = platform_device_add(tosa_snd_device);
59  
60 -       if (ret)
61 -               platform_device_put(tosa_snd_device);
62 +       if (!ret)
63 +               return 0;
64 +
65 +       platform_device_put(tosa_snd_device);
66 +
67 +err_alloc:
68 +#ifdef CONFIG_MFD_TC6393XB
69 +       gpio_free(TOSA_TC6393XB_L_MUTE);
70 +#endif
71  
72         return ret;
73  }
74 @@ -279,6 +295,9 @@ static int __init tosa_init(void)
75  static void __exit tosa_exit(void)
76  {
77         platform_device_unregister(tosa_snd_device);
78 +#ifdef CONFIG_MFD_TC6393XB
79 +       gpio_free(TOSA_TC6393XB_L_MUTE);
80 +#endif
81  }
82  
83  module_init(tosa_init);
84 -- 
85 1.5.3.8
86