[alsa-devel] [PATCH 0/2] ASoC: Intel: Export Baytrail PCM streams under one DAI
It wasn't necessary to export Baytrail SST PCM streams under separate DAI links and complicated needlessly basic ALSA command usage (for instance arecord).
This set exports PCM playback/capture streams under one DAI. Change should be safe now since known users are already converted and to my understanding no other distribution is using this yet (mainly due missing firmware).
Liam Girdwood (2): ASoC: Intel: Make Baytrail PCM data per stream rather than per DAI device ASoC: Intel: Only export one Baytrail DAI
sound/soc/intel/byt-rt5640.c | 14 +------------- sound/soc/intel/sst-baytrail-pcm.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 26 deletions(-)
From: Liam Girdwood liam.r.girdwood@linux.intel.com
Prepare for single Baytrail DAI playback/capture link by accessing PCM data using stream ID instead of rtd->dev. Now rtd->dev is unique for playback and capture since they are exported as separate DAIs but not once converted to single DAI.
[Jarkko: Separated from another commit with updated commit log]
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com Signed-off-by: Jarkko Nikula jarkko.nikula@linux.intel.com --- sound/soc/intel/sst-baytrail-pcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/intel/sst-baytrail-pcm.c b/sound/soc/intel/sst-baytrail-pcm.c index 0afb3491f5f0..73bb68119b9e 100644 --- a/sound/soc/intel/sst-baytrail-pcm.c +++ b/sound/soc/intel/sst-baytrail-pcm.c @@ -68,7 +68,7 @@ static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct sst_byt_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); - struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); + struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt *byt = pdata->byt; u32 rate, bits; u8 channels; @@ -140,7 +140,7 @@ static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substrea struct snd_soc_pcm_runtime *rtd = substream->private_data; struct sst_byt_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); - struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); + struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt *byt = pdata->byt; int ret;
@@ -172,7 +172,7 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) struct snd_soc_pcm_runtime *rtd = substream->private_data; struct sst_byt_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); - struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); + struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt *byt = pdata->byt;
dev_dbg(rtd->dev, "PCM: trigger %d\n", cmd); @@ -229,7 +229,9 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; - struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); + struct sst_byt_priv_data *pdata = + snd_soc_platform_get_drvdata(rtd->platform); + struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
dev_dbg(rtd->dev, "PCM: DMA pointer %u bytes\n", pcm_data->hw_ptr);
@@ -241,15 +243,13 @@ static int sst_byt_pcm_open(struct snd_pcm_substream *substream) struct snd_soc_pcm_runtime *rtd = substream->private_data; struct sst_byt_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); - struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); + struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt *byt = pdata->byt;
dev_dbg(rtd->dev, "PCM: open\n");
- pcm_data = &pdata->pcm[rtd->cpu_dai->id]; mutex_lock(&pcm_data->mutex);
- snd_soc_pcm_set_drvdata(rtd, pcm_data); pcm_data->substream = substream;
snd_soc_set_runtime_hwparams(substream, &sst_byt_pcm_hardware); @@ -271,7 +271,7 @@ static int sst_byt_pcm_close(struct snd_pcm_substream *substream) struct snd_soc_pcm_runtime *rtd = substream->private_data; struct sst_byt_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); - struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); + struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; struct sst_byt *byt = pdata->byt; int ret;
From: Liam Girdwood liam.r.girdwood@linux.intel.com
We don't need more than one DAI for Baytrail SST. Usage becomes also more straightforward by grouping playback and capture streams under the same PCM device.
[Jarkko: I made Liam's sst-baytrail-pcm.c change a few lines smaller and squashed together with my byt-rt5640.c change]
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com Signed-off-by: Jarkko Nikula jarkko.nikula@linux.intel.com --- sound/soc/intel/byt-rt5640.c | 14 +------------- sound/soc/intel/sst-baytrail-pcm.c | 7 ++----- 2 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/sound/soc/intel/byt-rt5640.c b/sound/soc/intel/byt-rt5640.c index 9061616f0f45..dbc63d09f424 100644 --- a/sound/soc/intel/byt-rt5640.c +++ b/sound/soc/intel/byt-rt5640.c @@ -117,7 +117,7 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { { .name = "Baytrail Audio", .stream_name = "Audio", - .cpu_dai_name = "Front-cpu-dai", + .cpu_dai_name = "baytrail-pcm-audio", .codec_dai_name = "rt5640-aif1", .codec_name = "i2c-10EC5640:00", .platform_name = "baytrail-pcm-audio", @@ -126,18 +126,6 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = { .init = byt_rt5640_init, .ops = &byt_rt5640_ops, }, - { - .name = "Baytrail Voice", - .stream_name = "Voice", - .cpu_dai_name = "Mic1-cpu-dai", - .codec_dai_name = "rt5640-aif1", - .codec_name = "i2c-10EC5640:00", - .platform_name = "baytrail-pcm-audio", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_CBS_CFS, - .init = NULL, - .ops = &byt_rt5640_ops, - }, };
static struct snd_soc_card byt_rt5640_card = { diff --git a/sound/soc/intel/sst-baytrail-pcm.c b/sound/soc/intel/sst-baytrail-pcm.c index 73bb68119b9e..23a25c0627bd 100644 --- a/sound/soc/intel/sst-baytrail-pcm.c +++ b/sound/soc/intel/sst-baytrail-pcm.c @@ -342,7 +342,7 @@ static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd)
static struct snd_soc_dai_driver byt_dais[] = { { - .name = "Front-cpu-dai", + .name = "Baytrail PCM", .playback = { .stream_name = "System Playback", .channels_min = 2, @@ -351,9 +351,6 @@ static struct snd_soc_dai_driver byt_dais[] = { .formats = SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S16_LE, }, - }, - { - .name = "Mic1-cpu-dai", .capture = { .stream_name = "Analog Capture", .channels_min = 2, @@ -378,7 +375,7 @@ static int sst_byt_pcm_probe(struct snd_soc_platform *platform) priv_data->byt = plat_data->dsp; snd_soc_platform_set_drvdata(platform, priv_data);
- for (i = 0; i < ARRAY_SIZE(byt_dais); i++) { + for (i = 0; i < BYT_PCM_COUNT; i++) { mutex_init(&priv_data->pcm[i].mutex); INIT_WORK(&priv_data->pcm[i].work, sst_byt_pcm_work); }
On Wed, May 14, 2014 at 05:20:52PM +0300, Jarkko Nikula wrote:
It wasn't necessary to export Baytrail SST PCM streams under separate DAI links and complicated needlessly basic ALSA command usage (for instance arecord).
Applied both, thanks.
participants (2)
-
Jarkko Nikula
-
Mark Brown