Revert "hal: Add volume control for pcm playback."
This reverts commit 1311b0bf848b9d31e653b21bb574ef92606874bc.
Change-Id: Iff6560159c84fc85d69846a2cc057eeb4ee9ce80
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index fc68210..db04b5a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -90,7 +90,6 @@
#define DIRECT_PCM_NUM_FRAGMENTS 2
#define COMPRESS_PLAYBACK_VOLUME_MAX 0x2000
#define VOIP_PLAYBACK_VOLUME_MAX 0x2000
-#define PCM_PLAYBACK_VOLUME_MAX 0x2000
#define DSD_VOLUME_MIN_DB (-110)
#define PROXY_OPEN_RETRY_COUNT 100
@@ -444,7 +443,6 @@
static int check_a2dp_restore_l(struct audio_device *adev, struct stream_out *out, bool restore);
static int out_set_compr_volume(struct audio_stream_out *stream, float left, float right);
static int out_set_voip_volume(struct audio_stream_out *stream, float left, float right);
-static int out_set_pcm_volume(struct audio_stream_out *stream, float left, float right);
static bool may_use_noirq_mode(struct audio_device *adev, audio_usecase_t uc_id,
int flags __unused)
@@ -3101,8 +3099,6 @@
// apply volume for voip playback after path is set up
if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP)
out_set_voip_volume(&out->stream, out->volume_l, out->volume_r);
- else if ((out->usecase == USECASE_AUDIO_PLAYBACK_LOW_LATENCY || out->usecase == USECASE_AUDIO_PLAYBACK_DEEP_BUFFER))
- out_set_pcm_volume(&out->stream, out->volume_l, out->volume_r);
} else {
platform_set_stream_channel_map(adev->platform, out->channel_mask,
out->pcm_device_id, &out->channel_map_param.channel_map[0]);
@@ -4159,33 +4155,6 @@
return 0;
}
-static int out_set_pcm_volume(struct audio_stream_out *stream, float left,
- float right)
-{
- struct stream_out *out = (struct stream_out *)stream;
- /* Volume control for pcm playback */
- if (left != right) {
- return -EINVAL;
- } else {
- char mixer_ctl_name [128];
- struct audio_device *adev = out->dev;
- struct mixer_ctl *ctl;
- int pcm_device_id = platform_get_pcm_device_id(out->usecase, PCM_PLAYBACK);
- snprintf(mixer_ctl_name, sizeof(mixer_ctl_name), "Playback %d Volume", pcm_device_id);
- ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
- if (!ctl) {
- ALOGE("%s : Could not get ctl for mixer cmd - %s", __func__, mixer_ctl_name);
- return -EINVAL;
- }
- int volume = (int) (left * PCM_PLAYBACK_VOLUME_MAX);
- mixer_ctl_set_value(ctl, 0, volume);
-
- ALOGV("%s : Pcm set volume value %d", __func__, volume);
-
- return 0;
- }
-}
-
static int out_set_volume(struct audio_stream_out *stream, float left,
float right)
{
@@ -4235,13 +4204,6 @@
out->volume_l = left;
out->volume_r = right;
return ret;
- } else {
- /* Volume control for pcm playback */
- if (!out->standby)
- ret = out_set_pcm_volume(stream, left, right);
- out->volume_l = left;
- out->volume_r = right;
- return ret;
}
return -ENOSYS;