ASoC: WM8750: Convert to new API
Register the WM8750 as a SPI or I2C device. This patch mostly shuffles code around. Hugely inspired by WM8753 which was already converted. Also, this patch fixes the Jive and Spitz machine. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:

zatwierdzone przez
Mark Brown

rodzic
53a61d967a
commit
6ca0c22ef8
@@ -322,19 +322,44 @@ static struct snd_soc_card snd_soc_spitz = {
|
||||
.num_links = 1,
|
||||
};
|
||||
|
||||
/* spitz audio private data */
|
||||
static struct wm8750_setup_data spitz_wm8750_setup = {
|
||||
.i2c_bus = 0,
|
||||
.i2c_address = 0x1b,
|
||||
};
|
||||
|
||||
/* spitz audio subsystem */
|
||||
static struct snd_soc_device spitz_snd_devdata = {
|
||||
.card = &snd_soc_spitz,
|
||||
.codec_dev = &soc_codec_dev_wm8750,
|
||||
.codec_data = &spitz_wm8750_setup,
|
||||
};
|
||||
|
||||
/*
|
||||
* FIXME: This is a temporary bodge to avoid cross-tree merge issues.
|
||||
* New drivers should register the wm8750 I2C device in the machine
|
||||
* setup code (under arch/arm for ARM systems).
|
||||
*/
|
||||
static int wm8750_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, "wm8750", 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 platform_device *spitz_snd_device;
|
||||
|
||||
static int __init spitz_init(void)
|
||||
@@ -344,6 +369,10 @@ static int __init spitz_init(void)
|
||||
if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita()))
|
||||
return -ENODEV;
|
||||
|
||||
ret = wm8750_i2c_setup();
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
spitz_snd_device = platform_device_alloc("soc-audio", -1);
|
||||
if (!spitz_snd_device)
|
||||
return -ENOMEM;
|
||||
|
Reference in New Issue
Block a user