| OLD | NEW |
| 1 /* | 1 /* |
| 2 * wm9712.c -- ALSA Soc WM9712 codec support | 2 * wm9712.c -- ALSA Soc WM9712 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 | 12 |
| 13 #include <linux/init.h> | 13 #include <linux/init.h> |
| 14 #include <linux/slab.h> | 14 #include <linux/slab.h> |
| 15 #include <linux/module.h> | 15 #include <linux/module.h> |
| 16 #include <linux/kernel.h> | 16 #include <linux/kernel.h> |
| 17 #include <linux/device.h> | 17 #include <linux/device.h> |
| 18 #include <sound/core.h> | 18 #include <sound/core.h> |
| 19 #include <sound/pcm.h> | 19 #include <sound/pcm.h> |
| 20 #include <sound/ac97_codec.h> | 20 #include <sound/ac97_codec.h> |
| 21 #include <sound/initval.h> | 21 #include <sound/initval.h> |
| 22 #include <sound/soc.h> | 22 #include <sound/soc.h> |
| 23 #include <sound/soc-dapm.h> | |
| 24 #include "wm9712.h" | 23 #include "wm9712.h" |
| 25 | 24 |
| 26 #define WM9712_VERSION "0.4" | 25 #define WM9712_VERSION "0.4" |
| 27 | 26 |
| 28 static unsigned int ac97_read(struct snd_soc_codec *codec, | 27 static unsigned int ac97_read(struct snd_soc_codec *codec, |
| 29 unsigned int reg); | 28 unsigned int reg); |
| 30 static int ac97_write(struct snd_soc_codec *codec, | 29 static int ac97_write(struct snd_soc_codec *codec, |
| 31 unsigned int reg, unsigned int val); | 30 unsigned int reg, unsigned int val); |
| 32 | 31 |
| 33 /* | 32 /* |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 /* speaker Mux */ | 424 /* speaker Mux */ |
| 426 {"Speaker Mux", "Speaker Mix", "Speaker Mixer"}, | 425 {"Speaker Mux", "Speaker Mix", "Speaker Mixer"}, |
| 427 {"Speaker Mux", "Headphone Mix", "Mono Mixer"}, | 426 {"Speaker Mux", "Headphone Mix", "Mono Mixer"}, |
| 428 {"Speaker PGA", NULL, "Speaker Mux"}, | 427 {"Speaker PGA", NULL, "Speaker Mux"}, |
| 429 {"LOUT2", NULL, "Speaker PGA"}, | 428 {"LOUT2", NULL, "Speaker PGA"}, |
| 430 {"ROUT2", NULL, "Speaker PGA"}, | 429 {"ROUT2", NULL, "Speaker PGA"}, |
| 431 }; | 430 }; |
| 432 | 431 |
| 433 static int wm9712_add_widgets(struct snd_soc_codec *codec) | 432 static int wm9712_add_widgets(struct snd_soc_codec *codec) |
| 434 { | 433 { |
| 435 » snd_soc_dapm_new_controls(codec, wm9712_dapm_widgets, | 434 » struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 435 |
| 436 » snd_soc_dapm_new_controls(dapm, wm9712_dapm_widgets, |
| 436 ARRAY_SIZE(wm9712_dapm_widgets)); | 437 ARRAY_SIZE(wm9712_dapm_widgets)); |
| 437 | 438 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
| 438 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | |
| 439 | 439 |
| 440 return 0; | 440 return 0; |
| 441 } | 441 } |
| 442 | 442 |
| 443 static unsigned int ac97_read(struct snd_soc_codec *codec, | 443 static unsigned int ac97_read(struct snd_soc_codec *codec, |
| 444 unsigned int reg) | 444 unsigned int reg) |
| 445 { | 445 { |
| 446 u16 *cache = codec->reg_cache; | 446 u16 *cache = codec->reg_cache; |
| 447 | 447 |
| 448 if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || | 448 if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 break; | 563 break; |
| 564 case SND_SOC_BIAS_STANDBY: | 564 case SND_SOC_BIAS_STANDBY: |
| 565 ac97_write(codec, AC97_POWERDOWN, 0x0000); | 565 ac97_write(codec, AC97_POWERDOWN, 0x0000); |
| 566 break; | 566 break; |
| 567 case SND_SOC_BIAS_OFF: | 567 case SND_SOC_BIAS_OFF: |
| 568 /* disable everything including AC link */ | 568 /* disable everything including AC link */ |
| 569 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); | 569 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); |
| 570 ac97_write(codec, AC97_POWERDOWN, 0xffff); | 570 ac97_write(codec, AC97_POWERDOWN, 0xffff); |
| 571 break; | 571 break; |
| 572 } | 572 } |
| 573 » codec->bias_level = level; | 573 » codec->dapm.bias_level = level; |
| 574 return 0; | 574 return 0; |
| 575 } | 575 } |
| 576 | 576 |
| 577 static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) | 577 static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) |
| 578 { | 578 { |
| 579 if (try_warm && soc_ac97_ops.warm_reset) { | 579 if (try_warm && soc_ac97_ops.warm_reset) { |
| 580 soc_ac97_ops.warm_reset(codec->ac97); | 580 soc_ac97_ops.warm_reset(codec->ac97); |
| 581 if (ac97_read(codec, 0) == wm9712_reg[0]) | 581 if (ac97_read(codec, 0) == wm9712_reg[0]) |
| 582 return 1; | 582 return 1; |
| 583 } | 583 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 | 710 |
| 711 static void __exit wm9712_exit(void) | 711 static void __exit wm9712_exit(void) |
| 712 { | 712 { |
| 713 platform_driver_unregister(&wm9712_codec_driver); | 713 platform_driver_unregister(&wm9712_codec_driver); |
| 714 } | 714 } |
| 715 module_exit(wm9712_exit); | 715 module_exit(wm9712_exit); |
| 716 | 716 |
| 717 MODULE_DESCRIPTION("ASoC WM9711/WM9712 driver"); | 717 MODULE_DESCRIPTION("ASoC WM9711/WM9712 driver"); |
| 718 MODULE_AUTHOR("Liam Girdwood"); | 718 MODULE_AUTHOR("Liam Girdwood"); |
| 719 MODULE_LICENSE("GPL"); | 719 MODULE_LICENSE("GPL"); |
| OLD | NEW |