diff options
Diffstat (limited to 'sound/soc/codecs')
-rwxr-xr-x | sound/soc/codecs/wm8994_herring.c | 58 | ||||
-rwxr-xr-x | sound/soc/codecs/wm8994_samsung.c | 27 | ||||
-rwxr-xr-x | sound/soc/codecs/wm8994_samsung.h | 9 |
3 files changed, 75 insertions, 19 deletions
diff --git a/sound/soc/codecs/wm8994_herring.c b/sound/soc/codecs/wm8994_herring.c index 29107b3..f01fc15 100755 --- a/sound/soc/codecs/wm8994_herring.c +++ b/sound/soc/codecs/wm8994_herring.c @@ -494,6 +494,46 @@ struct gain_info_t recording_gain_table[RECORDING_GAIN_NUM] = { .reg = WM8994_AIF1_ADC1_RIGHT_VOLUME, /* 401h */ .mask = WM8994_AIF1ADC1R_VOL_MASK, .gain = WM8994_AIF1ADC1_VU | 0xC0 + }, { /* CAMCORDER_MAIN */ + .mode = RECORDING_CAM_MAIN, + .reg = WM8994_LEFT_LINE_INPUT_1_2_VOLUME, /* 18h */ + .mask = WM8994_IN1L_VOL_MASK, + .gain = WM8994_IN1L_VU | 0x18 /* +19.5dB */ + }, { + .mode = RECORDING_CAM_MAIN, + .reg = WM8994_INPUT_MIXER_3, /* 29h */ + .mask = WM8994_IN1L_MIXINL_VOL_MASK | WM8994_MIXOUTL_MIXINL_VOL_MASK, + .gain = 0x10 /* 30dB */ + }, { + .mode = RECORDING_CAM_MAIN, + .reg = WM8994_AIF1_ADC1_LEFT_VOLUME, /* 400h */ + .mask = WM8994_AIF1ADC1L_VOL_MASK, + .gain = WM8994_AIF1ADC1_VU | 0xC0 /* +0dB */ + }, { + .mode = RECORDING_CAM_MAIN, + .reg = WM8994_AIF1_ADC1_RIGHT_VOLUME, /* 401h */ + .mask = WM8994_AIF1ADC1R_VOL_MASK, + .gain = WM8994_AIF1ADC1_VU | 0xC0 /* +0dB */ + }, { /* CAMCORDER_HP */ + .mode = RECORDING_CAM_HP, + .reg = WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, /* 1Ah */ + .mask = WM8994_IN1R_VOL_MASK, + .gain = WM8994_IN1R_VU | 0x15 /* +15dB */ + }, { + .mode = RECORDING_CAM_HP, + .reg = WM8994_INPUT_MIXER_4, /* 2Ah */ + .mask = WM8994_IN1R_MIXINR_VOL_MASK | WM8994_MIXOUTR_MIXINR_VOL_MASK, + .gain = 0x10 /* +30dB */ + }, { + .mode = RECORDING_CAM_HP, + .reg = WM8994_AIF1_ADC1_LEFT_VOLUME, /* 400h */ + .mask = WM8994_AIF1ADC1L_VOL_MASK, + .gain = WM8994_AIF1ADC1_VU | 0xC0 + }, { + .mode = RECORDING_CAM_HP, + .reg = WM8994_AIF1_ADC1_RIGHT_VOLUME, /* 401h */ + .mask = WM8994_AIF1ADC1R_VOL_MASK, + .gain = WM8994_AIF1ADC1_VU | 0xC0 }, }; @@ -1088,8 +1128,10 @@ void wm8994_record_headset_mic(struct snd_soc_codec *codec) val &= ~(WM8994_ADC1_TO_DAC2R_MASK); wm8994_write(codec, WM8994_DAC2_RIGHT_MIXER_ROUTING, val); - if (wm8994->recognition_active == REC_ON) + if (wm8994->input_source == RECOGNITION) wm8994_set_codec_gain(codec, RECORDING_MODE, RECORDING_REC_HP); + else if (wm8994->input_source == CAMCORDER) + wm8994_set_codec_gain(codec, RECORDING_MODE, RECORDING_CAM_HP); else wm8994_set_codec_gain(codec, RECORDING_MODE, RECORDING_HP); @@ -1194,9 +1236,12 @@ void wm8994_record_main_mic(struct snd_soc_codec *codec) val &= ~(WM8994_ADC1_TO_DAC2R_MASK); wm8994_write(codec, WM8994_DAC2_RIGHT_MIXER_ROUTING, val); - if (wm8994->recognition_active == REC_ON) + if (wm8994->input_source == RECOGNITION) wm8994_set_codec_gain(codec, RECORDING_MODE, RECORDING_REC_MAIN); + else if (wm8994->input_source == CAMCORDER) + wm8994_set_codec_gain(codec, RECORDING_MODE, + RECORDING_CAM_MAIN); else wm8994_set_codec_gain(codec, RECORDING_MODE, RECORDING_MAIN); @@ -2638,6 +2683,15 @@ int wm8994_set_codec_gain(struct snd_soc_codec *codec, u16 mode, u16 device) case RECORDING_REC_BT: gain_set_bits |= RECORDING_REC_BT; break; + case RECORDING_CAM_MAIN: + gain_set_bits |= RECORDING_CAM_MAIN; + break; + case RECORDING_CAM_HP: + gain_set_bits |= RECORDING_CAM_HP; + break; + case RECORDING_CAM_BT: + gain_set_bits |= RECORDING_CAM_BT; + break; default: pr_err("recording gain flag is wrong\n"); } diff --git a/sound/soc/codecs/wm8994_samsung.c b/sound/soc/codecs/wm8994_samsung.c index fb87d11..d3e5385 100755 --- a/sound/soc/codecs/wm8994_samsung.c +++ b/sound/soc/codecs/wm8994_samsung.c @@ -282,8 +282,8 @@ static const char *voicecall_path[] = { "OFF", "RCV", "SPK", "HP", "HP_NO_MIC", "BT" }; static const char *mic_path[] = { "Main Mic", "Hands Free Mic", "BT Sco Mic", "MIC OFF" }; -static const char *recognition_state[] = { "RECOGNITION_OFF", - "RECOGNITION_ON" }; +static const char *input_source_state[] = { "Default", "Voice Recognition", + "Camcorder" }; static int wm8994_get_mic_path(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -460,18 +460,18 @@ static int wm8994_set_voice_path(struct snd_kcontrol *kcontrol, return 0; } -static int wm8994_get_recognition_status(struct snd_kcontrol *kcontrol, +static int wm8994_get_input_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct wm8994_priv *wm8994 = codec->drvdata; - DEBUG_LOG("recognition_state = [%d]", wm8994->recognition_active); + DEBUG_LOG("input_source_state = [%d]", wm8994->input_source); - return wm8994->recognition_active; + return wm8994->input_source; } -static int wm8994_set_recognition_status(struct snd_kcontrol *kcontrol, +static int wm8994_set_input_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); @@ -479,10 +479,10 @@ static int wm8994_set_recognition_status(struct snd_kcontrol *kcontrol, int control_flag = ucontrol->value.integer.value[0]; - DEBUG_LOG("Changed recognition state [%d] => [%d]", - wm8994->recognition_active, control_flag); + DEBUG_LOG("Changed input_source state [%d] => [%d]", + wm8994->input_source, control_flag); - wm8994->recognition_active = control_flag; + wm8994->input_source = control_flag; return 0; } @@ -519,7 +519,7 @@ static const struct soc_enum path_control_enum[] = { SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(playback_path), playback_path), SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(voicecall_path), voicecall_path), SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(mic_path), mic_path), - SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(recognition_state), recognition_state), + SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(input_source_state), input_source_state), }; static const struct snd_kcontrol_new wm8994_snd_controls[] = { @@ -552,9 +552,8 @@ static const struct snd_kcontrol_new wm8994_snd_controls[] = { SOC_ENUM_EXT("Clock Control", clock_control_enum[0], s3c_pcmdev_get_clock, s3c_pcmdev_set_clock), #endif - SOC_ENUM_EXT("Recognition Control", path_control_enum[3], - wm8994_get_recognition_status, - wm8994_set_recognition_status), + SOC_ENUM_EXT("Input Source", path_control_enum[3], + wm8994_get_input_source, wm8994_set_input_source), }; @@ -2868,7 +2867,7 @@ static int wm8994_init(struct wm8994_priv *wm8994_private, wm8994->cur_path = OFF; wm8994->rec_path = MIC_OFF; wm8994->power_state = CODEC_OFF; - wm8994->recognition_active = REC_OFF; + wm8994->input_source = DEFAULT; wm8994->ringtone_active = RING_OFF; wm8994->pdata = pdata; diff --git a/sound/soc/codecs/wm8994_samsung.h b/sound/soc/codecs/wm8994_samsung.h index b5b88f7..c82753c 100755 --- a/sound/soc/codecs/wm8994_samsung.h +++ b/sound/soc/codecs/wm8994_samsung.h @@ -78,10 +78,13 @@ Codec Output Path BIT #define RECORDING_REC_MAIN (0x01 << 4) #define RECORDING_REC_HP (0x01 << 5) #define RECORDING_REC_BT (0x01 << 6) +#define RECORDING_CAM_MAIN (0x01 << 7) +#define RECORDING_CAM_HP (0x01 << 8) +#define RECORDING_CAM_BT (0x01 << 9) #define PLAYBACK_GAIN_NUM 43 #define VOICECALL_GAIN_NUM 32 -#define RECORDING_GAIN_NUM 16 +#define RECORDING_GAIN_NUM 24 #define GAIN_CODE_NUM 13 /* * Definitions of enum type @@ -93,7 +96,7 @@ enum audio_path { enum mic_path {MAIN, SUB, BT_REC, MIC_OFF}; enum power_state {CODEC_OFF, CODEC_ON }; enum ringtone_state {RING_OFF, RING_ON}; -enum recognition {REC_OFF, REC_ON}; +enum input_source_state {DEFAULT, RECOGNITION, CAMCORDER}; typedef void (*select_route)(struct snd_soc_codec *); typedef void (*select_mic_route)(struct snd_soc_codec *); @@ -125,7 +128,7 @@ struct wm8994_priv { enum audio_path cur_path; enum mic_path rec_path; enum power_state power_state; - enum recognition recognition_active; + enum input_source_state input_source; enum ringtone_state ringtone_active; select_route *universal_playback_path; select_route *universal_voicecall_path; |