summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-compress.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2020-12-14 15:57:14 +0100
committerTakashi Iwai <tiwai@suse.de>2020-12-14 15:57:14 +0100
commit598100be3053fef628adf3ad6ee4f828ad308f64 (patch)
tree78069fd27e04f19fb14043ce16122ed1a6df1886 /sound/soc/soc-compress.c
parent175b8d89fe292796811fdee87fa39799a5b6b87a (diff)
parent460aa020f56c974a3e7e5b5378b2355fec6a2c11 (diff)
downloadlinux-598100be3053fef628adf3ad6ee4f828ad308f64.tar.bz2
Merge tag 'asoc-v5.11' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v5.11 There's a lot of changes here but mostly cleanups and driver specific things, the most user visible change is the support for boot time selection of Intel DSP firmware which will make it easier for people to move over to the preferred modern implementations in distros and other large scale deployments. This also includes a merge of the new auxillary bus which was done in anticipation of use by the Intel DSP drivers which didn't quite make it. - Lots more cleanups and simplifications from Morimoto-san. - Support for some basic DPCM systems in the audio graph card from Sameer Pujar. - Remove some old pre-DT Freescale drivers for platforms that are now DT only. - Move selection of which Intel DSP implementation to use to boot time rather than requiring it to be selected at build time. - Support for Allwinner H6 I2S, Analog Devices ADAU1372, Intel Alderlake-S, GMediatek MT8192, NXP i.MX HDMI and XCVR, Realtek RT715, Qualcomm SM8250 and simple GPIO based muxes.
Diffstat (limited to 'sound/soc/soc-compress.c')
-rw-r--r--sound/soc/soc-compress.c397
1 files changed, 83 insertions, 314 deletions
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 3a6a60215e81..246a5e32e22a 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -22,93 +22,78 @@
#include <sound/soc-link.h>
#include <linux/pm_runtime.h>
-static int soc_compr_components_open(struct snd_compr_stream *cstream,
- struct snd_soc_component **last)
+static int soc_compr_clean(struct snd_compr_stream *cstream, int rollback)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i, ret;
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->open)
- continue;
+ mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
- ret = component->driver->compress_ops->open(component, cstream);
- if (ret < 0) {
- dev_err(component->dev,
- "Compress ASoC: can't open platform %s: %d\n",
- component->name, ret);
+ if (!rollback)
+ snd_soc_runtime_deactivate(rtd, stream);
- *last = component;
- return ret;
- }
- }
+ snd_soc_dai_digital_mute(codec_dai, 1, stream);
- *last = NULL;
- return 0;
-}
+ if (!snd_soc_dai_active(cpu_dai))
+ cpu_dai->rate = 0;
-static int soc_compr_components_free(struct snd_compr_stream *cstream,
- struct snd_soc_component *last)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i;
+ if (!snd_soc_dai_active(codec_dai))
+ codec_dai->rate = 0;
- for_each_rtd_components(rtd, i, component) {
- if (component == last)
- break;
+ snd_soc_link_compr_shutdown(cstream, rollback);
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->free)
- continue;
+ snd_soc_component_compr_free(cstream, rollback);
- component->driver->compress_ops->free(component, cstream);
- }
+ snd_soc_dai_compr_shutdown(cpu_dai, cstream, rollback);
+
+ if (!rollback)
+ snd_soc_dapm_stream_stop(rtd, stream);
+
+ mutex_unlock(&rtd->card->pcm_mutex);
+
+ snd_soc_pcm_component_pm_runtime_put(rtd, cstream, rollback);
return 0;
}
+static int soc_compr_free(struct snd_compr_stream *cstream)
+{
+ return soc_compr_clean(cstream, 0);
+}
+
static int soc_compr_open(struct snd_compr_stream *cstream)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component = NULL;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
int ret;
ret = snd_soc_pcm_component_pm_runtime_get(rtd, cstream);
if (ret < 0)
- goto pm_err;
+ goto err_no_lock;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
ret = snd_soc_dai_compr_startup(cpu_dai, cstream);
if (ret < 0)
- goto out;
+ goto err;
- ret = soc_compr_components_open(cstream, &component);
+ ret = snd_soc_component_compr_open(cstream);
if (ret < 0)
- goto machine_err;
+ goto err;
ret = snd_soc_link_compr_startup(cstream);
if (ret < 0)
- goto machine_err;
-
- snd_soc_runtime_activate(rtd, cstream->direction);
-
- mutex_unlock(&rtd->card->pcm_mutex);
-
- return 0;
-
-machine_err:
- soc_compr_components_free(cstream, component);
+ goto err;
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
-out:
+ snd_soc_runtime_activate(rtd, stream);
+err:
mutex_unlock(&rtd->card->pcm_mutex);
-pm_err:
- snd_soc_pcm_component_pm_runtime_put(rtd, cstream, 1);
+err_no_lock:
+ if (ret < 0)
+ soc_compr_clean(cstream, 1);
return ret;
}
@@ -118,18 +103,12 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
struct snd_soc_pcm_runtime *fe = cstream->private_data;
struct snd_pcm_substream *fe_substream =
fe->pcm->streams[cstream->direction].substream;
- struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
struct snd_soc_dpcm *dpcm;
struct snd_soc_dapm_widget_list *list;
- int stream;
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
int ret;
- if (cstream->direction == SND_COMPRESS_PLAYBACK)
- stream = SNDRV_PCM_STREAM_PLAYBACK;
- else
- stream = SNDRV_PCM_STREAM_CAPTURE;
-
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
fe->dpcm[stream].runtime = fe_substream->runtime;
@@ -160,7 +139,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
if (ret < 0)
goto out;
- ret = soc_compr_components_open(cstream, &component);
+ ret = snd_soc_component_compr_open(cstream);
if (ret < 0)
goto open_err;
@@ -181,9 +160,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
return 0;
machine_err:
- soc_compr_components_free(cstream, component);
+ snd_soc_component_compr_free(cstream, 1);
open_err:
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
+ snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1);
out:
dpcm_path_put(&list);
be_err:
@@ -192,59 +171,16 @@ be_err:
return ret;
}
-static int soc_compr_free(struct snd_compr_stream *cstream)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
- struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
- int stream;
-
- mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
-
- if (cstream->direction == SND_COMPRESS_PLAYBACK)
- stream = SNDRV_PCM_STREAM_PLAYBACK;
- else
- stream = SNDRV_PCM_STREAM_CAPTURE;
-
- snd_soc_runtime_deactivate(rtd, stream);
-
- snd_soc_dai_digital_mute(codec_dai, 1, cstream->direction);
-
- if (!snd_soc_dai_active(cpu_dai))
- cpu_dai->rate = 0;
-
- if (!snd_soc_dai_active(codec_dai))
- codec_dai->rate = 0;
-
- snd_soc_link_compr_shutdown(cstream);
-
- soc_compr_components_free(cstream, NULL);
-
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
-
- snd_soc_dapm_stream_stop(rtd, stream);
-
- mutex_unlock(&rtd->card->pcm_mutex);
-
- snd_soc_pcm_component_pm_runtime_put(rtd, cstream, 0);
-
- return 0;
-}
-
static int soc_compr_free_fe(struct snd_compr_stream *cstream)
{
struct snd_soc_pcm_runtime *fe = cstream->private_data;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
struct snd_soc_dpcm *dpcm;
- int stream, ret;
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
+ int ret;
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
- if (cstream->direction == SND_COMPRESS_PLAYBACK)
- stream = SNDRV_PCM_STREAM_PLAYBACK;
- else
- stream = SNDRV_PCM_STREAM_CAPTURE;
-
snd_soc_runtime_deactivate(fe, stream);
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
@@ -268,47 +204,27 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
fe->dpcm[stream].runtime = NULL;
- snd_soc_link_compr_shutdown(cstream);
+ snd_soc_link_compr_shutdown(cstream, 0);
- soc_compr_components_free(cstream, NULL);
+ snd_soc_component_compr_free(cstream, 0);
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
+ snd_soc_dai_compr_shutdown(cpu_dai, cstream, 0);
mutex_unlock(&fe->card->mutex);
return 0;
}
-static int soc_compr_components_trigger(struct snd_compr_stream *cstream,
- int cmd)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i, ret;
-
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->trigger)
- continue;
-
- ret = component->driver->compress_ops->trigger(
- component, cstream, cmd);
- if (ret < 0)
- return ret;
- }
-
- return 0;
-}
-
static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
int ret;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
- ret = soc_compr_components_trigger(cstream, cmd);
+ ret = snd_soc_component_compr_trigger(cstream, cmd);
if (ret < 0)
goto out;
@@ -318,10 +234,10 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- snd_soc_dai_digital_mute(codec_dai, 0, cstream->direction);
+ snd_soc_dai_digital_mute(codec_dai, 0, stream);
break;
case SNDRV_PCM_TRIGGER_STOP:
- snd_soc_dai_digital_mute(codec_dai, 1, cstream->direction);
+ snd_soc_dai_digital_mute(codec_dai, 1, stream);
break;
}
@@ -334,16 +250,12 @@ 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_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
- int ret, stream;
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
+ int ret;
if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN ||
cmd == SND_COMPR_TRIGGER_DRAIN)
- return soc_compr_components_trigger(cstream, cmd);
-
- if (cstream->direction == SND_COMPRESS_PLAYBACK)
- stream = SNDRV_PCM_STREAM_PLAYBACK;
- else
- stream = SNDRV_PCM_STREAM_CAPTURE;
+ return snd_soc_component_compr_trigger(cstream, cmd);
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
@@ -351,7 +263,7 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
if (ret < 0)
goto out;
- ret = soc_compr_components_trigger(cstream, cmd);
+ ret = snd_soc_component_compr_trigger(cstream, cmd);
if (ret < 0)
goto out;
@@ -380,32 +292,12 @@ out:
return ret;
}
-static int soc_compr_components_set_params(struct snd_compr_stream *cstream,
- struct snd_compr_params *params)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i, ret;
-
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->set_params)
- continue;
-
- ret = component->driver->compress_ops->set_params(
- component, cstream, params);
- if (ret < 0)
- return ret;
- }
-
- return 0;
-}
-
static int soc_compr_set_params(struct snd_compr_stream *cstream,
struct snd_compr_params *params)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
int ret;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
@@ -421,7 +313,7 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
if (ret < 0)
goto err;
- ret = soc_compr_components_set_params(cstream, params);
+ ret = snd_soc_component_compr_set_params(cstream, params);
if (ret < 0)
goto err;
@@ -429,12 +321,7 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
if (ret < 0)
goto err;
- if (cstream->direction == SND_COMPRESS_PLAYBACK)
- snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK,
- SND_SOC_DAPM_STREAM_START);
- else
- snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_CAPTURE,
- SND_SOC_DAPM_STREAM_START);
+ snd_soc_dapm_stream_event(rtd, stream, SND_SOC_DAPM_STREAM_START);
/* cancel any delayed stream shutdown that is pending */
rtd->pop_wait = 0;
@@ -456,12 +343,8 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
struct snd_pcm_substream *fe_substream =
fe->pcm->streams[cstream->direction].substream;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(fe, 0);
- int ret, stream;
-
- if (cstream->direction == SND_COMPRESS_PLAYBACK)
- stream = SNDRV_PCM_STREAM_PLAYBACK;
- else
- stream = SNDRV_PCM_STREAM_CAPTURE;
+ int stream = cstream->direction; /* SND_COMPRESS_xxx is same as SNDRV_PCM_STREAM_xxx */
+ int ret;
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
@@ -487,7 +370,7 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
if (ret < 0)
goto out;
- ret = soc_compr_components_set_params(cstream, params);
+ ret = snd_soc_component_compr_set_params(cstream, params);
if (ret < 0)
goto out;
@@ -508,9 +391,8 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
struct snd_codec *params)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
- int i, ret = 0;
+ int ret = 0;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
@@ -518,73 +400,17 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
if (ret < 0)
goto err;
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->get_params)
- continue;
-
- ret = component->driver->compress_ops->get_params(
- component, cstream, params);
- break;
- }
-
+ ret = snd_soc_component_compr_get_params(cstream, params);
err:
mutex_unlock(&rtd->card->pcm_mutex);
return ret;
}
-static int soc_compr_get_caps(struct snd_compr_stream *cstream,
- struct snd_compr_caps *caps)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i, ret = 0;
-
- mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
-
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->get_caps)
- continue;
-
- ret = component->driver->compress_ops->get_caps(
- component, cstream, caps);
- break;
- }
-
- mutex_unlock(&rtd->card->pcm_mutex);
- return ret;
-}
-
-static int soc_compr_get_codec_caps(struct snd_compr_stream *cstream,
- struct snd_compr_codec_caps *codec)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i, ret = 0;
-
- mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
-
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->get_codec_caps)
- continue;
-
- ret = component->driver->compress_ops->get_codec_caps(
- component, cstream, codec);
- break;
- }
-
- mutex_unlock(&rtd->card->pcm_mutex);
- return ret;
-}
-
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_component *component;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
- int i, ret = 0;
+ int ret;
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
@@ -592,17 +418,7 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes)
if (ret < 0)
goto err;
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->ack)
- continue;
-
- ret = component->driver->compress_ops->ack(
- component, cstream, bytes);
- if (ret < 0)
- goto err;
- }
-
+ ret = snd_soc_component_compr_ack(cstream, bytes);
err:
mutex_unlock(&rtd->card->pcm_mutex);
return ret;
@@ -612,8 +428,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
struct snd_compr_tstamp *tstamp)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i, ret = 0;
+ int ret;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
@@ -622,91 +437,38 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
if (ret < 0)
goto out;
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->pointer)
- continue;
-
- ret = component->driver->compress_ops->pointer(
- component, cstream, tstamp);
- break;
- }
+ ret = snd_soc_component_compr_pointer(cstream, tstamp);
out:
mutex_unlock(&rtd->card->pcm_mutex);
return ret;
}
-static int soc_compr_copy(struct snd_compr_stream *cstream,
- char __user *buf, size_t count)
-{
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
- int i, ret = 0;
-
- mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
-
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->copy)
- continue;
-
- ret = component->driver->compress_ops->copy(
- component, cstream, buf, count);
- break;
- }
-
- mutex_unlock(&rtd->card->pcm_mutex);
- return ret;
-}
-
static int soc_compr_set_metadata(struct snd_compr_stream *cstream,
struct snd_compr_metadata *metadata)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
- int i, ret;
+ int ret;
ret = snd_soc_dai_compr_set_metadata(cpu_dai, cstream, metadata);
if (ret < 0)
return ret;
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->set_metadata)
- continue;
-
- ret = component->driver->compress_ops->set_metadata(
- component, cstream, metadata);
- if (ret < 0)
- return ret;
- }
-
- return 0;
+ return snd_soc_component_compr_set_metadata(cstream, metadata);
}
static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
struct snd_compr_metadata *metadata)
{
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
- struct snd_soc_component *component;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
- int i, ret;
+ int ret;
ret = snd_soc_dai_compr_get_metadata(cpu_dai, cstream, metadata);
if (ret < 0)
return ret;
- for_each_rtd_components(rtd, i, component) {
- if (!component->driver->compress_ops ||
- !component->driver->compress_ops->get_metadata)
- continue;
-
- return component->driver->compress_ops->get_metadata(
- component, cstream, metadata);
- }
-
- return 0;
+ return snd_soc_component_compr_get_metadata(cstream, metadata);
}
/* ASoC Compress operations */
@@ -720,8 +482,8 @@ static struct snd_compr_ops soc_compr_ops = {
.trigger = soc_compr_trigger,
.pointer = soc_compr_pointer,
.ack = soc_compr_ack,
- .get_caps = soc_compr_get_caps,
- .get_codec_caps = soc_compr_get_codec_caps
+ .get_caps = snd_soc_component_compr_get_caps,
+ .get_codec_caps = snd_soc_component_compr_get_codec_caps,
};
/* ASoC Dynamic Compress operations */
@@ -735,8 +497,8 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
.trigger = soc_compr_trigger_fe,
.pointer = soc_compr_pointer,
.ack = soc_compr_ack,
- .get_caps = soc_compr_get_caps,
- .get_codec_caps = soc_compr_get_codec_caps
+ .get_caps = snd_soc_component_compr_get_caps,
+ .get_codec_caps = snd_soc_component_compr_get_codec_caps,
};
/**
@@ -759,6 +521,13 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
int playback = 0, capture = 0;
int i;
+ /*
+ * make sure these are same value,
+ * and then use these as equally
+ */
+ BUILD_BUG_ON((int)SNDRV_PCM_STREAM_PLAYBACK != (int)SND_COMPRESS_PLAYBACK);
+ BUILD_BUG_ON((int)SNDRV_PCM_STREAM_CAPTURE != (int)SND_COMPRESS_CAPTURE);
+
if (rtd->num_cpus > 1 ||
rtd->num_codecs > 1) {
dev_err(rtd->card->dev,
@@ -832,7 +601,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
!component->driver->compress_ops->copy)
continue;
- compr->ops->copy = soc_compr_copy;
+ compr->ops->copy = snd_soc_component_compr_copy;
break;
}