On Fri, Jan 25, 2013 at 09:00:00AM +0000, Charles Keepax wrote:
The ASoC compressed API did not implement the copy callback in its compressed ops which is required for DSPs that are not memory mapped. This patch adds a second set of compressed ops which does implement the copy callback and uses that when copy is defined in the platform compressed ops, ie. when the DSP is not memory mapped.
Signed-off-by: Charles Keepax ckeepax@opensource.wolfsonmicro.com +static struct snd_compr_ops soc_compr_nomap_ops = {
- .open = soc_compr_open,
- .free = soc_compr_free,
- .set_params = soc_compr_set_params,
- .get_params = soc_compr_get_params,
- .trigger = soc_compr_trigger,
- .pointer = soc_compr_pointer,
- .copy = soc_compr_copy,
- .ack = soc_compr_ack,
- .get_caps = soc_compr_get_caps,
- .get_codec_caps = soc_compr_get_codec_caps
+};
Somehow I dont like the idea of doing one more ops for this.
/* create a new compress */ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) { struct snd_soc_codec *codec = rtd->codec;
- struct snd_soc_platform *platform = rtd->platform; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_compr *compr;
@@ -335,7 +366,10 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) return -ENOMEM; }
- compr->ops = &soc_compr_ops;
- if (platform->driver->compr_ops && platform->driver->compr_ops->copy)
compr->ops = &soc_compr_nomap_ops;
- else
compr->ops = &soc_compr_ops;
How about: compr->ops = &soc_compr_ops; if (platform->driver->compr_ops && !platform->driver->compr_ops->copy) compr->ops->copy = NULL;
That way you set it to null for those who doent implement this and would called for drivers who implement this.
-- ~Vinod