Skip to content

Commit

Permalink
ASoC: Samsung: Do not register samsung audio dma device as pdev
Browse files Browse the repository at this point in the history
Previously, the ASoC 'platform' (PCM/DMA) object was instantiated via a
platform_device. This didn't represent the hardware well, since there
was no separate hardware associated with this platform_device; it was a
virtual device with sole purpose to call snd_soc_register_platform().

This change removes the platform_device completely. Each Samsung DAI now
registers the ASoC 'platform' itself. Machine drivers are adjusted for
the new 'platform' name.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Padmavathi Venna authored and Mark Brown committed Dec 7, 2012
1 parent 1974a04 commit a08485d
Show file tree
Hide file tree
Showing 45 changed files with 105 additions and 72 deletions.
1 change: 0 additions & 1 deletion arch/arm/mach-exynos/mach-armlex4210.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ static struct platform_device *armlex4210_devices[] __initdata = {
&s3c_device_hsmmc3,
&s3c_device_rtc,
&s3c_device_wdt,
&samsung_asoc_dma,
&armlex4210_smsc911x,
&exynos4_device_ahci,
};
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-exynos/mach-smdkv310.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ static struct platform_device *smdkv310_devices[] __initdata = {
&s5p_device_mfc_l,
&s5p_device_mfc_r,
&exynos4_device_spdif,
&samsung_asoc_dma,
&samsung_asoc_idma,
&s5p_device_fimd0,
&smdkv310_device_audio,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c24xx/mach-gta02.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ static struct platform_device *gta02_devices[] __initdata = {
&gta02_nor_flash,
&s3c24xx_pwm_device,
&s3c_device_iis,
&samsung_asoc_dma,
&s3c_device_i2c0,
&gta02_dfbmcs320_device,
&gta02_buttons_device,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c24xx/mach-h1940.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ static struct platform_device *h1940_devices[] __initdata = {
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&samsung_asoc_dma,
&s3c_device_usbgadget,
&h1940_device_leds,
&h1940_device_bluetooth,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c24xx/mach-mini2440.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ static struct platform_device *mini2440_devices[] __initdata = {
&s3c_device_iis,
&uda1340_codec,
&mini2440_audio,
&samsung_asoc_dma,
};

static void __init mini2440_map_io(void)
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c24xx/mach-rx1950.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,6 @@ static struct platform_device *rx1950_devices[] __initdata = {
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&samsung_asoc_dma,
&s3c_device_usbgadget,
&s3c_device_rtc,
&s3c_device_nand,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c64xx/mach-crag6410.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ static struct platform_device *crag6410_devices[] __initdata = {
&s3c_device_timer[0],
&s3c64xx_device_iis0,
&s3c64xx_device_iis1,
&samsung_asoc_dma,
&samsung_device_keypad,
&crag6410_gpio_keydev,
&crag6410_dm9k_device,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s3c64xx/mach-smdk6410.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ static struct platform_device *smdk6410_devices[] __initdata = {
&s3c_device_fb,
&s3c_device_ohci,
&s3c_device_usb_hsotg,
&samsung_asoc_dma,
&s3c64xx_device_iisv4,
&samsung_device_keypad,

Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s5p64x0/mach-smdk6440.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ static struct platform_device *smdk6440_devices[] __initdata = {
&s3c_device_i2c1,
&s3c_device_ts,
&s3c_device_wdt,
&samsung_asoc_dma,
&s5p6440_device_iis,
&s3c_device_fb,
&smdk6440_lcd_lte480wv,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s5p64x0/mach-smdk6450.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ static struct platform_device *smdk6450_devices[] __initdata = {
&s3c_device_i2c1,
&s3c_device_ts,
&s3c_device_wdt,
&samsung_asoc_dma,
&s5p6450_device_iis0,
&s3c_device_fb,
&smdk6450_lcd_lte480wv,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s5pc100/mach-smdkc100.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ static struct platform_device *smdkc100_devices[] __initdata = {
&s3c_device_ts,
&s3c_device_wdt,
&smdkc100_lcd_powerdev,
&samsung_asoc_dma,
&s5pc100_device_iis0,
&samsung_device_keypad,
&s5pc100_device_ac97,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s5pv210/mach-smdkc110.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ static struct s3c_ide_platdata smdkc110_ide_pdata __initdata = {
};

static struct platform_device *smdkc110_devices[] __initdata = {
&samsung_asoc_dma,
&s5pv210_device_iis0,
&s5pv210_device_ac97,
&s5pv210_device_spdif,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-s5pv210/mach-smdkv210.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ static struct platform_device *smdkv210_devices[] __initdata = {
&s5pv210_device_ac97,
&s5pv210_device_iis0,
&s5pv210_device_spdif,
&samsung_asoc_dma,
&samsung_asoc_idma,
&samsung_device_keypad,
&smdkv210_dm9000,
Expand Down
9 changes: 0 additions & 9 deletions arch/arm/plat-samsung/devs.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,6 @@ struct platform_device s3c_device_camif = {

/* ASOC DMA */

struct platform_device samsung_asoc_dma = {
.name = "samsung-audio",
.id = -1,
.dev = {
.dma_mask = &samsung_device_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
}
};

struct platform_device samsung_asoc_idma = {
.name = "samsung-idma",
.id = -1,
Expand Down
1 change: 0 additions & 1 deletion arch/arm/plat-samsung/include/plat/devs.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ extern struct platform_device exynos4_device_spdif;

extern struct platform_device exynos_device_drm;

extern struct platform_device samsung_asoc_dma;
extern struct platform_device samsung_asoc_idma;
extern struct platform_device samsung_device_keypad;

Expand Down
10 changes: 9 additions & 1 deletion sound/soc/samsung/ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,15 @@ static __devinit int s3c_ac97_probe(struct platform_device *pdev)
if (ret)
goto err5;

return 0;
ret = asoc_dma_platform_register(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
goto err6;
}

return 0;
err6:
snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c_ac97_dai));
err5:
free_irq(irq_res->start, NULL);
err4:
Expand All @@ -482,6 +489,7 @@ static __devexit int s3c_ac97_remove(struct platform_device *pdev)
{
struct resource *mem_res, *irq_res;

asoc_dma_platform_unregister(&pdev->dev);
snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c_ac97_dai));

irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/samsung/bells.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static struct snd_soc_dai_link bells_dai_wm2200[] = {
.stream_name = "CPU-DSP",
.cpu_dai_name = "samsung-i2s.0",
.codec_dai_name = "wm0010-sdi1",
.platform_name = "samsung-audio",
.platform_name = "samsung-i2s.0",
.codec_name = "spi0.0",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM,
Expand All @@ -257,7 +257,7 @@ static struct snd_soc_dai_link bells_dai_wm5102[] = {
.stream_name = "CPU-DSP",
.cpu_dai_name = "samsung-i2s.0",
.codec_dai_name = "wm0010-sdi1",
.platform_name = "samsung-audio",
.platform_name = "samsung-i2s.0",
.codec_name = "spi0.0",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM,
Expand Down Expand Up @@ -303,7 +303,7 @@ static struct snd_soc_dai_link bells_dai_wm5110[] = {
.stream_name = "CPU-DSP",
.cpu_dai_name = "samsung-i2s.0",
.codec_dai_name = "wm0010-sdi1",
.platform_name = "samsung-audio",
.platform_name = "samsung-i2s.0",
.codec_name = "spi0.0",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM,
Expand Down
24 changes: 6 additions & 18 deletions sound/soc/samsung/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,30 +432,18 @@ static struct snd_soc_platform_driver samsung_asoc_platform = {
.pcm_free = dma_free_dma_buffers,
};

static int __devinit samsung_asoc_platform_probe(struct platform_device *pdev)
int __devinit asoc_dma_platform_register(struct device *dev)
{
return snd_soc_register_platform(&pdev->dev, &samsung_asoc_platform);
return snd_soc_register_platform(dev, &samsung_asoc_platform);
}
EXPORT_SYMBOL_GPL(asoc_dma_platform_register);

static int __devexit samsung_asoc_platform_remove(struct platform_device *pdev)
void __devexit asoc_dma_platform_unregister(struct device *dev)
{
snd_soc_unregister_platform(&pdev->dev);
return 0;
snd_soc_unregister_platform(dev);
}

static struct platform_driver asoc_dma_driver = {
.driver = {
.name = "samsung-audio",
.owner = THIS_MODULE,
},

.probe = samsung_asoc_platform_probe,
.remove = __devexit_p(samsung_asoc_platform_remove),
};

module_platform_driver(asoc_dma_driver);
EXPORT_SYMBOL_GPL(asoc_dma_platform_unregister);

MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
MODULE_DESCRIPTION("Samsung ASoC DMA Driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:samsung-audio");
3 changes: 3 additions & 0 deletions sound/soc/samsung/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ struct s3c_dma_params {
struct samsung_dma_ops *ops;
};

int asoc_dma_platform_register(struct device *dev);
void asoc_dma_platform_unregister(struct device *dev);

#endif
2 changes: 1 addition & 1 deletion sound/soc/samsung/goni_wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static struct snd_soc_dai_link goni_dai[] = {
.stream_name = "WM8994 HiFi",
.cpu_dai_name = "samsung-i2s.0",
.codec_dai_name = "wm8994-aif1",
.platform_name = "samsung-audio",
.platform_name = "samsung-i2s.0",
.codec_name = "wm8994-codec.0-001a",
.init = goni_wm8994_init,
.ops = &goni_hifi_ops,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/h1940_uda1380.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static struct snd_soc_dai_link h1940_uda1380_dai[] = {
.cpu_dai_name = "s3c24xx-iis",
.codec_dai_name = "uda1380-hifi",
.init = h1940_uda1380_init,
.platform_name = "samsung-audio",
.platform_name = "s3c24xx-iis",
.codec_name = "uda1380-codec.0-001a",
.ops = &h1940_ops,
},
Expand Down
4 changes: 4 additions & 0 deletions sound/soc/samsung/i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
sec_dai = dev_get_drvdata(&pdev->dev);
snd_soc_register_dai(&sec_dai->pdev->dev,
&sec_dai->i2s_dai_drv);
asoc_dma_platform_register(&pdev->dev);
return 0;
}

Expand Down Expand Up @@ -1107,6 +1108,8 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)

pm_runtime_enable(&pdev->dev);

asoc_dma_platform_register(&pdev->dev);

return 0;
err:
release_mem_region(regs_base, resource_size(res));
Expand Down Expand Up @@ -1135,6 +1138,7 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev)
i2s->pri_dai = NULL;
i2s->sec_dai = NULL;

asoc_dma_platform_unregister(&pdev->dev);
snd_soc_unregister_dai(&pdev->dev);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/jive_wm8750.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static struct snd_soc_dai_link jive_dai = {
.stream_name = "WM8750",
.cpu_dai_name = "s3c2412-i2s",
.codec_dai_name = "wm8750-hifi",
.platform_name = "samsung-audio",
.platform_name = "s3c2412-i2s",
.codec_name = "wm8750.0-001a",
.init = jive_wm8750_init,
.ops = &jive_ops,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/littlemill.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static struct snd_soc_dai_link littlemill_dai[] = {
.stream_name = "CPU",
.cpu_dai_name = "samsung-i2s.0",
.codec_dai_name = "wm8994-aif1",
.platform_name = "samsung-audio",
.platform_name = "samsung-i2s.0",
.codec_name = "wm8994-codec",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/ln2440sbc_alc650.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static struct snd_soc_dai_link ln2440sbc_dai[] = {
.cpu_dai_name = "samsung-ac97",
.codec_dai_name = "ac97-hifi",
.codec_name = "ac97-codec",
.platform_name = "samsung-audio",
.platform_name = "samsung-ac97",
},
};

Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/lowland.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static struct snd_soc_dai_link lowland_dai[] = {
.stream_name = "CPU",
.cpu_dai_name = "samsung-i2s.0",
.codec_dai_name = "wm5100-aif1",
.platform_name = "samsung-audio",
.platform_name = "samsung-i2s.0",
.codec_name = "wm5100.1-001a",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/neo1973_wm8753.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static struct snd_soc_dai_link neo1973_dai[] = {
{ /* Hifi Playback - for similatious use with voice below */
.name = "WM8753",
.stream_name = "WM8753 HiFi",
.platform_name = "samsung-audio",
.platform_name = "s3c24xx-iis",
.cpu_dai_name = "s3c24xx-iis",
.codec_dai_name = "wm8753-hifi",
.codec_name = "wm8753.0-001a",
Expand Down
9 changes: 9 additions & 0 deletions sound/soc/samsung/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,16 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
goto err5;
}

ret = asoc_dma_platform_register(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
goto err6;
}

return 0;

err6:
snd_soc_unregister_dai(&pdev->dev);
err5:
clk_disable_unprepare(pcm->pclk);
clk_put(pcm->pclk);
Expand All @@ -610,6 +618,7 @@ static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev)
struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id];
struct resource *mem_res;

asoc_dma_platform_unregister(&pdev->dev);
snd_soc_unregister_dai(&pdev->dev);

pm_runtime_disable(&pdev->dev);
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/rx1950_uda1380.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static struct snd_soc_dai_link rx1950_uda1380_dai[] = {
.cpu_dai_name = "s3c24xx-iis",
.codec_dai_name = "uda1380-hifi",
.init = rx1950_uda1380_init,
.platform_name = "samsung-audio",
.platform_name = "s3c24xx-iis",
.codec_name = "uda1380-codec.0-001a",
.ops = &rx1950_ops,
},
Expand Down
20 changes: 19 additions & 1 deletion sound/soc/samsung/s3c2412-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,29 @@ static struct snd_soc_dai_driver s3c2412_i2s_dai = {

static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev)
{
return s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai);
int ret = 0;

ret = s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai);
if (ret) {
pr_err("failed to register the dai\n");
return ret;
}

ret = asoc_dma_platform_register(&pdev->dev);
if (ret) {
pr_err("failed to register the DMA: %d\n", ret);
goto err;
}

return 0;
err:
snd_soc_unregister_dai(&pdev->dev);
return ret;
}

static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev)
{
asoc_dma_platform_unregister(&pdev->dev);
snd_soc_unregister_dai(&pdev->dev);
return 0;
}
Expand Down
Loading

0 comments on commit a08485d

Please sign in to comment.