Commit dee89c4d authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: Merge snd_soc_ops into snd_soc_dai_ops



Liam Girdwood's ASoC v2 work avoids having two different ops structures
for DAIs by merging the members of struct snd_soc_ops into struct
snd_soc_dai_ops, allowing per DAI configuration for everything.
Backport this change.

This paves the way for future work allowing any combination of DAIs to
be connected rather than having fixed purpose CODEC and CPU DAIs and
only allowing CODEC<->CPU interconnections.

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent a47cbe72
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -156,6 +156,23 @@ struct snd_soc_dai_ops {
	 * Called by soc-core to minimise any pops.
	 */
	int (*digital_mute)(struct snd_soc_dai *dai, int mute);

	/*
	 * ALSA PCM audio operations - all optional.
	 * Called by soc-core during audio PCM operations.
	 */
	int (*startup)(struct snd_pcm_substream *,
		struct snd_soc_dai *);
	void (*shutdown)(struct snd_pcm_substream *,
		struct snd_soc_dai *);
	int (*hw_params)(struct snd_pcm_substream *,
		struct snd_pcm_hw_params *, struct snd_soc_dai *);
	int (*hw_free)(struct snd_pcm_substream *,
		struct snd_soc_dai *);
	int (*prepare)(struct snd_pcm_substream *,
		struct snd_soc_dai *);
	int (*trigger)(struct snd_pcm_substream *, int,
		struct snd_soc_dai *);
};

/*
@@ -180,8 +197,7 @@ struct snd_soc_dai {
		struct snd_soc_dai *dai);

	/* ops */
	struct snd_soc_ops ops;
	struct snd_soc_dai_ops dai_ops;
	struct snd_soc_dai_ops ops;

	/* DAI capabilities */
	struct snd_soc_pcm_stream capture;
+11 −10
Original line number Diff line number Diff line
@@ -202,7 +202,8 @@ static irqreturn_t atmel_ssc_interrupt(int irq, void *dev_id)
/*
 * Startup.  Only that one substream allowed in each direction.
 */
static int atmel_ssc_startup(struct snd_pcm_substream *substream)
static int atmel_ssc_startup(struct snd_pcm_substream *substream,
			     struct snd_soc_dai *dai)
{
	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
	struct atmel_ssc_info *ssc_p = &ssc_info[rtd->dai->cpu_dai->id];
@@ -231,7 +232,8 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream)
 * Shutdown.  Clear DMA parameters and shutdown the SSC if there
 * are no other substreams open.
 */
static void atmel_ssc_shutdown(struct snd_pcm_substream *substream)
static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
			       struct snd_soc_dai *dai)
{
	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
	struct atmel_ssc_info *ssc_p = &ssc_info[rtd->dai->cpu_dai->id];
@@ -332,7 +334,8 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
 * Configure the SSC.
 */
static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
	struct snd_pcm_hw_params *params)
	struct snd_pcm_hw_params *params,
	struct snd_soc_dai *dai)
{
	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
	int id = rtd->dai->cpu_dai->id;
@@ -600,7 +603,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
}


static int atmel_ssc_prepare(struct snd_pcm_substream *substream)
static int atmel_ssc_prepare(struct snd_pcm_substream *substream,
			     struct snd_soc_dai *dai)
{
	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
	struct atmel_ssc_info *ssc_p = &ssc_info[rtd->dai->cpu_dai->id];
@@ -715,8 +719,7 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
			.startup = atmel_ssc_startup,
			.shutdown = atmel_ssc_shutdown,
			.prepare = atmel_ssc_prepare,
			.hw_params = atmel_ssc_hw_params,},
		.dai_ops = {
			.hw_params = atmel_ssc_hw_params,
			.set_fmt = atmel_ssc_set_dai_fmt,
			.set_clkdiv = atmel_ssc_set_dai_clkdiv,},
		.private_data = &ssc_info[0],
@@ -741,8 +744,7 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
			.startup = atmel_ssc_startup,
			.shutdown = atmel_ssc_shutdown,
			.prepare = atmel_ssc_prepare,
			.hw_params = atmel_ssc_hw_params,},
		.dai_ops = {
			.hw_params = atmel_ssc_hw_params,
			.set_fmt = atmel_ssc_set_dai_fmt,
			.set_clkdiv = atmel_ssc_set_dai_clkdiv,},
		.private_data = &ssc_info[1],
@@ -766,8 +768,7 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
			.startup = atmel_ssc_startup,
			.shutdown = atmel_ssc_shutdown,
			.prepare = atmel_ssc_prepare,
			.hw_params = atmel_ssc_hw_params,},
		.dai_ops = {
			.hw_params = atmel_ssc_hw_params,
			.set_fmt = atmel_ssc_set_dai_fmt,
			.set_clkdiv = atmel_ssc_set_dai_clkdiv,},
		.private_data = &ssc_info[2],
+3 −2
Original line number Diff line number Diff line
@@ -160,7 +160,8 @@ struct snd_ac97_bus_ops soc_ac97_ops = {
EXPORT_SYMBOL_GPL(soc_ac97_ops);

static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
				  struct snd_pcm_hw_params *params)
				  struct snd_pcm_hw_params *params,
				  struct snd_soc_dai *dai)
{
	/* FIXME */
	struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
@@ -210,7 +211,7 @@ static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream,
}

static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream,
				int cmd)
				int cmd, struct snd_soc_dai *dai)
{
	/* FIXME */
	struct au1xpsc_audio_data *pscdata = au1xpsc_ac97_workdata;
+4 −4
Original line number Diff line number Diff line
@@ -116,7 +116,8 @@ static int au1xpsc_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
}

static int au1xpsc_i2s_hw_params(struct snd_pcm_substream *substream,
				 struct snd_pcm_hw_params *params)
				 struct snd_pcm_hw_params *params,
				 struct snd_soc_dai *dai)
{
	struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata;

@@ -240,7 +241,8 @@ static int au1xpsc_i2s_stop(struct au1xpsc_audio_data *pscdata, int stype)
	return 0;
}

static int au1xpsc_i2s_trigger(struct snd_pcm_substream *substream, int cmd)
static int au1xpsc_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
			       struct snd_soc_dai *dai)
{
	struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata;
	int ret, stype = SUBSTREAM_TYPE(substream);
@@ -389,8 +391,6 @@ struct snd_soc_dai au1xpsc_i2s_dai = {
	.ops = {
		.trigger	= au1xpsc_i2s_trigger,
		.hw_params	= au1xpsc_i2s_hw_params,
	},
	.dai_ops = {
		.set_fmt	= au1xpsc_i2s_set_fmt,
	},
};
+7 −5
Original line number Diff line number Diff line
@@ -132,7 +132,8 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
	return ret;
}

static int bf5xx_i2s_startup(struct snd_pcm_substream *substream)
static int bf5xx_i2s_startup(struct snd_pcm_substream *substream,
			     struct snd_soc_dai *dai)
{
	pr_debug("%s enter\n", __func__);

@@ -142,7 +143,8 @@ static int bf5xx_i2s_startup(struct snd_pcm_substream *substream)
}

static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params)
				struct snd_pcm_hw_params *params,
				struct snd_soc_dai *dai)
{
	int ret = 0;

@@ -193,7 +195,8 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
	return 0;
}

static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream)
static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream,
			       struct snd_soc_dai *dai)
{
	pr_debug("%s enter\n", __func__);
	bf5xx_i2s.counter--;
@@ -307,8 +310,7 @@ struct snd_soc_dai bf5xx_i2s_dai = {
	.ops = {
		.startup   = bf5xx_i2s_startup,
		.shutdown  = bf5xx_i2s_shutdown,
		.hw_params = bf5xx_i2s_hw_params,},
	.dai_ops = {
		.hw_params = bf5xx_i2s_hw_params,
		.set_fmt = bf5xx_i2s_set_dai_fmt,
	},
};
Loading