Commit e814e393 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/core' into asoc-next

parents 6367771f 2062b4c5
...@@ -2551,8 +2551,9 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, ...@@ -2551,8 +2551,9 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
if (uinfo->value.enumerated.item > e->max - 1) if (uinfo->value.enumerated.item > e->max - 1)
uinfo->value.enumerated.item = e->max - 1; uinfo->value.enumerated.item = e->max - 1;
strcpy(uinfo->value.enumerated.name, strlcpy(uinfo->value.enumerated.name,
e->texts[uinfo->value.enumerated.item]); e->texts[uinfo->value.enumerated.item],
sizeof(uinfo->value.enumerated.name));
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(snd_soc_info_enum_double); EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
......
...@@ -190,7 +190,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -190,7 +190,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
/* startup the audio subsystem */ /* startup the audio subsystem */
if (cpu_dai->driver->ops->startup) { if (cpu_dai->driver->ops && cpu_dai->driver->ops->startup) {
ret = cpu_dai->driver->ops->startup(substream, cpu_dai); ret = cpu_dai->driver->ops->startup(substream, cpu_dai);
if (ret < 0) { if (ret < 0) {
dev_err(cpu_dai->dev, "ASoC: can't open interface" dev_err(cpu_dai->dev, "ASoC: can't open interface"
...@@ -208,7 +208,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) ...@@ -208,7 +208,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
} }
} }
if (codec_dai->driver->ops->startup) { if (codec_dai->driver->ops && codec_dai->driver->ops->startup) {
ret = codec_dai->driver->ops->startup(substream, codec_dai); ret = codec_dai->driver->ops->startup(substream, codec_dai);
if (ret < 0) { if (ret < 0) {
dev_err(codec_dai->dev, "ASoC: can't open codec" dev_err(codec_dai->dev, "ASoC: can't open codec"
...@@ -463,7 +463,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -463,7 +463,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
} }
} }
if (codec_dai->driver->ops->prepare) { if (codec_dai->driver->ops && codec_dai->driver->ops->prepare) {
ret = codec_dai->driver->ops->prepare(substream, codec_dai); ret = codec_dai->driver->ops->prepare(substream, codec_dai);
if (ret < 0) { if (ret < 0) {
dev_err(codec_dai->dev, "ASoC: DAI prepare error: %d\n", dev_err(codec_dai->dev, "ASoC: DAI prepare error: %d\n",
...@@ -472,7 +472,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) ...@@ -472,7 +472,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
} }
} }
if (cpu_dai->driver->ops->prepare) { if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) {
ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); ret = cpu_dai->driver->ops->prepare(substream, cpu_dai);
if (ret < 0) { if (ret < 0) {
dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n", dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n",
...@@ -523,7 +523,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -523,7 +523,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
} }
} }
if (codec_dai->driver->ops->hw_params) { if (codec_dai->driver->ops && codec_dai->driver->ops->hw_params) {
ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai); ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai);
if (ret < 0) { if (ret < 0) {
dev_err(codec_dai->dev, "ASoC: can't set %s hw params:" dev_err(codec_dai->dev, "ASoC: can't set %s hw params:"
...@@ -532,7 +532,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -532,7 +532,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
} }
} }
if (cpu_dai->driver->ops->hw_params) { if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_params) {
ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai); ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai);
if (ret < 0) { if (ret < 0) {
dev_err(cpu_dai->dev, "ASoC: %s hw params failed: %d\n", dev_err(cpu_dai->dev, "ASoC: %s hw params failed: %d\n",
...@@ -559,11 +559,11 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -559,11 +559,11 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
platform_err: platform_err:
if (cpu_dai->driver->ops->hw_free) if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_free)
cpu_dai->driver->ops->hw_free(substream, cpu_dai); cpu_dai->driver->ops->hw_free(substream, cpu_dai);
interface_err: interface_err:
if (codec_dai->driver->ops->hw_free) if (codec_dai->driver->ops && codec_dai->driver->ops->hw_free)
codec_dai->driver->ops->hw_free(substream, codec_dai); codec_dai->driver->ops->hw_free(substream, codec_dai);
codec_err: codec_err:
...@@ -600,10 +600,10 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) ...@@ -600,10 +600,10 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
platform->driver->ops->hw_free(substream); platform->driver->ops->hw_free(substream);
/* now free hw params for the DAIs */ /* now free hw params for the DAIs */
if (codec_dai->driver->ops->hw_free) if (codec_dai->driver->ops && codec_dai->driver->ops->hw_free)
codec_dai->driver->ops->hw_free(substream, codec_dai); codec_dai->driver->ops->hw_free(substream, codec_dai);
if (cpu_dai->driver->ops->hw_free) if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_free)
cpu_dai->driver->ops->hw_free(substream, cpu_dai); cpu_dai->driver->ops->hw_free(substream, cpu_dai);
mutex_unlock(&rtd->pcm_mutex); mutex_unlock(&rtd->pcm_mutex);
...@@ -618,7 +618,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -618,7 +618,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
int ret; int ret;
if (codec_dai->driver->ops->trigger) { if (codec_dai->driver->ops && codec_dai->driver->ops->trigger) {
ret = codec_dai->driver->ops->trigger(substream, cmd, codec_dai); ret = codec_dai->driver->ops->trigger(substream, cmd, codec_dai);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -630,7 +630,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -630,7 +630,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
return ret; return ret;
} }
if (cpu_dai->driver->ops->trigger) { if (cpu_dai->driver->ops && cpu_dai->driver->ops->trigger) {
ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai); ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -647,19 +647,20 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, ...@@ -647,19 +647,20 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *codec_dai = rtd->codec_dai;
int ret; int ret;
if (codec_dai->driver->ops->bespoke_trigger) { if (codec_dai->driver->ops &&
codec_dai->driver->ops->bespoke_trigger) {
ret = codec_dai->driver->ops->bespoke_trigger(substream, cmd, codec_dai); ret = codec_dai->driver->ops->bespoke_trigger(substream, cmd, codec_dai);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
if (platform->driver->bespoke_trigger) { if (platform->driver->ops && platform->driver->bespoke_trigger) {
ret = platform->driver->bespoke_trigger(substream, cmd); ret = platform->driver->bespoke_trigger(substream, cmd);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
if (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)
return ret; return ret;
...@@ -684,10 +685,10 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) ...@@ -684,10 +685,10 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
if (platform->driver->ops && platform->driver->ops->pointer) if (platform->driver->ops && platform->driver->ops->pointer)
offset = platform->driver->ops->pointer(substream); offset = platform->driver->ops->pointer(substream);
if (cpu_dai->driver->ops->delay) if (cpu_dai->driver->ops && cpu_dai->driver->ops->delay)
delay += cpu_dai->driver->ops->delay(substream, cpu_dai); delay += cpu_dai->driver->ops->delay(substream, cpu_dai);
if (codec_dai->driver->ops->delay) if (codec_dai->driver->ops && codec_dai->driver->ops->delay)
delay += codec_dai->driver->ops->delay(substream, codec_dai); delay += codec_dai->driver->ops->delay(substream, codec_dai);
if (platform->driver->delay) if (platform->driver->delay)
...@@ -1037,6 +1038,12 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -1037,6 +1038,12 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
struct snd_pcm_substream *be_substream = struct snd_pcm_substream *be_substream =
snd_soc_dpcm_get_substream(be, stream); snd_soc_dpcm_get_substream(be, stream);
if (!be_substream) {
dev_err(be->dev, "ASoC: no backend %s stream\n",
stream ? "capture" : "playback");
continue;
}
/* is this op for this BE ? */ /* is this op for this BE ? */
if (!snd_soc_dpcm_be_can_update(fe, be, stream)) if (!snd_soc_dpcm_be_can_update(fe, be, stream))
continue; continue;
...@@ -1054,7 +1061,8 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -1054,7 +1061,8 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
(be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE))
continue; continue;
dev_dbg(be->dev, "ASoC: open BE %s\n", be->dai_link->name); dev_dbg(be->dev, "ASoC: open %s BE %s\n",
stream ? "capture" : "playback", be->dai_link->name);
be_substream->runtime = be->dpcm[stream].runtime; be_substream->runtime = be->dpcm[stream].runtime;
err = soc_pcm_open(be_substream); err = soc_pcm_open(be_substream);
...@@ -1673,7 +1681,7 @@ static int soc_pcm_ioctl(struct snd_pcm_substream *substream, ...@@ -1673,7 +1681,7 @@ static int soc_pcm_ioctl(struct snd_pcm_substream *substream,
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_platform *platform = rtd->platform;
if (platform->driver->ops->ioctl) if (platform->driver->ops && platform->driver->ops->ioctl)
return platform->driver->ops->ioctl(substream, cmd, arg); return platform->driver->ops->ioctl(substream, cmd, arg);
return snd_pcm_lib_ioctl(substream, cmd, arg); return snd_pcm_lib_ioctl(substream, cmd, arg);
} }
...@@ -1934,7 +1942,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute) ...@@ -1934,7 +1942,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
dev_dbg(be->dev, "ASoC: BE digital mute %s\n", be->dai_link->name); dev_dbg(be->dev, "ASoC: BE digital mute %s\n", be->dai_link->name);
if (drv->ops->digital_mute && dai->playback_active) if (drv->ops && drv->ops->digital_mute && dai->playback_active)
drv->ops->digital_mute(dai, mute); drv->ops->digital_mute(dai, mute);
} }
...@@ -2224,7 +2232,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params); ...@@ -2224,7 +2232,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params);
int snd_soc_platform_trigger(struct snd_pcm_substream *substream, int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_platform *platform) int cmd, struct snd_soc_platform *platform)
{ {
if (platform->driver->ops->trigger) if (platform->driver->ops && platform->driver->ops->trigger)
return platform->driver->ops->trigger(substream, cmd); return platform->driver->ops->trigger(substream, cmd);
return 0; return 0;
} }
......
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