diff options
author | Uk Kim <w0806.kim@samsung.com> | 2011-01-15 09:08:09 +0900 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2011-11-17 17:52:51 -0800 |
commit | d3a0fc7f77d13d04850103eabd9d7db3548a67ce (patch) | |
tree | b8a304d90ed046ea6464a9a30b856677eeb43445 /sound | |
parent | bb0dfdaff64373d80dfe724443e77506898cbb3b (diff) | |
download | kernel_samsung_crespo-d3a0fc7f77d13d04850103eabd9d7db3548a67ce.zip kernel_samsung_crespo-d3a0fc7f77d13d04850103eabd9d7db3548a67ce.tar.gz kernel_samsung_crespo-d3a0fc7f77d13d04850103eabd9d7db3548a67ce.tar.bz2 |
ASOC: support multi gain tables for several operator.
Change-Id: Iffc4340f37e80c446e212d656c5605687da6555d
Signed-off-by: Uk Kim <w0806.kim@samsung.com>
Diffstat (limited to 'sound')
-rwxr-xr-x | sound/soc/codecs/wm8994_herring.c | 46 | ||||
-rwxr-xr-x | sound/soc/codecs/wm8994_samsung.c | 18 | ||||
-rwxr-xr-x | sound/soc/codecs/wm8994_samsung.h | 12 |
3 files changed, 59 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm8994_herring.c b/sound/soc/codecs/wm8994_herring.c index 26d1d00..f760ac6 100755 --- a/sound/soc/codecs/wm8994_herring.c +++ b/sound/soc/codecs/wm8994_herring.c @@ -540,67 +540,67 @@ struct gain_info_t recording_gain_table[RECORDING_GAIN_NUM] = { struct gain_info_t gain_code_table[GAIN_CODE_NUM] = { /* Playback */ {/* HP */ - .mode = PLAYBACK_HP | PLAYBACK_MODE | GAIN_DIVISION_BIT, + .mode = PLAYBACK_HP | PLAYBACK_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_LEFT_OUTPUT_VOLUME, /* 1Ch */ .mask = WM8994_HPOUT1L_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x31 /* -8dB */ }, { - .mode = PLAYBACK_HP | PLAYBACK_MODE | GAIN_DIVISION_BIT, + .mode = PLAYBACK_HP | PLAYBACK_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_RIGHT_OUTPUT_VOLUME, /* 1Dh */ .mask = WM8994_HPOUT1R_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x31 /* -8dB */ }, {/* HP_NO_MIC */ - .mode = PLAYBACK_HP_NO_MIC | PLAYBACK_MODE | GAIN_DIVISION_BIT, + .mode = PLAYBACK_HP_NO_MIC | PLAYBACK_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_LEFT_OUTPUT_VOLUME, /* 1Ch */ .mask = WM8994_HPOUT1L_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x31 /* -8dB */ }, { - .mode = PLAYBACK_HP_NO_MIC | PLAYBACK_MODE | GAIN_DIVISION_BIT, + .mode = PLAYBACK_HP_NO_MIC | PLAYBACK_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_RIGHT_OUTPUT_VOLUME, /* 1Dh */ .mask = WM8994_HPOUT1R_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x31 /* -8dB */ }, {/* Voicecall RCV */ - .mode = VOICECALL_RCV | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_RCV | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_LEFT_LINE_INPUT_1_2_VOLUME, /* 18h */ .mask = WM8994_IN1L_VOL_MASK, .gain = WM8994_IN1L_VU | 0x14 /* +13.5dB */ }, {/* SPK */ - .mode = VOICECALL_SPK | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_SPK | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_LEFT_LINE_INPUT_1_2_VOLUME, /* 18h */ .mask = WM8994_IN1L_VOL_MASK, .gain = WM8994_IN1L_VU | 0x0D /* +3dB */ }, { - .mode = VOICECALL_SPK | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_SPK | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_SPEAKER_VOLUME_LEFT, /* 26h */ .mask = WM8994_SPKOUTL_VOL_MASK, .gain = WM8994_SPKOUT_VU | 0x3A /* +1dB */ }, {/* HP */ - .mode = VOICECALL_HP | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_HP | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, /* 1Ah */ .mask = WM8994_IN1R_VOL_MASK, .gain = WM8994_IN1R_VU | 0x1D /* +27dB */ }, { - .mode = VOICECALL_HP | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_HP | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_LEFT_OUTPUT_VOLUME, /* 1Ch */ .mask = WM8994_HPOUT1L_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x3a /* +1dB */ }, { - .mode = VOICECALL_HP | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_HP | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_RIGHT_OUTPUT_VOLUME, /* 1Dh */ .mask = WM8994_HPOUT1R_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x3a /* +1dB */ }, {/* HP_NO_MIC */ - .mode = VOICECALL_HP_NO_MIC | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_HP_NO_MIC | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_LEFT_LINE_INPUT_1_2_VOLUME, /* 18h */ .mask = WM8994_IN1L_VOL_MASK, .gain = WM8994_IN1L_VU | 0x12 /* +10.5dB */ }, { - .mode = VOICECALL_HP_NO_MIC | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_HP_NO_MIC | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_LEFT_OUTPUT_VOLUME, /* 1Ch */ .mask = WM8994_HPOUT1L_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x3a /* +1dB */ }, { - .mode = VOICECALL_HP_NO_MIC | VOICECALL_MODE | GAIN_DIVISION_BIT, + .mode = VOICECALL_HP_NO_MIC | VOICECALL_MODE | GAIN_DIVISION_BIT_1, .reg = WM8994_RIGHT_OUTPUT_VOLUME, /* 1Dh */ .mask = WM8994_HPOUT1R_VOL_MASK, .gain = WM8994_HPOUT1_VU | 0x3a /* +1dB */ @@ -2716,7 +2716,25 @@ int wm8994_set_codec_gain(struct snd_soc_codec *codec, u16 mode, u16 device) if (wm8994->gain_code) { gain_set_bits &= ~(COMMON_SET_BIT); - gain_set_bits |= (mode | GAIN_DIVISION_BIT); + + switch (wm8994->gain_code) { + case 1: + gain_set_bits |= (mode | GAIN_DIVISION_BIT_1); + break; + case 2: + gain_set_bits |= (mode | GAIN_DIVISION_BIT_2); + break; + case 3: + /* eur and eur tft device are same gain values currently + * but gain code is different because of modem. + */ + gain_set_bits |= (mode | GAIN_DIVISION_BIT_1); + break; + default: + DEBUG_LOG_ERR("gain_code(%d) isn't support", wm8994->gain_code); + return 0; + } + default_gain_table_p = gain_code_table; table_num = GAIN_CODE_NUM; diff --git a/sound/soc/codecs/wm8994_samsung.c b/sound/soc/codecs/wm8994_samsung.c index 84e8064..74a75dd 100755 --- a/sound/soc/codecs/wm8994_samsung.c +++ b/sound/soc/codecs/wm8994_samsung.c @@ -1209,6 +1209,17 @@ struct snd_soc_dai wm8994_dai = { .ops = &wm8994_ops, }; +/* gain_code range : integer 0~3 */ +static int is_valid_gain_code(char *str) +{ + if ((*str >= 0x30) && (*str <= 0x33)) + return 1; + else { + DEBUG_LOG_ERR("gain code is invalid (%d)", *str); + return 0; + } +} + static int __init gain_code_setup(char *str) { @@ -1219,8 +1230,11 @@ static int __init gain_code_setup(char *str) return 0; } - if (!strcmp(str, "1")) - gain_code = 1; + if (is_valid_gain_code(str)) { + gain_code = *str - 0x30; + DEBUG_LOG("gain_code : %d", gain_code); + } else + DEBUG_LOG_ERR("gain code is invalid and so use default value"); return 0; } diff --git a/sound/soc/codecs/wm8994_samsung.h b/sound/soc/codecs/wm8994_samsung.h index c82753c..e28937c 100755 --- a/sound/soc/codecs/wm8994_samsung.h +++ b/sound/soc/codecs/wm8994_samsung.h @@ -54,7 +54,17 @@ Codec Output Path BIT #define RECORDING_MODE (0x01 << 14) #define FMRADIO_MODE (0x01 << 15) -#define GAIN_DIVISION_BIT (0x01 << 16) +/* + * devide codec gain table + * GAIN_DIVISION_BIT_1 : EUR + * GAIN_DIVISION_BIT_2 : AT&T + * GAIN_DIVISION_BIT_3 : EUR_T + */ + +#define GAIN_DIVISION_BIT_1 (0x01 << 16) +#define GAIN_DIVISION_BIT_2 (0x01 << 17) +#define GAIN_DIVISION_BIT_3 (0x01 << 18) + #define COMMON_SET_BIT (0x01 << 0) #define PLAYBACK_RCV (0x01 << 1) #define PLAYBACK_SPK (0x01 << 2) |