X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=sound%2Fsoc%2Fpxa%2Fpoodle.c;h=a51058f66747fdad48b6b5dde422fd8d6d62de27;hb=ed40d0c472b136682b2fcba05f89762859c7374f;hp=3a62d4354ef69f985c059bd7be9a70919ebbe2a2;hpb=9e30d7718bb7402c7bdee631ad2aae2658c324f0;p=linux-2.6-omap-h63xx.git diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 3a62d4354ef..a51058f6674 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -26,8 +27,6 @@ #include #include -#include -#include #include #include @@ -240,19 +239,17 @@ static const struct snd_kcontrol_new wm8731_poodle_controls[] = { */ static int poodle_wm8731_init(struct snd_soc_codec *codec) { - int i, err; + int err; snd_soc_dapm_nc_pin(codec, "LLINEIN"); snd_soc_dapm_nc_pin(codec, "RLINEIN"); snd_soc_dapm_enable_pin(codec, "MICIN"); /* Add poodle specific controls */ - for (i = 0; i < ARRAY_SIZE(wm8731_poodle_controls); i++) { - err = snd_ctl_add(codec->card, - snd_soc_cnew(&wm8731_poodle_controls[i], codec, NULL)); - if (err < 0) - return err; - } + err = snd_soc_add_controls(codec, wm8731_poodle_controls, + ARRAY_SIZE(wm8731_poodle_controls)); + if (err < 0) + return err; /* Add poodle specific widgets */ snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, @@ -283,17 +280,42 @@ static struct snd_soc_card snd_soc_poodle = { .num_links = 1, }; -/* poodle audio private data */ -static struct wm8731_setup_data poodle_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; +} /* poodle audio subsystem */ static struct snd_soc_device poodle_snd_devdata = { .card = &snd_soc_poodle, .codec_dev = &soc_codec_dev_wm8731, - .codec_data = &poodle_wm8731_setup, }; static struct platform_device *poodle_snd_device; @@ -305,6 +327,10 @@ static int __init poodle_init(void) if (!machine_is_poodle()) return -ENODEV; + ret = wm8731_i2c_register(); + if (ret != 0) + return ret; + locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_AMP_ON, 0); /* should we mute HP at startup - burning power ?*/