AC101_DBG("stream = %s, play: %d, capt: %d, active: %d\n",
snd_pcm_stream_str(substream),
- codec_dai->playback_active, codec_dai->capture_active,
- codec_dai->active);
+ codec_dai->playback_active, codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE],
+ snd_soc_dai_active(codec_dai));
- if (!codec_dai->active) {
+ if (!snd_soc_dai_active(codec_dai)) {
ac10x->aif1_clken = 1;
ac101_aif1clk(codec, SND_SOC_DAPM_POST_PMD, 0);
} else {
freq_out = _FREQ_24_576K;
for (i = 0; i < ARRAY_SIZE(codec_aif1_fs); i++) {
if (codec_aif1_fs[i].samp_rate == params_rate(params)) {
- if (codec_dai->capture_active && dmic_used && codec_aif1_fs[i].samp_rate == 44100) {
+ if (codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] &&
+ dmic_used && codec_aif1_fs[i].samp_rate == 44100) {
ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), (0x4<<AIF1_FS));
} else {
ac101_update_bits(codec, AIF_SR_CTRL, (0xf<<AIF1_FS), ((codec_aif1_fs[i].srbit)<<AIF1_FS));
dev_dbg(dai->dev, "%s() stream=%s play:%d capt:%d +++\n", __func__,
snd_pcm_stream_str(substream),
- dai->playback_active, dai->capture_active);
+ dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK],
+ dai->stream_active[SNDRV_PCM_STREAM_CAPTURE]);
if (ac10x->i2c101) {
ret = ac101_hw_params(substream, params, dai);
}
}
- if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE && dai->playback_active)
- || (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && dai->capture_active)) {
+ if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK])
+ || (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ dai->stream_active[SNDRV_PCM_STREAM_CAPTURE])) {
/* not configure hw_param twice */
/* return 0; */
}
}
}
-int ac108_aif_mute(struct snd_soc_dai *dai, int mute) {
+int ac108_aif_mute(struct snd_soc_dai *dai, int mute, int direction) {
struct snd_soc_codec *codec = dai->codec;
struct ac10x_priv *ac10x = snd_soc_codec_get_drvdata(codec);
/*ALSA PCM audio operations*/
.hw_params = ac108_hw_params,
.prepare = ac108_prepare,
- .digital_mute = ac108_aif_mute,
+ .mute_stream = ac108_aif_mute,
/*DAI format configuration*/
.set_fmt = ac108_set_fmt,
struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct seeed_dai_props *dai_props =
seeed_priv_to_props(priv, rtd->num);
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
int ret;
ret = clk_prepare_enable(dai_props->cpu_dai.clk);
if (ret)
clk_disable_unprepare(dai_props->cpu_dai.clk);
- if (rtd->cpu_dai->driver->playback.channels_min) {
- priv->channels_playback_default = rtd->cpu_dai->driver->playback.channels_min;
+ if (cpu_dai->driver->playback.channels_min) {
+ priv->channels_playback_default = cpu_dai->driver->playback.channels_min;
}
- if (rtd->cpu_dai->driver->capture.channels_min) {
- priv->channels_capture_default = rtd->cpu_dai->driver->capture.channels_min;
+ if (cpu_dai->driver->capture.channels_min) {
+ priv->channels_capture_default = cpu_dai->driver->capture.channels_min;
}
- rtd->cpu_dai->driver->playback.channels_min = priv->channels_playback_override;
- rtd->cpu_dai->driver->playback.channels_max = priv->channels_playback_override;
- rtd->cpu_dai->driver->capture.channels_min = priv->channels_capture_override;
- rtd->cpu_dai->driver->capture.channels_max = priv->channels_capture_override;
+ cpu_dai->driver->playback.channels_min = priv->channels_playback_override;
+ cpu_dai->driver->playback.channels_max = priv->channels_playback_override;
+ cpu_dai->driver->capture.channels_min = priv->channels_capture_override;
+ cpu_dai->driver->capture.channels_max = priv->channels_capture_override;
return ret;
}
static void seeed_voice_card_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *dai = rtd->codec_dai;
+ struct snd_soc_dai *dai = asoc_rtd_to_codec(rtd, 0);
struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct seeed_dai_props *dai_props =
seeed_priv_to_props(priv, rtd->num);
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
- rtd->cpu_dai->driver->playback.channels_min = priv->channels_playback_default;
- rtd->cpu_dai->driver->playback.channels_max = priv->channels_playback_default;
- rtd->cpu_dai->driver->capture.channels_min = priv->channels_capture_default;
- rtd->cpu_dai->driver->capture.channels_max = priv->channels_capture_default;
+ cpu_dai->driver->playback.channels_min = priv->channels_playback_default;
+ cpu_dai->driver->playback.channels_max = priv->channels_playback_default;
+ cpu_dai->driver->capture.channels_min = priv->channels_capture_default;
+ cpu_dai->driver->capture.channels_max = priv->channels_capture_default;
clk_disable_unprepare(dai_props->cpu_dai.clk);
clk_disable_unprepare(dai_props->codec_dai.clk);
- if (dai->capture_active && substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (dai->stream_active[SNDRV_PCM_STREAM_CAPTURE] &&
+ substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
return;
/* interrupt environment */
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct seeed_dai_props *dai_props =
seeed_priv_to_props(priv, rtd->num);
static int seeed_voice_card_dai_init(struct snd_soc_pcm_runtime *rtd)
{
struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
- struct snd_soc_dai *codec = rtd->codec_dai;
- struct snd_soc_dai *cpu = rtd->cpu_dai;
+ struct snd_soc_dai *codec = asoc_rtd_to_codec(rtd, 0);
+ struct snd_soc_dai *cpu = asoc_rtd_to_cpu(rtd, 0);
struct seeed_dai_props *dai_props =
seeed_priv_to_props(priv, rtd->num);
int ret;