summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUtkarshGupta <utkarsh.eminem@gmail.com>2014-03-01 14:12:44 +0530
committertilaksidduram <tilaksidduram@gmail.com>2014-03-24 19:23:31 +0530
commitd70bf47d8a3fbac42a70832bf920af23387b56c7 (patch)
treec52a258d433bc3a8d36e5f16b9e431663448df12
parent3e5fcd69f24368230865767623c7b6341091e7aa (diff)
downloaddevice_samsung_n7100-d70bf47d8a3fbac42a70832bf920af23387b56c7.zip
device_samsung_n7100-d70bf47d8a3fbac42a70832bf920af23387b56c7.tar.gz
device_samsung_n7100-d70bf47d8a3fbac42a70832bf920af23387b56c7.tar.bz2
n7100: audio: update hal
Change-Id: I67d8822b68096445dd96ed8f80d21322c778daf2 Conflicts: audio/audio_hw.c
-rw-r--r--[-rwxr-xr-x]audio/audio_hw.c66
-rw-r--r--audio/audio_hw.h8
-rw-r--r--configs/tiny_hw.xml89
3 files changed, 66 insertions, 97 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 50b0014..55044f0 100755..100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -73,7 +73,7 @@ struct pcm_config pcm_config_capture = {
struct pcm_config pcm_config_vx = {
.channels = 2,
- .rate = VX_NB_SAMPLING_RATE,
+ .rate = VX_WB_SAMPLING_RATE,
.period_size = 160,
.period_count = 2,
.format = PCM_FORMAT_S16_LE,
@@ -209,7 +209,7 @@ static void in_update_aux_channels(struct m0_stream_in *in, effect_handle_t effe
/* The enable flag when 0 makes the assumption that enums are disabled by
* "Off" and integers/booleans by 0 */
-static int set_voicecall_route_by_array(struct mixer *mixer, struct route_setting *route,
+static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *route,
int enable)
{
struct mixer_ctl *ctl;
@@ -360,7 +360,13 @@ static int start_call(struct m0_audio_device *adev)
int bt_on;
bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO;
- pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE;
+
+ if (bt_on) {
+ /* use amr-nb for bluetooth */
+ pcm_config_vx.rate = VX_NB_SAMPLING_RATE;
+ } else {
+ pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE;
+ }
/* Open modem PCM channels */
if (adev->pcm_modem_dl == NULL) {
@@ -592,19 +598,7 @@ static void select_mode(struct m0_audio_device *adev)
adev->in_call = 0;
end_call(adev);
force_all_standby(adev);
-
- ALOGD("%s: set voicecall route: voicecall_default_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1);
- ALOGD("%s: set voicecall route: default_input_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, default_input_disable, 1);
- ALOGD("%s: set voicecall route: headset_input_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1);
- ALOGD("%s: set voicecall route: bt_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, bt_disable, 1);
-
select_output_device(adev);
- //Force Input Standby
- adev->in_device = AUDIO_DEVICE_NONE;
select_input_device(adev);
}
}
@@ -690,41 +684,37 @@ static void select_output_device(struct m0_audio_device *adev)
if (headset_on || headphone_on || speaker_on || earpiece_on) {
ALOGD("%s: set voicecall route: voicecall_default", __func__);
- set_voicecall_route_by_array(adev->mixer, voicecall_default, 1);
+ set_bigroute_by_array(adev->mixer, voicecall_default, 1);
} else {
ALOGD("%s: set voicecall route: voicecall_default_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1);
+ set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1);
}
if (speaker_on || earpiece_on || headphone_on) {
ALOGD("%s: set voicecall route: default_input", __func__);
- set_voicecall_route_by_array(adev->mixer, default_input, 1);
+ set_bigroute_by_array(adev->mixer, default_input, 1);
} else {
ALOGD("%s: set voicecall route: default_input_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, default_input_disable, 1);
+ set_bigroute_by_array(adev->mixer, default_input_disable, 1);
}
if (headset_on) {
ALOGD("%s: set voicecall route: headset_input", __func__);
- set_voicecall_route_by_array(adev->mixer, headset_input, 1);
+ set_bigroute_by_array(adev->mixer, headset_input, 1);
} else {
ALOGD("%s: set voicecall route: headset_input_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1);
+ set_bigroute_by_array(adev->mixer, headset_input_disable, 1);
}
if (bt_on) {
- // bt uses a different port (PORT_BT) for playback, reopen the pcms
- end_call(adev);
- start_call(adev);
ALOGD("%s: set voicecall route: bt_input", __func__);
- set_voicecall_route_by_array(adev->mixer, bt_input, 1);
+ set_bigroute_by_array(adev->mixer, bt_input, 1);
ALOGD("%s: set voicecall route: bt_output", __func__);
- set_voicecall_route_by_array(adev->mixer, bt_output, 1);
+ set_bigroute_by_array(adev->mixer, bt_output, 1);
} else {
ALOGD("%s: set voicecall route: bt_disable", __func__);
- set_voicecall_route_by_array(adev->mixer, bt_disable, 1);
+ set_bigroute_by_array(adev->mixer, bt_disable, 1);
}
-
set_incall_device(adev);
}
}
@@ -738,9 +728,9 @@ static void select_input_device(struct m0_audio_device *adev)
ALOGD("%s: AUDIO_DEVICE_IN_BUILTIN_MIC", __func__);
break;
case AUDIO_DEVICE_IN_BACK_MIC:
- ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC", __func__);
// Force use both mics for video recording
adev->in_device = (AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC) & ~AUDIO_DEVICE_BIT_IN;
+ ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC and AUDIO_DEVICE_IN_BUILTIN_MIC", __func__);
break;
case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET:
ALOGD("%s: AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET", __func__);
@@ -2602,12 +2592,12 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
ALOGE("%s: enabling two mic control", __func__);
ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON);
/* sub mic */
- set_voicecall_route_by_array(adev->mixer, noise_suppression, 1);
+ set_bigroute_by_array(adev->mixer, noise_suppression, 1);
} else {
ALOGE("%s: disabling two mic control", __func__);
ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF);
/* sub mic */
- set_voicecall_route_by_array(adev->mixer, noise_suppression_disable, 1);
+ set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1);
}
}
@@ -2830,7 +2820,7 @@ static const struct {
{ AUDIO_DEVICE_OUT_SPEAKER, "speaker" },
{ AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "headphone" },
{ AUDIO_DEVICE_OUT_EARPIECE, "earpiece" },
- { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analog-dock" },
+ { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analogue-dock" },
{ AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "digital-dock" },
{ AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" },
{ AUDIO_DEVICE_OUT_AUX_DIGITAL, "aux-digital" },
@@ -3078,6 +3068,10 @@ static int adev_open(const hw_module_t* module, const char* name,
return -EINVAL;
}
+ /* +30db boost for mics */
+ adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume");
+ adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume");
+
ret = adev_config_parse(adev);
if (ret != 0)
goto err_mixer;
@@ -3086,13 +3080,9 @@ static int adev_open(const hw_module_t* module, const char* name,
pthread_mutex_lock(&adev->lock);
adev->mode = AUDIO_MODE_NORMAL;
adev->out_device = AUDIO_DEVICE_OUT_SPEAKER;
- adev->in_device = AUDIO_DEVICE_NONE;
+ adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN;
select_devices(adev);
- /* +30db boost for mics */
- adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume");
- adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume");
-
adev->pcm_modem_dl = NULL;
adev->pcm_modem_ul = NULL;
adev->pcm_bt_dl = NULL;
@@ -3128,7 +3118,7 @@ struct audio_module HAL_MODULE_INFO_SYM = {
.module_api_version = AUDIO_MODULE_API_VERSION_0_1,
.hal_api_version = HARDWARE_HAL_API_VERSION,
.id = AUDIO_HARDWARE_MODULE_ID,
- .name = "M0 audio HW HAL",
+ .name = "T03G audio HW HAL",
.author = "The CyanogenMod Project",
.methods = &hal_module_methods,
},
diff --git a/audio/audio_hw.h b/audio/audio_hw.h
index d7d68d9..889c249 100644
--- a/audio/audio_hw.h
+++ b/audio/audio_hw.h
@@ -134,6 +134,8 @@ struct route_setting voicecall_default_disable[] = {
{ .ctl_name = "AIF2DAC Mux", .strval = "AIF3DACDAT", },
{ .ctl_name = "Main Mic Switch", .intval = 0, },
{ .ctl_name = "MIXINL IN2L Switch", .intval = 0, },
+ { .ctl_name = "Sub Mic Switch", .intval = 0, },
+ { .ctl_name = "MIXINR IN1R Switch", .intval = 0, },
{ .ctl_name = NULL, },
};
@@ -177,7 +179,7 @@ struct route_setting headset_input[] = {
{ .ctl_name = "MIXINL IN2L Switch", .intval = 0, },
{ .ctl_name = "MIXINR IN1R Switch", .intval = 0, },
{ .ctl_name = "Headset Mic Switch", .intval = 1, },
- { .ctl_name = "IN1L Volume", .intval = 28, },
+ { .ctl_name = "IN1L Volume", .intval = 18, },
{ .ctl_name = "MIXINL IN1L Switch", .intval = 1, },
{ .ctl_name = "MIXINL IN1L Volume", .intval = 0, },
{ .ctl_name = "AIF1ADC1 HPF Mode", .intval = 1, },
@@ -208,8 +210,8 @@ struct route_setting bt_output[] = {
{ .ctl_name = "AIF2DAC2R Mixer AIF1.1 Switch", .intval = 1, },
{ .ctl_name = "AIF2DAC Volume", .intval = 96, },
{ .ctl_name = "MIXINL IN1L Volume", .intval = 1, },
- { .ctl_name = "IN2L Volume", .intval = 25, },
- { .ctl_name = "IN1R Volume", .intval = 25, },
+ { .ctl_name = "IN2L Volume", .intval = 28, },
+ { .ctl_name = "IN1R Volume", .intval = 28, },
{ .ctl_name = "LINEOUT1N Switch", .intval = 0, },
{ .ctl_name = "LINEOUT1P Switch", .intval = 0, },
{ .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, },
diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml
index bbdf2ec..017e9e7 100644
--- a/configs/tiny_hw.xml
+++ b/configs/tiny_hw.xml
@@ -10,6 +10,9 @@ We are able to have most of our routing static so do that
<ctl name="AIF2ADCL Source" val="0"/>
<ctl name="AIF2ADCR Source" val="1"/>
+ <!-- AIF1->DAC1 -->
+ <ctl name="DAC1 Switch" val="1"/>
+
<!-- general -->
<ctl name="IN1L ZC Switch" val="0"/>
<ctl name="IN1R ZC Switch" val="0"/>
@@ -124,10 +127,12 @@ We are able to have most of our routing static so do that
<ctl name="AIF1DAC1 Volume" val="96"/>
<ctl name="AIF1 Boost Volume" val="0"/>
<ctl name="DAC1 Volume" val="96"/>
+ <ctl name="Left Output Mixer DAC Volume" val="7"/>
+ <ctl name="Right Output Mixer DAC Volume" val="7"/>
<ctl name="SPKL DAC1 Volume" val="1"/>
<ctl name="SPKR DAC1 Volume" val="1"/>
<ctl name="Speaker Mixer Volume" val="3"/>
- <ctl name="Speaker Boost Volume" val="4"/>
+ <ctl name="Speaker Boost Volume" val="6"/>
<ctl name="Speaker Volume" val="57"/>
<ctl name="AIF1DAC1 EQ Switch" val="1"/>
<ctl name="AIF1DAC1 EQ1 Volume" val="9"/>
@@ -159,6 +164,7 @@ We are able to have most of our routing static so do that
<ctl name="Right Output Mixer DAC Volume" val="7"/>
<ctl name="Output Volume" val="57"/>
<ctl name="Earpiece Volume" val="1"/>
+ <ctl name="Speaker Mixer Volume" val="1"/>
</path>
<path name="off">
<ctl name="RCV Switch" val="0"/>
@@ -191,82 +197,59 @@ We are able to have most of our routing static so do that
<path name="off">
<ctl name="HP Switch" val="0"/>
<ctl name="AIF1DAC1 EQ Switch" val="0"/>
- <ctl name="Left Output Mixer DAC Volume" val="7"/>
- <ctl name="Right Output Mixer DAC Volume" val="7"/>
</path>
</device>
<device name="sco-out">
<path name="on">
- <ctl name="AIF1DAC1 Volume" val="96"/>
- <ctl name="AIF1 Boost Volume" val="0"/>
<ctl name="AIF3ADC Mux" val="1"/>
- <ctl name="AIF2ADC HPF Mode" val="3"/>
- <ctl name="AIF2ADC HPF Switch" val="1"/>
<ctl name="AIF2DAC2L Mixer AIF1.1 Switch" val="1"/>
<ctl name="AIF2DAC2R Mixer AIF1.1 Switch" val="1"/>
<ctl name="AIF2DAC Volume" val="96"/>
- <ctl name="AIF2ADC Volume" val="96"/>
<ctl name="DAC2 Volume" val="96"/>
<ctl name="AIF2ADC Volume" val="96"/>
+ <ctl name="Speaker Mixer Volume" val="1"/>
</path>
<path name="off">
- <ctl name="AIF1DAC1 Volume" val="96"/>
- <ctl name="AIF1 Boost Volume" val="0"/>
- <ctl name="DAC2 Volume" val="96"/>
- <ctl name="AIF2ADC Volume" val="96"/>
<ctl name="AIF2DAC2L Mixer AIF1.1 Switch" val="0"/>
<ctl name="AIF2DAC2R Mixer AIF1.1 Switch" val="0"/>
</path>
</device>
-<device name="analog-dock">
+<device name="analogue-dock">
<path name="on">
<ctl name="LINEOUT2N Switch" val="1"/>
<ctl name="LINEOUT2P Switch" val="1"/>
<ctl name="LINEOUT2N Mixer Left Output Switch" val="1"/>
- <ctl name="LINEOUT2N Mixer Right Output Switch" val="1"/>
+ <ctl name="LINEOUT2N Mixer Right Output Switch" val="0"/>
<ctl name="LINEOUT2P Mixer Right Output Switch" val="1"/>
<ctl name="LINE Switch" val="1"/>
- <ctl name="AIF1DAC1 Volume" val="96"/>
- <ctl name="AIF1 Boost Volume" val="0"/>
- <ctl name="DAC1 Volume" val="96"/>
+ <ctl name="LineoutSwitch Mode" val="1"/>
<ctl name="Left Output Mixer DAC Volume" val="7"/>
<ctl name="Right Output Mixer DAC Volume" val="7"/>
- <ctl name="Output Volume" val="55"/>
- <ctl name="LINEOUT2 Volume" val="1"/>
- <ctl name="LineoutSwitch Mode" val="1"/>
</path>
<path name="off">
+ <ctl name="LineoutSwitch Mode" val="0"/>
<ctl name="LINEOUT2N Switch" val="0"/>
<ctl name="LINEOUT2P Switch" val="0"/>
<ctl name="LINE Switch" val="0"/>
- <ctl name="AIF1DAC1 Volume" val="96"/>
- <ctl name="AIF1 Boost Volume" val="0"/>
- <ctl name="DAC1 Volume" val="96"/>
- <ctl name="Left Output Mixer DAC Volume" val="7"/>
- <ctl name="Right Output Mixer DAC Volume" val="7"/>
- <ctl name="Output Volume" val="57"/>
- <ctl name="LINEOUT2 Volume" val="1"/>
- <ctl name="LineoutSwitch Mode" val="0"/>
</path>
</device>
<device name="digital-dock">
<path name="on">
- <ctl name="LINEOUT1N Switch" val="1"/>
- <ctl name="LINEOUT1P Switch" val="1"/>
- <ctl name="HDMI Switch" val="1"/>
- <ctl name="AIF1DAC1 Volume" val="96"/>
+ <ctl name="LINEOUT2N Switch" val="1"/>
+ <ctl name="LINEOUT2P Switch" val="1"/>
+ <ctl name="LINEOUT2N Mixer Left Output Switch" val="1"/>
+ <ctl name="LINEOUT2N Mixer Right Output Switch" val="0"/>
+ <ctl name="LINEOUT2P Mixer Right Output Switch" val="1"/>
+ <ctl name="LINE Switch" val="1"/>
+ <ctl name="LineoutSwitch Mode" val="1"/>
+ <ctl name="Left Output Mixer DAC Volume" val="7"/>
+ <ctl name="Right Output Mixer DAC Volume" val="7"/>
</path>
<path name="off">
- <ctl name="LINEOUT1N Switch" val="0"/>
- <ctl name="LINEOUT1P Switch" val="0"/>
- <ctl name="HDMI Switch" val="0"/>
- <ctl name="AIF1DAC1 Volume" val="96"/>
- <ctl name="AIF1 Boost Volume" val="0"/>
- <ctl name="DAC1 Volume" val="96"/>
- <ctl name="SPKL DAC1 Volume" val="1"/>
- <ctl name="SPKR DAC1 Volume" val="1"/>
- <ctl name="Speaker Mixer Volume" val="0"/>
- <ctl name="Speaker Boost Volume" val="0"/>
+ <ctl name="LineoutSwitch Mode" val="0"/>
+ <ctl name="LINEOUT2N Switch" val="0"/>
+ <ctl name="LINEOUT2P Switch" val="0"/>
+ <ctl name="LINE Switch" val="0"/>
</path>
</device>
<device name="aux-digital">
@@ -298,14 +281,14 @@ We are able to have most of our routing static so do that
<ctl name="MainMicBias Mode" val="0"/>
<ctl name="MIXINL IN2L Switch" val="0"/>
<ctl name="MIXINL IN2L Volume" val="0"/>
- <ctl name="IN2L Volume" val="4"/>
+ <ctl name="IN2L Volume" val="10"/>
</path>
</device>
<device name="back-mic">
<path name="on">
<ctl name="Sub Mic Switch" val="1"/>
<ctl name="SubMicBias Mode" val="1"/>
- <ctl name="IN1R Volume" val="25"/>
+ <ctl name="IN1R Volume" val="28"/>
<ctl name="MIXINR IN1R Switch" val="1"/>
<ctl name="MIXINR IN1R Volume" val="1"/>
<ctl name="AIF1ADCR Source" val="1"/>
@@ -317,18 +300,16 @@ We are able to have most of our routing static so do that
<ctl name="Sub Mic Switch" val="0"/>
<ctl name="SubMicBias Mode" val="0"/>
<ctl name="MIXINR IN1R Switch" val="0"/>
- <ctl name="IN1R Volume" val="11"/>
+ <ctl name="IN1R Volume" val="10"/>
</path>
</device>
<device name="headset-in">
<path name="on">
- <ctl name="MIXINL IN2L Switch" val="0"/>
+ <ctl name="MIXINL IN1L Switch" val="0"/>
<ctl name="Headset Mic Switch" val="1"/>
- <ctl name="IN1L Volume" val="24"/>
+ <ctl name="IN1L Volume" val="22"/>
<ctl name="MIXINL IN1L Switch" val="1"/>
- <ctl name="MIXINL IN1L Volume" val="0"/>
- <ctl name="AIF2ADC HPF Mode" val="1"/>
- <ctl name="AIF2ADC HPF Switch" val="1"/>
+ <ctl name="MIXINL IN1L Volume" val="1"/>
<ctl name="AIF1ADC1 HPF Mode" val="1"/>
<ctl name="AIF1ADC1 HPF Switch" val="1"/>
<ctl name="AIF1ADC1 Volume" val="96"/>
@@ -337,9 +318,9 @@ We are able to have most of our routing static so do that
</path>
<path name="off">
<ctl name="Headset Mic Switch" val="0"/>
- <ctl name="IN1L Volume" val="11"/>
+ <ctl name="IN1L Volume" val="10"/>
<ctl name="MIXINL IN1L Switch" val="0"/>
- <ctl name="MIXINL IN1L Volume" val="0"/>
+ <ctl name="MIXINL IN1L Volume" val="1"/>
<ctl name="AIF1ADC1 HPF Mode" val="0"/>
<ctl name="AIF1ADC1 HPF Switch" val="0"/>
<ctl name="AIF1ADC1 Volume" val="96"/>
@@ -348,10 +329,6 @@ We are able to have most of our routing static so do that
<device name="sco-in">
<path name="on">
<ctl name="AIF2ADC Mux" val="1"/>
- <ctl name="AIF2ADC HPF Mode" val="3"/>
- <ctl name="AIF2ADC HPF Switch" val="1"/>
- <ctl name="AIF1ADCL Source" val="0"/>
- <ctl name="AIF1ADCR Source" val="1"/>
<ctl name="AIF1ADC1R Mixer AIF2 Switch" val="1"/>
<ctl name="AIF1ADC1L Mixer AIF2 Switch" val="1"/>
<ctl name="AIF1ADC1 Volume" val="96"/>