|
@@ -1055,7 +1055,6 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
|
|
int cmd)
|
|
int cmd)
|
|
{
|
|
{
|
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
|
- struct snd_soc_platform *platform = rtd->platform;
|
|
|
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
|
struct snd_soc_dai *codec_dai;
|
|
struct snd_soc_dai *codec_dai;
|
|
int i, ret;
|
|
int i, ret;
|
|
@@ -1071,12 +1070,6 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (platform->driver->bespoke_trigger) {
|
|
|
|
- ret = platform->driver->bespoke_trigger(substream, cmd);
|
|
|
|
- if (ret < 0)
|
|
|
|
- return ret;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (cpu_dai->driver->ops && cpu_dai->driver->ops->bespoke_trigger) {
|
|
if (cpu_dai->driver->ops && cpu_dai->driver->ops->bespoke_trigger) {
|
|
ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai);
|
|
ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai);
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
@@ -1116,13 +1109,6 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
|
|
}
|
|
}
|
|
delay += codec_delay;
|
|
delay += codec_delay;
|
|
|
|
|
|
- /*
|
|
|
|
- * None of the existing platform drivers implement delay(), so
|
|
|
|
- * for now the codec_dai of first multicodec entry is used
|
|
|
|
- */
|
|
|
|
- if (platform->driver->delay)
|
|
|
|
- delay += platform->driver->delay(substream, rtd->codec_dais[0]);
|
|
|
|
-
|
|
|
|
runtime->delay = delay;
|
|
runtime->delay = delay;
|
|
|
|
|
|
return offset;
|
|
return offset;
|
|
@@ -2642,12 +2628,25 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void soc_pcm_free(struct snd_pcm *pcm)
|
|
|
|
+{
|
|
|
|
+ struct snd_soc_pcm_runtime *rtd = pcm->private_data;
|
|
|
|
+ struct snd_soc_component *component;
|
|
|
|
+
|
|
|
|
+ list_for_each_entry(component, &rtd->card->component_dev_list,
|
|
|
|
+ card_list) {
|
|
|
|
+ if (component->pcm_free)
|
|
|
|
+ component->pcm_free(pcm);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
/* create a new pcm */
|
|
/* create a new pcm */
|
|
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
|
|
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
|
|
{
|
|
{
|
|
struct snd_soc_platform *platform = rtd->platform;
|
|
struct snd_soc_platform *platform = rtd->platform;
|
|
struct snd_soc_dai *codec_dai;
|
|
struct snd_soc_dai *codec_dai;
|
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
|
|
|
+ struct snd_soc_component *component;
|
|
struct snd_pcm *pcm;
|
|
struct snd_pcm *pcm;
|
|
char new_name[64];
|
|
char new_name[64];
|
|
int ret = 0, playback = 0, capture = 0;
|
|
int ret = 0, playback = 0, capture = 0;
|
|
@@ -2756,17 +2755,18 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
|
|
if (capture)
|
|
if (capture)
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
|
|
|
|
|
|
- if (platform->driver->pcm_new) {
|
|
|
|
- ret = platform->driver->pcm_new(rtd);
|
|
|
|
- if (ret < 0) {
|
|
|
|
- dev_err(platform->dev,
|
|
|
|
- "ASoC: pcm constructor failed: %d\n",
|
|
|
|
- ret);
|
|
|
|
- return ret;
|
|
|
|
|
|
+ list_for_each_entry(component, &rtd->card->component_dev_list, card_list) {
|
|
|
|
+ if (component->pcm_new) {
|
|
|
|
+ ret = component->pcm_new(rtd);
|
|
|
|
+ if (ret < 0) {
|
|
|
|
+ dev_err(component->dev,
|
|
|
|
+ "ASoC: pcm constructor failed: %d\n",
|
|
|
|
+ ret);
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- pcm->private_free = platform->driver->pcm_free;
|
|
|
|
|
|
+ pcm->private_free = soc_pcm_free;
|
|
out:
|
|
out:
|
|
dev_info(rtd->card->dev, "%s <-> %s mapping ok\n",
|
|
dev_info(rtd->card->dev, "%s <-> %s mapping ok\n",
|
|
(rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name,
|
|
(rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name,
|
|
@@ -2874,15 +2874,6 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe,
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params);
|
|
EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params);
|
|
|
|
|
|
-int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
|
|
|
|
- int cmd, struct snd_soc_platform *platform)
|
|
|
|
-{
|
|
|
|
- if (platform->driver->ops && platform->driver->ops->trigger)
|
|
|
|
- return platform->driver->ops->trigger(substream, cmd);
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(snd_soc_platform_trigger);
|
|
|
|
-
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
#ifdef CONFIG_DEBUG_FS
|
|
static const char *dpcm_state_string(enum snd_soc_dpcm_state state)
|
|
static const char *dpcm_state_string(enum snd_soc_dpcm_state state)
|
|
{
|
|
{
|