Loading sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c +44 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ struct msm_pcm_loopback { int capture_start; int session_id; struct audio_client *audio_client; int volume; uint32_t volume; }; struct fe_dai_session_map { Loading Loading @@ -150,7 +150,8 @@ static int msm_pcm_loopback_probe(struct snd_soc_platform *platform) return 0; } static int pcm_loopback_set_volume(struct msm_pcm_loopback *prtd, int volume) static int pcm_loopback_set_volume(struct msm_pcm_loopback *prtd, uint32_t volume) { int rc = -EINVAL; Loading Loading @@ -459,10 +460,49 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, int rc = 0; struct snd_pcm_volume *vol = kcontrol->private_data; struct snd_pcm_substream *substream = vol->pcm->streams[0].substream; struct msm_pcm_loopback *prtd = substream->runtime->private_data; struct msm_pcm_loopback *prtd; int volume = ucontrol->value.integer.value[0]; pr_debug("%s: volume : 0x%x\n", __func__, volume); if ((!substream) || (!substream->runtime)) { pr_err("%s substream or runtime not found\n", __func__); rc = -ENODEV; goto exit; } prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; goto exit; } rc = pcm_loopback_set_volume(prtd, volume); exit: return rc; } static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int rc = 0; struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct snd_pcm_substream *substream = vol->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; struct msm_pcm_loopback *prtd; pr_debug("%s\n", __func__); if ((!substream) || (!substream->runtime)) { pr_err("%s substream or runtime not found\n", __func__); rc = -ENODEV; goto exit; } prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; goto exit; } ucontrol->value.integer.value[0] = prtd->volume; exit: return rc; } Loading @@ -482,6 +522,7 @@ static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) return ret; kctl = volume_info->kctl; kctl->put = msm_pcm_volume_ctl_put; kctl->get = msm_pcm_volume_ctl_get; kctl->tlv.p = loopback_rx_vol_gain; return 0; } Loading Loading
sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c +44 −3 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ struct msm_pcm_loopback { int capture_start; int session_id; struct audio_client *audio_client; int volume; uint32_t volume; }; struct fe_dai_session_map { Loading Loading @@ -150,7 +150,8 @@ static int msm_pcm_loopback_probe(struct snd_soc_platform *platform) return 0; } static int pcm_loopback_set_volume(struct msm_pcm_loopback *prtd, int volume) static int pcm_loopback_set_volume(struct msm_pcm_loopback *prtd, uint32_t volume) { int rc = -EINVAL; Loading Loading @@ -459,10 +460,49 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, int rc = 0; struct snd_pcm_volume *vol = kcontrol->private_data; struct snd_pcm_substream *substream = vol->pcm->streams[0].substream; struct msm_pcm_loopback *prtd = substream->runtime->private_data; struct msm_pcm_loopback *prtd; int volume = ucontrol->value.integer.value[0]; pr_debug("%s: volume : 0x%x\n", __func__, volume); if ((!substream) || (!substream->runtime)) { pr_err("%s substream or runtime not found\n", __func__); rc = -ENODEV; goto exit; } prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; goto exit; } rc = pcm_loopback_set_volume(prtd, volume); exit: return rc; } static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int rc = 0; struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct snd_pcm_substream *substream = vol->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; struct msm_pcm_loopback *prtd; pr_debug("%s\n", __func__); if ((!substream) || (!substream->runtime)) { pr_err("%s substream or runtime not found\n", __func__); rc = -ENODEV; goto exit; } prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; goto exit; } ucontrol->value.integer.value[0] = prtd->volume; exit: return rc; } Loading @@ -482,6 +522,7 @@ static int msm_pcm_add_controls(struct snd_soc_pcm_runtime *rtd) return ret; kctl = volume_info->kctl; kctl->put = msm_pcm_volume_ctl_put; kctl->get = msm_pcm_volume_ctl_get; kctl->tlv.p = loopback_rx_vol_gain; return 0; } Loading