Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6335d055 authored by Eric Miao's avatar Eric Miao Committed by Mark Brown
Browse files

ASoC: make ops a pointer in 'struct snd_soc_dai'



Considering the fact that most cpu_dai or codec_dai are using a same
'snd_soc_dai_ops' for several similar interfaces, 'ops' would be better
made a pointer instead, to make sharing easier and code a bit cleaner.

The patch below is rather preliminary since the asoc tree is being
actively developed, and this touches almost every piece of code,
(and possibly many others in development need to be changed as
well). Building of all codecs are OK, yet to every SoC, I didn't test
that.

Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
Acked-by: default avatarTimur Tabi <timur@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent ff09d49a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ struct snd_soc_dai {
	int (*resume)(struct snd_soc_dai *dai);

	/* ops */
	struct snd_soc_dai_ops ops;
	struct snd_soc_dai_ops *ops;

	/* DAI capabilities */
	struct snd_soc_pcm_stream capture;
+12 −21
Original line number Diff line number Diff line
@@ -697,6 +697,15 @@ static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai)
#define ATMEL_SSC_FORMATS (SNDRV_PCM_FMTBIT_S8     | SNDRV_PCM_FMTBIT_S16_LE |\
			  SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)

static struct snd_soc_dai_ops atmel_ssc_dai_ops = {
	.startup	= atmel_ssc_startup,
	.shutdown	= atmel_ssc_shutdown,
	.prepare	= atmel_ssc_prepare,
	.hw_params	= atmel_ssc_hw_params,
	.set_fmt	= atmel_ssc_set_dai_fmt,
	.set_clkdiv	= atmel_ssc_set_dai_clkdiv,
};

struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
	{	.name = "atmel-ssc0",
		.id = 0,
@@ -712,13 +721,7 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
			.channels_max = 2,
			.rates = ATMEL_SSC_RATES,
			.formats = ATMEL_SSC_FORMATS,},
		.ops = {
			.startup = atmel_ssc_startup,
			.shutdown = atmel_ssc_shutdown,
			.prepare = atmel_ssc_prepare,
			.hw_params = atmel_ssc_hw_params,
			.set_fmt = atmel_ssc_set_dai_fmt,
			.set_clkdiv = atmel_ssc_set_dai_clkdiv,},
		.ops = &atmel_ssc_dai_ops,
		.private_data = &ssc_info[0],
	},
#if NUM_SSC_DEVICES == 3
@@ -736,13 +739,7 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
			.channels_max = 2,
			.rates = ATMEL_SSC_RATES,
			.formats = ATMEL_SSC_FORMATS,},
		.ops = {
			.startup = atmel_ssc_startup,
			.shutdown = atmel_ssc_shutdown,
			.prepare = atmel_ssc_prepare,
			.hw_params = atmel_ssc_hw_params,
			.set_fmt = atmel_ssc_set_dai_fmt,
			.set_clkdiv = atmel_ssc_set_dai_clkdiv,},
		.ops = &atmel_ssc_dai_ops,
		.private_data = &ssc_info[1],
	},
	{	.name = "atmel-ssc2",
@@ -759,13 +756,7 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
			.channels_max = 2,
			.rates = ATMEL_SSC_RATES,
			.formats = ATMEL_SSC_FORMATS,},
		.ops = {
			.startup = atmel_ssc_startup,
			.shutdown = atmel_ssc_shutdown,
			.prepare = atmel_ssc_prepare,
			.hw_params = atmel_ssc_hw_params,
			.set_fmt = atmel_ssc_set_dai_fmt,
			.set_clkdiv = atmel_ssc_set_dai_clkdiv,},
		.ops = &atmel_ssc_dai_ops,
		.private_data = &ssc_info[2],
	},
#endif
+6 −4
Original line number Diff line number Diff line
@@ -342,6 +342,11 @@ static int au1xpsc_ac97_resume(struct snd_soc_dai *dai)
	return 0;
}

static struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = {
	.trigger	= au1xpsc_ac97_trigger,
	.hw_params	= au1xpsc_ac97_hw_params,
};

struct snd_soc_dai au1xpsc_ac97_dai = {
	.name			= "au1xpsc_ac97",
	.ac97_control		= 1,
@@ -361,10 +366,7 @@ struct snd_soc_dai au1xpsc_ac97_dai = {
		.channels_min	= 2,
		.channels_max	= 2,
	},
	.ops = {
		.trigger	= au1xpsc_ac97_trigger,
		.hw_params	= au1xpsc_ac97_hw_params,
	},
	.ops = &au1xpsc_ac97_dai_ops,
};
EXPORT_SYMBOL_GPL(au1xpsc_ac97_dai);

+7 −5
Original line number Diff line number Diff line
@@ -367,6 +367,12 @@ static int au1xpsc_i2s_resume(struct snd_soc_dai *cpu_dai)
	return 0;
}

static struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = {
	.trigger	= au1xpsc_i2s_trigger,
	.hw_params	= au1xpsc_i2s_hw_params,
	.set_fmt	= au1xpsc_i2s_set_fmt,
};

struct snd_soc_dai au1xpsc_i2s_dai = {
	.name			= "au1xpsc_i2s",
	.probe			= au1xpsc_i2s_probe,
@@ -385,11 +391,7 @@ struct snd_soc_dai au1xpsc_i2s_dai = {
		.channels_min	= 2,
		.channels_max	= 8,	/* 2 without external help */
	},
	.ops = {
		.trigger	= au1xpsc_i2s_trigger,
		.hw_params	= au1xpsc_i2s_hw_params,
		.set_fmt	= au1xpsc_i2s_set_fmt,
	},
	.ops = &au1xpsc_i2s_dai_ops,
};
EXPORT_SYMBOL(au1xpsc_i2s_dai);

+8 −6
Original line number Diff line number Diff line
@@ -287,6 +287,13 @@ static int bf5xx_i2s_resume(struct platform_device *pdev,
#define BF5XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |\
	SNDRV_PCM_FMTBIT_S32_LE)

static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = {
	.startup	= bf5xx_i2s_startup,
	.shutdown	= bf5xx_i2s_shutdown,
	.hw_params	= bf5xx_i2s_hw_params,
	.set_fmt	= bf5xx_i2s_set_dai_fmt,
};

struct snd_soc_dai bf5xx_i2s_dai = {
	.name = "bf5xx-i2s",
	.id = 0,
@@ -304,12 +311,7 @@ struct snd_soc_dai bf5xx_i2s_dai = {
		.channels_max = 2,
		.rates = BF5XX_I2S_RATES,
		.formats = BF5XX_I2S_FORMATS,},
	.ops = {
		.startup   = bf5xx_i2s_startup,
		.shutdown  = bf5xx_i2s_shutdown,
		.hw_params = bf5xx_i2s_hw_params,
		.set_fmt = bf5xx_i2s_set_dai_fmt,
	},
	.ops = &bf5xx_i2s_dai_ops,
};
EXPORT_SYMBOL_GPL(bf5xx_i2s_dai);

Loading