From 794f5a840f7ef2f3f4cbcd8e9a259564f2be69d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=AE=8B=E7=A7=80=E6=9D=B0?= Date: Mon, 19 Nov 2012 20:49:49 +0800 Subject: [PATCH] phonepad: rt3261 set spkear amplify and playback data swap function in board. --- arch/arm/mach-rk30/board-rk30-phonepad.c | 18 ++++++++++++- arch/arm/mach-rk30/include/mach/board.h | 3 +++ sound/soc/codecs/rt3261.c | 32 +++++++++--------------- sound/soc/codecs/rt3261.h | 3 +++ 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-rk30/board-rk30-phonepad.c b/arch/arm/mach-rk30/board-rk30-phonepad.c index 3479b4720990..511b46c8db70 100755 --- a/arch/arm/mach-rk30/board-rk30-phonepad.c +++ b/arch/arm/mach-rk30/board-rk30-phonepad.c @@ -1162,6 +1162,20 @@ static struct platform_device rk29_device_backlight = { #define TWO_SPK 2 #define ONE_SPK 1 +enum { + SPK_AMPLIFY_ZERO_POINT_FIVE_WATT=1, + SPK_AMPLIFY_ZERO_POINT_SIX_WATT, + SPK_AMPLIFY_ZERO_POINT_EIGHT_WATT, + SPK_AMPLIFY_ONE_WATT, +}; + +enum { + NORMAL, + SWAP, + LEFT_COPY_TO_RIGHT, + RIGHT_COPY_LEFT, +}; + static int rt3261_io_init(int gpio, char *iomux_name, int iomux_mode) { gpio_request(gpio,NULL); @@ -1177,8 +1191,10 @@ static struct rt3261_platform_data rt3261_info = { .spk_num = TWO_SPK, .modem_input_mode = DIFFERENTIAL, .lout_to_modem_mode = DIFFERENTIAL, + .spk_amplify = SPK_AMPLIFY_ZERO_POINT_SIX_WATT, + .playback_if1_data_control = NORMAL, + .playback_if2_data_control = NORMAL, }; - #endif #ifdef CONFIG_RK29_SUPPORT_MODEM diff --git a/arch/arm/mach-rk30/include/mach/board.h b/arch/arm/mach-rk30/include/mach/board.h index 4e96f5ed77c5..ca047030cf04 100644 --- a/arch/arm/mach-rk30/include/mach/board.h +++ b/arch/arm/mach-rk30/include/mach/board.h @@ -64,6 +64,9 @@ struct rt3261_platform_data{ unsigned int spk_num; unsigned int modem_input_mode; unsigned int lout_to_modem_mode; + unsigned int spk_amplify; + unsigned int playback_if1_data_control; + unsigned int playback_if2_data_control; }; extern struct rk29_sdmmc_platform_data default_sdmmc0_data; diff --git a/sound/soc/codecs/rt3261.c b/sound/soc/codecs/rt3261.c index 7c26a92ebe16..e01113443682 100755 --- a/sound/soc/codecs/rt3261.c +++ b/sound/soc/codecs/rt3261.c @@ -132,27 +132,16 @@ static int rt3261_customer_redefine(struct snd_soc_codec *codec, struct rt3261_p RT3261_M_SV_R_SPM_R, 1 << RT3261_M_SV_R_SPM_R_SFT); } - if(rt3261->modem_input_mode==DIFFERENTIAL) - { - snd_soc_update_bits(codec, RT3261_IN3_IN4, - RT3261_IN_DF2, 1 << RT3261_IN_SFT2); - } - else - { - snd_soc_update_bits(codec, RT3261_IN3_IN4, - RT3261_IN_DF2, 0 << RT3261_IN_SFT2); - } - if(rt3261->lout_to_modem_mode==DIFFERENTIAL) - { - snd_soc_update_bits(codec, RT3261_GEN_CTRL1, - RT3261_LOUT_DF_MASK, 1 << RT3261_LOUT_DF); - } - else - { - snd_soc_update_bits(codec, RT3261_GEN_CTRL1, - RT3261_LOUT_DF_MASK, 0 << RT3261_LOUT_DF); - } + snd_soc_update_bits(codec, RT3261_IN3_IN4, + RT3261_IN_DF2, rt3261->modem_input_mode << RT3261_IN_SFT2); + snd_soc_update_bits(codec, RT3261_GEN_CTRL1, + RT3261_LOUT_DF_MASK, rt3261->lout_to_modem_mode << RT3261_LOUT_DF); + snd_soc_update_bits(codec, RT3261_SPO_CLSD_RATIO, + RT3261_SPO_CLSD_RATIO_MASK, rt3261->spk_amplify); + snd_soc_update_bits(codec, RT3261_DIG_INF_DATA, + RT3261_IF1_DAC_SEL_MASK | RT3261_IF2_DAC_SEL_MASK, + (rt3261->playback_if1_data_control<playback_if2_data_control<spk_num = pdata->spk_num; rt3261->modem_input_mode = pdata->modem_input_mode; rt3261->lout_to_modem_mode = pdata->lout_to_modem_mode; + rt3261->spk_amplify = pdata->spk_amplify; + rt3261->playback_if1_data_control = pdata->playback_if1_data_control; + rt3261->playback_if2_data_control = pdata->playback_if2_data_control; if(rt3261->io_init) rt3261->io_init(pdata->codec_en_gpio, pdata->codec_en_gpio_info.iomux_name, pdata->codec_en_gpio_info.iomux_mode); diff --git a/sound/soc/codecs/rt3261.h b/sound/soc/codecs/rt3261.h index b1f90a557ae3..1577bf0bb8a1 100755 --- a/sound/soc/codecs/rt3261.h +++ b/sound/soc/codecs/rt3261.h @@ -2154,6 +2154,9 @@ struct rt3261_priv { unsigned int spk_num; unsigned int modem_input_mode; unsigned int lout_to_modem_mode; + unsigned int spk_amplify; + unsigned int playback_if1_data_control; + unsigned int playback_if2_data_control; }; int rt3261_conn_mux_path(struct snd_soc_codec *codec, -- 2.34.1