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;
-}
-
-int avs_control_volume_get2(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl)
+int avs_control_volume_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl)
{
struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value;
struct avs_control_data *ctl_data = mc->dobj.private;
return 0;
}
-int avs_control_volume_put2(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl)
+int avs_control_volume_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl)
{
struct avs_path_module *active_module;
struct avs_control_data *ctl_data;
struct avs_control_data {
u32 id;
-
- long volume;
long values[SND_SOC_TPLG_MAX_CHAN];
};
-int avs_control_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
-int avs_control_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
-int avs_control_volume_get2(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl);
-int avs_control_volume_put2(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl);
+int avs_control_volume_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl);
+int avs_control_volume_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *uctl);
int avs_control_volume_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo);
#endif