Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 342689
b: refs/heads/master
c: 242b9bb
h: refs/heads/master
i:
  342687: 07fec9f
v: v3
  • Loading branch information
Bo Shen authored and Mark Brown committed Nov 6, 2012
1 parent 6c7bfd3 commit bbf30f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5c86ac695c7e2402f60e30ad8174ceb66ef22a91
refs/heads/master: 242b9bb83e458ddc6205265eafb8770c3dedd009
51 changes: 22 additions & 29 deletions trunk/sound/soc/atmel/sam9g20_wm8731.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,15 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = {
.set_bias_level = at91sam9g20ek_set_bias_level,
};

static struct platform_device *at91sam9g20ek_snd_device;

static int __init at91sam9g20ek_init(void)
static int __devinit at91sam9g20ek_audio_probe(struct platform_device *pdev)
{
struct clk *pllb;
struct snd_soc_card *card = &snd_soc_at91sam9g20ek;
int ret;

if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
return -ENODEV;

ret = atmel_ssc_set_audio(0);
if (ret != 0) {
pr_err("Failed to set SSC 0 for audio: %d\n", ret);
return ret;
}

/*
* Codec MCLK is supplied by PCK0 - set it up.
*/
Expand All @@ -236,45 +229,45 @@ static int __init at91sam9g20ek_init(void)

clk_set_rate(mclk, MCLK_RATE);

at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1);
if (!at91sam9g20ek_snd_device) {
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
ret = -ENOMEM;
goto err_mclk;
}

platform_set_drvdata(at91sam9g20ek_snd_device,
&snd_soc_at91sam9g20ek);

ret = platform_device_add(at91sam9g20ek_snd_device);
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
if (ret) {
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
goto err_device_add;
printk(KERN_ERR "ASoC: snd_soc_register_card() failed\n");
}

return ret;

err_device_add:
platform_device_put(at91sam9g20ek_snd_device);
err_mclk:
clk_put(mclk);
mclk = NULL;
err:
return ret;
}

static void __exit at91sam9g20ek_exit(void)
static int __devexit at91sam9g20ek_audio_remove(struct platform_device *pdev)
{
platform_device_unregister(at91sam9g20ek_snd_device);
at91sam9g20ek_snd_device = NULL;
struct snd_soc_card *card = platform_get_drvdata(pdev);

snd_soc_unregister_card(card);
clk_put(mclk);
mclk = NULL;

return 0;
}

module_init(at91sam9g20ek_init);
module_exit(at91sam9g20ek_exit);
static struct platform_driver at91sam9g20ek_audio_driver = {
.driver = {
.name = "at91sam9g20ek-audio",
.owner = THIS_MODULE,
},
.probe = at91sam9g20ek_audio_probe,
.remove = __devexit_p(at91sam9g20ek_audio_remove),
};

module_platform_driver(at91sam9g20ek_audio_driver);

/* Module information */
MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
MODULE_DESCRIPTION("ALSA SoC AT91SAM9G20EK_WM8731");
MODULE_ALIAS("platform:at91sam9g20ek-audio");
MODULE_LICENSE("GPL");

0 comments on commit bbf30f7

Please sign in to comment.