cleanup kernel config and make use of previously applied soundcore patch
[oweals/openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1137-This-adds-some-debug-messages-to-the-Neo1937-sound-d.patch
1 From 1796e3d226fd1b119b09130478c781e25b7f5770 Mon Sep 17 00:00:00 2001
2 From: Tim Niemeyer <reddog@mastersword.de>
3 Date: Mon, 21 Apr 2008 21:09:37 +0100
4 Subject: [PATCH] This-adds-some-debug-messages-to-the-Neo1937-sound-d.patch
5  Subject: [PATCH] This adds some debug messages to the Neo1937 sound driver.
6
7 Signed-off-by: Tim Niemeyer <reddog@mastersword.de>
8 ---
9  sound/soc/s3c24xx/Kconfig          |    6 ++++
10  sound/soc/s3c24xx/neo1973_wm8753.c |   51 ++++++++++++++++++++++++++++++++++++
11  sound/soc/s3c24xx/s3c24xx-i2s.c    |    4 ++-
12  sound/soc/s3c24xx/s3c24xx-pcm.c    |    2 +-
13  4 files changed, 61 insertions(+), 2 deletions(-)
14
15 diff --git a/sound/soc/s3c24xx/Kconfig b/sound/soc/s3c24xx/Kconfig
16 index 4146ac4..17caf67 100644
17 --- a/sound/soc/s3c24xx/Kconfig
18 +++ b/sound/soc/s3c24xx/Kconfig
19 @@ -25,6 +25,12 @@ config SND_S3C24XX_SOC_NEO1973_WM8753
20           Say Y if you want to add support for SoC audio on smdk2440
21           with the WM8753.
22  
23 +config SND_S3C24XX_SOC_NEO1973_WM8753_DEBUG
24 +       bool "SoC I2S Audio support for NEO1973 - WM8753 debug"
25 +       depends on SND_S3C24XX_SOC_NEO1973_WM8753
26 +       help
27 +         Enable debugging output for the SoC I2S Audio code.
28 +
29  config SND_S3C24XX_SOC_NEO1973_GTA02_WM8753
30         tristate "SoC I2S Audio support for NEO1973 GTA02 - WM8753"
31         depends on SND_S3C24XX_SOC && MACH_NEO1973_GTA02
32 diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
33 index 09641cc..d7e031b 100644
34 --- a/sound/soc/s3c24xx/neo1973_wm8753.c
35 +++ b/sound/soc/s3c24xx/neo1973_wm8753.c
36 @@ -44,6 +44,15 @@
37  #include "s3c24xx-pcm.h"
38  #include "s3c24xx-i2s.h"
39  
40 +/* Debugging stuff */
41 +#ifdef SND_S3C24XX_SOC_NEO1973_WM8753_DEBUG
42 +static int debug        = 1;
43 +#else
44 +static int debug        = 0;
45 +#endif
46 +
47 +#define dprintk(msg...) if (debug) { printk(KERN_DEBUG "wm8753: " msg); }
48 +
49  /* define the scenarios */
50  #define NEO_AUDIO_OFF                  0
51  #define NEO_GSM_CALL_AUDIO_HANDSET     1
52 @@ -68,6 +77,8 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream,
53         int ret = 0;
54         unsigned long iis_clkrate;
55  
56 +       dprintk("Entered %s\n", __FUNCTION__);
57 +
58         iis_clkrate = s3c24xx_i2s_get_clockrate();
59  
60         switch (params_rate(params)) {
61 @@ -152,6 +163,8 @@ static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream)
62         struct snd_soc_pcm_runtime *rtd = substream->private_data;
63         struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
64  
65 +       dprintk("Entered %s\n", __FUNCTION__);
66 +
67         /* disable the PLL */
68         return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL1, 0, 0);
69  }
70 @@ -173,6 +186,8 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream,
71         int ret = 0;
72         unsigned long iis_clkrate;
73  
74 +       dprintk("Entered %s\n", __FUNCTION__);
75 +
76         iis_clkrate = s3c24xx_i2s_get_clockrate();
77  
78         if (params_rate(params) != 8000)
79 @@ -214,6 +229,8 @@ static int neo1973_voice_hw_free(struct snd_pcm_substream *substream)
80         struct snd_soc_pcm_runtime *rtd = substream->private_data;
81         struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
82  
83 +       dprintk("Entered %s\n", __FUNCTION__);
84 +
85         /* disable the PLL */
86         return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL2, 0, 0);
87  }
88 @@ -228,12 +245,16 @@ static int neo1973_scenario = 0;
89  static int neo1973_get_scenario(struct snd_kcontrol *kcontrol,
90         struct snd_ctl_elem_value *ucontrol)
91  {
92 +       dprintk("Entered %s\n", __FUNCTION__);
93 +
94         ucontrol->value.integer.value[0] = neo1973_scenario;
95         return 0;
96  }
97  
98  static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario)
99  {
100 +       dprintk("Entered %s\n", __FUNCTION__);
101 +
102         switch(neo1973_scenario) {
103         case NEO_AUDIO_OFF:
104                 snd_soc_dapm_set_endpoint(codec, "Audio Out",    0);
105 @@ -316,6 +337,8 @@ static int neo1973_set_scenario(struct snd_kcontrol *kcontrol,
106  {
107         struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
108  
109 +       dprintk("Entered %s\n", __FUNCTION__);
110 +
111         if (neo1973_scenario == ucontrol->value.integer.value[0])
112                 return 0;
113  
114 @@ -328,6 +351,8 @@ static u8 lm4857_regs[4] = {0x00, 0x40, 0x80, 0xC0};
115  
116  static void lm4857_write_regs(void)
117  {
118 +       dprintk("Entered %s\n", __FUNCTION__);
119 +
120         if (i2c_master_send(i2c, lm4857_regs, 4) != 4)
121                 printk(KERN_ERR "lm4857: i2c write failed\n");
122  }
123 @@ -339,6 +364,8 @@ static int lm4857_get_reg(struct snd_kcontrol *kcontrol,
124         int shift = (kcontrol->private_value >> 8) & 0x0F;
125         int mask = (kcontrol->private_value >> 16) & 0xFF;
126  
127 +       dprintk("Entered %s\n", __FUNCTION__);
128 +
129         ucontrol->value.integer.value[0] = (lm4857_regs[reg] >> shift) & mask;
130         return 0;
131  }
132 @@ -350,6 +377,8 @@ static int lm4857_set_reg(struct snd_kcontrol *kcontrol,
133         int shift = (kcontrol->private_value >> 8) & 0x0F;
134         int mask = (kcontrol->private_value >> 16) & 0xFF;
135  
136 +       dprintk("Entered %s\n", __FUNCTION__);
137 +
138         if (((lm4857_regs[reg] >> shift ) & mask) ==
139                 ucontrol->value.integer.value[0])
140                 return 0;
141 @@ -365,6 +394,8 @@ static int lm4857_get_mode(struct snd_kcontrol *kcontrol,
142  {
143         u8 value = lm4857_regs[LM4857_CTRL] & 0x0F;
144  
145 +       dprintk("Entered %s\n", __FUNCTION__);
146 +
147         if (value)
148                 value -= 5;
149  
150 @@ -377,6 +408,8 @@ static int lm4857_set_mode(struct snd_kcontrol *kcontrol,
151  {
152         u8 value = ucontrol->value.integer.value[0];
153  
154 +       dprintk("Entered %s\n", __FUNCTION__);
155 +
156         if (value)
157                 value += 5;
158  
159 @@ -484,6 +517,8 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
160  {
161         int i, err;
162  
163 +       dprintk("Entered %s\n", __FUNCTION__);
164 +
165         /* set up NC codec pins */
166         snd_soc_dapm_set_endpoint(codec, "LOUT2", 0);
167         snd_soc_dapm_set_endpoint(codec, "ROUT2", 0);
168 @@ -584,6 +619,8 @@ static int lm4857_amp_probe(struct i2c_adapter *adap, int addr, int kind)
169  {
170         int ret;
171  
172 +       dprintk("Entered %s\n", __FUNCTION__);
173 +
174         client_template.adapter = adap;
175         client_template.addr = addr;
176  
177 @@ -607,6 +644,8 @@ exit_err:
178  
179  static int lm4857_i2c_detach(struct i2c_client *client)
180  {
181 +       dprintk("Entered %s\n", __FUNCTION__);
182 +
183         i2c_detach_client(client);
184         kfree(client);
185         return 0;
186 @@ -614,6 +653,8 @@ static int lm4857_i2c_detach(struct i2c_client *client)
187  
188  static int lm4857_i2c_attach(struct i2c_adapter *adap)
189  {
190 +       dprintk("Entered %s\n", __FUNCTION__);
191 +
192         return i2c_probe(adap, &addr_data, lm4857_amp_probe);
193  }
194  
195 @@ -621,6 +662,8 @@ static u8 lm4857_state;
196  
197  static int lm4857_suspend(struct i2c_client *dev, pm_message_t state)
198  {
199 +       dprintk("Entered %s\n", __FUNCTION__);
200 +
201         dev_dbg(&dev->dev, "lm4857_suspend\n");
202         lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf;
203         if (lm4857_state) {
204 @@ -632,6 +675,8 @@ static int lm4857_suspend(struct i2c_client *dev, pm_message_t state)
205  
206  static int lm4857_resume(struct i2c_client *dev)
207  {
208 +       dprintk("Entered %s\n", __FUNCTION__);
209 +
210         if (lm4857_state) {
211                 lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f);
212                 lm4857_write_regs();
213 @@ -641,6 +686,8 @@ static int lm4857_resume(struct i2c_client *dev)
214  
215  static void lm4857_shutdown(struct i2c_client *dev)
216  {
217 +       dprintk("Entered %s\n", __FUNCTION__);
218 +
219         dev_dbg(&dev->dev, "lm4857_shutdown\n");
220         lm4857_regs[LM4857_CTRL] &= 0xf0;
221         lm4857_write_regs();
222 @@ -672,6 +719,8 @@ static int __init neo1973_init(void)
223  {
224         int ret;
225  
226 +       dprintk("Entered %s\n", __FUNCTION__);
227 +
228         if (!machine_is_neo1973_gta01()) {
229                 printk(KERN_INFO
230                        "Only GTA01 hardware supported by ASoc driver\n");
231 @@ -698,6 +747,8 @@ static int __init neo1973_init(void)
232  
233  static void __exit neo1973_exit(void)
234  {
235 +       dprintk("Entered %s\n", __FUNCTION__);
236 +
237         i2c_del_driver(&lm4857_i2c_driver);
238         platform_device_unregister(neo1973_snd_device);
239  }
240 diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c
241 index 43fd25a..7b6cca7 100644
242 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c
243 +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
244 @@ -46,7 +46,7 @@
245  
246  #define S3C24XX_I2S_DEBUG 0
247  #if S3C24XX_I2S_DEBUG
248 -#define DBG(x...) printk(KERN_DEBUG x)
249 +#define DBG(x...) printk(KERN_DEBUG "s3c24xx-i2s: " x)
250  #else
251  #define DBG(x...)
252  #endif
253 @@ -415,6 +415,7 @@ static int s3c24xx_i2s_probe(struct platform_device *pdev)
254  int s3c24xx_i2s_suspend(struct platform_device *pdev,
255                  struct snd_soc_cpu_dai *cpu_dai)
256  {
257 +       DBG("Entered %s\n", __FUNCTION__);
258         s3c24xx_i2s.iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON);
259         s3c24xx_i2s.iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD);
260         s3c24xx_i2s.iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON);
261 @@ -428,6 +429,7 @@ int s3c24xx_i2s_suspend(struct platform_device *pdev,
262  int s3c24xx_i2s_resume(struct platform_device *pdev,
263                  struct snd_soc_cpu_dai *cpu_dai)
264  {
265 +       DBG("Entered %s\n", __FUNCTION__);
266         clk_enable(s3c24xx_i2s.iis_clk);
267  
268          writel(s3c24xx_i2s.iiscon, s3c24xx_i2s.regs + S3C2410_IISCON);
269 diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
270 index e9f3b60..57b0c74 100644
271 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c
272 +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
273 @@ -40,7 +40,7 @@
274  
275  #define S3C24XX_PCM_DEBUG 0
276  #if S3C24XX_PCM_DEBUG
277 -#define DBG(x...) printk(KERN_DEBUG x)
278 +#define DBG(x...) printk(KERN_DEBUG "s3c24xx-pcm: " x)
279  #else
280  #define DBG(x...)
281  #endif
282 -- 
283 1.5.6.5
284