Commit aa982b05 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: remove rtd->cpu/codec_dai{s} v2" from Kuninori Morimoto...

Merge series "ASoC: remove rtd->cpu/codec_dai{s} v2" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These are rebased "remove rtd->cpu/codec_dai" patches.

Kuninori Morimoto (4):
  ASoC: soc: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
  ASoC: soc-core: set rtd->num_cpu/codec at soc_new_pcm_runtime()
  ASoC: soc-core: tidyup soc_new_pcm_runtime() rtd setups
  ASoC: soc-core: remove cpu_dai/codec_dai/cpu_dais/codec_dais

 include/sound/soc.h                   | 26 +++++++++--------
 sound/soc/soc-compress.c              | 36 +++++++++++------------
 sound/soc/soc-core.c                  | 42 ++++++++++-----------------
 sound/soc/soc-dapm.c                  |  4 +--
 sound/soc/soc-generic-dmaengine-pcm.c |  6 ++--
 sound/soc/soc-pcm.c                   | 30 +++++++++----------
 6 files changed, 68 insertions(+), 76 deletions(-)

--
2.17.1
parents 4c979a77 1729025b
...@@ -1143,14 +1143,16 @@ struct snd_soc_pcm_runtime { ...@@ -1143,14 +1143,16 @@ struct snd_soc_pcm_runtime {
/* runtime devices */ /* runtime devices */
struct snd_pcm *pcm; struct snd_pcm *pcm;
struct snd_compr *compr; struct snd_compr *compr;
struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai;
struct snd_soc_dai **dais;
struct snd_soc_dai **codec_dais; /*
* dais = cpu_dai + codec_dai
* see
* soc_new_pcm_runtime()
* asoc_rtd_to_cpu()
* asoc_rtd_to_codec()
*/
struct snd_soc_dai **dais;
unsigned int num_codecs; unsigned int num_codecs;
struct snd_soc_dai **cpu_dais;
unsigned int num_cpus; unsigned int num_cpus;
struct delayed_work delayed_work; struct delayed_work delayed_work;
...@@ -1179,16 +1181,16 @@ struct snd_soc_pcm_runtime { ...@@ -1179,16 +1181,16 @@ struct snd_soc_pcm_runtime {
(i)++) (i)++)
#define for_each_rtd_cpu_dais(rtd, i, dai) \ #define for_each_rtd_cpu_dais(rtd, i, dai) \
for ((i) = 0; \ for ((i) = 0; \
((i) < rtd->num_cpus) && ((dai) = rtd->cpu_dais[i]); \ ((i) < rtd->num_cpus) && ((dai) = asoc_rtd_to_cpu(rtd, i)); \
(i)++) (i)++)
#define for_each_rtd_cpu_dais_rollback(rtd, i, dai) \ #define for_each_rtd_cpu_dais_rollback(rtd, i, dai) \
for (; (--(i) >= 0) && ((dai) = rtd->cpu_dais[i]);) for (; (--(i) >= 0) && ((dai) = asoc_rtd_to_cpu(rtd, i));)
#define for_each_rtd_codec_dais(rtd, i, dai) \ #define for_each_rtd_codec_dais(rtd, i, dai) \
for ((i) = 0; \ for ((i) = 0; \
((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \ ((i) < rtd->num_codecs) && ((dai) = asoc_rtd_to_codec(rtd, i)); \
(i)++) (i)++)
#define for_each_rtd_codec_dais_rollback(rtd, i, dai) \ #define for_each_rtd_codec_dais_rollback(rtd, i, dai) \
for (; (--(i) >= 0) && ((dai) = rtd->codec_dais[i]);) for (; (--(i) >= 0) && ((dai) = asoc_rtd_to_codec(rtd, i));)
#define for_each_rtd_dais(rtd, i, dai) \ #define for_each_rtd_dais(rtd, i, dai) \
for ((i) = 0; \ for ((i) = 0; \
((i) < (rtd)->num_cpus + (rtd)->num_codecs) && \ ((i) < (rtd)->num_cpus + (rtd)->num_codecs) && \
...@@ -1381,8 +1383,8 @@ struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card, ...@@ -1381,8 +1383,8 @@ struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
struct snd_soc_pcm_runtime *rtd; struct snd_soc_pcm_runtime *rtd;
list_for_each_entry(rtd, &card->rtd_list, list) { list_for_each_entry(rtd, &card->rtd_list, list) {
if (!strcmp(rtd->codec_dai->name, dai_name)) if (!strcmp(asoc_rtd_to_codec(rtd, 0)->name, dai_name))
return rtd->codec_dai; return asoc_rtd_to_codec(rtd, 0);
} }
return NULL; return NULL;
......
...@@ -73,7 +73,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream) ...@@ -73,7 +73,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component, *save = NULL; struct snd_soc_component *component, *save = NULL;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret, i; int ret, i;
for_each_rtd_components(rtd, i, component) { for_each_rtd_components(rtd, i, component) {
...@@ -141,7 +141,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) ...@@ -141,7 +141,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
struct snd_pcm_substream *fe_substream = struct snd_pcm_substream *fe_substream =
fe->pcm->streams[cstream->direction].substream; fe->pcm->streams[cstream->direction].substream;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = fe->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
struct snd_soc_dpcm *dpcm; struct snd_soc_dpcm *dpcm;
struct snd_soc_dapm_widget_list *list; struct snd_soc_dapm_widget_list *list;
int stream; int stream;
...@@ -230,8 +230,8 @@ static int soc_compr_free(struct snd_compr_stream *cstream) ...@@ -230,8 +230,8 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int stream, i; int stream, i;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -274,7 +274,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream) ...@@ -274,7 +274,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
static int soc_compr_free_fe(struct snd_compr_stream *cstream) static int soc_compr_free_fe(struct snd_compr_stream *cstream)
{ {
struct snd_soc_pcm_runtime *fe = cstream->private_data; struct snd_soc_pcm_runtime *fe = cstream->private_data;
struct snd_soc_dai *cpu_dai = fe->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
struct snd_soc_dpcm *dpcm; struct snd_soc_dpcm *dpcm;
int stream, ret; int stream, ret;
...@@ -343,8 +343,8 @@ static int soc_compr_components_trigger(struct snd_compr_stream *cstream, ...@@ -343,8 +343,8 @@ static int soc_compr_components_trigger(struct snd_compr_stream *cstream,
static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret; int ret;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -373,7 +373,7 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) ...@@ -373,7 +373,7 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
{ {
struct snd_soc_pcm_runtime *fe = cstream->private_data; struct snd_soc_pcm_runtime *fe = cstream->private_data;
struct snd_soc_dai *cpu_dai = fe->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
int ret, stream; int ret, stream;
if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN || if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN ||
...@@ -446,7 +446,7 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, ...@@ -446,7 +446,7 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
struct snd_compr_params *params) struct snd_compr_params *params)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret; int ret;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -500,7 +500,7 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, ...@@ -500,7 +500,7 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
struct snd_soc_pcm_runtime *fe = cstream->private_data; struct snd_soc_pcm_runtime *fe = cstream->private_data;
struct snd_pcm_substream *fe_substream = struct snd_pcm_substream *fe_substream =
fe->pcm->streams[cstream->direction].substream; fe->pcm->streams[cstream->direction].substream;
struct snd_soc_dai *cpu_dai = fe->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
int ret, stream; int ret, stream;
if (cstream->direction == SND_COMPRESS_PLAYBACK) if (cstream->direction == SND_COMPRESS_PLAYBACK)
...@@ -558,7 +558,7 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, ...@@ -558,7 +558,7 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int i, ret = 0; int i, ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -632,7 +632,7 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes) ...@@ -632,7 +632,7 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes)
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int i, ret = 0; int i, ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -664,7 +664,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, ...@@ -664,7 +664,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
int i, ret = 0; int i, ret = 0;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -711,7 +711,7 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream, ...@@ -711,7 +711,7 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int i, ret; int i, ret;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_metadata) { if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_metadata) {
...@@ -739,7 +739,7 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, ...@@ -739,7 +739,7 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
{ {
struct snd_soc_pcm_runtime *rtd = cstream->private_data; struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int i, ret; int i, ret;
if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) { if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) {
...@@ -801,8 +801,8 @@ static struct snd_compr_ops soc_compr_dyn_ops = { ...@@ -801,8 +801,8 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_compr *compr; struct snd_compr *compr;
struct snd_pcm *be_pcm; struct snd_pcm *be_pcm;
char new_name[64]; char new_name[64];
...@@ -891,7 +891,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -891,7 +891,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
ret = snd_compress_new(rtd->card->snd_card, num, direction, ret = snd_compress_new(rtd->card->snd_card, num, direction,
new_name, compr); new_name, compr);
if (ret < 0) { if (ret < 0) {
component = rtd->codec_dai->component; component = asoc_rtd_to_codec(rtd, 0)->component;
dev_err(component->dev, dev_err(component->dev,
"Compress ASoC: can't create compress for codec %s: %d\n", "Compress ASoC: can't create compress for codec %s: %d\n",
component->name, ret); component->name, ret);
......
...@@ -364,7 +364,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_pcm_runtime); ...@@ -364,7 +364,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_pcm_runtime);
*/ */
void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd) void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int playback = SNDRV_PCM_STREAM_PLAYBACK; int playback = SNDRV_PCM_STREAM_PLAYBACK;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
...@@ -487,20 +487,18 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( ...@@ -487,20 +487,18 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
* dais = [][][][][][][][][][][][][][][][][][] * dais = [][][][][][][][][][][][][][][][][][]
* ^cpu_dais ^codec_dais * ^cpu_dais ^codec_dais
* |--- num_cpus ---|--- num_codecs --| * |--- num_cpus ---|--- num_codecs --|
* see
* asoc_rtd_to_cpu()
* asoc_rtd_to_codec()
*/ */
rtd->cpu_dais = &rtd->dais[0]; rtd->num_cpus = dai_link->num_cpus;
rtd->codec_dais = &rtd->dais[dai_link->num_cpus]; rtd->num_codecs = dai_link->num_codecs;
/*
* rtd remaining settings
*/
rtd->card = card; rtd->card = card;
rtd->dai_link = dai_link; rtd->dai_link = dai_link;
rtd->num = card->num_rtd++;
/* see for_each_card_rtds */ /* see for_each_card_rtds */
list_add_tail(&rtd->list, &card->rtd_list); list_add_tail(&rtd->list, &card->rtd_list);
rtd->num = card->num_rtd;
card->num_rtd++;
return rtd; return rtd;
...@@ -989,36 +987,28 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card, ...@@ -989,36 +987,28 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
if (!rtd) if (!rtd)
return -ENOMEM; return -ENOMEM;
rtd->num_cpus = dai_link->num_cpus;
for_each_link_cpus(dai_link, i, cpu) { for_each_link_cpus(dai_link, i, cpu) {
rtd->cpu_dais[i] = snd_soc_find_dai(cpu); asoc_rtd_to_cpu(rtd, i) = snd_soc_find_dai(cpu);
if (!rtd->cpu_dais[i]) { if (!asoc_rtd_to_cpu(rtd, i)) {
dev_info(card->dev, "ASoC: CPU DAI %s not registered\n", dev_info(card->dev, "ASoC: CPU DAI %s not registered\n",
cpu->dai_name); cpu->dai_name);
goto _err_defer; goto _err_defer;
} }
snd_soc_rtd_add_component(rtd, rtd->cpu_dais[i]->component); snd_soc_rtd_add_component(rtd, asoc_rtd_to_cpu(rtd, i)->component);
} }
/* Single cpu links expect cpu and cpu_dai in runtime data */
rtd->cpu_dai = rtd->cpu_dais[0];
/* Find CODEC from registered CODECs */ /* Find CODEC from registered CODECs */
rtd->num_codecs = dai_link->num_codecs;
for_each_link_codecs(dai_link, i, codec) { for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec); asoc_rtd_to_codec(rtd, i) = snd_soc_find_dai(codec);
if (!rtd->codec_dais[i]) { if (!asoc_rtd_to_codec(rtd, i)) {
dev_info(card->dev, "ASoC: CODEC DAI %s not registered\n", dev_info(card->dev, "ASoC: CODEC DAI %s not registered\n",
codec->dai_name); codec->dai_name);
goto _err_defer; goto _err_defer;
} }
snd_soc_rtd_add_component(rtd, rtd->codec_dais[i]->component); snd_soc_rtd_add_component(rtd, asoc_rtd_to_codec(rtd, i)->component);
} }
/* Single codec links expect codec and codec_dai in runtime data */
rtd->codec_dai = rtd->codec_dais[0];
/* Find PLATFORM from registered PLATFORMs */ /* Find PLATFORM from registered PLATFORMs */
for_each_link_platforms(dai_link, i, platform) { for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) { for_each_component(component) {
...@@ -1062,7 +1052,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, ...@@ -1062,7 +1052,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
struct snd_soc_pcm_runtime *rtd) struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai_link *dai_link = rtd->dai_link;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct snd_soc_component *component; struct snd_soc_component *component;
int ret, num, i; int ret, num, i;
......
...@@ -4370,11 +4370,11 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, ...@@ -4370,11 +4370,11 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
if (rtd->num_cpus == 1) { if (rtd->num_cpus == 1) {
for_each_rtd_codec_dais(rtd, i, codec_dai) for_each_rtd_codec_dais(rtd, i, codec_dai)
dapm_add_valid_dai_widget(card, rtd, codec_dai, dapm_add_valid_dai_widget(card, rtd, codec_dai,
rtd->cpu_dais[0]); asoc_rtd_to_cpu(rtd, 0));
} else if (rtd->num_codecs == rtd->num_cpus) { } else if (rtd->num_codecs == rtd->num_cpus) {
for_each_rtd_codec_dais(rtd, i, codec_dai) for_each_rtd_codec_dais(rtd, i, codec_dai)
dapm_add_valid_dai_widget(card, rtd, codec_dai, dapm_add_valid_dai_widget(card, rtd, codec_dai,
rtd->cpu_dais[i]); asoc_rtd_to_cpu(rtd, i));
} else { } else {
dev_err(card->dev, dev_err(card->dev,
"N cpus to M codecs link is not supported yet\n"); "N cpus to M codecs link is not supported yet\n");
......
...@@ -68,7 +68,7 @@ int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream, ...@@ -68,7 +68,7 @@ int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); dma_data = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config); ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config);
if (ret) if (ret)
...@@ -134,7 +134,7 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component, ...@@ -134,7 +134,7 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
return snd_soc_set_runtime_hwparams(substream, return snd_soc_set_runtime_hwparams(substream,
pcm->config->pcm_hardware); pcm->config->pcm_hardware);
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); dma_data = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
hw.info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | hw.info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
...@@ -203,7 +203,7 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel( ...@@ -203,7 +203,7 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
return NULL; return NULL;
} }
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); dma_data = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0]) if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0])
return pcm->chan[0]; return pcm->chan[0];
......
...@@ -136,7 +136,7 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf, ...@@ -136,7 +136,7 @@ static ssize_t dpcm_state_read_file(struct file *file, char __user *user_buf,
return -ENOMEM; return -ENOMEM;
for_each_pcm_streams(stream) for_each_pcm_streams(stream)
if (snd_soc_dai_stream_valid(fe->cpu_dai, stream)) if (snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream))
offset += dpcm_show_state(fe, stream, offset += dpcm_show_state(fe, stream,
buf + offset, buf + offset,
out_count - offset); out_count - offset);
...@@ -836,10 +836,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -836,10 +836,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
soc_pcm_init_runtime_hw(substream); soc_pcm_init_runtime_hw(substream);
if (rtd->num_codecs == 1) if (rtd->num_codecs == 1)
codec_dai_name = rtd->codec_dai->name; codec_dai_name = asoc_rtd_to_codec(rtd, 0)->name;
if (rtd->num_cpus == 1) if (rtd->num_cpus == 1)
cpu_dai_name = rtd->cpu_dai->name; cpu_dai_name = asoc_rtd_to_cpu(rtd, 0)->name;
if (soc_pcm_has_symmetry(substream)) if (soc_pcm_has_symmetry(substream))
runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX; runtime->hw.info |= SNDRV_PCM_INFO_JOINT_DUPLEX;
...@@ -1483,7 +1483,7 @@ static bool dpcm_end_walk_at_be(struct snd_soc_dapm_widget *widget, ...@@ -1483,7 +1483,7 @@ static bool dpcm_end_walk_at_be(struct snd_soc_dapm_widget *widget,
int dpcm_path_get(struct snd_soc_pcm_runtime *fe, int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
int stream, struct snd_soc_dapm_widget_list **list) int stream, struct snd_soc_dapm_widget_list **list)
{ {
struct snd_soc_dai *cpu_dai = fe->cpu_dai; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
int paths; int paths;
if (fe->num_cpus > 1) { if (fe->num_cpus > 1) {
...@@ -1842,7 +1842,7 @@ static void dpcm_runtime_merge_chan(struct snd_pcm_substream *substream, ...@@ -1842,7 +1842,7 @@ static void dpcm_runtime_merge_chan(struct snd_pcm_substream *substream,
* DAIs connected to a single CPU DAI, use CPU DAI's directly * DAIs connected to a single CPU DAI, use CPU DAI's directly
*/ */
if (be->num_codecs == 1) { if (be->num_codecs == 1) {
codec_stream = snd_soc_dai_get_pcm_stream(be->codec_dais[0], stream); codec_stream = snd_soc_dai_get_pcm_stream(asoc_rtd_to_codec(be, 0), stream);
*channels_min = max(*channels_min, *channels_min = max(*channels_min,
codec_stream->channels_min); codec_stream->channels_min);
...@@ -2759,7 +2759,7 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) ...@@ -2759,7 +2759,7 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
return 0; return 0;
/* only check active links */ /* only check active links */
if (!fe->cpu_dai->active) if (!asoc_rtd_to_cpu(fe, 0)->active)
return 0; return 0;
/* DAPM sync will call this to update DSP paths */ /* DAPM sync will call this to update DSP paths */
...@@ -2769,13 +2769,13 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) ...@@ -2769,13 +2769,13 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
for_each_pcm_streams(stream) { for_each_pcm_streams(stream) {
/* skip if FE doesn't have playback/capture capability */ /* skip if FE doesn't have playback/capture capability */
if (!snd_soc_dai_stream_valid(fe->cpu_dai, stream) || if (!snd_soc_dai_stream_valid(asoc_rtd_to_cpu(fe, 0), stream) ||
!snd_soc_dai_stream_valid(fe->codec_dai, stream)) !snd_soc_dai_stream_valid(asoc_rtd_to_codec(fe, 0), stream))
continue; continue;
/* skip if FE isn't currently playing/capturing */ /* skip if FE isn't currently playing/capturing */
if (!fe->cpu_dai->stream_active[stream] || if (!asoc_rtd_to_cpu(fe, 0)->stream_active[stream] ||
!fe->codec_dai->stream_active[stream]) !asoc_rtd_to_codec(fe, 0)->stream_active[stream])
continue; continue;
paths = dpcm_path_get(fe, stream, &list); paths = dpcm_path_get(fe, stream, &list);
...@@ -2922,9 +2922,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -2922,9 +2922,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
for_each_rtd_codec_dais(rtd, i, codec_dai) { for_each_rtd_codec_dais(rtd, i, codec_dai) {
if (rtd->num_cpus == 1) { if (rtd->num_cpus == 1) {
cpu_dai = rtd->cpu_dais[0]; cpu_dai = asoc_rtd_to_cpu(rtd, 0);
} else if (rtd->num_cpus == rtd->num_codecs) { } else if (rtd->num_cpus == rtd->num_codecs) {
cpu_dai = rtd->cpu_dais[i]; cpu_dai = asoc_rtd_to_cpu(rtd, i);
} else { } else {
dev_err(rtd->card->dev, dev_err(rtd->card->dev,
"N cpus to M codecs link is not supported yet\n"); "N cpus to M codecs link is not supported yet\n");
...@@ -2971,7 +2971,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -2971,7 +2971,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
snprintf(new_name, sizeof(new_name), "%s %s-%d", snprintf(new_name, sizeof(new_name), "%s %s-%d",
rtd->dai_link->stream_name, rtd->dai_link->stream_name,
(rtd->num_codecs > 1) ? (rtd->num_codecs > 1) ?
"multicodec" : rtd->codec_dai->name, num); "multicodec" : asoc_rtd_to_codec(rtd, 0)->name, num);
ret = snd_pcm_new(rtd->card->snd_card, new_name, num, playback, ret = snd_pcm_new(rtd->card->snd_card, new_name, num, playback,
capture, &pcm); capture, &pcm);
...@@ -3050,8 +3050,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) ...@@ -3050,8 +3050,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
pcm->no_device_suspend = true; pcm->no_device_suspend = true;
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" : asoc_rtd_to_codec(rtd, 0)->name,
(rtd->num_cpus > 1) ? "multicpu" : rtd->cpu_dai->name); (rtd->num_cpus > 1) ? "multicpu" : asoc_rtd_to_cpu(rtd, 0)->name);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment