diff options
author | Manuel Lauss <manuel.lauss@googlemail.com> | 2010-08-26 14:53:51 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-31 13:06:31 +0100 |
commit | ffc4fdbbe1b4be79e98340ebcd5a0ade6f5de318 (patch) | |
tree | e4f16ef2561497482df5ac9039ba7bdb21212b2d /sound/soc/au1x/psc-i2s.c | |
parent | 0bb5f267af41c39af895faee3abe2d9ab8c562e0 (diff) | |
download | linux-ffc4fdbbe1b4be79e98340ebcd5a0ade6f5de318.tar.bz2 |
ASoC: fix au1x platform
This patch fixes up the au1x audio platform after the multi-component
merge:
- compile fixes and updates to get DB1200 platform audio working again,
- removal of global variables in AC97/I2S/DMA(PCM) modules.
The AC97 part is limited to one instance only for now due to issues
with getting at driver data in the soc_ac97_ops.
Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/au1x/psc-i2s.c')
-rw-r--r-- | sound/soc/au1x/psc-i2s.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 94e560a8756d..fca091276320 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -10,9 +10,6 @@ * * Au1xxx-PSC I2S glue. * - * NOTE: all of these drivers can only work with a SINGLE instance - * of a PSC. Multiple independent audio devices are impossible - * with ASoC v1. * NOTE: so far only PSC slave mode (bit- and frameclock) is supported. */ @@ -54,13 +51,10 @@ ((stype) == PCM_TX ? PSC_I2SPCR_TC : PSC_I2SPCR_RC) -/* instance data. There can be only one, MacLeod!!!! */ -static struct au1xpsc_audio_data *au1xpsc_i2s_workdata; - static int au1xpsc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { - struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata; + struct au1xpsc_audio_data *pscdata = snd_soc_dai_get_drvdata(cpu_dai); unsigned long ct; int ret; @@ -120,7 +114,7 @@ static int au1xpsc_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct au1xpsc_audio_data *pscdata = au1xpsc_i2s_workdata; + struct au1xpsc_audio_data *pscdata = snd_soc_dai_get_drvdata(dai); int cfgbits; unsigned long stat; @@ -245,7 +239,7 @@ static int au1xpsc_i2s_stop(struct au1xpsc_audio_data *pscdata, int stype) 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; + struct au1xpsc_audio_data *pscdata = snd_soc_dai_get_drvdata(dai); int ret, stype = SUBSTREAM_TYPE(substream); switch (cmd) { @@ -263,19 +257,13 @@ static int au1xpsc_i2s_trigger(struct snd_pcm_substream *substream, int cmd, return ret; } -static int au1xpsc_i2s_probe(struct snd_soc_dai *dai) -{ - return au1xpsc_i2s_workdata ? 0 : -ENODEV; -} - 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, }; -static struct snd_soc_dai_driver au1xpsc_i2s_dai = { - .probe = au1xpsc_i2s_probe, +static const struct snd_soc_dai_driver au1xpsc_i2s_dai_template = { .playback = { .rates = AU1XPSC_I2S_RATES, .formats = AU1XPSC_I2S_FMTS, @@ -298,9 +286,6 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev) int ret; struct au1xpsc_audio_data *wd; - if (au1xpsc_i2s_workdata) - return -EBUSY; - wd = kzalloc(sizeof(struct au1xpsc_audio_data), GFP_KERNEL); if (!wd) return -ENOMEM; @@ -337,17 +322,21 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev) * time out. */ - ret = snd_soc_register_dai(&pdev->dev, &au1xpsc_i2s_dai); + /* name the DAI like this device instance ("au1xpsc-i2s.PSCINDEX") */ + memcpy(&wd->dai_drv, &au1xpsc_i2s_dai_template, + sizeof(struct snd_soc_dai_driver)); + wd->dai_drv.name = dev_name(&pdev->dev); + + platform_set_drvdata(pdev, wd); + + ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv); if (ret) goto out1; /* finally add the DMA device for this PSC */ wd->dmapd = au1xpsc_pcm_add(pdev); - if (wd->dmapd) { - platform_set_drvdata(pdev, wd); - au1xpsc_i2s_workdata = wd; + if (wd->dmapd) return 0; - } snd_soc_unregister_dai(&pdev->dev); out1: @@ -376,8 +365,6 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) release_mem_region(r->start, resource_size(r)); kfree(wd); - au1xpsc_i2s_workdata = NULL; /* MDEV */ - return 0; } @@ -427,7 +414,7 @@ static struct dev_pm_ops au1xpsci2s_pmops = { static struct platform_driver au1xpsc_i2s_driver = { .driver = { - .name = "au1xpsc", + .name = "au1xpsc_i2s", .owner = THIS_MODULE, .pm = AU1XPSCI2S_PMOPS, }, @@ -437,7 +424,6 @@ static struct platform_driver au1xpsc_i2s_driver = { static int __init au1xpsc_i2s_load(void) { - au1xpsc_i2s_workdata = NULL; return platform_driver_register(&au1xpsc_i2s_driver); } |