tegra-alt: adsp: Add pcm_drain functionality

- TRIGGER_DRAIN support is added in pcm_trigger, which sends EOS
    message to ADSP; this is needed so that ADSP sends notification
    for last consumed buffer
 - DRAIN handling in pcm path is as per the implementation in native
    PCM driver

Bug 2117496

Change-Id: I530c16aaea3993569ecf2733f01d43b37df604c1
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1792940
Reviewed-on: https://git-master.nvidia.com/r/1806327
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Viswanath L
2018-08-06 13:23:19 +05:30
committed by Sameer Pujar
parent 8b02cb388e
commit ffdbb9edcd

View File

@@ -212,7 +212,8 @@ static const struct snd_pcm_hardware adsp_pcm_hardware = {
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_RESUME |
SNDRV_PCM_INFO_INTERLEAVED,
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_DRAIN_TRIGGER,
.formats = SNDRV_PCM_FMTBIT_S8 |
SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
@@ -1268,6 +1269,10 @@ static int tegra210_adsp_pcm_msg_handler(struct tegra210_adsp_app *app,
}
}
break;
case nvfx_apm_method_set_eos:
/* Nothing specific to be done here as DRAIN */
/* is implemented in native PCM driver */
break;
case nvfx_apm_method_ack:
complete(app->msg_complete);
break;
@@ -2178,6 +2183,16 @@ static int tegra210_adsp_pcm_trigger(struct snd_pcm_substream *substream,
return ret;
}
break;
case SNDRV_PCM_TRIGGER_DRAIN:
/* EOS message is sent so that ADSP sends */
/* notification for last consumed buffer */
ret = tegra210_adsp_send_eos_msg(prtd->fe_apm,
TEGRA210_ADSP_MSG_FLAG_SEND);
if (ret < 0) {
dev_err(prtd->dev, "Failed to set state drain");
return ret;
}
break;
default:
dev_err(prtd->dev, "Unsupported state.");
return -EINVAL;