Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
android_hardware_qcom-caf_sm8350_audio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
halogenOS
android_hardware_qcom-caf_sm8350_audio
Commits
e9c4519d
Commit
e9c4519d
authored
1 year ago
by
qctecmdr
Committed by
Gerrit - the friendly Code Review server
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge "HAL: Support Mute and Unmute feature for compress offload path"
parents
2f19d4bd
2606fac6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hal/audio_extn/auto_hal.c
+42
-2
42 additions, 2 deletions
hal/audio_extn/auto_hal.c
with
42 additions
and
2 deletions
hal/audio_extn/auto_hal.c
+
42
−
2
View file @
e9c4519d
...
...
@@ -787,6 +787,32 @@ int auto_hal_set_audio_port_config(struct audio_hw_device *dev,
return
ret
;
}
static
int
auto_hal_out_set_compr_volume
(
struct
stream_out
*
out
,
float
left
,
float
right
)
{
/* Volume control for compress playback */
long
volume
[
2
];
char
mixer_ctl_name
[
128
];
struct
audio_device
*
adev
=
out
->
dev
;
struct
mixer_ctl
*
ctl
;
int
pcm_device_id
=
fp_platform_get_pcm_device_id
(
out
->
usecase
,
PCM_PLAYBACK
);
snprintf
(
mixer_ctl_name
,
sizeof
(
mixer_ctl_name
),
"Compress 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
;
}
ALOGE
(
"%s:ctl for mixer cmd - %s, left %f, right %f"
,
__func__
,
mixer_ctl_name
,
left
,
right
);
volume
[
0
]
=
(
int
)(
left
*
DSP_MAX_VOLUME
);
volume
[
1
]
=
(
int
)(
right
*
DSP_MAX_VOLUME
);
mixer_ctl_set_array
(
ctl
,
volume
,
sizeof
(
volume
)
/
sizeof
(
volume
[
0
]));
return
0
;
}
static
int
auto_hal_out_set_pcm_volume
(
struct
stream_out
*
out
,
float
volume
)
{
...
...
@@ -834,22 +860,36 @@ static void auto_hal_set_mute_duck_state(struct audio_device *adev,
switch
(
duck_mute_state
)
{
case
AUDIO_DEVICE_DUCKED
:
ALOGD
(
"%s: Ducking BUS device %s"
,
__func__
,
ptr
);
auto_hal_out_set_pcm_volume
(
out
,
DUCKED_VOLUME
);
if
(
out
->
flags
&
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD
){
ALOGD
(
"%s:%d Ducking compress offload path"
,
__func__
,
__LINE__
);
auto_hal_out_set_compr_volume
(
out
,
DUCKED_VOLUME
,
DUCKED_VOLUME
);
}
else
{
auto_hal_out_set_pcm_volume
(
out
,
DUCKED_VOLUME
);
}
break
;
case
AUDIO_DEVICE_UNDUCKED
:
ALOGD
(
"%s: Unducking BUS device %s"
,
__func__
,
ptr
);
auto_hal_out_set_pcm_volume
(
out
,
out
->
volume_l
);
if
(
out
->
flags
&
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD
){
ALOGD
(
"%s:%d Unducking compress offload path"
,
__func__
,
__LINE__
);
auto_hal_out_set_compr_volume
(
out
,
out
->
volume_l
,
out
->
volume_r
);
}
else
{
auto_hal_out_set_pcm_volume
(
out
,
out
->
volume_l
);
}
break
;
case
AUDIO_DEVICE_MUTED
:
ALOGD
(
"%s: Muting BUS device %s"
,
__func__
,
ptr
);
out
->
muted
=
true
;
if
(
out
&&
out
->
compr
)
auto_hal_out_set_compr_volume
(
out
,
DUCKED_VOLUME
,
DUCKED_VOLUME
);
break
;
case
AUDIO_DEVICE_UNMUTED
:
ALOGD
(
"%s: Unmuting BUS device %s"
,
__func__
,
ptr
);
out
->
muted
=
false
;
if
(
out
&&
out
->
compr
)
auto_hal_out_set_compr_volume
(
out
,
out
->
volume_l
,
out
->
volume_r
);
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment