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