asoc: vote for Glink Rx thread priority upgrade

For Low-latency audio playback usecase, vote for a priority
upgrade for Glink Rx thread, to avoid any performance issue.

Change-Id: I8332c80eedd7325700e695f341fc4b92f65fd77c
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
This commit is contained in:
Banajit Goswami
2017-10-27 01:31:19 -07:00
committed by Gerrit - the friendly Code Review server
부모 8832732009
커밋 616e68cd4a

파일 보기

@@ -614,8 +614,15 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct msm_audio *prtd;
struct msm_plat_data *pdata;
int ret = 0;
pdata = (struct msm_plat_data *)
dev_get_drvdata(soc_prtd->platform->dev);
if (!pdata) {
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
}
prtd = kzalloc(sizeof(struct msm_audio), GFP_KERNEL);
if (prtd == NULL)
return -ENOMEM;
@@ -693,6 +700,10 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
prtd->reset_event = false;
runtime->private_data = prtd;
msm_adsp_init_mixer_ctl_pp_event_queue(soc_prtd);
/* Vote to update the Rx thread priority to RT Thread for playback */
if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) &&
(pdata->perf_mode == LOW_LATENCY_PCM_MODE))
apr_start_rx_rt(prtd->audio_client->apr);
return 0;
}
@@ -800,6 +811,7 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
struct msm_audio *prtd = runtime->private_data;
struct msm_plat_data *pdata;
uint32_t timeout;
int dir = 0;
int ret = 0;
@@ -809,6 +821,16 @@ static int msm_pcm_playback_close(struct snd_pcm_substream *substream)
if (prtd->audio_client) {
dir = IN;
/*
* Unvote to downgrade the Rx thread priority from
* RT Thread for Low-Latency use case.
*/
pdata = (struct msm_plat_data *)
dev_get_drvdata(soc_prtd->platform->dev);
if (pdata) {
if (pdata->perf_mode == LOW_LATENCY_PCM_MODE)
apr_end_rx_rt(prtd->audio_client->apr);
}
/* determine timeout length */
if (runtime->frame_bits == 0 || runtime->rate == 0) {
timeout = CMD_EOS_MIN_TIMEOUT_LENGTH;