Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
bac4d82
Documentation
LICENSES
arch
block
certs
crypto
drivers
fs
include
init
io_uring
ipc
kernel
lib
mm
net
rust
samples
scripts
security
sound
ac97
aoa
arm
atmel
core
drivers
firewire
hda
i2c
isa
mips
oss
parisc
pci
pcmcia
ppc
sh
soc
adi
amd
apple
atmel
au1x
bcm
cirrus
codecs
dwc
fsl
generic
hisilicon
img
intel
atom
avs
boards
Makefile
apl.c
avs.h
board_selection.c
cldma.c
cldma.h
control.c
control.h
core.c
debugfs.c
dsp.c
ipc.c
loader.c
messages.c
messages.h
path.c
path.h
pcm.c
probes.c
registers.h
skl.c
topology.c
topology.h
trace.c
trace.h
utils.c
boards
catpt
common
keembay
skylake
Kconfig
Makefile
jz4740
kirkwood
mediatek
meson
mxs
pxa
qcom
rockchip
samsung
sh
sof
spear
sprd
sti
stm
sunxi
tegra
ti
uniphier
ux500
xilinx
xtensa
Kconfig
Makefile
soc-ac97.c
soc-acpi.c
soc-card.c
soc-component.c
soc-compress.c
soc-core.c
soc-dai.c
soc-dapm.c
soc-devres.c
soc-generic-dmaengine-pcm.c
soc-jack.c
soc-link.c
soc-ops.c
soc-pcm.c
soc-topology-test.c
soc-topology.c
soc-utils-test.c
soc-utils.c
sparc
spi
synth
usb
virtio
x86
xen
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
sound
/
soc
/
intel
/
avs
/
control.c
Copy path
Blame
Blame
Latest commit
History
History
113 lines (93 loc) · 3.17 KB
Breadcrumbs
linux
/
sound
/
soc
/
intel
/
avs
/
control.c
Top
File metadata and controls
Code
Blame
113 lines (93 loc) · 3.17 KB
Raw
// SPDX-License-Identifier: GPL-2.0-only // // Copyright(c) 2021-2022 Intel Corporation. All rights reserved. // // Authors: Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com> // Cezary Rojewski <cezary.rojewski@intel.com> // #include <sound/soc.h> #include "avs.h" #include "control.h" #include "messages.h" #include "path.h" static struct avs_dev *avs_get_kcontrol_adev(struct snd_kcontrol *kcontrol) { struct snd_soc_dapm_widget *w; w = snd_soc_dapm_kcontrol_widget(kcontrol); return to_avs_dev(w->dapm->component->dev); } static struct avs_path_module *avs_get_volume_module(struct avs_dev *adev, u32 id) { struct avs_path *path; struct avs_path_pipeline *ppl; struct avs_path_module *mod; spin_lock(&adev->path_list_lock); list_for_each_entry(path, &adev->path_list, node) { list_for_each_entry(ppl, &path->ppl_list, node) { list_for_each_entry(mod, &ppl->mod_list, node) { if (guid_equal(&mod->template->cfg_ext->type, &AVS_PEAKVOL_MOD_UUID) && mod->template->ctl_id == id) { spin_unlock(&adev->path_list_lock); return mod; } } } } spin_unlock(&adev->path_list_lock); return NULL; } int avs_control_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; struct avs_control_data *ctl_data = (struct avs_control_data *)mc->dobj.private; struct avs_dev *adev = avs_get_kcontrol_adev(kcontrol); struct avs_volume_cfg *dspvols = NULL; struct avs_path_module *active_module; size_t num_dspvols; int ret = 0; /* prevent access to modules while path is being constructed */ mutex_lock(&adev->path_mutex); active_module = avs_get_volume_module(adev, ctl_data->id); if (active_module) { ret = avs_ipc_peakvol_get_volume(adev, active_module->module_id, active_module->instance_id, &dspvols, &num_dspvols); if (!ret) ucontrol->value.integer.value[0] = dspvols[0].target_volume; ret = AVS_IPC_RET(ret); kfree(dspvols); } else { ucontrol->value.integer.value[0] = ctl_data->volume; } mutex_unlock(&adev->path_mutex); return ret; } int avs_control_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; struct avs_control_data *ctl_data = (struct avs_control_data *)mc->dobj.private; struct avs_dev *adev = avs_get_kcontrol_adev(kcontrol); long *volume = &ctl_data->volume; struct avs_path_module *active_module; struct avs_volume_cfg dspvol = {0}; long ctlvol = ucontrol->value.integer.value[0]; int ret = 0, changed = 0; if (ctlvol < 0 || ctlvol > mc->max) return -EINVAL; /* prevent access to modules while path is being constructed */ mutex_lock(&adev->path_mutex); if (*volume != ctlvol) { *volume = ctlvol; changed = 1; } active_module = avs_get_volume_module(adev, ctl_data->id); if (active_module) { dspvol.channel_id = AVS_ALL_CHANNELS_MASK; dspvol.target_volume = *volume; ret = avs_ipc_peakvol_set_volume(adev, active_module->module_id, active_module->instance_id, &dspvol); ret = AVS_IPC_RET(ret); } mutex_unlock(&adev->path_mutex); return ret ? ret : changed; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
You can’t perform that action at this time.