aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-2.6.20/nhk15/patch_classdamp_pm_v_audio_codec_patch.patch
blob: b48134cde15938b4d597d143e6fa4a9c88c279c0 (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
---
 sound/nomadik_stw5095.c |   42 +++++++++++++++++++++++++++++++-----------
 1 file changed, 31 insertions(+), 11 deletions(-)

--- linux-2.6.20.orig/sound/nomadik_stw5095.c
+++ linux-2.6.20/sound/nomadik_stw5095.c
@@ -1991,10 +1991,20 @@ t_codec_error nomadik_acodec_enable_audi
 			return CODEC_ERROR;
 		}
 
 	break;
 	case 0:
+		/*enable the amplifiers*/
+		err = STMPE2401_SetGpioAltFunction(STMPE0,EGPIO_PIN_12,STMPE2401_PRIMARY_FUNCTION);
+        	if (err != STMPE2401_OK)
+               		printk("Couldn't set STMPE%d %d as primary function\n",STMPE1,EGPIO_PIN_12);
+        	err = STMPE2401_SetGpioDir( STMPE0,EGPIO_PIN_12,STMPE2401_GPIO_OUT );
+        	if (err != STMPE2401_OK)
+                	printk("Couldn't set STMPE EGPIO:%d in Output direction\n", EGPIO_PIN_12);
+        	err = STMPE2401_SetGpioVal( STMPE0, EGPIO_PIN_12, 1);
+        	if (err != STMPE2401_OK)
+                	printk("Couldn't set STMPE GPIO12\n");
 		codec_error = nomadik_acodec_select_output(CODEC_DEST_LOUDSPEAKER,user);
 		if (CODEC_OK != codec_error) {
 			printk("AUDIOCODEC: ERROR: select output failed\n");
 			return CODEC_ERROR;
 		}
@@ -2220,10 +2230,20 @@ t_codec_error nomadik_acodec_enable_voic
 			return CODEC_ERROR;
 		}
 
 	break;
 	case 0:
+		/*enable the amplifiers*/
+		err = STMPE2401_SetGpioAltFunction(STMPE0,EGPIO_PIN_12,STMPE2401_PRIMARY_FUNCTION);
+        	if (err != STMPE2401_OK)
+               		printk("Couldn't set STMPE%d %d as primary function\n",STMPE1,EGPIO_PIN_12);
+        	err = STMPE2401_SetGpioDir( STMPE0,EGPIO_PIN_12,STMPE2401_GPIO_OUT );
+        	if (err != STMPE2401_OK)
+                	printk("Couldn't set STMPE EGPIO:%d in Output direction\n", EGPIO_PIN_12);
+        	err = STMPE2401_SetGpioVal( STMPE0, EGPIO_PIN_12, 1);
+        	if (err != STMPE2401_OK)
+                	printk("Couldn't set STMPE GPIO12\n");
 		codec_error = nomadik_acodec_select_output(CODEC_DEST_LOUDSPEAKER,user);
 		if (CODEC_OK != codec_error) {
 			printk("AUDIOCODEC: ERROR: select output failed\n");
 			return CODEC_ERROR;
 		}
@@ -2523,15 +2543,26 @@ t_codec_error nomadik_acodec_set_volume(
 * will be achieved in power management
 */
 
 t_codec_error nomadik_acodec_powerdown(__u8 flag)
 {
+	int err=0;
 	t_codec_error error_status = CODEC_OK;
 
 	g_codec_system_context.codec_configuration.cr0_powerup =
 	    CODEC_STW5095_CR0_POWERUP_OFF;
 	error_status = codec_stw5095_update_cr0();
+	/*disable the amplifiers to save power*/
+	err = STMPE2401_SetGpioAltFunction(STMPE0,EGPIO_PIN_12,STMPE2401_PRIMARY_FUNCTION);
+	if (err != STMPE2401_OK)
+		printk("Couldn't set STMPE%d %d as primary function\n",STMPE1,EGPIO_PIN_12);
+	err = STMPE2401_SetGpioDir( STMPE0,EGPIO_PIN_12,STMPE2401_GPIO_OUT );
+	if (err != STMPE2401_OK)
+		printk("Couldn't set STMPE EGPIO:%d in Output direction\n", EGPIO_PIN_12);
+	err = STMPE2401_SetGpioVal( STMPE0, EGPIO_PIN_12, 0);
+	if (err != STMPE2401_OK)
+		printk("Couldn't set STMPE GPIO12\n");
 
 	DEBUG(1, "leaving nomadik_acodec_powerdown() \n");
 	return (error_status);
 }
 
@@ -3343,21 +3374,10 @@ static void codec_callback1(void *user)
 }
 /*initialize the 5095 codec's amplifier */
 void codec_hd_amp_init(t_acodec_user user)
 {
 	int err = 0;
-	/*enable the amplifier*/
-	err = STMPE2401_SetGpioAltFunction(STMPE0,EGPIO_PIN_12,STMPE2401_PRIMARY_FUNCTION);
-	if (err != STMPE2401_OK)
-        	printk("Couldn't set STMPE%d %d as primary function\n",STMPE1,EGPIO_PIN_12);
-       	err = STMPE2401_SetGpioDir( STMPE0,EGPIO_PIN_12,STMPE2401_GPIO_OUT );
-       	if (err != STMPE2401_OK)
-        	printk("Couldn't set STMPE EGPIO:%d in Output direction\n", EGPIO_PIN_12);
-	err = STMPE2401_SetGpioVal( STMPE0, EGPIO_PIN_12, 1);
-        if (err != STMPE2401_OK)
-        	printk("Couldn't set STMPE GPIO12\n");
-
 	/**/
 	err = STMPE2401_SetGpioAltFunction(STMPE0,EGPIO_PIN_7,STMPE2401_PRIMARY_FUNCTION);
 	if (err != STMPE2401_OK)
                 printk("Couldn't set STMPE0 %d as  primary function\n",EGPIO_PIN_7);