--- 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);