Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132849
b: refs/heads/master
c: 5998102
h: refs/heads/master
i:
  132847: 28d0346
v: v3
  • Loading branch information
Mark Brown committed Feb 18, 2009
1 parent 8b1f101 commit 9dcfd91
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 212 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: a8035c8f04477895207b92915b908344749be336
refs/heads/master: 5998102b9095fdb7c67755812038612afea315c5
43 changes: 38 additions & 5 deletions trunk/sound/soc/atmel/sam9g20_wm8731.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>

#include <linux/atmel-ssc.h>

Expand Down Expand Up @@ -280,15 +281,41 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = {
.set_bias_level = at91sam9g20ek_set_bias_level,
};

static struct wm8731_setup_data at91sam9g20ek_wm8731_setup = {
.i2c_bus = 0,
.i2c_address = 0x1b,
};
/*
* FIXME: This is a temporary bodge to avoid cross-tree merge issues.
* New drivers should register the wm8731 I2C device in the machine
* setup code (under arch/arm for ARM systems).
*/
static int wm8731_i2c_register(void)
{
struct i2c_board_info info;
struct i2c_adapter *adapter;
struct i2c_client *client;

memset(&info, 0, sizeof(struct i2c_board_info));
info.addr = 0x1b;
strlcpy(info.type, "wm8731", I2C_NAME_SIZE);

adapter = i2c_get_adapter(0);
if (!adapter) {
printk(KERN_ERR "can't get i2c adapter 0\n");
return -ENODEV;
}

client = i2c_new_device(adapter, &info);
i2c_put_adapter(adapter);
if (!client) {
printk(KERN_ERR "can't add i2c device at 0x%x\n",
(unsigned int)info.addr);
return -ENODEV;
}

return 0;
}

static struct snd_soc_device at91sam9g20ek_snd_devdata = {
.card = &snd_soc_at91sam9g20ek,
.codec_dev = &soc_codec_dev_wm8731,
.codec_data = &at91sam9g20ek_wm8731_setup,
};

static struct platform_device *at91sam9g20ek_snd_device;
Expand Down Expand Up @@ -340,6 +367,10 @@ static int __init at91sam9g20ek_init(void)
}
ssc_p->ssc = ssc;

ret = wm8731_i2c_register();
if (ret != 0)
goto err_ssc;

at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1);
if (!at91sam9g20ek_snd_device) {
printk(KERN_ERR "ASoC: Platform device allocation failed\n");
Expand All @@ -359,6 +390,8 @@ static int __init at91sam9g20ek_init(void)
return ret;

err_ssc:
ssc_free(ssc);
ssc_p->ssc = NULL;
err_mclk:
clk_put(mclk);
mclk = NULL;
Expand Down
Loading

0 comments on commit 9dcfd91

Please sign in to comment.