| OLD | NEW |
| 1 /* | 1 /* |
| 2 * wm9713.c -- ALSA Soc WM9713 codec support | 2 * wm9713.c -- ALSA Soc WM9713 codec support |
| 3 * | 3 * |
| 4 * Copyright 2006 Wolfson Microelectronics PLC. | 4 * Copyright 2006 Wolfson Microelectronics PLC. |
| 5 * Author: Liam Girdwood <lrg@slimlogic.co.uk> | 5 * Author: Liam Girdwood <lrg@slimlogic.co.uk> |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or modify it | 7 * This program is free software; you can redistribute it and/or modify it |
| 8 * under the terms of the GNU General Public License as published by the | 8 * under the terms of the GNU General Public License as published by the |
| 9 * Free Software Foundation; either version 2 of the License, or (at your | 9 * Free Software Foundation; either version 2 of the License, or (at your |
| 10 * option) any later version. | 10 * option) any later version. |
| 11 * | 11 * |
| 12 * Features:- | 12 * Features:- |
| 13 * | 13 * |
| 14 * o Support for AC97 Codec, Voice DAC and Aux DAC | 14 * o Support for AC97 Codec, Voice DAC and Aux DAC |
| 15 * o Support for DAPM | 15 * o Support for DAPM |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include <linux/init.h> | 18 #include <linux/init.h> |
| 19 #include <linux/slab.h> | 19 #include <linux/slab.h> |
| 20 #include <linux/module.h> | 20 #include <linux/module.h> |
| 21 #include <linux/device.h> | 21 #include <linux/device.h> |
| 22 #include <sound/core.h> | 22 #include <sound/core.h> |
| 23 #include <sound/pcm.h> | 23 #include <sound/pcm.h> |
| 24 #include <sound/ac97_codec.h> | 24 #include <sound/ac97_codec.h> |
| 25 #include <sound/initval.h> | 25 #include <sound/initval.h> |
| 26 #include <sound/pcm_params.h> | 26 #include <sound/pcm_params.h> |
| 27 #include <sound/tlv.h> | 27 #include <sound/tlv.h> |
| 28 #include <sound/soc.h> | 28 #include <sound/soc.h> |
| 29 #include <sound/soc-dapm.h> | |
| 30 | 29 |
| 31 #include "wm9713.h" | 30 #include "wm9713.h" |
| 32 | 31 |
| 33 struct wm9713_priv { | 32 struct wm9713_priv { |
| 34 u32 pll_in; /* PLL input frequency */ | 33 u32 pll_in; /* PLL input frequency */ |
| 35 }; | 34 }; |
| 36 | 35 |
| 37 static unsigned int ac97_read(struct snd_soc_codec *codec, | 36 static unsigned int ac97_read(struct snd_soc_codec *codec, |
| 38 unsigned int reg); | 37 unsigned int reg); |
| 39 static int ac97_write(struct snd_soc_codec *codec, | 38 static int ac97_write(struct snd_soc_codec *codec, |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 {"Capture Headphone Mux", "Right", "Right Capture Source"}, | 639 {"Capture Headphone Mux", "Right", "Right Capture Source"}, |
| 641 | 640 |
| 642 /* mono capture */ | 641 /* mono capture */ |
| 643 {"Capture Mono Mux", "Stereo", "Capture Mixer"}, | 642 {"Capture Mono Mux", "Stereo", "Capture Mixer"}, |
| 644 {"Capture Mono Mux", "Left", "Left Capture Source"}, | 643 {"Capture Mono Mux", "Left", "Left Capture Source"}, |
| 645 {"Capture Mono Mux", "Right", "Right Capture Source"}, | 644 {"Capture Mono Mux", "Right", "Right Capture Source"}, |
| 646 }; | 645 }; |
| 647 | 646 |
| 648 static int wm9713_add_widgets(struct snd_soc_codec *codec) | 647 static int wm9713_add_widgets(struct snd_soc_codec *codec) |
| 649 { | 648 { |
| 650 » snd_soc_dapm_new_controls(codec, wm9713_dapm_widgets, | 649 » struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 650 |
| 651 » snd_soc_dapm_new_controls(dapm, wm9713_dapm_widgets, |
| 651 ARRAY_SIZE(wm9713_dapm_widgets)); | 652 ARRAY_SIZE(wm9713_dapm_widgets)); |
| 652 | 653 |
| 653 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 654 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
| 654 | 655 |
| 655 return 0; | 656 return 0; |
| 656 } | 657 } |
| 657 | 658 |
| 658 static unsigned int ac97_read(struct snd_soc_codec *codec, | 659 static unsigned int ac97_read(struct snd_soc_codec *codec, |
| 659 unsigned int reg) | 660 unsigned int reg) |
| 660 { | 661 { |
| 661 u16 *cache = codec->reg_cache; | 662 u16 *cache = codec->reg_cache; |
| 662 | 663 |
| 663 if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || | 664 if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 ac97_write(codec, AC97_EXTENDED_MID, reg); | 1141 ac97_write(codec, AC97_EXTENDED_MID, reg); |
| 1141 ac97_write(codec, AC97_POWERDOWN, 0x0000); | 1142 ac97_write(codec, AC97_POWERDOWN, 0x0000); |
| 1142 break; | 1143 break; |
| 1143 case SND_SOC_BIAS_OFF: | 1144 case SND_SOC_BIAS_OFF: |
| 1144 /* disable everything including AC link */ | 1145 /* disable everything including AC link */ |
| 1145 ac97_write(codec, AC97_EXTENDED_MID, 0xffff); | 1146 ac97_write(codec, AC97_EXTENDED_MID, 0xffff); |
| 1146 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); | 1147 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); |
| 1147 ac97_write(codec, AC97_POWERDOWN, 0xffff); | 1148 ac97_write(codec, AC97_POWERDOWN, 0xffff); |
| 1148 break; | 1149 break; |
| 1149 } | 1150 } |
| 1150 » codec->bias_level = level; | 1151 » codec->dapm.bias_level = level; |
| 1151 return 0; | 1152 return 0; |
| 1152 } | 1153 } |
| 1153 | 1154 |
| 1154 static int wm9713_soc_suspend(struct snd_soc_codec *codec, | 1155 static int wm9713_soc_suspend(struct snd_soc_codec *codec, |
| 1155 pm_message_t state) | 1156 pm_message_t state) |
| 1156 { | 1157 { |
| 1157 u16 reg; | 1158 u16 reg; |
| 1158 | 1159 |
| 1159 /* Disable everything except touchpanel - that will be handled | 1160 /* Disable everything except touchpanel - that will be handled |
| 1160 * by the touch driver and left disabled if touch is not in | 1161 * by the touch driver and left disabled if touch is not in |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 | 1294 |
| 1294 static void __exit wm9713_exit(void) | 1295 static void __exit wm9713_exit(void) |
| 1295 { | 1296 { |
| 1296 platform_driver_unregister(&wm9713_codec_driver); | 1297 platform_driver_unregister(&wm9713_codec_driver); |
| 1297 } | 1298 } |
| 1298 module_exit(wm9713_exit); | 1299 module_exit(wm9713_exit); |
| 1299 | 1300 |
| 1300 MODULE_DESCRIPTION("ASoC WM9713/WM9714 driver"); | 1301 MODULE_DESCRIPTION("ASoC WM9713/WM9714 driver"); |
| 1301 MODULE_AUTHOR("Liam Girdwood"); | 1302 MODULE_AUTHOR("Liam Girdwood"); |
| 1302 MODULE_LICENSE("GPL"); | 1303 MODULE_LICENSE("GPL"); |
| OLD | NEW |