Loading asoc/msm-pcm-loopback-v2.c +14 −4 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ static int msm_loopback_session_mute_put(struct snd_kcontrol *kcontrol, ret = -EINVAL; goto done; } mutex_lock(&loopback_session_lock); pr_debug("%s: mute=%d\n", __func__, mute); hfp_tx_mute = mute; for (n = 0; n < LOOPBACK_SESSION_MAX; n++) { Loading @@ -145,6 +145,7 @@ static int msm_loopback_session_mute_put(struct snd_kcontrol *kcontrol, pr_err("%s: Send mute command failed rc=%d\n", __func__, ret); } mutex_unlock(&loopback_session_lock); done: return ret; } Loading Loading @@ -347,6 +348,8 @@ static void stop_pcm(struct msm_pcm_loopback *pcm) if (pcm->audio_client == NULL) return; mutex_lock(&loopback_session_lock); q6asm_cmd(pcm->audio_client, CMD_CLOSE); if (pcm->playback_substream != NULL) { Loading @@ -361,6 +364,7 @@ static void stop_pcm(struct msm_pcm_loopback *pcm) } q6asm_audio_client_free(pcm->audio_client); pcm->audio_client = NULL; mutex_unlock(&loopback_session_lock); } static int msm_pcm_close(struct snd_pcm_substream *substream) Loading Loading @@ -537,13 +541,15 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, rc = -ENODEV; goto exit; } mutex_lock(&loopback_session_lock); prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; mutex_unlock(&loopback_session_lock); goto exit; } rc = pcm_loopback_set_volume(prtd, volume); mutex_unlock(&loopback_session_lock); exit: return rc; } Loading @@ -563,13 +569,15 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, rc = -ENODEV; goto exit; } mutex_lock(&loopback_session_lock); prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; mutex_unlock(&loopback_session_lock); goto exit; } ucontrol->value.integer.value[0] = prtd->volume; mutex_unlock(&loopback_session_lock); exit: return rc; } Loading Loading @@ -855,11 +863,13 @@ static int msm_pcm_channel_mixer_cfg_ctl_put(struct snd_kcontrol *kcontrol, session_type, chmixer_pspd); mutex_lock(&loopback_session_lock); if (chmixer_pspd->enable && substream->runtime) { prtd = substream->runtime->private_data; if (!prtd) { pr_err("%s find invalid prtd fail\n", __func__); ret = -EINVAL; mutex_unlock(&loopback_session_lock); goto done; } Loading @@ -872,7 +882,7 @@ static int msm_pcm_channel_mixer_cfg_ctl_put(struct snd_kcontrol *kcontrol, chmixer_pspd); } } mutex_unlock(&loopback_session_lock); if (reset_override_out_ch_map) chmixer_pspd->override_out_ch_map = false; if (reset_override_in_ch_map) Loading asoc/msm-pcm-q6-noirq.c +69 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/time.h> #include <linux/mutex.h> #include <linux/wait.h> #include <linux/platform_device.h> #include <linux/slab.h> Loading Loading @@ -630,6 +631,8 @@ static int msm_pcm_prepare(struct snd_pcm_substream *substream) static int msm_pcm_close(struct snd_pcm_substream *substream) { struct msm_plat_data *pdata = NULL; struct snd_soc_component *component = NULL; struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_pcm_runtime *soc_prtd = substream->private_data; struct msm_audio *prtd = runtime->private_data; Loading @@ -638,6 +641,25 @@ static int msm_pcm_close(struct snd_pcm_substream *substream) int dir = 0; int ret = 0; if (!soc_prtd) { pr_debug("%s private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); if (ac) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) dir = IN; Loading Loading @@ -672,6 +694,7 @@ static int msm_pcm_close(struct snd_pcm_substream *substream) SNDRV_PCM_STREAM_CAPTURE); kfree(prtd); runtime->private_data = NULL; mutex_unlock(&pdata->lock); return 0; } Loading @@ -696,8 +719,11 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct msm_plat_data *pdata = NULL; struct snd_pcm_substream *substream = vol->pcm->streams[vol->stream].substream; struct snd_soc_pcm_runtime *soc_prtd = NULL; struct snd_soc_component *component = NULL; struct msm_audio *prtd; pr_debug("%s\n", __func__); Loading @@ -705,13 +731,29 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, pr_err("%s substream not found\n", __func__); return -ENODEV; } if (!substream->runtime) { pr_debug("%s substream runtime not found\n", __func__); soc_prtd = substream->private_data; if (!substream->runtime || !soc_prtd) { pr_debug("%s substream runtime or private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) ucontrol->value.integer.value[0] = prtd->volume; mutex_unlock(&pdata->lock); return 0; } Loading @@ -720,8 +762,11 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, { int rc = 0; struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct msm_plat_data *pdata = NULL; struct snd_pcm_substream *substream = vol->pcm->streams[vol->stream].substream; struct snd_soc_pcm_runtime *soc_prtd = NULL; struct snd_soc_component *component = NULL; struct msm_audio *prtd; int volume = ucontrol->value.integer.value[0]; Loading @@ -730,15 +775,32 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, pr_err("%s substream not found\n", __func__); return -ENODEV; } if (!substream->runtime) { pr_err("%s substream runtime not found\n", __func__); soc_prtd = substream->private_data; if (!substream->runtime || !soc_prtd) { pr_err("%s substream runtime or private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) { rc = msm_pcm_set_volume(prtd, volume); prtd->volume = volume; } mutex_unlock(&pdata->lock); return rc; } Loading Loading @@ -1338,6 +1400,8 @@ static int msm_pcm_probe(struct platform_device *pdev) pdata->perf_mode = perf_mode; mutex_init(&pdata->lock); dev_set_drvdata(&pdev->dev, pdata); dev_dbg(&pdev->dev, "%s: dev name %s\n", Loading @@ -1359,6 +1423,7 @@ static int msm_pcm_remove(struct platform_device *pdev) dev_dbg(&pdev->dev, "Pull mode remove\n"); pdata = dev_get_drvdata(&pdev->dev); mutex_destroy(&pdata->lock); devm_kfree(&pdev->dev, pdata); snd_soc_unregister_component(&pdev->dev); return 0; Loading asoc/msm-pcm-q6-v2.c +28 −5 Original line number Diff line number Diff line Loading @@ -1309,10 +1309,10 @@ static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol, pdata = dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s pdata is NULL\n", __func__); ret = -ENODEV; goto done; return -ENODEV; } mutex_lock(&pdata->lock); substream = pdata->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; if (!substream) { pr_err("%s substream not found\n", __func__); Loading @@ -1339,7 +1339,6 @@ static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol, goto done; } mutex_lock(&pdata->lock); event_data = (struct msm_adsp_event_data *)ucontrol->value.bytes.data; if ((event_data->event_type < ADSP_STREAM_PP_EVENT) || (event_data->event_type >= ADSP_STREAM_EVENT_MAX)) { Loading Loading @@ -1514,8 +1513,11 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct msm_plat_data *pdata = NULL; struct snd_pcm_substream *substream = vol->pcm->streams[vol->stream].substream; struct snd_soc_pcm_runtime *soc_prtd = NULL; struct snd_soc_component *component = NULL; struct msm_audio *prtd; pr_debug("%s\n", __func__); Loading @@ -1523,13 +1525,30 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, pr_err("%s substream not found\n", __func__); return -ENODEV; } if (!substream->runtime) { pr_debug("%s substream runtime not found\n", __func__); soc_prtd = substream->private_data; if (!substream->runtime || !soc_prtd) { pr_debug("%s substream runtime or private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) ucontrol->value.integer.value[0] = prtd->volume; mutex_unlock(&pdata->lock); return 0; } Loading Loading @@ -1635,9 +1654,11 @@ static int msm_pcm_compress_ctl_get(struct snd_kcontrol *kcontrol, pr_debug("%s substream runtime not found\n", __func__); return 0; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) ucontrol->value.integer.value[0] = prtd->compress_enable; mutex_unlock(&pdata->lock); return 0; } Loading Loading @@ -1665,12 +1686,14 @@ static int msm_pcm_compress_ctl_put(struct snd_kcontrol *kcontrol, pr_err("%s substream runtime not found\n", __func__); return 0; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) { pr_debug("%s: setting compress flag to 0x%x\n", __func__, compress); prtd->compress_enable = compress; } mutex_unlock(&pdata->lock); return rc; } Loading Loading
asoc/msm-pcm-loopback-v2.c +14 −4 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ static int msm_loopback_session_mute_put(struct snd_kcontrol *kcontrol, ret = -EINVAL; goto done; } mutex_lock(&loopback_session_lock); pr_debug("%s: mute=%d\n", __func__, mute); hfp_tx_mute = mute; for (n = 0; n < LOOPBACK_SESSION_MAX; n++) { Loading @@ -145,6 +145,7 @@ static int msm_loopback_session_mute_put(struct snd_kcontrol *kcontrol, pr_err("%s: Send mute command failed rc=%d\n", __func__, ret); } mutex_unlock(&loopback_session_lock); done: return ret; } Loading Loading @@ -347,6 +348,8 @@ static void stop_pcm(struct msm_pcm_loopback *pcm) if (pcm->audio_client == NULL) return; mutex_lock(&loopback_session_lock); q6asm_cmd(pcm->audio_client, CMD_CLOSE); if (pcm->playback_substream != NULL) { Loading @@ -361,6 +364,7 @@ static void stop_pcm(struct msm_pcm_loopback *pcm) } q6asm_audio_client_free(pcm->audio_client); pcm->audio_client = NULL; mutex_unlock(&loopback_session_lock); } static int msm_pcm_close(struct snd_pcm_substream *substream) Loading Loading @@ -537,13 +541,15 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, rc = -ENODEV; goto exit; } mutex_lock(&loopback_session_lock); prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; mutex_unlock(&loopback_session_lock); goto exit; } rc = pcm_loopback_set_volume(prtd, volume); mutex_unlock(&loopback_session_lock); exit: return rc; } Loading @@ -563,13 +569,15 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, rc = -ENODEV; goto exit; } mutex_lock(&loopback_session_lock); prtd = substream->runtime->private_data; if (!prtd) { rc = -ENODEV; mutex_unlock(&loopback_session_lock); goto exit; } ucontrol->value.integer.value[0] = prtd->volume; mutex_unlock(&loopback_session_lock); exit: return rc; } Loading Loading @@ -855,11 +863,13 @@ static int msm_pcm_channel_mixer_cfg_ctl_put(struct snd_kcontrol *kcontrol, session_type, chmixer_pspd); mutex_lock(&loopback_session_lock); if (chmixer_pspd->enable && substream->runtime) { prtd = substream->runtime->private_data; if (!prtd) { pr_err("%s find invalid prtd fail\n", __func__); ret = -EINVAL; mutex_unlock(&loopback_session_lock); goto done; } Loading @@ -872,7 +882,7 @@ static int msm_pcm_channel_mixer_cfg_ctl_put(struct snd_kcontrol *kcontrol, chmixer_pspd); } } mutex_unlock(&loopback_session_lock); if (reset_override_out_ch_map) chmixer_pspd->override_out_ch_map = false; if (reset_override_in_ch_map) Loading
asoc/msm-pcm-q6-noirq.c +69 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/time.h> #include <linux/mutex.h> #include <linux/wait.h> #include <linux/platform_device.h> #include <linux/slab.h> Loading Loading @@ -630,6 +631,8 @@ static int msm_pcm_prepare(struct snd_pcm_substream *substream) static int msm_pcm_close(struct snd_pcm_substream *substream) { struct msm_plat_data *pdata = NULL; struct snd_soc_component *component = NULL; struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_pcm_runtime *soc_prtd = substream->private_data; struct msm_audio *prtd = runtime->private_data; Loading @@ -638,6 +641,25 @@ static int msm_pcm_close(struct snd_pcm_substream *substream) int dir = 0; int ret = 0; if (!soc_prtd) { pr_debug("%s private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); if (ac) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) dir = IN; Loading Loading @@ -672,6 +694,7 @@ static int msm_pcm_close(struct snd_pcm_substream *substream) SNDRV_PCM_STREAM_CAPTURE); kfree(prtd); runtime->private_data = NULL; mutex_unlock(&pdata->lock); return 0; } Loading @@ -696,8 +719,11 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct msm_plat_data *pdata = NULL; struct snd_pcm_substream *substream = vol->pcm->streams[vol->stream].substream; struct snd_soc_pcm_runtime *soc_prtd = NULL; struct snd_soc_component *component = NULL; struct msm_audio *prtd; pr_debug("%s\n", __func__); Loading @@ -705,13 +731,29 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, pr_err("%s substream not found\n", __func__); return -ENODEV; } if (!substream->runtime) { pr_debug("%s substream runtime not found\n", __func__); soc_prtd = substream->private_data; if (!substream->runtime || !soc_prtd) { pr_debug("%s substream runtime or private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) ucontrol->value.integer.value[0] = prtd->volume; mutex_unlock(&pdata->lock); return 0; } Loading @@ -720,8 +762,11 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, { int rc = 0; struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct msm_plat_data *pdata = NULL; struct snd_pcm_substream *substream = vol->pcm->streams[vol->stream].substream; struct snd_soc_pcm_runtime *soc_prtd = NULL; struct snd_soc_component *component = NULL; struct msm_audio *prtd; int volume = ucontrol->value.integer.value[0]; Loading @@ -730,15 +775,32 @@ static int msm_pcm_volume_ctl_put(struct snd_kcontrol *kcontrol, pr_err("%s substream not found\n", __func__); return -ENODEV; } if (!substream->runtime) { pr_err("%s substream runtime not found\n", __func__); soc_prtd = substream->private_data; if (!substream->runtime || !soc_prtd) { pr_err("%s substream runtime or private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) { rc = msm_pcm_set_volume(prtd, volume); prtd->volume = volume; } mutex_unlock(&pdata->lock); return rc; } Loading Loading @@ -1338,6 +1400,8 @@ static int msm_pcm_probe(struct platform_device *pdev) pdata->perf_mode = perf_mode; mutex_init(&pdata->lock); dev_set_drvdata(&pdev->dev, pdata); dev_dbg(&pdev->dev, "%s: dev name %s\n", Loading @@ -1359,6 +1423,7 @@ static int msm_pcm_remove(struct platform_device *pdev) dev_dbg(&pdev->dev, "Pull mode remove\n"); pdata = dev_get_drvdata(&pdev->dev); mutex_destroy(&pdata->lock); devm_kfree(&pdev->dev, pdata); snd_soc_unregister_component(&pdev->dev); return 0; Loading
asoc/msm-pcm-q6-v2.c +28 −5 Original line number Diff line number Diff line Loading @@ -1309,10 +1309,10 @@ static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol, pdata = dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s pdata is NULL\n", __func__); ret = -ENODEV; goto done; return -ENODEV; } mutex_lock(&pdata->lock); substream = pdata->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; if (!substream) { pr_err("%s substream not found\n", __func__); Loading @@ -1339,7 +1339,6 @@ static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol, goto done; } mutex_lock(&pdata->lock); event_data = (struct msm_adsp_event_data *)ucontrol->value.bytes.data; if ((event_data->event_type < ADSP_STREAM_PP_EVENT) || (event_data->event_type >= ADSP_STREAM_EVENT_MAX)) { Loading Loading @@ -1514,8 +1513,11 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_pcm_volume *vol = snd_kcontrol_chip(kcontrol); struct msm_plat_data *pdata = NULL; struct snd_pcm_substream *substream = vol->pcm->streams[vol->stream].substream; struct snd_soc_pcm_runtime *soc_prtd = NULL; struct snd_soc_component *component = NULL; struct msm_audio *prtd; pr_debug("%s\n", __func__); Loading @@ -1523,13 +1525,30 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol, pr_err("%s substream not found\n", __func__); return -ENODEV; } if (!substream->runtime) { pr_debug("%s substream runtime not found\n", __func__); soc_prtd = substream->private_data; if (!substream->runtime || !soc_prtd) { pr_debug("%s substream runtime or private_data not found\n", __func__); return 0; } component = snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME); if (!component) { pr_err("%s: component is NULL\n", __func__); return -EINVAL; } pdata = (struct msm_plat_data *) dev_get_drvdata(component->dev); if (!pdata) { pr_err("%s: pdata not found\n", __func__); return -ENODEV; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) ucontrol->value.integer.value[0] = prtd->volume; mutex_unlock(&pdata->lock); return 0; } Loading Loading @@ -1635,9 +1654,11 @@ static int msm_pcm_compress_ctl_get(struct snd_kcontrol *kcontrol, pr_debug("%s substream runtime not found\n", __func__); return 0; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) ucontrol->value.integer.value[0] = prtd->compress_enable; mutex_unlock(&pdata->lock); return 0; } Loading Loading @@ -1665,12 +1686,14 @@ static int msm_pcm_compress_ctl_put(struct snd_kcontrol *kcontrol, pr_err("%s substream runtime not found\n", __func__); return 0; } mutex_lock(&pdata->lock); prtd = substream->runtime->private_data; if (prtd) { pr_debug("%s: setting compress flag to 0x%x\n", __func__, compress); prtd->compress_enable = compress; } mutex_unlock(&pdata->lock); return rc; } Loading