audio: Support get output device mute in audiohal. [1/2]
PD#SWPL-191790
Problem:
getMute call audiohal api failed.
Solution:
Complete audiohal api called by getMute.
Verify:
yocto.
Change-Id: Idf3f076bbc098ac8761b3cf13e8b034743c065ac
Signed-off-by: yuliang.hu <yuliang.hu@amlogic.com>
diff --git a/audio_hal/audio_hw.c b/audio_hal/audio_hw.c
index 81291bd..9d61d19 100644
--- a/audio_hal/audio_hw.c
+++ b/audio_hal/audio_hw.c
@@ -3918,13 +3918,8 @@
ret = str_parms_get_int(parms, "Audio hdmi-out mute", &val);
if (ret >= 0) {
- /* for tv,hdmitx module is not registered, do not response this control interface */
- if (is_STB(adev)) {
- aml_mixer_ctrl_set_int(&adev->alsa_mixer, AML_MIXER_ID_HDMI_OUT_AUDIO_MUTE, val);
- AM_LOGI("audio hdmi out status: %d", val);
- } else {
- AM_LOGE("for tv,hdmitx module is not registered, do not response this control interface");
- }
+ set_output_device_mute(adev, AUDIO_DEVICE_OUT_HDMI, val, false);
+ AM_LOGI("set Audio hdmi-out mute status: %d", val);
goto exit;
}
@@ -4187,18 +4182,21 @@
ret = str_parms_get_int(parms, "speaker_mute", &val);
if (ret >= 0) {
set_output_device_mute(adev, AUDIO_DEVICE_OUT_SPEAKER, val, false);
+ AM_LOGI("set speaker_mute status: %d", val);
goto exit;
}
ret = str_parms_get_int(parms, "headphone_mute", &val);
if (ret >= 0) {
set_output_device_mute(adev, AUDIO_DEVICE_OUT_WIRED_HEADPHONE, val, false);
+ AM_LOGI("set headphone_mute status: %d", val);
goto exit;
}
ret = str_parms_get_int(parms, "ARC eARC mute", &val);
if (ret >= 0) {
set_output_device_mute(adev, AUDIO_DEVICE_OUT_HDMI_ARC, val, false);
+ AM_LOGI("set ARC eARC mute status: %d", val);
goto exit;
}
@@ -5698,6 +5696,37 @@
sprintf(temp_buf, "support_effect_list =%s", effect_list);
ALOGI("audio_effect_list: %s", temp_buf);
return strdup(temp_buf);
+ } else if (strstr (keys, "speaker_mute")) {
+ bool is_muted = is_output_device_muted(adev, AUDIO_DEVICE_OUT_SPEAKER, false);
+ sprintf (temp_buf, "speaker_mute=%d", is_muted);
+ return strdup (temp_buf);
+ } else if (strstr (keys, "headphone_mute")) {
+ bool is_muted = is_output_device_muted(adev, AUDIO_DEVICE_OUT_WIRED_HEADPHONE, false);
+ sprintf (temp_buf, "headphone_mute=%d", is_muted);
+ return strdup (temp_buf);
+ } else if (strstr (keys, "Audio spdif mute")) {
+ bool is_muted = is_output_device_muted(adev, AUDIO_DEVICE_OUT_SPDIF, false);
+ sprintf (temp_buf, "Audio spdif mute=%d", is_muted);
+ return strdup (temp_buf);
+ } else if (strstr (keys, "ARC eARC mute")) {
+ bool is_muted = is_output_device_muted(adev, AUDIO_DEVICE_OUT_HDMI_ARC, false);
+ sprintf (temp_buf, "ARC eARC mute=%d", is_muted);
+ return strdup (temp_buf);
+ } else if (strstr (keys, "Master volume")) {
+ int master_volume = 0;
+ if (is_STB(adev)) {
+ int dac_vol[2] = {0};
+ aml_mixer_ctrl_get_array(&adev->alsa_mixer, AML_MIXER_ID_DAC_DIGITAL_VOLUME, &dac_vol, 2);
+ master_volume = dac_vol[0];
+ } else {
+ master_volume = aml_mixer_ctrl_get_int(&adev->alsa_mixer, AML_MIXER_ID_AMP_MASTER_VOLUME);
+ }
+ sprintf (temp_buf, "Master volume=%d", master_volume);
+ return strdup (temp_buf);
+ } else if (strstr (keys, "Audio hdmi-out mute")) {
+ bool is_muted = is_output_device_muted(adev, AUDIO_DEVICE_OUT_HDMI, false);
+ sprintf (temp_buf, "Audio hdmi-out mute=%d", is_muted);
+ return strdup (temp_buf);
}
return strdup("");
}
diff --git a/audio_hal/audio_hw_resource_mgr.c b/audio_hal/audio_hw_resource_mgr.c
index b334832..5a3ff04 100644
--- a/audio_hal/audio_hw_resource_mgr.c
+++ b/audio_hal/audio_hw_resource_mgr.c
@@ -632,8 +632,21 @@
}
port_info->mute = enable;
break;
- case AUDIO_DEVICE_OUT_HDMI_ARC:
case AUDIO_DEVICE_OUT_HDMI:
+ /* for tv, hdmitx module is not registered, do not response this control interface */
+ if (is_STB(adev)) {
+ if (enable) {
+ audio_route_apply_path(mgr->ar, "hdmi_off");
+ } else {
+ audio_route_apply_path(mgr->ar, "hdmi");
+ }
+ audio_route_update_mixer(mgr->ar);
+ port_info->mute = enable;
+ } else {
+ AM_LOGE("for tv, hdmitx module is not registered, do not response this control interface");
+ }
+ break;
+ case AUDIO_DEVICE_OUT_HDMI_ARC:
if (extern_arc) {
aml_mixer_ctrl_set_int(mgr->mixer_ctrl, AML_MIXER_ID_SPDIF_MUTE, enable);
} else {