aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/poodle.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa/poodle.c')
-rw-r--r--sound/soc/pxa/poodle.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 6e9827189fff..ef7c6c8dc8f1 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/moduleparam.h> 18#include <linux/moduleparam.h>
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/i2c.h>
20#include <linux/interrupt.h> 21#include <linux/interrupt.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
22#include <sound/core.h> 23#include <sound/core.h>
@@ -77,7 +78,7 @@ static void poodle_ext_control(struct snd_soc_codec *codec)
77static int poodle_startup(struct snd_pcm_substream *substream) 78static int poodle_startup(struct snd_pcm_substream *substream)
78{ 79{
79 struct snd_soc_pcm_runtime *rtd = substream->private_data; 80 struct snd_soc_pcm_runtime *rtd = substream->private_data;
80 struct snd_soc_codec *codec = rtd->socdev->codec; 81 struct snd_soc_codec *codec = rtd->socdev->card->codec;
81 82
82 /* check the jack status at stream startup */ 83 /* check the jack status at stream startup */
83 poodle_ext_control(codec); 84 poodle_ext_control(codec);
@@ -240,19 +241,17 @@ static const struct snd_kcontrol_new wm8731_poodle_controls[] = {
240 */ 241 */
241static int poodle_wm8731_init(struct snd_soc_codec *codec) 242static int poodle_wm8731_init(struct snd_soc_codec *codec)
242{ 243{
243 int i, err; 244 int err;
244 245
245 snd_soc_dapm_nc_pin(codec, "LLINEIN"); 246 snd_soc_dapm_nc_pin(codec, "LLINEIN");
246 snd_soc_dapm_nc_pin(codec, "RLINEIN"); 247 snd_soc_dapm_nc_pin(codec, "RLINEIN");
247 snd_soc_dapm_enable_pin(codec, "MICIN"); 248 snd_soc_dapm_enable_pin(codec, "MICIN");
248 249
249 /* Add poodle specific controls */ 250 /* Add poodle specific controls */
250 for (i = 0; i < ARRAY_SIZE(wm8731_poodle_controls); i++) { 251 err = snd_soc_add_controls(codec, wm8731_poodle_controls,
251 err = snd_ctl_add(codec->card, 252 ARRAY_SIZE(wm8731_poodle_controls));
252 snd_soc_cnew(&wm8731_poodle_controls[i], codec, NULL)); 253 if (err < 0)
253 if (err < 0) 254 return err;
254 return err;
255 }
256 255
257 /* Add poodle specific widgets */ 256 /* Add poodle specific widgets */
258 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, 257 snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets,
@@ -283,17 +282,42 @@ static struct snd_soc_card snd_soc_poodle = {
283 .num_links = 1, 282 .num_links = 1,
284}; 283};
285 284
286/* poodle audio private data */ 285/*
287static struct wm8731_setup_data poodle_wm8731_setup = { 286 * FIXME: This is a temporary bodge to avoid cross-tree merge issues.
288 .i2c_bus = 0, 287 * New drivers should register the wm8731 I2C device in the machine
289 .i2c_address = 0x1b, 288 * setup code (under arch/arm for ARM systems).
290}; 289 */
290static int wm8731_i2c_register(void)
291{
292 struct i2c_board_info info;
293 struct i2c_adapter *adapter;
294 struct i2c_client *client;
295
296 memset(&info, 0, sizeof(struct i2c_board_info));
297 info.addr = 0x1b;
298 strlcpy(info.type, "wm8731", I2C_NAME_SIZE);
299
300 adapter = i2c_get_adapter(0);
301 if (!adapter) {
302 printk(KERN_ERR "can't get i2c adapter 0\n");
303 return -ENODEV;
304 }
305
306 client = i2c_new_device(adapter, &info);
307 i2c_put_adapter(adapter);
308 if (!client) {
309 printk(KERN_ERR "can't add i2c device at 0x%x\n",
310 (unsigned int)info.addr);
311 return -ENODEV;
312 }
313
314 return 0;
315}
291 316
292/* poodle audio subsystem */ 317/* poodle audio subsystem */
293static struct snd_soc_device poodle_snd_devdata = { 318static struct snd_soc_device poodle_snd_devdata = {
294 .card = &snd_soc_poodle, 319 .card = &snd_soc_poodle,
295 .codec_dev = &soc_codec_dev_wm8731, 320 .codec_dev = &soc_codec_dev_wm8731,
296 .codec_data = &poodle_wm8731_setup,
297}; 321};
298 322
299static struct platform_device *poodle_snd_device; 323static struct platform_device *poodle_snd_device;
@@ -305,6 +329,10 @@ static int __init poodle_init(void)
305 if (!machine_is_poodle()) 329 if (!machine_is_poodle())
306 return -ENODEV; 330 return -ENODEV;
307 331
332 ret = wm8731_i2c_register();
333 if (ret != 0)
334 return ret;
335
308 locomo_gpio_set_dir(&poodle_locomo_device.dev, 336 locomo_gpio_set_dir(&poodle_locomo_device.dev,
309 POODLE_LOCOMO_GPIO_AMP_ON, 0); 337 POODLE_LOCOMO_GPIO_AMP_ON, 0);
310 /* should we mute HP at startup - burning power ?*/ 338 /* should we mute HP at startup - burning power ?*/