diff options
| author | deadman96385 <seanhoyt963@gmail.com> | 2015-06-20 05:46:33 -0400 |
|---|---|---|
| committer | deadman96385 <seanhoyt963@gmail.com> | 2015-06-20 05:46:55 -0400 |
| commit | f6b47ffb18cdeef8b8a3cdc4aee760bfe370a025 (patch) | |
| tree | 07788b3bc591ce7f35276373ddbd89ff37e692a3 | |
| parent | 86a569fbaae4b438c7755fe870dc0b9c31c987e4 (diff) | |
Revert "Revert "audio: add hdmi routing support to the hal""
This reverts commit 92483665990072136299ba5a50466d4af6a10e23.
Change-Id: I9c107316a758018d0d2998e6d41bcabc7b19f316
| -rw-r--r-- | audio/Android.mk | 1 | ||||
| -rw-r--r-- | audio/audio_hw.c | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/audio/Android.mk b/audio/Android.mk index abd5908..cb1ef46 100644 --- a/audio/Android.mk +++ b/audio/Android.mk @@ -25,6 +25,7 @@ LOCAL_SRC_FILES := audio_hw.c ril_interface.c LOCAL_C_INCLUDES += \ external/tinyalsa/include \ + hardware/samsung_slsi/exynos5/include \ $(call include-path-for, audio-effects) \ $(call include-path-for, audio-utils) \ $(call include-path-for, audio-route) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 72fc8f8..40857ef 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -27,6 +27,7 @@ #include <stdint.h> #include <stdlib.h> #include <sys/time.h> +#include <fcntl.h> #include <cutils/log.h> #include <cutils/properties.h> @@ -35,6 +36,9 @@ #include <hardware/audio.h> #include <hardware/hardware.h> +#include <linux/videodev2.h> +#include <videodev2_exynos_media.h> + #include <system/audio.h> #include <tinyalsa/asoundlib.h> @@ -324,6 +328,30 @@ static void adev_set_call_audio_path(struct audio_device *adev); * stream_out mutexes. */ +static int enable_hdmi_audio(int enable) +{ + int fd; + int ret; + struct v4l2_control ctrl; + + fd = open("/dev/video16", O_RDWR); + if (fd < 0) { + ALOGE("cannot open /dev/video16 (%d)", fd); + return -ENOSYS; + } + + ctrl.id = V4L2_CID_TV_ENABLE_HDMI_AUDIO; + ctrl.value = !!enable; + ret = ioctl(fd, VIDIOC_S_CTRL, &ctrl); + + if (ret < 0) + ALOGE("V4L2_CID_TV_ENABLE_HDMI_AUDIO ioctl error (%d)", errno); + + close(fd); + + return ret; +} + static void select_devices(struct audio_device *adev) { int output_device_id = get_output_device_id(adev->out_device); @@ -335,6 +363,8 @@ static void select_devices(struct audio_device *adev) audio_route_reset(adev->ar); + enable_hdmi_audio(adev->out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL); + new_route_id = (1 << (input_source_id + OUT_DEVICE_CNT)) + (1 << output_device_id); if ((new_route_id == adev->cur_route_id) && (adev->es325_mode == adev->es325_new_mode)) return; @@ -398,6 +428,8 @@ static void select_devices(struct audio_device *adev) } + enable_hdmi_audio(adev->out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL); + audio_route_update_mixer(adev->ar); adev_set_call_audio_path(adev); |
