| OLD | NEW |
| 1 /* | 1 /* |
| 2 * wm8940.c -- WM8940 ALSA Soc Audio driver | 2 * wm8940.c -- WM8940 ALSA Soc Audio driver |
| 3 * | 3 * |
| 4 * Author: Jonathan Cameron <jic23@cam.ac.uk> | 4 * Author: Jonathan Cameron <jic23@cam.ac.uk> |
| 5 * | 5 * |
| 6 * Based on wm8510.c | 6 * Based on wm8510.c |
| 7 * Copyright 2006 Wolfson Microelectronics PLC. | 7 * Copyright 2006 Wolfson Microelectronics PLC. |
| 8 * Author: Liam Girdwood <lrg@slimlogic.co.uk> | 8 * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
| 9 * | 9 * |
| 10 * This program is free software; you can redistribute it and/or modify | 10 * This program is free software; you can redistribute it and/or modify |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include <linux/delay.h> | 28 #include <linux/delay.h> |
| 29 #include <linux/pm.h> | 29 #include <linux/pm.h> |
| 30 #include <linux/i2c.h> | 30 #include <linux/i2c.h> |
| 31 #include <linux/platform_device.h> | 31 #include <linux/platform_device.h> |
| 32 #include <linux/spi/spi.h> | 32 #include <linux/spi/spi.h> |
| 33 #include <linux/slab.h> | 33 #include <linux/slab.h> |
| 34 #include <sound/core.h> | 34 #include <sound/core.h> |
| 35 #include <sound/pcm.h> | 35 #include <sound/pcm.h> |
| 36 #include <sound/pcm_params.h> | 36 #include <sound/pcm_params.h> |
| 37 #include <sound/soc.h> | 37 #include <sound/soc.h> |
| 38 #include <sound/soc-dapm.h> | |
| 39 #include <sound/initval.h> | 38 #include <sound/initval.h> |
| 40 #include <sound/tlv.h> | 39 #include <sound/tlv.h> |
| 41 | 40 |
| 42 #include "wm8940.h" | 41 #include "wm8940.h" |
| 43 | 42 |
| 44 struct wm8940_priv { | 43 struct wm8940_priv { |
| 45 unsigned int sysclk; | 44 unsigned int sysclk; |
| 46 u16 reg_cache[WM8940_CACHEREGNUM]; | |
| 47 enum snd_soc_control_type control_type; | 45 enum snd_soc_control_type control_type; |
| 48 void *control_data; | 46 void *control_data; |
| 49 }; | 47 }; |
| 50 | 48 |
| 51 static u16 wm8940_reg_defaults[] = { | 49 static u16 wm8940_reg_defaults[] = { |
| 52 0x8940, /* Soft Reset */ | 50 0x8940, /* Soft Reset */ |
| 53 0x0000, /* Power 1 */ | 51 0x0000, /* Power 1 */ |
| 54 0x0000, /* Power 2 */ | 52 0x0000, /* Power 2 */ |
| 55 0x0000, /* Power 3 */ | 53 0x0000, /* Power 3 */ |
| 56 0x0010, /* Interface Control */ | 54 0x0010, /* Interface Control */ |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 /* Boost Mixer */ | 282 /* Boost Mixer */ |
| 285 {"Boost Mixer", "Mic PGA Switch", "Mic PGA"}, | 283 {"Boost Mixer", "Mic PGA Switch", "Mic PGA"}, |
| 286 {"Boost Mixer", "Mic Volume", "MICP"}, | 284 {"Boost Mixer", "Mic Volume", "MICP"}, |
| 287 {"Boost Mixer", "Aux Volume", "Aux Input"}, | 285 {"Boost Mixer", "Aux Volume", "Aux Input"}, |
| 288 | 286 |
| 289 {"ADC", NULL, "Boost Mixer"}, | 287 {"ADC", NULL, "Boost Mixer"}, |
| 290 }; | 288 }; |
| 291 | 289 |
| 292 static int wm8940_add_widgets(struct snd_soc_codec *codec) | 290 static int wm8940_add_widgets(struct snd_soc_codec *codec) |
| 293 { | 291 { |
| 292 struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 294 int ret; | 293 int ret; |
| 295 | 294 |
| 296 » ret = snd_soc_dapm_new_controls(codec, wm8940_dapm_widgets, | 295 » ret = snd_soc_dapm_new_controls(dapm, wm8940_dapm_widgets, |
| 297 ARRAY_SIZE(wm8940_dapm_widgets)); | 296 ARRAY_SIZE(wm8940_dapm_widgets)); |
| 298 if (ret) | 297 if (ret) |
| 299 goto error_ret; | 298 goto error_ret; |
| 300 » ret = snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 299 » ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
| 301 if (ret) | 300 if (ret) |
| 302 goto error_ret; | 301 goto error_ret; |
| 303 | 302 |
| 304 error_ret: | 303 error_ret: |
| 305 return ret; | 304 return ret; |
| 306 } | 305 } |
| 307 | 306 |
| 308 #define wm8940_reset(c) snd_soc_write(c, WM8940_SOFTRESET, 0); | 307 #define wm8940_reset(c) snd_soc_write(c, WM8940_SOFTRESET, 0); |
| 309 | 308 |
| 310 static int wm8940_set_dai_fmt(struct snd_soc_dai *codec_dai, | 309 static int wm8940_set_dai_fmt(struct snd_soc_dai *codec_dai, |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 727 |
| 729 ret = snd_soc_add_controls(codec, wm8940_snd_controls, | 728 ret = snd_soc_add_controls(codec, wm8940_snd_controls, |
| 730 ARRAY_SIZE(wm8940_snd_controls)); | 729 ARRAY_SIZE(wm8940_snd_controls)); |
| 731 if (ret) | 730 if (ret) |
| 732 return ret; | 731 return ret; |
| 733 ret = wm8940_add_widgets(codec); | 732 ret = wm8940_add_widgets(codec); |
| 734 if (ret) | 733 if (ret) |
| 735 return ret; | 734 return ret; |
| 736 | 735 |
| 737 return ret; | 736 return ret; |
| 738 ; | |
| 739 } | 737 } |
| 740 | 738 |
| 741 static int wm8940_remove(struct snd_soc_codec *codec) | 739 static int wm8940_remove(struct snd_soc_codec *codec) |
| 742 { | 740 { |
| 743 wm8940_set_bias_level(codec, SND_SOC_BIAS_OFF); | 741 wm8940_set_bias_level(codec, SND_SOC_BIAS_OFF); |
| 744 return 0; | 742 return 0; |
| 745 } | 743 } |
| 746 | 744 |
| 747 static struct snd_soc_codec_driver soc_codec_dev_wm8940 = { | 745 static struct snd_soc_codec_driver soc_codec_dev_wm8940 = { |
| 748 .probe = wm8940_probe, | 746 .probe = wm8940_probe, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 { | 817 { |
| 820 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 818 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
| 821 i2c_del_driver(&wm8940_i2c_driver); | 819 i2c_del_driver(&wm8940_i2c_driver); |
| 822 #endif | 820 #endif |
| 823 } | 821 } |
| 824 module_exit(wm8940_exit); | 822 module_exit(wm8940_exit); |
| 825 | 823 |
| 826 MODULE_DESCRIPTION("ASoC WM8940 driver"); | 824 MODULE_DESCRIPTION("ASoC WM8940 driver"); |
| 827 MODULE_AUTHOR("Jonathan Cameron"); | 825 MODULE_AUTHOR("Jonathan Cameron"); |
| 828 MODULE_LICENSE("GPL"); | 826 MODULE_LICENSE("GPL"); |
| OLD | NEW |