diff options
author | Tim Niemeyer <reddog@mastersword.de> | 2008-05-05 08:16:12 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-05-19 07:19:14 -0400 |
commit | 1894c59fdb63692f5ba2576875cc558b856935ca (patch) | |
tree | 3890a5a4d8f62c954fadea330905a8bbe02ee708 /sound/soc | |
parent | 650f6b13318bce6a8d59bfa48fe15b5832623cbc (diff) |
[ALSA] soc - Patch to add debug messages to the neo1973_wm8753 (GTA01) sound driver
Signed-off-by: Tim Niemeyer <reddog@mastersword.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/s3c24xx/neo1973_wm8753.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c index 0e9d1c5f2484..e469186a407d 100644 --- a/sound/soc/s3c24xx/neo1973_wm8753.c +++ b/sound/soc/s3c24xx/neo1973_wm8753.c | |||
@@ -43,6 +43,14 @@ | |||
43 | #include "s3c24xx-pcm.h" | 43 | #include "s3c24xx-pcm.h" |
44 | #include "s3c24xx-i2s.h" | 44 | #include "s3c24xx-i2s.h" |
45 | 45 | ||
46 | /* Debugging stuff */ | ||
47 | #define S3C24XX_SOC_NEO1973_WM8753_DEBUG 0 | ||
48 | #if S3C24XX_SOC_NEO1973_WM8753_DEBUG | ||
49 | #define DBG(x...) printk(KERN_DEBUG "s3c24xx-soc-neo1973-wm8753: " x) | ||
50 | #else | ||
51 | #define DBG(x...) | ||
52 | #endif | ||
53 | |||
46 | /* define the scenarios */ | 54 | /* define the scenarios */ |
47 | #define NEO_AUDIO_OFF 0 | 55 | #define NEO_AUDIO_OFF 0 |
48 | #define NEO_GSM_CALL_AUDIO_HANDSET 1 | 56 | #define NEO_GSM_CALL_AUDIO_HANDSET 1 |
@@ -67,6 +75,8 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, | |||
67 | int ret = 0; | 75 | int ret = 0; |
68 | unsigned long iis_clkrate; | 76 | unsigned long iis_clkrate; |
69 | 77 | ||
78 | DBG("Entered %s\n", __func__); | ||
79 | |||
70 | iis_clkrate = s3c24xx_i2s_get_clockrate(); | 80 | iis_clkrate = s3c24xx_i2s_get_clockrate(); |
71 | 81 | ||
72 | switch (params_rate(params)) { | 82 | switch (params_rate(params)) { |
@@ -151,6 +161,8 @@ static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream) | |||
151 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 161 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
152 | struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai; | 162 | struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai; |
153 | 163 | ||
164 | DBG("Entered %s\n", __func__); | ||
165 | |||
154 | /* disable the PLL */ | 166 | /* disable the PLL */ |
155 | return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL1, 0, 0); | 167 | return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL1, 0, 0); |
156 | } | 168 | } |
@@ -172,6 +184,8 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream, | |||
172 | int ret = 0; | 184 | int ret = 0; |
173 | unsigned long iis_clkrate; | 185 | unsigned long iis_clkrate; |
174 | 186 | ||
187 | DBG("Entered %s\n", __func__); | ||
188 | |||
175 | iis_clkrate = s3c24xx_i2s_get_clockrate(); | 189 | iis_clkrate = s3c24xx_i2s_get_clockrate(); |
176 | 190 | ||
177 | if (params_rate(params) != 8000) | 191 | if (params_rate(params) != 8000) |
@@ -213,6 +227,8 @@ static int neo1973_voice_hw_free(struct snd_pcm_substream *substream) | |||
213 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 227 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
214 | struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai; | 228 | struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai; |
215 | 229 | ||
230 | DBG("Entered %s\n", __func__); | ||
231 | |||
216 | /* disable the PLL */ | 232 | /* disable the PLL */ |
217 | return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL2, 0, 0); | 233 | return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL2, 0, 0); |
218 | } | 234 | } |
@@ -233,6 +249,8 @@ static int neo1973_get_scenario(struct snd_kcontrol *kcontrol, | |||
233 | 249 | ||
234 | static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario) | 250 | static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario) |
235 | { | 251 | { |
252 | DBG("Entered %s\n", __func__); | ||
253 | |||
236 | switch (neo1973_scenario) { | 254 | switch (neo1973_scenario) { |
237 | case NEO_AUDIO_OFF: | 255 | case NEO_AUDIO_OFF: |
238 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); | 256 | snd_soc_dapm_set_endpoint(codec, "Audio Out", 0); |
@@ -315,6 +333,8 @@ static int neo1973_set_scenario(struct snd_kcontrol *kcontrol, | |||
315 | { | 333 | { |
316 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 334 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
317 | 335 | ||
336 | DBG("Entered %s\n", __func__); | ||
337 | |||
318 | if (neo1973_scenario == ucontrol->value.integer.value[0]) | 338 | if (neo1973_scenario == ucontrol->value.integer.value[0]) |
319 | return 0; | 339 | return 0; |
320 | 340 | ||
@@ -327,6 +347,8 @@ static u8 lm4857_regs[4] = {0x00, 0x40, 0x80, 0xC0}; | |||
327 | 347 | ||
328 | static void lm4857_write_regs(void) | 348 | static void lm4857_write_regs(void) |
329 | { | 349 | { |
350 | DBG("Entered %s\n", __func__); | ||
351 | |||
330 | if (i2c_master_send(i2c, lm4857_regs, 4) != 4) | 352 | if (i2c_master_send(i2c, lm4857_regs, 4) != 4) |
331 | printk(KERN_ERR "lm4857: i2c write failed\n"); | 353 | printk(KERN_ERR "lm4857: i2c write failed\n"); |
332 | } | 354 | } |
@@ -338,6 +360,8 @@ static int lm4857_get_reg(struct snd_kcontrol *kcontrol, | |||
338 | int shift = (kcontrol->private_value >> 8) & 0x0F; | 360 | int shift = (kcontrol->private_value >> 8) & 0x0F; |
339 | int mask = (kcontrol->private_value >> 16) & 0xFF; | 361 | int mask = (kcontrol->private_value >> 16) & 0xFF; |
340 | 362 | ||
363 | DBG("Entered %s\n", __func__); | ||
364 | |||
341 | ucontrol->value.integer.value[0] = (lm4857_regs[reg] >> shift) & mask; | 365 | ucontrol->value.integer.value[0] = (lm4857_regs[reg] >> shift) & mask; |
342 | return 0; | 366 | return 0; |
343 | } | 367 | } |
@@ -364,6 +388,8 @@ static int lm4857_get_mode(struct snd_kcontrol *kcontrol, | |||
364 | { | 388 | { |
365 | u8 value = lm4857_regs[LM4857_CTRL] & 0x0F; | 389 | u8 value = lm4857_regs[LM4857_CTRL] & 0x0F; |
366 | 390 | ||
391 | DBG("Entered %s\n", __func__); | ||
392 | |||
367 | if (value) | 393 | if (value) |
368 | value -= 5; | 394 | value -= 5; |
369 | 395 | ||
@@ -376,6 +402,8 @@ static int lm4857_set_mode(struct snd_kcontrol *kcontrol, | |||
376 | { | 402 | { |
377 | u8 value = ucontrol->value.integer.value[0]; | 403 | u8 value = ucontrol->value.integer.value[0]; |
378 | 404 | ||
405 | DBG("Entered %s\n", __func__); | ||
406 | |||
379 | if (value) | 407 | if (value) |
380 | value += 5; | 408 | value += 5; |
381 | 409 | ||
@@ -483,6 +511,8 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec) | |||
483 | { | 511 | { |
484 | int i, err; | 512 | int i, err; |
485 | 513 | ||
514 | DBG("Entered %s\n", __func__); | ||
515 | |||
486 | /* set up NC codec pins */ | 516 | /* set up NC codec pins */ |
487 | snd_soc_dapm_set_endpoint(codec, "LOUT2", 0); | 517 | snd_soc_dapm_set_endpoint(codec, "LOUT2", 0); |
488 | snd_soc_dapm_set_endpoint(codec, "ROUT2", 0); | 518 | snd_soc_dapm_set_endpoint(codec, "ROUT2", 0); |
@@ -583,6 +613,8 @@ static int lm4857_amp_probe(struct i2c_adapter *adap, int addr, int kind) | |||
583 | { | 613 | { |
584 | int ret; | 614 | int ret; |
585 | 615 | ||
616 | DBG("Entered %s\n", __func__); | ||
617 | |||
586 | client_template.adapter = adap; | 618 | client_template.adapter = adap; |
587 | client_template.addr = addr; | 619 | client_template.addr = addr; |
588 | 620 | ||
@@ -606,6 +638,8 @@ exit_err: | |||
606 | 638 | ||
607 | static int lm4857_i2c_detach(struct i2c_client *client) | 639 | static int lm4857_i2c_detach(struct i2c_client *client) |
608 | { | 640 | { |
641 | DBG("Entered %s\n", __func__); | ||
642 | |||
609 | i2c_detach_client(client); | 643 | i2c_detach_client(client); |
610 | kfree(client); | 644 | kfree(client); |
611 | return 0; | 645 | return 0; |
@@ -613,6 +647,8 @@ static int lm4857_i2c_detach(struct i2c_client *client) | |||
613 | 647 | ||
614 | static int lm4857_i2c_attach(struct i2c_adapter *adap) | 648 | static int lm4857_i2c_attach(struct i2c_adapter *adap) |
615 | { | 649 | { |
650 | DBG("Entered %s\n", __func__); | ||
651 | |||
616 | return i2c_probe(adap, &addr_data, lm4857_amp_probe); | 652 | return i2c_probe(adap, &addr_data, lm4857_amp_probe); |
617 | } | 653 | } |
618 | 654 | ||
@@ -620,6 +656,8 @@ static u8 lm4857_state; | |||
620 | 656 | ||
621 | static int lm4857_suspend(struct i2c_client *dev, pm_message_t state) | 657 | static int lm4857_suspend(struct i2c_client *dev, pm_message_t state) |
622 | { | 658 | { |
659 | DBG("Entered %s\n", __func__); | ||
660 | |||
623 | dev_dbg(&dev->dev, "lm4857_suspend\n"); | 661 | dev_dbg(&dev->dev, "lm4857_suspend\n"); |
624 | lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf; | 662 | lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf; |
625 | if (lm4857_state) { | 663 | if (lm4857_state) { |
@@ -631,6 +669,8 @@ static int lm4857_suspend(struct i2c_client *dev, pm_message_t state) | |||
631 | 669 | ||
632 | static int lm4857_resume(struct i2c_client *dev) | 670 | static int lm4857_resume(struct i2c_client *dev) |
633 | { | 671 | { |
672 | DBG("Entered %s\n", __func__); | ||
673 | |||
634 | if (lm4857_state) { | 674 | if (lm4857_state) { |
635 | lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f); | 675 | lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f); |
636 | lm4857_write_regs(); | 676 | lm4857_write_regs(); |
@@ -640,6 +680,8 @@ static int lm4857_resume(struct i2c_client *dev) | |||
640 | 680 | ||
641 | static void lm4857_shutdown(struct i2c_client *dev) | 681 | static void lm4857_shutdown(struct i2c_client *dev) |
642 | { | 682 | { |
683 | DBG("Entered %s\n", __func__); | ||
684 | |||
643 | dev_dbg(&dev->dev, "lm4857_shutdown\n"); | 685 | dev_dbg(&dev->dev, "lm4857_shutdown\n"); |
644 | lm4857_regs[LM4857_CTRL] &= 0xf0; | 686 | lm4857_regs[LM4857_CTRL] &= 0xf0; |
645 | lm4857_write_regs(); | 687 | lm4857_write_regs(); |
@@ -671,6 +713,8 @@ static int __init neo1973_init(void) | |||
671 | { | 713 | { |
672 | int ret; | 714 | int ret; |
673 | 715 | ||
716 | DBG("Entered %s\n", __func__); | ||
717 | |||
674 | neo1973_snd_device = platform_device_alloc("soc-audio", -1); | 718 | neo1973_snd_device = platform_device_alloc("soc-audio", -1); |
675 | if (!neo1973_snd_device) | 719 | if (!neo1973_snd_device) |
676 | return -ENOMEM; | 720 | return -ENOMEM; |
@@ -691,6 +735,8 @@ static int __init neo1973_init(void) | |||
691 | 735 | ||
692 | static void __exit neo1973_exit(void) | 736 | static void __exit neo1973_exit(void) |
693 | { | 737 | { |
738 | DBG("Entered %s\n", __func__); | ||
739 | |||
694 | i2c_del_driver(&lm4857_i2c_driver); | 740 | i2c_del_driver(&lm4857_i2c_driver); |
695 | platform_device_unregister(neo1973_snd_device); | 741 | platform_device_unregister(neo1973_snd_device); |
696 | } | 742 | } |