Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283969
b: refs/heads/master
c: f285b8c
h: refs/heads/master
i:
  283967: d8ff424
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Dec 17, 2011
1 parent b5894a9 commit 23bc328
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 48 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: ac1e89860a89c9d91174bf5439689bba2e4f83bb
refs/heads/master: f285b8c83a8dccc70f168bb1eb6f04c8e36450a6
6 changes: 6 additions & 0 deletions trunk/arch/arm/mach-pxa/tosa.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@ static struct platform_device wm9712_device = {
.id = -1,
};

static struct platform_device tosa_audio_device = {
.name = "tosa-audio",
.id = -1,
};

static struct platform_device *devices[] __initdata = {
&tosascoop_device,
&tosascoop_jc_device,
Expand All @@ -901,6 +906,7 @@ static struct platform_device *devices[] __initdata = {
&sharpsl_rom_device,
&wm9712_device,
&tosa_gpio_vbus,
&tosa_audio_device,
};

static void tosa_poweroff(void)
Expand Down
77 changes: 30 additions & 47 deletions trunk/sound/soc/pxa/tosa.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#include "../codecs/wm9712.h"
#include "pxa2xx-ac97.h"

static struct snd_soc_card tosa;

#define TOSA_HP 0
#define TOSA_MIC_INT 1
#define TOSA_HEADSET 2
Expand Down Expand Up @@ -236,70 +234,55 @@ static struct snd_soc_dai_link tosa_dai[] = {
},
};

static int tosa_probe(struct snd_soc_card *card)
{
int ret;

ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack");
if (ret)
return ret;
ret = gpio_direction_output(TOSA_GPIO_L_MUTE, 0);
if (ret)
gpio_free(TOSA_GPIO_L_MUTE);

return ret;
}

static int tosa_remove(struct snd_soc_card *card)
{
gpio_free(TOSA_GPIO_L_MUTE);
return 0;
}

static struct snd_soc_card tosa = {
.name = "Tosa",
.dai_link = tosa_dai,
.num_links = ARRAY_SIZE(tosa_dai),
.probe = tosa_probe,
.remove = tosa_remove,
};

static struct platform_device *tosa_snd_device;

static int __init tosa_init(void)
static int __devinit tosa_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = ⤩
int ret;

if (!machine_is_tosa())
return -ENODEV;

tosa_snd_device = platform_device_alloc("soc-audio", -1);
if (!tosa_snd_device) {
ret = -ENOMEM;
goto err_alloc;
}

platform_set_drvdata(tosa_snd_device, &tosa);
ret = platform_device_add(tosa_snd_device);

if (!ret)
return 0;
ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW,
"Headphone Jack");
if (ret)
return ret;

platform_device_put(tosa_snd_device);
card->dev = &pdev->dev;

err_alloc:
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
gpio_free(TOSA_GPIO_L_MUTE);
}
return ret;
}

static void __exit tosa_exit(void)
static int __devexit tosa_remove(struct platform_device *pdev)
{
platform_device_unregister(tosa_snd_device);
struct snd_soc_card *card = platform_get_drvdata(pdev);

gpio_free(TOSA_GPIO_L_MUTE);
snd_soc_unregister_card(card);
return 0;
}

module_init(tosa_init);
module_exit(tosa_exit);
static struct platform_driver tosa_driver = {
.driver = {
.name = "tosa-audio",
.owner = THIS_MODULE,
},
.probe = tosa_probe,
.remove = __devexit_p(tosa_remove),
};

module_platform_driver(tosa_driver);

/* Module information */
MODULE_AUTHOR("Richard Purdie");
MODULE_DESCRIPTION("ALSA SoC Tosa");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:tosa-audio");

0 comments on commit 23bc328

Please sign in to comment.