ASoC: use helper function and cleanup
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>: struct snd_soc_dai need to have info for playback/capture, but it is using "playback/capture_xxx" or "tx/tx_xxx" or array. This kind of random definition is very difficult to read. This patch-set add helper functions and each driver use it. And cleanup the definition.
This commit is contained in:
commit
6570befb4f
@ -423,6 +423,16 @@ struct snd_soc_dai_driver {
|
||||
int remove_order;
|
||||
};
|
||||
|
||||
/* for Playback/Capture */
|
||||
struct snd_soc_dai_stream {
|
||||
struct snd_soc_dapm_widget *widget;
|
||||
|
||||
unsigned int active; /* usage count */
|
||||
unsigned int tdm_mask; /* CODEC TDM slot masks and params (for fixup) */
|
||||
|
||||
void *dma_data; /* DAI DMA data */
|
||||
};
|
||||
|
||||
/*
|
||||
* Digital Audio Interface runtime data.
|
||||
*
|
||||
@ -437,14 +447,7 @@ struct snd_soc_dai {
|
||||
struct snd_soc_dai_driver *driver;
|
||||
|
||||
/* DAI runtime info */
|
||||
unsigned int stream_active[SNDRV_PCM_STREAM_LAST + 1]; /* usage count */
|
||||
|
||||
struct snd_soc_dapm_widget *playback_widget;
|
||||
struct snd_soc_dapm_widget *capture_widget;
|
||||
|
||||
/* DAI DMA data */
|
||||
void *playback_dma_data;
|
||||
void *capture_dma_data;
|
||||
struct snd_soc_dai_stream stream[SNDRV_PCM_STREAM_LAST + 1];
|
||||
|
||||
/* Symmetry data - only valid if symmetry is being enforced */
|
||||
unsigned int rate;
|
||||
@ -454,10 +457,6 @@ struct snd_soc_dai {
|
||||
/* parent platform/codec */
|
||||
struct snd_soc_component *component;
|
||||
|
||||
/* CODEC TDM slot masks and params (for fixup) */
|
||||
unsigned int tx_mask;
|
||||
unsigned int rx_mask;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
/* function mark */
|
||||
@ -477,36 +476,59 @@ snd_soc_dai_get_pcm_stream(const struct snd_soc_dai *dai, int stream)
|
||||
&dai->driver->playback : &dai->driver->capture;
|
||||
}
|
||||
|
||||
#define snd_soc_dai_get_widget_playback(dai) snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_PLAYBACK)
|
||||
#define snd_soc_dai_get_widget_capture(dai) snd_soc_dai_get_widget(dai, SNDRV_PCM_STREAM_CAPTURE)
|
||||
static inline
|
||||
struct snd_soc_dapm_widget *snd_soc_dai_get_widget(
|
||||
struct snd_soc_dai *dai, int stream)
|
||||
struct snd_soc_dapm_widget *snd_soc_dai_get_widget(struct snd_soc_dai *dai, int stream)
|
||||
{
|
||||
return (stream == SNDRV_PCM_STREAM_PLAYBACK) ?
|
||||
dai->playback_widget : dai->capture_widget;
|
||||
return dai->stream[stream].widget;
|
||||
}
|
||||
|
||||
static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
|
||||
const struct snd_pcm_substream *ss)
|
||||
#define snd_soc_dai_set_widget_playback(dai, widget) snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_PLAYBACK, widget)
|
||||
#define snd_soc_dai_set_widget_capture(dai, widget) snd_soc_dai_set_widget(dai, SNDRV_PCM_STREAM_CAPTURE, widget)
|
||||
static inline
|
||||
void snd_soc_dai_set_widget(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_widget *widget)
|
||||
{
|
||||
return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
|
||||
dai->playback_dma_data : dai->capture_dma_data;
|
||||
dai->stream[stream].widget = widget;
|
||||
}
|
||||
|
||||
static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
|
||||
const struct snd_pcm_substream *ss,
|
||||
void *data)
|
||||
#define snd_soc_dai_dma_data_get_playback(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_PLAYBACK)
|
||||
#define snd_soc_dai_dma_data_get_capture(dai) snd_soc_dai_dma_data_get(dai, SNDRV_PCM_STREAM_CAPTURE)
|
||||
#define snd_soc_dai_get_dma_data(dai, ss) snd_soc_dai_dma_data_get(dai, ss->stream)
|
||||
static inline void *snd_soc_dai_dma_data_get(const struct snd_soc_dai *dai, int stream)
|
||||
{
|
||||
if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = data;
|
||||
else
|
||||
dai->capture_dma_data = data;
|
||||
return dai->stream[stream].dma_data;
|
||||
}
|
||||
|
||||
static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai,
|
||||
void *playback, void *capture)
|
||||
#define snd_soc_dai_dma_data_set_playback(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_PLAYBACK, data)
|
||||
#define snd_soc_dai_dma_data_set_capture(dai, data) snd_soc_dai_dma_data_set(dai, SNDRV_PCM_STREAM_CAPTURE, data)
|
||||
#define snd_soc_dai_set_dma_data(dai, ss, data) snd_soc_dai_dma_data_set(dai, ss->stream, data)
|
||||
static inline void snd_soc_dai_dma_data_set(struct snd_soc_dai *dai, int stream, void *data)
|
||||
{
|
||||
dai->playback_dma_data = playback;
|
||||
dai->capture_dma_data = capture;
|
||||
dai->stream[stream].dma_data = data;
|
||||
}
|
||||
|
||||
static inline void snd_soc_dai_init_dma_data(struct snd_soc_dai *dai, void *playback, void *capture)
|
||||
{
|
||||
snd_soc_dai_dma_data_set_playback(dai, playback);
|
||||
snd_soc_dai_dma_data_set_capture(dai, capture);
|
||||
}
|
||||
|
||||
static inline unsigned int snd_soc_dai_tdm_mask_get(struct snd_soc_dai *dai, int stream)
|
||||
{
|
||||
return dai->stream[stream].tdm_mask;
|
||||
}
|
||||
|
||||
static inline void snd_soc_dai_tdm_mask_set(struct snd_soc_dai *dai, int stream,
|
||||
unsigned int tdm_mask)
|
||||
{
|
||||
dai->stream[stream].tdm_mask = tdm_mask;
|
||||
}
|
||||
|
||||
static inline unsigned int snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream)
|
||||
{
|
||||
/* see snd_soc_dai_action() for setup */
|
||||
return dai->stream[stream].active;
|
||||
}
|
||||
|
||||
static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai,
|
||||
@ -561,10 +583,4 @@ static inline void *snd_soc_dai_get_stream(struct snd_soc_dai *dai,
|
||||
return ERR_PTR(-ENOTSUPP);
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
snd_soc_dai_stream_active(struct snd_soc_dai *dai, int stream)
|
||||
{
|
||||
return dai->stream_active[stream];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1052,6 +1052,12 @@ struct snd_soc_card {
|
||||
#define for_each_card_widgets_safe(card, w, _w) \
|
||||
list_for_each_entry_safe(w, _w, &card->widgets, list)
|
||||
|
||||
|
||||
static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card)
|
||||
{
|
||||
return card && card->instantiated;
|
||||
}
|
||||
|
||||
/* SoC machine DAI configuration, glues a codec and cpu DAI together */
|
||||
struct snd_soc_pcm_runtime {
|
||||
struct device *dev;
|
||||
|
@ -323,8 +323,8 @@ static int ep93xx_ac97_dai_probe(struct snd_soc_dai *dai)
|
||||
info->dma_params_tx.filter_data = &ep93xx_ac97_pcm_out;
|
||||
info->dma_params_rx.filter_data = &ep93xx_ac97_pcm_in;
|
||||
|
||||
dai->playback_dma_data = &info->dma_params_tx;
|
||||
dai->capture_dma_data = &info->dma_params_rx;
|
||||
snd_soc_dai_init_dma_data(dai, &info->dma_params_tx,
|
||||
&info->dma_params_rx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -202,8 +202,8 @@ static int ep93xx_i2s_dai_probe(struct snd_soc_dai *dai)
|
||||
info->dma_params_rx.filter_data =
|
||||
&ep93xx_i2s_dma_data[SNDRV_PCM_STREAM_CAPTURE];
|
||||
|
||||
dai->playback_dma_data = &info->dma_params_tx;
|
||||
dai->capture_dma_data = &info->dma_params_rx;
|
||||
snd_soc_dai_init_dma_data(dai, &info->dma_params_tx,
|
||||
&info->dma_params_rx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -126,12 +126,15 @@ static void hda_codec_unregister_dais(struct hda_codec *codec,
|
||||
struct hda_pcm *pcm;
|
||||
|
||||
for_each_component_dais_safe(component, dai, save) {
|
||||
int stream;
|
||||
|
||||
list_for_each_entry(pcm, &codec->pcm_list_head, list) {
|
||||
if (strcmp(dai->driver->name, pcm->name))
|
||||
continue;
|
||||
|
||||
snd_soc_dapm_free_widget(dai->playback_widget);
|
||||
snd_soc_dapm_free_widget(dai->capture_widget);
|
||||
for_each_pcm_streams(stream)
|
||||
snd_soc_dapm_free_widget(snd_soc_dai_get_widget(dai, stream));
|
||||
|
||||
snd_soc_unregister_dai(dai);
|
||||
break;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ static int hdmi_codec_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
|
||||
struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
|
||||
struct hdmi_codec_daifmt *cf = snd_soc_dai_dma_data_get_playback(dai);
|
||||
struct hdmi_codec_params hp = {
|
||||
.iec = {
|
||||
.status = { 0 },
|
||||
@ -562,7 +562,7 @@ static int hdmi_codec_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
|
||||
struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
|
||||
struct hdmi_codec_daifmt *cf = snd_soc_dai_dma_data_get_playback(dai);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
unsigned int channels = runtime->channels;
|
||||
unsigned int width = snd_pcm_format_width(runtime->format);
|
||||
@ -597,7 +597,7 @@ static int hdmi_codec_prepare(struct snd_pcm_substream *substream,
|
||||
static int hdmi_codec_i2s_set_fmt(struct snd_soc_dai *dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
struct hdmi_codec_daifmt *cf = dai->playback_dma_data;
|
||||
struct hdmi_codec_daifmt *cf = snd_soc_dai_dma_data_get_playback(dai);
|
||||
|
||||
/* Reset daifmt */
|
||||
memset(cf, 0, sizeof(*cf));
|
||||
@ -834,7 +834,8 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai)
|
||||
if (!daifmt)
|
||||
return -ENOMEM;
|
||||
|
||||
dai->playback_dma_data = daifmt;
|
||||
snd_soc_dai_dma_data_set_playback(dai, daifmt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -891,7 +892,7 @@ static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
cf = dai->playback_dma_data;
|
||||
cf = snd_soc_dai_dma_data_get_playback(dai);
|
||||
cf->fmt = HDMI_SPDIF;
|
||||
|
||||
return 0;
|
||||
|
@ -689,10 +689,7 @@ static int max98373_set_sdw_stream(struct snd_soc_dai *dai,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -508,10 +508,7 @@ static int rt1308_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -507,10 +507,7 @@ static int rt1316_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -575,10 +575,7 @@ static int rt1318_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3157,7 +3157,7 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inse
|
||||
snd_soc_dapm_force_enable_pin(dapm, "LDO2");
|
||||
snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power");
|
||||
snd_soc_dapm_sync(dapm);
|
||||
if (!dapm->card->instantiated) {
|
||||
if (!snd_soc_card_is_instantiated(dapm->card)) {
|
||||
/* Power up necessary bits for JD if dapm is
|
||||
not ready yet */
|
||||
regmap_update_bits(rt5645->regmap, RT5645_PWR_ANLG1,
|
||||
|
@ -1298,7 +1298,7 @@ static void rt5665_jack_detect_handler(struct work_struct *work)
|
||||
usleep_range(10000, 15000);
|
||||
}
|
||||
|
||||
while (!rt5665->component->card->instantiated) {
|
||||
while (!snd_soc_card_is_instantiated(rt5665->component->card)) {
|
||||
pr_debug("%s\n", __func__);
|
||||
usleep_range(10000, 15000);
|
||||
}
|
||||
@ -4748,7 +4748,7 @@ static void rt5665_calibrate_handler(struct work_struct *work)
|
||||
struct rt5665_priv *rt5665 = container_of(work, struct rt5665_priv,
|
||||
calibrate_work.work);
|
||||
|
||||
while (!rt5665->component->card->instantiated) {
|
||||
while (!snd_soc_card_is_instantiated(rt5665->component->card)) {
|
||||
pr_debug("%s\n", __func__);
|
||||
usleep_range(10000, 15000);
|
||||
}
|
||||
|
@ -1022,8 +1022,8 @@ static void rt5668_jack_detect_handler(struct work_struct *work)
|
||||
container_of(work, struct rt5668_priv, jack_detect_work.work);
|
||||
int val, btn_type;
|
||||
|
||||
if (!rt5668->component || !rt5668->component->card ||
|
||||
!rt5668->component->card->instantiated) {
|
||||
if (!rt5668->component ||
|
||||
!snd_soc_card_is_instantiated(rt5668->component->card)) {
|
||||
/* card not yet ready, try later */
|
||||
mod_delayed_work(system_power_efficient_wq,
|
||||
&rt5668->jack_detect_work, msecs_to_jiffies(15));
|
||||
|
@ -107,10 +107,7 @@ static int rt5682_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1094,8 +1094,8 @@ void rt5682_jack_detect_handler(struct work_struct *work)
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
int val, btn_type;
|
||||
|
||||
if (!rt5682->component || !rt5682->component->card ||
|
||||
!rt5682->component->card->instantiated) {
|
||||
if (!rt5682->component ||
|
||||
!snd_soc_card_is_instantiated(rt5682->component->card)) {
|
||||
/* card not yet ready, try later */
|
||||
mod_delayed_work(system_power_efficient_wq,
|
||||
&rt5682->jack_detect_work, msecs_to_jiffies(15));
|
||||
|
@ -834,8 +834,8 @@ static void rt5682s_jack_detect_handler(struct work_struct *work)
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
int val, btn_type;
|
||||
|
||||
if (!rt5682s->component || !rt5682s->component->card ||
|
||||
!rt5682s->component->card->instantiated) {
|
||||
if (!rt5682s->component ||
|
||||
!snd_soc_card_is_instantiated(rt5682s->component->card)) {
|
||||
/* card not yet ready, try later */
|
||||
mod_delayed_work(system_power_efficient_wq,
|
||||
&rt5682s->jack_detect_work, msecs_to_jiffies(15));
|
||||
|
@ -163,7 +163,7 @@ static void rt700_jack_detect_handler(struct work_struct *work)
|
||||
if (!rt700->hs_jack)
|
||||
return;
|
||||
|
||||
if (!rt700->component->card || !rt700->component->card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(rt700->component->card))
|
||||
return;
|
||||
|
||||
reg = RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT;
|
||||
@ -887,10 +887,7 @@ static int rt700_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ static void rt711_sdca_jack_detect_handler(struct work_struct *work)
|
||||
if (!rt711->hs_jack)
|
||||
return;
|
||||
|
||||
if (!rt711->component->card || !rt711->component->card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(rt711->component->card))
|
||||
return;
|
||||
|
||||
/* SDW_SCP_SDCA_INT_SDCA_0 is used for jack detection */
|
||||
@ -1249,10 +1249,7 @@ static int rt711_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ static void rt711_jack_detect_handler(struct work_struct *work)
|
||||
if (!rt711->hs_jack)
|
||||
return;
|
||||
|
||||
if (!rt711->component->card || !rt711->component->card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(rt711->component->card))
|
||||
return;
|
||||
|
||||
if (pm_runtime_status_suspended(rt711->slave->dev.parent)) {
|
||||
@ -976,10 +976,7 @@ static int rt711_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -793,10 +793,7 @@ static int rt715_sdca_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -777,10 +777,7 @@ static int rt715_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -57,10 +57,7 @@ static int sdw_mockup_set_sdw_stream(struct snd_soc_dai *dai, void *sdw_stream,
|
||||
stream->sdw_stream = sdw_stream;
|
||||
|
||||
/* Use tx_mask or rx_mask to configure stream tag and set dma_data */
|
||||
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
dai->playback_dma_data = stream;
|
||||
else
|
||||
dai->capture_dma_data = stream;
|
||||
snd_soc_dai_dma_data_set(dai, direction, stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1327,15 +1327,13 @@ static bool is_sst_dapm_widget(struct snd_soc_dapm_widget *w)
|
||||
int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
|
||||
{
|
||||
struct sst_data *drv = snd_soc_dai_get_drvdata(dai);
|
||||
struct snd_soc_dapm_widget *w;
|
||||
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
|
||||
struct snd_soc_dapm_path *p;
|
||||
|
||||
dev_dbg(dai->dev, "enter, dai-name=%s dir=%d\n", dai->name, stream);
|
||||
dev_dbg(dai->dev, "Stream name=%s\n", w->name);
|
||||
|
||||
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
dev_dbg(dai->dev, "Stream name=%s\n",
|
||||
dai->playback_widget->name);
|
||||
w = dai->playback_widget;
|
||||
snd_soc_dapm_widget_for_each_sink_path(w, p) {
|
||||
if (p->connected && !p->connected(w, p->sink))
|
||||
continue;
|
||||
@ -1352,9 +1350,6 @@ int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dev_dbg(dai->dev, "Stream name=%s\n",
|
||||
dai->capture_widget->name);
|
||||
w = dai->capture_widget;
|
||||
snd_soc_dapm_widget_for_each_source_path(w, p) {
|
||||
if (p->connected && !p->connected(w, p->source))
|
||||
continue;
|
||||
|
@ -258,14 +258,15 @@ static int avs_card_resume_post(struct snd_soc_card *card)
|
||||
{
|
||||
struct snd_soc_dai *codec_dai = snd_soc_card_get_codec_dai(card, SKL_NUVOTON_CODEC_DAI);
|
||||
struct snd_soc_jack *jack = snd_soc_card_get_drvdata(card);
|
||||
int stream = SNDRV_PCM_STREAM_PLAYBACK;
|
||||
|
||||
if (!codec_dai) {
|
||||
dev_err(card->dev, "Codec dai not found\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK] &&
|
||||
codec_dai->playback_widget->active)
|
||||
if (snd_soc_dai_stream_active(codec_dai, stream) &&
|
||||
snd_soc_dai_get_widget(codec_dai, stream)->active)
|
||||
snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS, 0, SND_SOC_CLOCK_IN);
|
||||
|
||||
return snd_soc_component_set_jack(codec_dai->component, jack, NULL);
|
||||
|
@ -35,15 +35,13 @@ struct avs_dma_data {
|
||||
static struct avs_tplg_path_template *
|
||||
avs_dai_find_path_template(struct snd_soc_dai *dai, bool is_fe, int direction)
|
||||
{
|
||||
struct snd_soc_dapm_widget *dw;
|
||||
struct snd_soc_dapm_widget *dw = snd_soc_dai_get_widget(dai, direction);
|
||||
struct snd_soc_dapm_path *dp;
|
||||
enum snd_soc_dapm_direction dir;
|
||||
|
||||
if (direction == SNDRV_PCM_STREAM_CAPTURE) {
|
||||
dw = dai->capture_widget;
|
||||
dir = is_fe ? SND_SOC_DAPM_DIR_OUT : SND_SOC_DAPM_DIR_IN;
|
||||
} else {
|
||||
dw = dai->playback_widget;
|
||||
dir = is_fe ? SND_SOC_DAPM_DIR_IN : SND_SOC_DAPM_DIR_OUT;
|
||||
}
|
||||
|
||||
@ -929,7 +927,7 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
|
||||
int ret;
|
||||
|
||||
for_each_component_dais(component, dai) {
|
||||
data = dai->playback_dma_data;
|
||||
data = snd_soc_dai_dma_data_get_playback(dai);
|
||||
if (data) {
|
||||
rtd = asoc_substream_to_rtd(data->substream);
|
||||
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
|
||||
@ -942,7 +940,7 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
|
||||
}
|
||||
}
|
||||
|
||||
data = dai->capture_dma_data;
|
||||
data = snd_soc_dai_dma_data_get_capture(dai);
|
||||
if (data) {
|
||||
rtd = asoc_substream_to_rtd(data->substream);
|
||||
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
|
||||
@ -1291,11 +1289,14 @@ static void avs_component_hda_unregister_dais(struct snd_soc_component *componen
|
||||
sprintf(name, "%s-cpu", dev_name(&codec->core.dev));
|
||||
|
||||
for_each_component_dais_safe(component, dai, save) {
|
||||
int stream;
|
||||
|
||||
if (!strstr(dai->driver->name, name))
|
||||
continue;
|
||||
|
||||
snd_soc_dapm_free_widget(dai->playback_widget);
|
||||
snd_soc_dapm_free_widget(dai->capture_widget);
|
||||
for_each_pcm_streams(stream)
|
||||
snd_soc_dapm_free_widget(snd_soc_dai_get_widget(dai, stream));
|
||||
|
||||
snd_soc_unregister_dai(dai);
|
||||
}
|
||||
}
|
||||
|
@ -1663,11 +1663,10 @@ int skl_tplg_update_pipe_params(struct device *dev,
|
||||
struct skl_module_cfg *
|
||||
skl_tplg_fe_get_cpr_module(struct snd_soc_dai *dai, int stream)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
|
||||
struct snd_soc_dapm_path *p = NULL;
|
||||
|
||||
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
w = dai->playback_widget;
|
||||
snd_soc_dapm_widget_for_each_sink_path(w, p) {
|
||||
if (p->connect && p->sink->power &&
|
||||
!is_skl_dsp_widget_type(p->sink, dai->dev))
|
||||
@ -1680,7 +1679,6 @@ skl_tplg_fe_get_cpr_module(struct snd_soc_dai *dai, int stream)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
w = dai->capture_widget;
|
||||
snd_soc_dapm_widget_for_each_source_path(w, p) {
|
||||
if (p->connect && p->source->power &&
|
||||
!is_skl_dsp_widget_type(p->source, dai->dev))
|
||||
@ -1744,14 +1742,12 @@ static struct skl_module_cfg *skl_get_mconfig_cap_cpr(
|
||||
struct skl_module_cfg *
|
||||
skl_tplg_be_get_cpr_module(struct snd_soc_dai *dai, int stream)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
|
||||
struct skl_module_cfg *mconfig;
|
||||
|
||||
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
w = dai->playback_widget;
|
||||
mconfig = skl_get_mconfig_pb_cpr(dai, w);
|
||||
} else {
|
||||
w = dai->capture_widget;
|
||||
mconfig = skl_get_mconfig_cap_cpr(dai, w);
|
||||
}
|
||||
return mconfig;
|
||||
@ -1905,20 +1901,13 @@ static int skl_tplg_be_set_sink_pipe_params(struct snd_soc_dai *dai,
|
||||
int skl_tplg_be_update_params(struct snd_soc_dai *dai,
|
||||
struct skl_pipe_params *params)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, params->stream);
|
||||
|
||||
if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
w = dai->playback_widget;
|
||||
|
||||
return skl_tplg_be_set_src_pipe_params(dai, w, params);
|
||||
|
||||
} else {
|
||||
w = dai->capture_widget;
|
||||
|
||||
return skl_tplg_be_set_sink_pipe_params(dai, w, params);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_tplg_widget_events skl_tplg_widget_ops[] = {
|
||||
@ -2978,7 +2967,7 @@ void skl_cleanup_resources(struct skl_dev *skl)
|
||||
return;
|
||||
|
||||
card = soc_component->card;
|
||||
if (!card || !card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(card))
|
||||
return;
|
||||
|
||||
list_for_each_entry(w, &card->widgets, list) {
|
||||
|
@ -32,7 +32,7 @@ int mtk_sof_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
|
||||
continue;
|
||||
|
||||
for_each_rtd_cpu_dais(runtime, j, cpu_dai) {
|
||||
if (cpu_dai->stream_active[conn->stream_dir] > 0) {
|
||||
if (snd_soc_dai_stream_active(cpu_dai, conn->stream_dir) > 0) {
|
||||
sof_dai_link = runtime->dai_link;
|
||||
break;
|
||||
}
|
||||
@ -111,21 +111,17 @@ int mtk_sof_card_late_probe(struct snd_soc_card *card)
|
||||
for_each_rtd_cpu_dais(sof_rtd, j, cpu_dai) {
|
||||
struct snd_soc_dapm_route route;
|
||||
struct snd_soc_dapm_path *p = NULL;
|
||||
struct snd_soc_dapm_widget *play_widget =
|
||||
cpu_dai->playback_widget;
|
||||
struct snd_soc_dapm_widget *cap_widget =
|
||||
cpu_dai->capture_widget;
|
||||
struct snd_soc_dapm_widget *widget = snd_soc_dai_get_widget(cpu_dai, conn->stream_dir);
|
||||
|
||||
memset(&route, 0, sizeof(route));
|
||||
if (conn->stream_dir == SNDRV_PCM_STREAM_CAPTURE &&
|
||||
cap_widget) {
|
||||
snd_soc_dapm_widget_for_each_sink_path(cap_widget, p) {
|
||||
if (conn->stream_dir == SNDRV_PCM_STREAM_CAPTURE && widget) {
|
||||
snd_soc_dapm_widget_for_each_sink_path(widget, p) {
|
||||
route.source = conn->sof_dma;
|
||||
route.sink = p->sink->name;
|
||||
snd_soc_dapm_add_routes(&card->dapm, &route, 1);
|
||||
}
|
||||
} else if (conn->stream_dir == SNDRV_PCM_STREAM_PLAYBACK &&
|
||||
play_widget) {
|
||||
snd_soc_dapm_widget_for_each_source_path(play_widget, p) {
|
||||
} else if (conn->stream_dir == SNDRV_PCM_STREAM_PLAYBACK && widget) {
|
||||
snd_soc_dapm_widget_for_each_source_path(widget, p) {
|
||||
route.source = p->source->name;
|
||||
route.sink = conn->sof_dma;
|
||||
snd_soc_dapm_add_routes(&card->dapm, &route, 1);
|
||||
|
@ -183,6 +183,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
|
||||
struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai);
|
||||
struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai);
|
||||
unsigned int rate = params_rate(params);
|
||||
unsigned int rate_reg = mt6797_rate_transform(afe->dev, rate, dai->id);
|
||||
unsigned int pcm_con = 0;
|
||||
@ -193,10 +195,10 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
substream->stream,
|
||||
rate,
|
||||
rate_reg,
|
||||
dai->playback_widget->active,
|
||||
dai->capture_widget->active);
|
||||
p->active,
|
||||
c->active);
|
||||
|
||||
if (dai->playback_widget->active || dai->capture_widget->active)
|
||||
if (p->active || c->active)
|
||||
return 0;
|
||||
|
||||
switch (dai->id) {
|
||||
|
@ -183,6 +183,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
|
||||
struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai);
|
||||
struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai);
|
||||
unsigned int rate = params_rate(params);
|
||||
unsigned int rate_reg = mt8183_rate_transform(afe->dev, rate, dai->id);
|
||||
unsigned int pcm_con = 0;
|
||||
@ -193,10 +195,9 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
substream->stream,
|
||||
rate,
|
||||
rate_reg,
|
||||
dai->playback_widget->active,
|
||||
dai->capture_widget->active);
|
||||
p->active, c->active);
|
||||
|
||||
if (dai->playback_widget->active || dai->capture_widget->active)
|
||||
if (p->active || c->active)
|
||||
return 0;
|
||||
|
||||
switch (dai->id) {
|
||||
|
@ -218,6 +218,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
{
|
||||
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
|
||||
struct mt8186_afe_private *afe_priv = afe->platform_priv;
|
||||
struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai);
|
||||
struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai);
|
||||
int pcm_id = dai->id;
|
||||
struct mtk_afe_pcm_priv *pcm_priv = afe_priv->dai_priv[pcm_id];
|
||||
unsigned int rate = params_rate(params);
|
||||
@ -230,12 +232,11 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
unsigned int pcm_con = 0;
|
||||
|
||||
dev_dbg(afe->dev, "%s(), id %d, stream %d, widget active p %d, c %d\n",
|
||||
__func__, dai->id, substream->stream, dai->playback_widget->active,
|
||||
dai->capture_widget->active);
|
||||
__func__, dai->id, substream->stream, p->active, c->active);
|
||||
dev_dbg(afe->dev, "%s(), rate %d, rate_reg %d, data_width %d, wlen_width %d\n",
|
||||
__func__, rate, rate_reg, data_width, wlen_width);
|
||||
|
||||
if (dai->playback_widget->active || dai->capture_widget->active)
|
||||
if (p->active || c->active)
|
||||
return 0;
|
||||
|
||||
switch (dai->id) {
|
||||
|
@ -227,7 +227,8 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
|
||||
static int mtk_dai_pcm_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
if (dai->playback_widget->active || dai->capture_widget->active)
|
||||
if (snd_soc_dai_get_widget_playback(dai)->active ||
|
||||
snd_soc_dai_get_widget_capture(dai)->active)
|
||||
return 0;
|
||||
|
||||
return mtk_dai_pcm_configure(substream, dai);
|
||||
|
@ -273,6 +273,8 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
|
||||
struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai);
|
||||
struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai);
|
||||
unsigned int rate = params_rate(params);
|
||||
unsigned int rate_reg = mt8192_rate_transform(afe->dev, rate, dai->id);
|
||||
unsigned int pcm_con = 0;
|
||||
@ -283,10 +285,10 @@ static int mtk_dai_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||
substream->stream,
|
||||
rate,
|
||||
rate_reg,
|
||||
dai->playback_widget->active,
|
||||
dai->capture_widget->active);
|
||||
p->active,
|
||||
c->active);
|
||||
|
||||
if (dai->playback_widget->active || dai->capture_widget->active)
|
||||
if (p->active || c->active)
|
||||
return 0;
|
||||
|
||||
switch (dai->id) {
|
||||
|
@ -213,11 +213,14 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
|
||||
static int mtk_dai_pcm_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_dapm_widget *p = snd_soc_dai_get_widget_playback(dai);
|
||||
struct snd_soc_dapm_widget *c = snd_soc_dai_get_widget_capture(dai);
|
||||
|
||||
dev_dbg(dai->dev, "%s(), id %d, stream %d, widget active p %d, c %d\n",
|
||||
__func__, dai->id, substream->stream,
|
||||
dai->playback_widget->active, dai->capture_widget->active);
|
||||
p->active, c->active);
|
||||
|
||||
if (dai->playback_widget->active || dai->capture_widget->active)
|
||||
if (p->active || c->active)
|
||||
return 0;
|
||||
|
||||
return mtk_dai_pcm_configure(substream, dai);
|
||||
|
@ -88,7 +88,7 @@ static int aiu_fifo_i2s_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
@ -158,7 +158,7 @@ int aiu_fifo_i2s_dai_probe(struct snd_soc_dai *dai)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fifo = dai->playback_dma_data;
|
||||
fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
|
||||
fifo->pcm = &fifo_i2s_pcm;
|
||||
fifo->mem_offset = AIU_MEM_I2S_START;
|
||||
|
@ -173,7 +173,7 @@ int aiu_fifo_spdif_dai_probe(struct snd_soc_dai *dai)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fifo = dai->playback_dma_data;
|
||||
fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
|
||||
fifo->pcm = &fifo_spdif_pcm;
|
||||
fifo->mem_offset = AIU_MEM_IEC958_START;
|
||||
|
@ -34,7 +34,7 @@ snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_dai *dai = aiu_fifo_dai(substream);
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
unsigned int addr;
|
||||
|
||||
@ -46,7 +46,7 @@ snd_pcm_uframes_t aiu_fifo_pointer(struct snd_soc_component *component,
|
||||
static void aiu_fifo_enable(struct snd_soc_dai *dai, bool enable)
|
||||
{
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
unsigned int en_mask = (AIU_MEM_CONTROL_FILL_EN |
|
||||
AIU_MEM_CONTROL_EMPTY_EN);
|
||||
|
||||
@ -80,7 +80,7 @@ int aiu_fifo_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
|
||||
snd_soc_component_update_bits(component,
|
||||
fifo->mem_offset + AIU_MEM_CONTROL,
|
||||
@ -98,7 +98,7 @@ int aiu_fifo_hw_params(struct snd_pcm_substream *substream,
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
dma_addr_t end;
|
||||
|
||||
/* Setup the fifo boundaries */
|
||||
@ -132,7 +132,7 @@ static irqreturn_t aiu_fifo_isr(int irq, void *dev_id)
|
||||
int aiu_fifo_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
int ret;
|
||||
|
||||
snd_soc_set_runtime_hwparams(substream, fifo->pcm);
|
||||
@ -168,7 +168,7 @@ int aiu_fifo_startup(struct snd_pcm_substream *substream,
|
||||
void aiu_fifo_shutdown(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
|
||||
free_irq(fifo->irq, substream);
|
||||
clk_disable_unprepare(fifo->pclk);
|
||||
@ -178,7 +178,7 @@ int aiu_fifo_pcm_new(struct snd_soc_pcm_runtime *rtd,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_card *card = rtd->card->snd_card;
|
||||
struct aiu_fifo *fifo = dai->playback_dma_data;
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
size_t size = fifo->pcm->buffer_bytes_max;
|
||||
int ret;
|
||||
|
||||
@ -200,15 +200,16 @@ int aiu_fifo_dai_probe(struct snd_soc_dai *dai)
|
||||
if (!fifo)
|
||||
return -ENOMEM;
|
||||
|
||||
dai->playback_dma_data = fifo;
|
||||
snd_soc_dai_dma_data_set_playback(dai, fifo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aiu_fifo_dai_remove(struct snd_soc_dai *dai)
|
||||
{
|
||||
kfree(dai->playback_dma_data);
|
||||
struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai);
|
||||
|
||||
kfree(fifo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,8 @@ int axg_tdm_set_tdm_slots(struct snd_soc_dai *dai, u32 *tx_mask,
|
||||
unsigned int slot_width)
|
||||
{
|
||||
struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
|
||||
struct axg_tdm_stream *tx = (struct axg_tdm_stream *)
|
||||
dai->playback_dma_data;
|
||||
struct axg_tdm_stream *rx = (struct axg_tdm_stream *)
|
||||
dai->capture_dma_data;
|
||||
struct axg_tdm_stream *tx = snd_soc_dai_dma_data_get_playback(dai);
|
||||
struct axg_tdm_stream *rx = snd_soc_dai_dma_data_get_capture(dai);
|
||||
unsigned int tx_slots, rx_slots;
|
||||
unsigned int fmt = 0;
|
||||
|
||||
@ -362,11 +360,14 @@ static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream,
|
||||
|
||||
static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai)
|
||||
{
|
||||
if (dai->capture_dma_data)
|
||||
axg_tdm_stream_free(dai->capture_dma_data);
|
||||
int stream;
|
||||
|
||||
if (dai->playback_dma_data)
|
||||
axg_tdm_stream_free(dai->playback_dma_data);
|
||||
for_each_pcm_streams(stream) {
|
||||
struct axg_tdm_stream *ts = snd_soc_dai_dma_data_get(dai, stream);
|
||||
|
||||
if (ts)
|
||||
axg_tdm_stream_free(ts);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -374,19 +375,20 @@ static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai)
|
||||
static int axg_tdm_iface_probe_dai(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct axg_tdm_iface *iface = snd_soc_dai_get_drvdata(dai);
|
||||
int stream;
|
||||
|
||||
if (dai->capture_widget) {
|
||||
dai->capture_dma_data = axg_tdm_stream_alloc(iface);
|
||||
if (!dai->capture_dma_data)
|
||||
return -ENOMEM;
|
||||
}
|
||||
for_each_pcm_streams(stream) {
|
||||
struct axg_tdm_stream *ts;
|
||||
|
||||
if (dai->playback_widget) {
|
||||
dai->playback_dma_data = axg_tdm_stream_alloc(iface);
|
||||
if (!dai->playback_dma_data) {
|
||||
if (!snd_soc_dai_get_widget(dai, stream))
|
||||
continue;
|
||||
|
||||
ts = axg_tdm_stream_alloc(iface);
|
||||
if (!ts) {
|
||||
axg_tdm_iface_remove_dai(dai);
|
||||
return -ENOMEM;
|
||||
}
|
||||
snd_soc_dai_dma_data_set(dai, stream, ts);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -83,7 +83,7 @@ axg_tdmin_get_tdm_stream(struct snd_soc_dapm_widget *w)
|
||||
if (!be)
|
||||
return NULL;
|
||||
|
||||
return be->capture_dma_data;
|
||||
return snd_soc_dai_dma_data_get_capture(be);
|
||||
}
|
||||
|
||||
static void axg_tdmin_enable(struct regmap *map)
|
||||
|
@ -81,7 +81,7 @@ axg_tdmout_get_tdm_stream(struct snd_soc_dapm_widget *w)
|
||||
if (!be)
|
||||
return NULL;
|
||||
|
||||
return be->playback_dma_data;
|
||||
return snd_soc_dai_dma_data_get_playback(be);
|
||||
}
|
||||
|
||||
static void axg_tdmout_enable(struct regmap *map)
|
||||
|
@ -39,13 +39,13 @@ meson_codec_glue_get_input(struct snd_soc_dapm_widget *w)
|
||||
static void meson_codec_glue_input_set_data(struct snd_soc_dai *dai,
|
||||
struct meson_codec_glue_input *data)
|
||||
{
|
||||
dai->playback_dma_data = data;
|
||||
snd_soc_dai_dma_data_set_playback(dai, data);
|
||||
}
|
||||
|
||||
struct meson_codec_glue_input *
|
||||
meson_codec_glue_input_get_data(struct snd_soc_dai *dai)
|
||||
{
|
||||
return dai->playback_dma_data;
|
||||
return snd_soc_dai_dma_data_get_playback(dai);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(meson_codec_glue_input_get_data);
|
||||
|
||||
@ -99,8 +99,8 @@ int meson_codec_glue_output_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct meson_codec_glue_input *in_data =
|
||||
meson_codec_glue_output_get_input_data(dai->capture_widget);
|
||||
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget_capture(dai);
|
||||
struct meson_codec_glue_input *in_data = meson_codec_glue_output_get_input_data(w);
|
||||
|
||||
if (!in_data)
|
||||
return -ENODEV;
|
||||
|
@ -1070,9 +1070,9 @@ static int rockchip_i2s_tdm_dai_probe(struct snd_soc_dai *dai)
|
||||
struct rk_i2s_tdm_dev *i2s_tdm = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
if (i2s_tdm->has_capture)
|
||||
dai->capture_dma_data = &i2s_tdm->capture_dma_data;
|
||||
snd_soc_dai_dma_data_set_capture(dai, &i2s_tdm->capture_dma_data);
|
||||
if (i2s_tdm->has_playback)
|
||||
dai->playback_dma_data = &i2s_tdm->playback_dma_data;
|
||||
snd_soc_dai_dma_data_set_playback(dai, &i2s_tdm->playback_dma_data);
|
||||
|
||||
if (i2s_tdm->mclk_calibrate)
|
||||
snd_soc_add_dai_controls(dai, &rockchip_i2s_tdm_compensation_control, 1);
|
||||
|
@ -373,7 +373,7 @@ static int rockchip_pdm_dai_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct rk_pdm_dev *pdm = to_info(dai);
|
||||
|
||||
dai->capture_dma_data = &pdm->capture_dma_data;
|
||||
snd_soc_dai_dma_data_set_capture(dai, &pdm->capture_dma_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ static int rk_spdif_dai_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct rk_spdif_dev *spdif = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
dai->playback_dma_data = &spdif->playback_dma_data;
|
||||
snd_soc_dai_dma_data_set_playback(dai, &spdif->playback_dma_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ int snd_soc_suspend(struct device *dev)
|
||||
int i;
|
||||
|
||||
/* If the card is not initialized yet there is nothing to do */
|
||||
if (!card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(card))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@ -695,7 +695,7 @@ int snd_soc_resume(struct device *dev)
|
||||
struct snd_soc_component *component;
|
||||
|
||||
/* If the card is not initialized yet there is nothing to do */
|
||||
if (!card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(card))
|
||||
return 0;
|
||||
|
||||
/* activate pins from sleep state */
|
||||
@ -1915,7 +1915,7 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
|
||||
|
||||
static void snd_soc_unbind_card(struct snd_soc_card *card, bool unregister)
|
||||
{
|
||||
if (card->instantiated) {
|
||||
if (snd_soc_card_is_instantiated(card)) {
|
||||
card->instantiated = false;
|
||||
snd_soc_flush_all_delayed_work(card);
|
||||
|
||||
@ -2126,7 +2126,7 @@ int snd_soc_poweroff(struct device *dev)
|
||||
struct snd_soc_card *card = dev_get_drvdata(dev);
|
||||
struct snd_soc_component *component;
|
||||
|
||||
if (!card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(card))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
@ -267,6 +267,11 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
|
||||
int slots, int slot_width)
|
||||
{
|
||||
int ret = -ENOTSUPP;
|
||||
int stream;
|
||||
unsigned int *tdm_mask[] = {
|
||||
&tx_mask,
|
||||
&rx_mask,
|
||||
};
|
||||
|
||||
if (dai->driver->ops &&
|
||||
dai->driver->ops->xlate_tdm_slot_mask)
|
||||
@ -275,8 +280,8 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
|
||||
else
|
||||
snd_soc_xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask);
|
||||
|
||||
dai->tx_mask = tx_mask;
|
||||
dai->rx_mask = rx_mask;
|
||||
for_each_pcm_streams(stream)
|
||||
snd_soc_dai_tdm_mask_set(dai, stream, *tdm_mask[stream]);
|
||||
|
||||
if (dai->driver->ops &&
|
||||
dai->driver->ops->set_tdm_slot)
|
||||
@ -509,7 +514,7 @@ void snd_soc_dai_action(struct snd_soc_dai *dai,
|
||||
int stream, int action)
|
||||
{
|
||||
/* see snd_soc_dai_stream_active() */
|
||||
dai->stream_active[stream] += action;
|
||||
dai->stream[stream].active += action;
|
||||
|
||||
/* see snd_soc_component_active() */
|
||||
dai->component->active += action;
|
||||
@ -522,7 +527,7 @@ int snd_soc_dai_active(struct snd_soc_dai *dai)
|
||||
|
||||
active = 0;
|
||||
for_each_pcm_streams(stream)
|
||||
active += dai->stream_active[stream];
|
||||
active += dai->stream[stream].active;
|
||||
|
||||
return active;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ static int dapm_down_seq[] = {
|
||||
|
||||
static void dapm_assert_locked(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
if (dapm->card && dapm->card->instantiated)
|
||||
if (snd_soc_card_is_instantiated(dapm->card))
|
||||
lockdep_assert_held(&dapm->card->dapm_mutex);
|
||||
}
|
||||
|
||||
@ -1297,7 +1297,7 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
|
||||
enum snd_soc_dapm_direction))
|
||||
{
|
||||
struct snd_soc_card *card = dai->component->card;
|
||||
struct snd_soc_dapm_widget *w;
|
||||
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(dai, stream);
|
||||
LIST_HEAD(widgets);
|
||||
int paths;
|
||||
int ret;
|
||||
@ -1305,12 +1305,10 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
|
||||
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
|
||||
|
||||
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
w = dai->playback_widget;
|
||||
invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT);
|
||||
paths = is_connected_output_ep(w, &widgets,
|
||||
custom_stop_condition);
|
||||
} else {
|
||||
w = dai->capture_widget;
|
||||
invalidate_paths_ep(w, SND_SOC_DAPM_DIR_IN);
|
||||
paths = is_connected_input_ep(w, &widgets,
|
||||
custom_stop_condition);
|
||||
@ -2614,7 +2612,7 @@ int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm)
|
||||
* Suppress early reports (eg, jacks syncing their state) to avoid
|
||||
* silly DAPM runs during card startup.
|
||||
*/
|
||||
if (!dapm->card || !dapm->card->instantiated)
|
||||
if (!snd_soc_card_is_instantiated(dapm->card))
|
||||
return 0;
|
||||
|
||||
return dapm_power_widgets(dapm->card, SND_SOC_DAPM_STREAM_NOP);
|
||||
@ -2908,7 +2906,7 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm,
|
||||
dapm_mark_dirty(path->node[dir], "Route added");
|
||||
}
|
||||
|
||||
if (dapm->card->instantiated && path->connect)
|
||||
if (snd_soc_card_is_instantiated(dapm->card) && path->connect)
|
||||
dapm_path_invalidate(path);
|
||||
|
||||
return 0;
|
||||
@ -4229,7 +4227,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
|
||||
return PTR_ERR(w);
|
||||
|
||||
w->priv = dai;
|
||||
dai->playback_widget = w;
|
||||
snd_soc_dai_set_widget_playback(dai, w);
|
||||
}
|
||||
|
||||
if (dai->driver->capture.stream_name) {
|
||||
@ -4245,7 +4243,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
|
||||
return PTR_ERR(w);
|
||||
|
||||
w->priv = dai;
|
||||
dai->capture_widget = w;
|
||||
snd_soc_dai_set_widget_capture(dai, w);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -4339,16 +4337,16 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card,
|
||||
int stream;
|
||||
|
||||
if (dai_link->params) {
|
||||
playback_cpu = cpu_dai->capture_widget;
|
||||
capture_cpu = cpu_dai->playback_widget;
|
||||
playback_cpu = snd_soc_dai_get_widget_capture(cpu_dai);
|
||||
capture_cpu = snd_soc_dai_get_widget_playback(cpu_dai);
|
||||
} else {
|
||||
playback_cpu = cpu_dai->playback_widget;
|
||||
capture_cpu = cpu_dai->capture_widget;
|
||||
playback_cpu = snd_soc_dai_get_widget_playback(cpu_dai);
|
||||
capture_cpu = snd_soc_dai_get_widget_capture(cpu_dai);
|
||||
}
|
||||
|
||||
/* connect BE DAI playback if widgets are valid */
|
||||
stream = SNDRV_PCM_STREAM_PLAYBACK;
|
||||
codec = codec_dai->playback_widget;
|
||||
codec = snd_soc_dai_get_widget(codec_dai, stream);
|
||||
|
||||
if (playback_cpu && codec) {
|
||||
if (dai_link->params && !rtd->c2c_widget[stream]) {
|
||||
@ -4367,7 +4365,7 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card,
|
||||
capture:
|
||||
/* connect BE DAI capture if widgets are valid */
|
||||
stream = SNDRV_PCM_STREAM_CAPTURE;
|
||||
codec = codec_dai->capture_widget;
|
||||
codec = snd_soc_dai_get_widget(codec_dai, stream);
|
||||
|
||||
if (codec && capture_cpu) {
|
||||
if (dai_link->params && !rtd->c2c_widget[stream]) {
|
||||
|
@ -1012,6 +1012,7 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
|
||||
|
||||
for_each_rtd_codec_dais(rtd, i, codec_dai) {
|
||||
struct snd_pcm_hw_params codec_params;
|
||||
unsigned int tdm_mask = snd_soc_dai_tdm_mask_get(codec_dai, substream->stream);
|
||||
|
||||
/*
|
||||
* Skip CODECs which don't support the current stream type,
|
||||
@ -1034,15 +1035,8 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd,
|
||||
codec_params = *params;
|
||||
|
||||
/* fixup params based on TDM slot masks */
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
||||
codec_dai->tx_mask)
|
||||
soc_pcm_codec_params_fixup(&codec_params,
|
||||
codec_dai->tx_mask);
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
|
||||
codec_dai->rx_mask)
|
||||
soc_pcm_codec_params_fixup(&codec_params,
|
||||
codec_dai->rx_mask);
|
||||
if (tdm_mask)
|
||||
soc_pcm_codec_params_fixup(&codec_params, tdm_mask);
|
||||
|
||||
ret = snd_soc_dai_hw_params(codec_dai, substream,
|
||||
&codec_params);
|
||||
|
@ -1436,7 +1436,7 @@ widget:
|
||||
|
||||
/* card dapm mutex is held by the core if we are loading topology
|
||||
* data during sound card init. */
|
||||
if (card->instantiated)
|
||||
if (snd_soc_card_is_instantiated(card))
|
||||
widget = snd_soc_dapm_new_control(dapm, &template);
|
||||
else
|
||||
widget = snd_soc_dapm_new_control_unlocked(dapm, &template);
|
||||
@ -1525,7 +1525,7 @@ static int soc_tplg_dapm_complete(struct soc_tplg *tplg)
|
||||
/* Card might not have been registered at this point.
|
||||
* If so, just return success.
|
||||
*/
|
||||
if (!card || !card->instantiated) {
|
||||
if (!snd_soc_card_is_instantiated(card)) {
|
||||
dev_warn(tplg->dev, "ASoC: Parent card not yet available,"
|
||||
" widget card binding deferred\n");
|
||||
return 0;
|
||||
|
@ -1055,6 +1055,7 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
|
||||
struct snd_soc_card *card = scomp->card;
|
||||
struct snd_soc_pcm_runtime *rtd;
|
||||
struct snd_soc_dai *cpu_dai;
|
||||
int stream;
|
||||
int i;
|
||||
|
||||
if (!w->sname) {
|
||||
@ -1062,62 +1063,41 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (w->id == snd_soc_dapm_dai_out)
|
||||
stream = SNDRV_PCM_STREAM_CAPTURE;
|
||||
if (w->id == snd_soc_dapm_dai_in)
|
||||
stream = SNDRV_PCM_STREAM_PLAYBACK;
|
||||
else
|
||||
goto end;
|
||||
|
||||
list_for_each_entry(rtd, &card->rtd_list, list) {
|
||||
/* does stream match DAI link ? */
|
||||
if (!rtd->dai_link->stream_name ||
|
||||
strcmp(w->sname, rtd->dai_link->stream_name))
|
||||
continue;
|
||||
|
||||
switch (w->id) {
|
||||
case snd_soc_dapm_dai_out:
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
||||
/*
|
||||
* Please create DAI widget in the right order
|
||||
* to ensure BE will connect to the right DAI
|
||||
* widget.
|
||||
*/
|
||||
if (!cpu_dai->capture_widget) {
|
||||
cpu_dai->capture_widget = w;
|
||||
break;
|
||||
}
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
||||
/*
|
||||
* Please create DAI widget in the right order
|
||||
* to ensure BE will connect to the right DAI
|
||||
* widget.
|
||||
*/
|
||||
if (!snd_soc_dai_get_widget(cpu_dai, stream)) {
|
||||
snd_soc_dai_set_widget(cpu_dai, stream, w);
|
||||
break;
|
||||
}
|
||||
if (i == rtd->dai_link->num_cpus) {
|
||||
dev_err(scomp->dev, "error: can't find BE for DAI %s\n",
|
||||
w->name);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
dai->name = rtd->dai_link->name;
|
||||
dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n",
|
||||
w->name, rtd->dai_link->name);
|
||||
break;
|
||||
case snd_soc_dapm_dai_in:
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
||||
/*
|
||||
* Please create DAI widget in the right order
|
||||
* to ensure BE will connect to the right DAI
|
||||
* widget.
|
||||
*/
|
||||
if (!cpu_dai->playback_widget) {
|
||||
cpu_dai->playback_widget = w;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == rtd->dai_link->num_cpus) {
|
||||
dev_err(scomp->dev, "error: can't find BE for DAI %s\n",
|
||||
w->name);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
dai->name = rtd->dai_link->name;
|
||||
dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n",
|
||||
w->name, rtd->dai_link->name);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == rtd->dai_link->num_cpus) {
|
||||
dev_err(scomp->dev, "error: can't find BE for DAI %s\n", w->name);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dai->name = rtd->dai_link->name;
|
||||
dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n",
|
||||
w->name, rtd->dai_link->name);
|
||||
}
|
||||
end:
|
||||
/* check we have a connection */
|
||||
if (!dai->name) {
|
||||
dev_err(scomp->dev, "error: can't connect DAI %s stream %s\n",
|
||||
@ -1134,37 +1114,29 @@ static void sof_disconnect_dai_widget(struct snd_soc_component *scomp,
|
||||
struct snd_soc_card *card = scomp->card;
|
||||
struct snd_soc_pcm_runtime *rtd;
|
||||
struct snd_soc_dai *cpu_dai;
|
||||
int i;
|
||||
int i, stream;
|
||||
|
||||
if (!w->sname)
|
||||
return;
|
||||
|
||||
if (w->id == snd_soc_dapm_dai_out)
|
||||
stream = SNDRV_PCM_STREAM_CAPTURE;
|
||||
else if (w->id == snd_soc_dapm_dai_in)
|
||||
stream = SNDRV_PCM_STREAM_PLAYBACK;
|
||||
else
|
||||
return;
|
||||
|
||||
list_for_each_entry(rtd, &card->rtd_list, list) {
|
||||
/* does stream match DAI link ? */
|
||||
if (!rtd->dai_link->stream_name ||
|
||||
strcmp(w->sname, rtd->dai_link->stream_name))
|
||||
continue;
|
||||
|
||||
switch (w->id) {
|
||||
case snd_soc_dapm_dai_out:
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
||||
if (cpu_dai->capture_widget == w) {
|
||||
cpu_dai->capture_widget = NULL;
|
||||
break;
|
||||
}
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai)
|
||||
if (snd_soc_dai_get_widget(cpu_dai, stream) == w) {
|
||||
snd_soc_dai_set_widget(cpu_dai, stream, NULL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case snd_soc_dapm_dai_in:
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
||||
if (cpu_dai->playback_widget == w) {
|
||||
cpu_dai->playback_widget = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,8 @@ static int spdif_soc_dai_probe(struct snd_soc_dai *dai)
|
||||
struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
host->dma_params_tx.filter_data = &host->dma_params;
|
||||
dai->playback_dma_data = &host->dma_params_tx;
|
||||
|
||||
snd_soc_dai_dma_data_set_playback(dai, &host->dma_params_tx);
|
||||
|
||||
return snd_soc_add_dai_controls(dai, spdif_out_controls,
|
||||
ARRAY_SIZE(spdif_out_controls));
|
||||
|
@ -212,8 +212,8 @@ static int tegra20_ac97_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct tegra20_ac97 *ac97 = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
dai->capture_dma_data = &ac97->capture_dma_data;
|
||||
dai->playback_dma_data = &ac97->playback_dma_data;
|
||||
snd_soc_dai_init_dma_data(dai, &ac97->playback_dma_data,
|
||||
&ac97->capture_dma_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -256,8 +256,8 @@ static int tegra20_i2s_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct tegra20_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
dai->capture_dma_data = &i2s->capture_dma_data;
|
||||
dai->playback_dma_data = &i2s->playback_dma_data;
|
||||
snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data,
|
||||
&i2s->capture_dma_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -236,8 +236,7 @@ static int tegra20_spdif_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct tegra20_spdif *spdif = dev_get_drvdata(dai->dev);
|
||||
|
||||
dai->capture_dma_data = NULL;
|
||||
dai->playback_dma_data = &spdif->playback_dma_data;
|
||||
snd_soc_dai_init_dma_data(dai, &spdif->playback_dma_data, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -544,8 +544,8 @@ static int tegra_admaif_dai_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct tegra_admaif *admaif = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
dai->capture_dma_data = &admaif->capture_dma_data[dai->id];
|
||||
dai->playback_dma_data = &admaif->playback_dma_data[dai->id];
|
||||
snd_soc_dai_init_dma_data(dai, &admaif->playback_dma_data[dai->id],
|
||||
&admaif->capture_dma_data[dai->id]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -297,8 +297,8 @@ static int tegra30_i2s_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
dai->capture_dma_data = &i2s->capture_dma_data;
|
||||
dai->playback_dma_data = &i2s->playback_dma_data;
|
||||
snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data,
|
||||
&i2s->capture_dma_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -614,9 +614,10 @@ static const struct snd_soc_dai_ops davinci_i2s_dai_ops = {
|
||||
static int davinci_i2s_dai_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);
|
||||
int stream;
|
||||
|
||||
dai->playback_dma_data = &dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
dai->capture_dma_data = &dev->dma_data[SNDRV_PCM_STREAM_CAPTURE];
|
||||
for_each_pcm_streams(stream)
|
||||
snd_soc_dai_dma_data_set(dai, stream, &dev->dma_data[stream]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1699,9 +1699,10 @@ static void davinci_mcasp_init_iec958_status(struct davinci_mcasp *mcasp)
|
||||
static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
|
||||
int stream;
|
||||
|
||||
dai->playback_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
dai->capture_dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE];
|
||||
for_each_pcm_streams(stream)
|
||||
snd_soc_dai_dma_data_set(dai, stream, &mcasp->dma_data[stream]);
|
||||
|
||||
if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE) {
|
||||
davinci_mcasp_init_iec958_status(mcasp);
|
||||
|
@ -161,9 +161,10 @@ static const struct snd_soc_dai_ops davinci_vcif_dai_ops = {
|
||||
static int davinci_vcif_dai_probe(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct davinci_vcif_dev *dev = snd_soc_dai_get_drvdata(dai);
|
||||
int stream;
|
||||
|
||||
dai->playback_dma_data = &dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
dai->capture_dma_data = &dev->dma_data[SNDRV_PCM_STREAM_CAPTURE];
|
||||
for_each_pcm_streams(stream)
|
||||
snd_soc_dai_dma_data_set(dai, stream, &dev->dma_data[stream]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user