forked from luck/tmp_suning_uos_patched
ASoC: Rename snd_soc_dai_driver struct ac97_control field to bus_control
Setting the ac97_control field on a CPU DAI tells the ASoC core that this DAI in addition to audio data also transports control data to the CODEC. This causes the core to suspend the DAI after the CODEC and resume it before the CODEC so communication to the CODEC is still possible. This is not necessarily something that is specific to AC'97 and can be used by other buses with the same requirement. This patch renames the flag from ac97_control to bus_control to make this explicit. While we are at it also change the type from int to bool. The following semantich patch was used for automatic conversion of the drivers: // <smpl> @@ identifier drv; @@ struct snd_soc_dai_driver drv = { - .ac97_control + .bus_control = - 1 + true }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4bafcf074a
commit
bc26321404
|
@ -206,7 +206,6 @@ struct snd_soc_dai_driver {
|
|||
/* DAI description */
|
||||
const char *name;
|
||||
unsigned int id;
|
||||
int ac97_control;
|
||||
unsigned int base;
|
||||
|
||||
/* DAI driver callbacks */
|
||||
|
@ -216,6 +215,8 @@ struct snd_soc_dai_driver {
|
|||
int (*resume)(struct snd_soc_dai *dai);
|
||||
/* compress dai */
|
||||
bool compress_dai;
|
||||
/* DAI is also used for the control bus */
|
||||
bool bus_control;
|
||||
|
||||
/* ops */
|
||||
const struct snd_soc_dai_ops *ops;
|
||||
|
|
|
@ -205,7 +205,7 @@ static int au1xac97c_dai_probe(struct snd_soc_dai *dai)
|
|||
|
||||
static struct snd_soc_dai_driver au1xac97c_dai_driver = {
|
||||
.name = "alchemy-ac97c",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.probe = au1xac97c_dai_probe,
|
||||
.playback = {
|
||||
.rates = AC97_RATES,
|
||||
|
|
|
@ -343,7 +343,7 @@ static const struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = {
|
|||
};
|
||||
|
||||
static const struct snd_soc_dai_driver au1xpsc_ac97_dai_template = {
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.probe = au1xpsc_ac97_probe,
|
||||
.playback = {
|
||||
.rates = AC97_RATES,
|
||||
|
|
|
@ -260,7 +260,7 @@ static int bf5xx_ac97_resume(struct snd_soc_dai *dai)
|
|||
#endif
|
||||
|
||||
static struct snd_soc_dai_driver bfin_ac97_dai = {
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.suspend = bf5xx_ac97_suspend,
|
||||
.resume = bf5xx_ac97_resume,
|
||||
.playback = {
|
||||
|
|
|
@ -338,7 +338,7 @@ static const struct snd_soc_dai_ops ep93xx_ac97_dai_ops = {
|
|||
static struct snd_soc_dai_driver ep93xx_ac97_dai = {
|
||||
.name = "ep93xx-ac97",
|
||||
.id = 0,
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.probe = ep93xx_ac97_dai_probe,
|
||||
.playback = {
|
||||
.stream_name = "AC97 Playback",
|
||||
|
|
|
@ -1099,7 +1099,7 @@ static const struct snd_soc_component_driver fsl_ssi_component = {
|
|||
};
|
||||
|
||||
static struct snd_soc_dai_driver fsl_ssi_ac97_dai = {
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.stream_name = "AC97 Playback",
|
||||
.channels_min = 2,
|
||||
|
|
|
@ -382,7 +382,7 @@ static struct snd_soc_dai_driver imx_ssi_dai = {
|
|||
|
||||
static struct snd_soc_dai_driver imx_ac97_dai = {
|
||||
.probe = imx_ssi_dai_probe,
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.stream_name = "AC97 Playback",
|
||||
.channels_min = 2,
|
||||
|
|
|
@ -237,7 +237,7 @@ static const struct snd_soc_dai_ops psc_ac97_digital_ops = {
|
|||
static struct snd_soc_dai_driver psc_ac97_dai[] = {
|
||||
{
|
||||
.name = "mpc5200-psc-ac97.0",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.probe = psc_ac97_probe,
|
||||
.playback = {
|
||||
.stream_name = "AC97 Playback",
|
||||
|
@ -257,7 +257,7 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {
|
|||
},
|
||||
{
|
||||
.name = "mpc5200-psc-ac97.1",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.stream_name = "AC97 SPDIF",
|
||||
.channels_min = 1,
|
||||
|
|
|
@ -298,7 +298,7 @@ static const struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
|
|||
static struct snd_soc_dai_driver nuc900_ac97_dai = {
|
||||
.probe = nuc900_ac97_probe,
|
||||
.remove = nuc900_ac97_remove,
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.rates = SNDRV_PCM_RATE_8000_48000,
|
||||
.formats = SNDRV_PCM_FMTBIT_S16_LE,
|
||||
|
|
|
@ -157,7 +157,7 @@ static const struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = {
|
|||
static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
|
||||
{
|
||||
.name = "pxa2xx-ac97",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.stream_name = "AC97 Playback",
|
||||
.channels_min = 2,
|
||||
|
@ -174,7 +174,7 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
|
|||
},
|
||||
{
|
||||
.name = "pxa2xx-ac97-aux",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.stream_name = "AC97 Aux Playback",
|
||||
.channels_min = 1,
|
||||
|
@ -191,7 +191,7 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
|
|||
},
|
||||
{
|
||||
.name = "pxa2xx-ac97-mic",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.capture = {
|
||||
.stream_name = "AC97 Mic Capture",
|
||||
.channels_min = 1,
|
||||
|
|
|
@ -288,7 +288,7 @@ static int s3c_ac97_mic_dai_probe(struct snd_soc_dai *dai)
|
|||
static struct snd_soc_dai_driver s3c_ac97_dai[] = {
|
||||
[S3C_AC97_DAI_PCM] = {
|
||||
.name = "samsung-ac97",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.stream_name = "AC97 Playback",
|
||||
.channels_min = 2,
|
||||
|
@ -306,7 +306,7 @@ static struct snd_soc_dai_driver s3c_ac97_dai[] = {
|
|||
},
|
||||
[S3C_AC97_DAI_MIC] = {
|
||||
.name = "samsung-ac97-mic",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.capture = {
|
||||
.stream_name = "AC97 Mic Capture",
|
||||
.channels_min = 1,
|
||||
|
|
|
@ -272,7 +272,7 @@ static const struct snd_soc_dai_ops hac_dai_ops = {
|
|||
static struct snd_soc_dai_driver sh4_hac_dai[] = {
|
||||
{
|
||||
.name = "hac-dai.0",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.playback = {
|
||||
.rates = AC97_RATES,
|
||||
.formats = AC97_FMTS,
|
||||
|
|
|
@ -550,7 +550,7 @@ int snd_soc_suspend(struct device *dev)
|
|||
if (card->rtd[i].dai_link->ignore_suspend)
|
||||
continue;
|
||||
|
||||
if (cpu_dai->driver->suspend && !cpu_dai->driver->ac97_control)
|
||||
if (cpu_dai->driver->suspend && !cpu_dai->driver->bus_control)
|
||||
cpu_dai->driver->suspend(cpu_dai);
|
||||
if (platform->driver->suspend && !platform->suspended) {
|
||||
platform->driver->suspend(cpu_dai);
|
||||
|
@ -629,7 +629,7 @@ int snd_soc_suspend(struct device *dev)
|
|||
if (card->rtd[i].dai_link->ignore_suspend)
|
||||
continue;
|
||||
|
||||
if (cpu_dai->driver->suspend && cpu_dai->driver->ac97_control)
|
||||
if (cpu_dai->driver->suspend && cpu_dai->driver->bus_control)
|
||||
cpu_dai->driver->suspend(cpu_dai);
|
||||
|
||||
/* deactivate pins to sleep state */
|
||||
|
@ -665,14 +665,14 @@ static void soc_resume_deferred(struct work_struct *work)
|
|||
if (card->resume_pre)
|
||||
card->resume_pre(card);
|
||||
|
||||
/* resume AC97 DAIs */
|
||||
/* resume control bus DAIs */
|
||||
for (i = 0; i < card->num_rtd; i++) {
|
||||
struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
|
||||
|
||||
if (card->rtd[i].dai_link->ignore_suspend)
|
||||
continue;
|
||||
|
||||
if (cpu_dai->driver->resume && cpu_dai->driver->ac97_control)
|
||||
if (cpu_dai->driver->resume && cpu_dai->driver->bus_control)
|
||||
cpu_dai->driver->resume(cpu_dai);
|
||||
}
|
||||
|
||||
|
@ -733,7 +733,7 @@ static void soc_resume_deferred(struct work_struct *work)
|
|||
if (card->rtd[i].dai_link->ignore_suspend)
|
||||
continue;
|
||||
|
||||
if (cpu_dai->driver->resume && !cpu_dai->driver->ac97_control)
|
||||
if (cpu_dai->driver->resume && !cpu_dai->driver->bus_control)
|
||||
cpu_dai->driver->resume(cpu_dai);
|
||||
if (platform->driver->resume && platform->suspended) {
|
||||
platform->driver->resume(cpu_dai);
|
||||
|
@ -758,7 +758,8 @@ static void soc_resume_deferred(struct work_struct *work)
|
|||
int snd_soc_resume(struct device *dev)
|
||||
{
|
||||
struct snd_soc_card *card = dev_get_drvdata(dev);
|
||||
int i, ac97_control = 0;
|
||||
bool bus_control = false;
|
||||
int i;
|
||||
|
||||
/* If the card is not initialized yet there is nothing to do */
|
||||
if (!card->instantiated)
|
||||
|
@ -781,17 +782,18 @@ int snd_soc_resume(struct device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
/* AC97 devices might have other drivers hanging off them so
|
||||
* need to resume immediately. Other drivers don't have that
|
||||
* problem and may take a substantial amount of time to resume
|
||||
/*
|
||||
* DAIs that also act as the control bus master might have other drivers
|
||||
* hanging off them so need to resume immediately. Other drivers don't
|
||||
* have that problem and may take a substantial amount of time to resume
|
||||
* due to I/O costs and anti-pop so handle them out of line.
|
||||
*/
|
||||
for (i = 0; i < card->num_rtd; i++) {
|
||||
struct snd_soc_dai *cpu_dai = card->rtd[i].cpu_dai;
|
||||
ac97_control |= cpu_dai->driver->ac97_control;
|
||||
bus_control |= cpu_dai->driver->bus_control;
|
||||
}
|
||||
if (ac97_control) {
|
||||
dev_dbg(dev, "ASoC: Resuming AC97 immediately\n");
|
||||
if (bus_control) {
|
||||
dev_dbg(dev, "ASoC: Resuming control bus master immediately\n");
|
||||
soc_resume_deferred(&card->deferred_resume_work);
|
||||
} else {
|
||||
dev_dbg(dev, "ASoC: Scheduling resume work\n");
|
||||
|
|
|
@ -228,7 +228,7 @@ static int tegra20_ac97_probe(struct snd_soc_dai *dai)
|
|||
|
||||
static struct snd_soc_dai_driver tegra20_ac97_dai = {
|
||||
.name = "tegra-ac97-pcm",
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.probe = tegra20_ac97_probe,
|
||||
.playback = {
|
||||
.stream_name = "PCM Playback",
|
||||
|
|
|
@ -152,7 +152,7 @@ static int txx9aclc_ac97_remove(struct snd_soc_dai *dai)
|
|||
}
|
||||
|
||||
static struct snd_soc_dai_driver txx9aclc_ac97_dai = {
|
||||
.ac97_control = 1,
|
||||
.bus_control = true,
|
||||
.probe = txx9aclc_ac97_probe,
|
||||
.remove = txx9aclc_ac97_remove,
|
||||
.playback = {
|
||||
|
|
Loading…
Reference in New Issue
Block a user