aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-2.6.20/nhk15/audio_codec_patch_base_v5.6.0.patch
blob: 5b9c187fbceafedad748c1d57f0f07c3264a8dda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
 drivers/media/nomadik_mm/saa/nomadik-saa.c |    4 +++-
 sound/arm/nomadik_alsa.c                   |    4 ++++
 sound/nomadik_stw5095.c                    |   17 +++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

--- linux-2.6.20.orig/drivers/media/nomadik_mm/saa/nomadik-saa.c
+++ linux-2.6.20/drivers/media/nomadik_mm/saa/nomadik-saa.c
@@ -1290,16 +1290,18 @@ static int link_msp (struct instance_des
 
 	}
 	else
 	{
 		/*Configure Output sink for audiocodec*/
+		//Audiocodec driver will do this.
+		#if 0
 		acodec_error = nomadik_acodec_select_output(DEFAULT_OUTPUT_DEVICE, USER_SAA);
 		if (acodec_error != CODEC_OK) {
 			printk ("SAA_DRV ERROR : configuring audiocodec:%i\n", acodec_error);
 			return acodec_error;
 		}
-
+		#endif
 		down(&saa_desc->open_lock);
 		if(saa_desc->msp_out_flag != 0){
 			printk ("SAA_DRV ERROR : MSP OUT already used \n");
 			up(&saa_desc->open_lock);
 			return -EBUSY;
--- linux-2.6.20.orig/sound/arm/nomadik_alsa.c
+++ linux-2.6.20/sound/arm/nomadik_alsa.c
@@ -566,14 +566,18 @@ static int snd_nomadik_alsa_pcm_open(snd
 	/* Set the hardware configuration */
 	stream_id = substream->pstr->stream;
 	if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) {
 		runtime->hw = snd_nomadik_playback_hw;
 		/* configure the output sink for the acodec */
+		#if 0
+		if(codec_conf.codec_output != chip->output_device){
 		if ((error = nomadik_acodec_select_output(chip->output_device, USER_ALSA))) {
 			printk("ALSA: ERROR: select output failed\n");
 			return error;
 		}
+		}
+		#endif
 	} else {
 		runtime->hw = snd_nomadik_capture_hw;
 		/* configure the input source for the acodec */
 		if ((error = nomadik_acodec_select_input(chip->input_device, USER_ALSA))) {
 			printk("ALSA: ERROR: select input failed\n");
--- linux-2.6.20.orig/sound/nomadik_stw5095.c
+++ linux-2.6.20/sound/nomadik_stw5095.c
@@ -3235,19 +3235,32 @@ t_codec_error nomadik_acodec_setuser(t_a
  * Unset the current user for acodec.
  */
 
 t_codec_error nomadik_acodec_unsetuser(t_acodec_user user)
 {
+	int err=0;
 	t_codec_error codec_error = CODEC_OK;
 
 	if(g_codec_system_context.cur_user != user){
 		printk
 			("ERROR : Trying to free audiocodec already in use by other user %d\n", g_codec_system_context.cur_user);
 		return CODEC_ERROR;
 	}
 	else {
 		g_codec_system_context.cur_user = NO_USER;
+
+		err = STMPE2401_Install_Callback(STMPE0, EGPIO_PIN_7 ,NULL,(void*)user);
+		if (err != STMPE2401_OK)
+		{
+			printk("Couldn't setup codec callback\n");
+		}
+
+		err = STMPE2401_Install_Callback(STMPE0, EGPIO_PIN_6 ,NULL,(void*)user);
+		if (err != STMPE2401_OK)
+		{
+			printk("Couldn't setup codec callback\n");
+		}
                 nomadik_acodec_powerdown(0);
         }
 
 	return (codec_error);
 }
@@ -3280,10 +3293,14 @@ static void codec_callback1(void *user)
 {
 	int err,codec_error;
 	uint8 byte_value;
 	t_acodec_user t;
 	t = (t_acodec_user) user;
+	//spurious interuupt protection
+	if((t != USER_ALSA) && (t != USER_SAA) )
+		return;
+
 	err = STMPE2401_GetGpioVal(STMPE0,EGPIO_PIN_7,&byte_value);
 	switch(byte_value)	{
 
 	case 0:
 		err = STMPE2401_SetGpioAltFunction(STMPE0,EGPIO_PIN_12,STMPE2401_PRIMARY_FUNCTION);