1
0
Fork 0

ASoC: Remove DAI type information

DAI type information is only ever used within ASoC in order to special
case AC97 and for diagnostic purposes. Since modern CPUs and codecs
support multi function DAIs which can be configured for several modes
it is more trouble than it's worth to maintain anything other than a
flag identifying AC97 DAIs so remove the type field and replace it with
an ac97_control flag.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
hifive-unleashed-5.1
Mark Brown 2008-11-24 18:01:05 +00:00
parent b0bd53a739
commit 3ba9e10a6d
24 changed files with 21 additions and 63 deletions

View File

@ -184,7 +184,7 @@ struct snd_soc_dai {
/* DAI description */
char *name;
unsigned int id;
unsigned char type;
int ac97_control;
/* DAI callbacks */
int (*probe)(struct platform_device *pdev,

View File

@ -143,14 +143,6 @@ enum snd_soc_bias_level {
SND_SOC_BIAS_OFF,
};
/*
* Digital Audio Interface (DAI) types
*/
#define SND_SOC_DAI_AC97 0x1
#define SND_SOC_DAI_I2S 0x2
#define SND_SOC_DAI_PCM 0x4
#define SND_SOC_DAI_AC97_BUS 0x8 /* for custom i.e. non ac97_codec.c */
struct snd_soc_device;
struct snd_soc_pcm_stream;
struct snd_soc_ops;

View File

@ -702,7 +702,6 @@ static int atmel_ssc_resume(struct platform_device *pdev,
struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
{ .name = "atmel-ssc0",
.id = 0,
.type = SND_SOC_DAI_PCM,
.suspend = atmel_ssc_suspend,
.resume = atmel_ssc_resume,
.playback = {
@ -727,7 +726,6 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
#if NUM_SSC_DEVICES == 3
{ .name = "atmel-ssc1",
.id = 1,
.type = SND_SOC_DAI_PCM,
.suspend = atmel_ssc_suspend,
.resume = atmel_ssc_resume,
.playback = {
@ -751,7 +749,6 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
},
{ .name = "atmel-ssc2",
.id = 2,
.type = SND_SOC_DAI_PCM,
.suspend = atmel_ssc_suspend,
.resume = atmel_ssc_resume,
.playback = {

View File

@ -346,7 +346,7 @@ static int au1xpsc_ac97_resume(struct platform_device *pdev,
struct snd_soc_dai au1xpsc_ac97_dai = {
.name = "au1xpsc_ac97",
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.probe = au1xpsc_ac97_probe,
.remove = au1xpsc_ac97_remove,
.suspend = au1xpsc_ac97_suspend,

View File

@ -371,7 +371,6 @@ static int au1xpsc_i2s_resume(struct platform_device *pdev,
struct snd_soc_dai au1xpsc_i2s_dai = {
.name = "au1xpsc_i2s",
.type = SND_SOC_DAI_I2S,
.probe = au1xpsc_i2s_probe,
.remove = au1xpsc_i2s_remove,
.suspend = au1xpsc_i2s_suspend,

View File

@ -409,7 +409,7 @@ static void bf5xx_ac97_remove(struct platform_device *pdev,
struct snd_soc_dai bfin_ac97_dai = {
.name = "bf5xx-ac97",
.id = 0,
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.probe = bf5xx_ac97_probe,
.remove = bf5xx_ac97_remove,
.suspend = bf5xx_ac97_suspend,

View File

@ -292,7 +292,6 @@ static int bf5xx_i2s_resume(struct platform_device *pdev,
struct snd_soc_dai bf5xx_i2s_dai = {
.name = "bf5xx-i2s",
.id = 0,
.type = SND_SOC_DAI_I2S,
.probe = bf5xx_i2s_probe,
.remove = bf5xx_i2s_remove,
.suspend = bf5xx_i2s_suspend,

View File

@ -43,7 +43,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai ac97_dai = {
.name = "AC97 HiFi",
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.playback = {
.stream_name = "AC97 Playback",
.channels_min = 1,

View File

@ -33,7 +33,6 @@
struct snd_soc_dai pcm3008_dai = {
.name = "PCM3008 HiFi",
.type = SND_SOC_DAI_I2S,
.playback = {
.stream_name = "PCM3008 Playback",
.channels_min = 1,

View File

@ -535,7 +535,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai wm9712_dai[] = {
{
.name = "AC97 HiFi",
.type = SND_SOC_DAI_AC97_BUS,
.ac97_control = 1,
.playback = {
.stream_name = "HiFi Playback",
.channels_min = 1,

View File

@ -1024,7 +1024,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai wm9713_dai[] = {
{
.name = "AC97 HiFi",
.type = SND_SOC_DAI_AC97_BUS,
.ac97_control = 1,
.playback = {
.stream_name = "HiFi Playback",
.channels_min = 1,

View File

@ -460,7 +460,6 @@ static void davinci_i2s_remove(struct platform_device *pdev,
struct snd_soc_dai davinci_i2s_dai = {
.name = "davinci-i2s",
.id = 0,
.type = SND_SOC_DAI_I2S,
.probe = davinci_i2s_probe,
.remove = davinci_i2s_remove,
.playback = {

View File

@ -469,7 +469,6 @@ static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int format)
* psc_i2s_dai_template: template CPU Digital Audio Interface
*/
static struct snd_soc_dai psc_i2s_dai_template = {
.type = SND_SOC_DAI_I2S,
.playback = {
.channels_min = 2,
.channels_max = 2,

View File

@ -456,7 +456,6 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
{ \
.name = "omap-mcbsp-dai-"#link_id, \
.id = (link_id), \
.type = SND_SOC_DAI_I2S, \
.playback = { \
.channels_min = 2, \
.channels_max = 2, \

View File

@ -788,7 +788,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
{
.name = "pxa2xx-ssp1",
.id = 0,
.type = SND_SOC_DAI_PCM,
.probe = pxa_ssp_probe,
.remove = pxa_ssp_remove,
.suspend = pxa_ssp_suspend,
@ -820,7 +819,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
},
{ .name = "pxa2xx-ssp2",
.id = 1,
.type = SND_SOC_DAI_PCM,
.probe = pxa_ssp_probe,
.remove = pxa_ssp_remove,
.suspend = pxa_ssp_suspend,
@ -853,7 +851,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
{
.name = "pxa2xx-ssp3",
.id = 2,
.type = SND_SOC_DAI_PCM,
.probe = pxa_ssp_probe,
.remove = pxa_ssp_remove,
.suspend = pxa_ssp_suspend,
@ -886,7 +883,6 @@ struct snd_soc_dai pxa_ssp_dai[] = {
{
.name = "pxa2xx-ssp4",
.id = 3,
.type = SND_SOC_DAI_PCM,
.probe = pxa_ssp_probe,
.remove = pxa_ssp_remove,
.suspend = pxa_ssp_suspend,

View File

@ -173,7 +173,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
{
.name = "pxa2xx-ac97",
.id = 0,
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.probe = pxa2xx_ac97_probe,
.remove = pxa2xx_ac97_remove,
.suspend = pxa2xx_ac97_suspend,
@ -196,7 +196,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
{
.name = "pxa2xx-ac97-aux",
.id = 1,
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.playback = {
.stream_name = "AC97 Aux Playback",
.channels_min = 1,
@ -215,7 +215,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
{
.name = "pxa2xx-ac97-mic",
.id = 2,
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.capture = {
.stream_name = "AC97 Mic Capture",
.channels_min = 1,

View File

@ -340,7 +340,6 @@ static int pxa2xx_i2s_resume(struct platform_device *pdev,
struct snd_soc_dai pxa_i2s_dai = {
.name = "pxa2xx-i2s",
.id = 0,
.type = SND_SOC_DAI_I2S,
.suspend = pxa2xx_i2s_suspend,
.resume = pxa2xx_i2s_resume,
.playback = {

View File

@ -548,7 +548,6 @@ static int neo1973_wm8753_init(struct snd_soc_codec *codec)
static struct snd_soc_dai bt_dai = {
.name = "Bluetooth",
.id = 0,
.type = SND_SOC_DAI_PCM,
.playback = {
.channels_min = 1,
.channels_max = 1,

View File

@ -713,7 +713,6 @@ static int s3c2412_i2s_resume(struct platform_device *pdev,
struct snd_soc_dai s3c2412_i2s_dai = {
.name = "s3c2412-i2s",
.id = 0,
.type = SND_SOC_DAI_I2S,
.probe = s3c2412_i2s_probe,
.suspend = s3c2412_i2s_suspend,
.resume = s3c2412_i2s_resume,

View File

@ -358,7 +358,7 @@ struct snd_soc_dai s3c2443_ac97_dai[] = {
{
.name = "s3c2443-ac97",
.id = 0,
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.probe = s3c2443_ac97_probe,
.remove = s3c2443_ac97_remove,
.playback = {
@ -380,7 +380,7 @@ struct snd_soc_dai s3c2443_ac97_dai[] = {
{
.name = "pxa2xx-ac97-mic",
.id = 1,
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.capture = {
.stream_name = "AC97 Mic Capture",
.channels_min = 1,

View File

@ -461,7 +461,6 @@ static int s3c24xx_i2s_resume(struct platform_device *pdev,
struct snd_soc_dai s3c24xx_i2s_dai = {
.name = "s3c24xx-i2s",
.id = 0,
.type = SND_SOC_DAI_I2S,
.probe = s3c24xx_i2s_probe,
.suspend = s3c24xx_i2s_suspend,
.resume = s3c24xx_i2s_resume,

View File

@ -271,7 +271,7 @@ struct snd_soc_dai sh4_hac_dai[] = {
{
.name = "HAC0",
.id = 0,
.type = SND_SOC_DAI_AC97,
.ac97_control = 1,
.playback = {
.rates = AC97_RATES,
.formats = AC97_FMTS,
@ -291,8 +291,8 @@ struct snd_soc_dai sh4_hac_dai[] = {
#ifdef CONFIG_CPU_SUBTYPE_SH7760
{
.name = "HAC1",
.ac97_control = 1,
.id = 1,
.type = SND_SOC_DAI_AC97,
.playback = {
.rates = AC97_RATES,
.formats = AC97_FMTS,

View File

@ -340,7 +340,6 @@ struct snd_soc_dai sh4_ssi_dai[] = {
{
.name = "SSI0",
.id = 0,
.type = SND_SOC_DAI_I2S,
.playback = {
.rates = SSI_RATES,
.formats = SSI_FMTS,
@ -367,7 +366,6 @@ struct snd_soc_dai sh4_ssi_dai[] = {
{
.name = "SSI1",
.id = 1,
.type = SND_SOC_DAI_I2S,
.playback = {
.rates = SSI_RATES,
.formats = SSI_FMTS,

View File

@ -100,20 +100,6 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
}
#endif
static inline const char *get_dai_name(int type)
{
switch (type) {
case SND_SOC_DAI_AC97_BUS:
case SND_SOC_DAI_AC97:
return "AC97";
case SND_SOC_DAI_I2S:
return "I2S";
case SND_SOC_DAI_PCM:
return "PCM";
}
return NULL;
}
/*
* Called by ALSA when a PCM substream is opened, the runtime->hw record is
* then initialized and any private data can be allocated. This also calls
@ -652,7 +638,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (cpu_dai->suspend && cpu_dai->type != SND_SOC_DAI_AC97)
if (cpu_dai->suspend && !cpu_dai->ac97_control)
cpu_dai->suspend(pdev, cpu_dai);
if (platform->suspend)
platform->suspend(pdev, cpu_dai);
@ -678,7 +664,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (cpu_dai->suspend && cpu_dai->type == SND_SOC_DAI_AC97)
if (cpu_dai->suspend && cpu_dai->ac97_control)
cpu_dai->suspend(pdev, cpu_dai);
}
@ -714,7 +700,7 @@ static void soc_resume_deferred(struct work_struct *work)
for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (cpu_dai->resume && cpu_dai->type == SND_SOC_DAI_AC97)
if (cpu_dai->resume && cpu_dai->ac97_control)
cpu_dai->resume(pdev, cpu_dai);
}
@ -741,7 +727,7 @@ static void soc_resume_deferred(struct work_struct *work)
for (i = 0; i < card->num_links; i++) {
struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
if (cpu_dai->resume && cpu_dai->type != SND_SOC_DAI_AC97)
if (cpu_dai->resume && !cpu_dai->ac97_control)
cpu_dai->resume(pdev, cpu_dai);
if (platform->resume)
platform->resume(pdev, cpu_dai);
@ -898,8 +884,8 @@ static int soc_new_pcm(struct snd_soc_device *socdev,
codec_dai->codec = socdev->codec;
/* check client and interface hw capabilities */
sprintf(new_name, "%s %s-%s-%d", dai_link->stream_name, codec_dai->name,
get_dai_name(cpu_dai->type), num);
sprintf(new_name, "%s %s-%d", dai_link->stream_name, codec_dai->name,
num);
if (codec_dai->playback.channels_min)
playback = 1;
@ -1270,8 +1256,7 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
continue;
}
}
if (card->dai_link[i].codec_dai->type ==
SND_SOC_DAI_AC97_BUS)
if (card->dai_link[i].codec_dai->ac97_control)
ac97 = 1;
}
snprintf(codec->card->shortname, sizeof(codec->card->shortname),
@ -1335,7 +1320,7 @@ void snd_soc_free_pcms(struct snd_soc_device *socdev)
#ifdef CONFIG_SND_SOC_AC97_BUS
for (i = 0; i < codec->num_dai; i++) {
codec_dai = &codec->dai[i];
if (codec_dai->type == SND_SOC_DAI_AC97_BUS && codec->ac97) {
if (codec_dai->ac97_control && codec->ac97) {
soc_ac97_dev_unregister(codec);
goto free_card;
}