diff options
Diffstat (limited to 'sound/soc/codecs/wm8990.c')
-rw-r--r-- | sound/soc/codecs/wm8990.c | 258 |
1 files changed, 106 insertions, 152 deletions
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 253c88bb7a4c..0ccd4d8d043b 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/regmap.h> | ||
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
@@ -30,13 +31,12 @@ | |||
30 | 31 | ||
31 | /* codec private data */ | 32 | /* codec private data */ |
32 | struct wm8990_priv { | 33 | struct wm8990_priv { |
33 | enum snd_soc_control_type control_type; | 34 | struct regmap *regmap; |
34 | unsigned int sysclk; | 35 | unsigned int sysclk; |
35 | unsigned int pcmclk; | 36 | unsigned int pcmclk; |
36 | }; | 37 | }; |
37 | 38 | ||
38 | static int wm8990_volatile_register(struct snd_soc_codec *codec, | 39 | static bool wm8990_volatile_register(struct device *dev, unsigned int reg) |
39 | unsigned int reg) | ||
40 | { | 40 | { |
41 | switch (reg) { | 41 | switch (reg) { |
42 | case WM8990_RESET: | 42 | case WM8990_RESET: |
@@ -46,71 +46,69 @@ static int wm8990_volatile_register(struct snd_soc_codec *codec, | |||
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | static const u16 wm8990_reg[] = { | 49 | static const struct reg_default wm8990_reg_defaults[] = { |
50 | 0x8990, /* R0 - Reset */ | 50 | { 1, 0x0000 }, /* R1 - Power Management (1) */ |
51 | 0x0000, /* R1 - Power Management (1) */ | 51 | { 2, 0x6000 }, /* R2 - Power Management (2) */ |
52 | 0x6000, /* R2 - Power Management (2) */ | 52 | { 3, 0x0000 }, /* R3 - Power Management (3) */ |
53 | 0x0000, /* R3 - Power Management (3) */ | 53 | { 4, 0x4050 }, /* R4 - Audio Interface (1) */ |
54 | 0x4050, /* R4 - Audio Interface (1) */ | 54 | { 5, 0x4000 }, /* R5 - Audio Interface (2) */ |
55 | 0x4000, /* R5 - Audio Interface (2) */ | 55 | { 6, 0x01C8 }, /* R6 - Clocking (1) */ |
56 | 0x01C8, /* R6 - Clocking (1) */ | 56 | { 7, 0x0000 }, /* R7 - Clocking (2) */ |
57 | 0x0000, /* R7 - Clocking (2) */ | 57 | { 8, 0x0040 }, /* R8 - Audio Interface (3) */ |
58 | 0x0040, /* R8 - Audio Interface (3) */ | 58 | { 9, 0x0040 }, /* R9 - Audio Interface (4) */ |
59 | 0x0040, /* R9 - Audio Interface (4) */ | 59 | { 10, 0x0004 }, /* R10 - DAC CTRL */ |
60 | 0x0004, /* R10 - DAC CTRL */ | 60 | { 11, 0x00C0 }, /* R11 - Left DAC Digital Volume */ |
61 | 0x00C0, /* R11 - Left DAC Digital Volume */ | 61 | { 12, 0x00C0 }, /* R12 - Right DAC Digital Volume */ |
62 | 0x00C0, /* R12 - Right DAC Digital Volume */ | 62 | { 13, 0x0000 }, /* R13 - Digital Side Tone */ |
63 | 0x0000, /* R13 - Digital Side Tone */ | 63 | { 14, 0x0100 }, /* R14 - ADC CTRL */ |
64 | 0x0100, /* R14 - ADC CTRL */ | 64 | { 15, 0x00C0 }, /* R15 - Left ADC Digital Volume */ |
65 | 0x00C0, /* R15 - Left ADC Digital Volume */ | 65 | { 16, 0x00C0 }, /* R16 - Right ADC Digital Volume */ |
66 | 0x00C0, /* R16 - Right ADC Digital Volume */ | 66 | |
67 | 0x0000, /* R17 */ | 67 | { 18, 0x0000 }, /* R18 - GPIO CTRL 1 */ |
68 | 0x0000, /* R18 - GPIO CTRL 1 */ | 68 | { 19, 0x1000 }, /* R19 - GPIO1 & GPIO2 */ |
69 | 0x1000, /* R19 - GPIO1 & GPIO2 */ | 69 | { 20, 0x1010 }, /* R20 - GPIO3 & GPIO4 */ |
70 | 0x1010, /* R20 - GPIO3 & GPIO4 */ | 70 | { 21, 0x1010 }, /* R21 - GPIO5 & GPIO6 */ |
71 | 0x1010, /* R21 - GPIO5 & GPIO6 */ | 71 | { 22, 0x8000 }, /* R22 - GPIOCTRL 2 */ |
72 | 0x8000, /* R22 - GPIOCTRL 2 */ | 72 | { 23, 0x0800 }, /* R23 - GPIO_POL */ |
73 | 0x0800, /* R23 - GPIO_POL */ | 73 | { 24, 0x008B }, /* R24 - Left Line Input 1&2 Volume */ |
74 | 0x008B, /* R24 - Left Line Input 1&2 Volume */ | 74 | { 25, 0x008B }, /* R25 - Left Line Input 3&4 Volume */ |
75 | 0x008B, /* R25 - Left Line Input 3&4 Volume */ | 75 | { 26, 0x008B }, /* R26 - Right Line Input 1&2 Volume */ |
76 | 0x008B, /* R26 - Right Line Input 1&2 Volume */ | 76 | { 27, 0x008B }, /* R27 - Right Line Input 3&4 Volume */ |
77 | 0x008B, /* R27 - Right Line Input 3&4 Volume */ | 77 | { 28, 0x0000 }, /* R28 - Left Output Volume */ |
78 | 0x0000, /* R28 - Left Output Volume */ | 78 | { 29, 0x0000 }, /* R29 - Right Output Volume */ |
79 | 0x0000, /* R29 - Right Output Volume */ | 79 | { 30, 0x0066 }, /* R30 - Line Outputs Volume */ |
80 | 0x0066, /* R30 - Line Outputs Volume */ | 80 | { 31, 0x0022 }, /* R31 - Out3/4 Volume */ |
81 | 0x0022, /* R31 - Out3/4 Volume */ | 81 | { 32, 0x0079 }, /* R32 - Left OPGA Volume */ |
82 | 0x0079, /* R32 - Left OPGA Volume */ | 82 | { 33, 0x0079 }, /* R33 - Right OPGA Volume */ |
83 | 0x0079, /* R33 - Right OPGA Volume */ | 83 | { 34, 0x0003 }, /* R34 - Speaker Volume */ |
84 | 0x0003, /* R34 - Speaker Volume */ | 84 | { 35, 0x0003 }, /* R35 - ClassD1 */ |
85 | 0x0003, /* R35 - ClassD1 */ | 85 | |
86 | 0x0000, /* R36 */ | 86 | { 37, 0x0100 }, /* R37 - ClassD3 */ |
87 | 0x0100, /* R37 - ClassD3 */ | 87 | { 38, 0x0079 }, /* R38 - ClassD4 */ |
88 | 0x0079, /* R38 - ClassD4 */ | 88 | { 39, 0x0000 }, /* R39 - Input Mixer1 */ |
89 | 0x0000, /* R39 - Input Mixer1 */ | 89 | { 40, 0x0000 }, /* R40 - Input Mixer2 */ |
90 | 0x0000, /* R40 - Input Mixer2 */ | 90 | { 41, 0x0000 }, /* R41 - Input Mixer3 */ |
91 | 0x0000, /* R41 - Input Mixer3 */ | 91 | { 42, 0x0000 }, /* R42 - Input Mixer4 */ |
92 | 0x0000, /* R42 - Input Mixer4 */ | 92 | { 43, 0x0000 }, /* R43 - Input Mixer5 */ |
93 | 0x0000, /* R43 - Input Mixer5 */ | 93 | { 44, 0x0000 }, /* R44 - Input Mixer6 */ |
94 | 0x0000, /* R44 - Input Mixer6 */ | 94 | { 45, 0x0000 }, /* R45 - Output Mixer1 */ |
95 | 0x0000, /* R45 - Output Mixer1 */ | 95 | { 46, 0x0000 }, /* R46 - Output Mixer2 */ |
96 | 0x0000, /* R46 - Output Mixer2 */ | 96 | { 47, 0x0000 }, /* R47 - Output Mixer3 */ |
97 | 0x0000, /* R47 - Output Mixer3 */ | 97 | { 48, 0x0000 }, /* R48 - Output Mixer4 */ |
98 | 0x0000, /* R48 - Output Mixer4 */ | 98 | { 49, 0x0000 }, /* R49 - Output Mixer5 */ |
99 | 0x0000, /* R49 - Output Mixer5 */ | 99 | { 50, 0x0000 }, /* R50 - Output Mixer6 */ |
100 | 0x0000, /* R50 - Output Mixer6 */ | 100 | { 51, 0x0180 }, /* R51 - Out3/4 Mixer */ |
101 | 0x0180, /* R51 - Out3/4 Mixer */ | 101 | { 52, 0x0000 }, /* R52 - Line Mixer1 */ |
102 | 0x0000, /* R52 - Line Mixer1 */ | 102 | { 53, 0x0000 }, /* R53 - Line Mixer2 */ |
103 | 0x0000, /* R53 - Line Mixer2 */ | 103 | { 54, 0x0000 }, /* R54 - Speaker Mixer */ |
104 | 0x0000, /* R54 - Speaker Mixer */ | 104 | { 55, 0x0000 }, /* R55 - Additional Control */ |
105 | 0x0000, /* R55 - Additional Control */ | 105 | { 56, 0x0000 }, /* R56 - AntiPOP1 */ |
106 | 0x0000, /* R56 - AntiPOP1 */ | 106 | { 57, 0x0000 }, /* R57 - AntiPOP2 */ |
107 | 0x0000, /* R57 - AntiPOP2 */ | 107 | { 58, 0x0000 }, /* R58 - MICBIAS */ |
108 | 0x0000, /* R58 - MICBIAS */ | 108 | |
109 | 0x0000, /* R59 */ | 109 | { 60, 0x0008 }, /* R60 - PLL1 */ |
110 | 0x0008, /* R60 - PLL1 */ | 110 | { 61, 0x0031 }, /* R61 - PLL2 */ |
111 | 0x0031, /* R61 - PLL2 */ | 111 | { 62, 0x0026 }, /* R62 - PLL3 */ |
112 | 0x0026, /* R62 - PLL3 */ | ||
113 | 0x0000, /* R63 - Driver internal */ | ||
114 | }; | 112 | }; |
115 | 113 | ||
116 | #define wm8990_reset(c) snd_soc_write(c, WM8990_RESET, 0) | 114 | #define wm8990_reset(c) snd_soc_write(c, WM8990_RESET, 0) |
@@ -376,32 +374,6 @@ SOC_SINGLE("RIN34 Mute Switch", WM8990_RIGHT_LINE_INPUT_3_4_VOLUME, | |||
376 | * _DAPM_ Controls | 374 | * _DAPM_ Controls |
377 | */ | 375 | */ |
378 | 376 | ||
379 | static int inmixer_event(struct snd_soc_dapm_widget *w, | ||
380 | struct snd_kcontrol *kcontrol, int event) | ||
381 | { | ||
382 | u16 reg, fakepower; | ||
383 | |||
384 | reg = snd_soc_read(w->codec, WM8990_POWER_MANAGEMENT_2); | ||
385 | fakepower = snd_soc_read(w->codec, WM8990_INTDRIVBITS); | ||
386 | |||
387 | if (fakepower & ((1 << WM8990_INMIXL_PWR_BIT) | | ||
388 | (1 << WM8990_AINLMUX_PWR_BIT))) { | ||
389 | reg |= WM8990_AINL_ENA; | ||
390 | } else { | ||
391 | reg &= ~WM8990_AINL_ENA; | ||
392 | } | ||
393 | |||
394 | if (fakepower & ((1 << WM8990_INMIXR_PWR_BIT) | | ||
395 | (1 << WM8990_AINRMUX_PWR_BIT))) { | ||
396 | reg |= WM8990_AINR_ENA; | ||
397 | } else { | ||
398 | reg &= ~WM8990_AINR_ENA; | ||
399 | } | ||
400 | snd_soc_write(w->codec, WM8990_POWER_MANAGEMENT_2, reg); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static int outmixer_event(struct snd_soc_dapm_widget *w, | 377 | static int outmixer_event(struct snd_soc_dapm_widget *w, |
406 | struct snd_kcontrol *kcontrol, int event) | 378 | struct snd_kcontrol *kcontrol, int event) |
407 | { | 379 | { |
@@ -656,6 +628,11 @@ SND_SOC_DAPM_INPUT("RIN1"), | |||
656 | SND_SOC_DAPM_INPUT("RIN2"), | 628 | SND_SOC_DAPM_INPUT("RIN2"), |
657 | SND_SOC_DAPM_INPUT("Internal ADC Source"), | 629 | SND_SOC_DAPM_INPUT("Internal ADC Source"), |
658 | 630 | ||
631 | SND_SOC_DAPM_SUPPLY("INL", WM8990_POWER_MANAGEMENT_2, WM8990_AINL_ENA_BIT, 0, | ||
632 | NULL, 0), | ||
633 | SND_SOC_DAPM_SUPPLY("INR", WM8990_POWER_MANAGEMENT_2, WM8990_AINR_ENA_BIT, 0, | ||
634 | NULL, 0), | ||
635 | |||
659 | /* DACs */ | 636 | /* DACs */ |
660 | SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8990_POWER_MANAGEMENT_2, | 637 | SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8990_POWER_MANAGEMENT_2, |
661 | WM8990_ADCL_ENA_BIT, 0), | 638 | WM8990_ADCL_ENA_BIT, 0), |
@@ -677,26 +654,20 @@ SND_SOC_DAPM_MIXER("RIN34 PGA", WM8990_POWER_MANAGEMENT_2, WM8990_RIN34_ENA_BIT, | |||
677 | ARRAY_SIZE(wm8990_dapm_rin34_pga_controls)), | 654 | ARRAY_SIZE(wm8990_dapm_rin34_pga_controls)), |
678 | 655 | ||
679 | /* INMIXL */ | 656 | /* INMIXL */ |
680 | SND_SOC_DAPM_MIXER_E("INMIXL", WM8990_INTDRIVBITS, WM8990_INMIXL_PWR_BIT, 0, | 657 | SND_SOC_DAPM_MIXER("INMIXL", SND_SOC_NOPM, 0, 0, |
681 | &wm8990_dapm_inmixl_controls[0], | 658 | &wm8990_dapm_inmixl_controls[0], |
682 | ARRAY_SIZE(wm8990_dapm_inmixl_controls), | 659 | ARRAY_SIZE(wm8990_dapm_inmixl_controls)), |
683 | inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
684 | 660 | ||
685 | /* AINLMUX */ | 661 | /* AINLMUX */ |
686 | SND_SOC_DAPM_MUX_E("AINLMUX", WM8990_INTDRIVBITS, WM8990_AINLMUX_PWR_BIT, 0, | 662 | SND_SOC_DAPM_MUX("AINLMUX", SND_SOC_NOPM, 0, 0, &wm8990_dapm_ainlmux_controls), |
687 | &wm8990_dapm_ainlmux_controls, inmixer_event, | ||
688 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
689 | 663 | ||
690 | /* INMIXR */ | 664 | /* INMIXR */ |
691 | SND_SOC_DAPM_MIXER_E("INMIXR", WM8990_INTDRIVBITS, WM8990_INMIXR_PWR_BIT, 0, | 665 | SND_SOC_DAPM_MIXER("INMIXR", SND_SOC_NOPM, 0, 0, |
692 | &wm8990_dapm_inmixr_controls[0], | 666 | &wm8990_dapm_inmixr_controls[0], |
693 | ARRAY_SIZE(wm8990_dapm_inmixr_controls), | 667 | ARRAY_SIZE(wm8990_dapm_inmixr_controls)), |
694 | inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
695 | 668 | ||
696 | /* AINRMUX */ | 669 | /* AINRMUX */ |
697 | SND_SOC_DAPM_MUX_E("AINRMUX", WM8990_INTDRIVBITS, WM8990_AINRMUX_PWR_BIT, 0, | 670 | SND_SOC_DAPM_MUX("AINRMUX", SND_SOC_NOPM, 0, 0, &wm8990_dapm_ainrmux_controls), |
698 | &wm8990_dapm_ainrmux_controls, inmixer_event, | ||
699 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
700 | 671 | ||
701 | /* Output Side */ | 672 | /* Output Side */ |
702 | /* DACs */ | 673 | /* DACs */ |
@@ -787,7 +758,7 @@ SND_SOC_DAPM_OUTPUT("RON"), | |||
787 | SND_SOC_DAPM_OUTPUT("Internal DAC Sink"), | 758 | SND_SOC_DAPM_OUTPUT("Internal DAC Sink"), |
788 | }; | 759 | }; |
789 | 760 | ||
790 | static const struct snd_soc_dapm_route audio_map[] = { | 761 | static const struct snd_soc_dapm_route wm8990_dapm_routes[] = { |
791 | /* Make DACs turn on when playing even if not mixed into any outputs */ | 762 | /* Make DACs turn on when playing even if not mixed into any outputs */ |
792 | {"Internal DAC Sink", NULL, "Left DAC"}, | 763 | {"Internal DAC Sink", NULL, "Left DAC"}, |
793 | {"Internal DAC Sink", NULL, "Right DAC"}, | 764 | {"Internal DAC Sink", NULL, "Right DAC"}, |
@@ -796,6 +767,11 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
796 | {"Left ADC", NULL, "Internal ADC Source"}, | 767 | {"Left ADC", NULL, "Internal ADC Source"}, |
797 | {"Right ADC", NULL, "Internal ADC Source"}, | 768 | {"Right ADC", NULL, "Internal ADC Source"}, |
798 | 769 | ||
770 | {"AINLMUX", NULL, "INL"}, | ||
771 | {"INMIXL", NULL, "INL"}, | ||
772 | {"AINRMUX", NULL, "INR"}, | ||
773 | {"INMIXR", NULL, "INR"}, | ||
774 | |||
799 | /* Input Side */ | 775 | /* Input Side */ |
800 | /* LIN12 PGA */ | 776 | /* LIN12 PGA */ |
801 | {"LIN12 PGA", "LIN1 Switch", "LIN1"}, | 777 | {"LIN12 PGA", "LIN1 Switch", "LIN1"}, |
@@ -912,18 +888,6 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
912 | {"RON", NULL, "RONMIX"}, | 888 | {"RON", NULL, "RONMIX"}, |
913 | }; | 889 | }; |
914 | 890 | ||
915 | static int wm8990_add_widgets(struct snd_soc_codec *codec) | ||
916 | { | ||
917 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
918 | |||
919 | snd_soc_dapm_new_controls(dapm, wm8990_dapm_widgets, | ||
920 | ARRAY_SIZE(wm8990_dapm_widgets)); | ||
921 | /* set up the WM8990 audio map */ | ||
922 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
923 | |||
924 | return 0; | ||
925 | } | ||
926 | |||
927 | /* PLL divisors */ | 891 | /* PLL divisors */ |
928 | struct _pll_div { | 892 | struct _pll_div { |
929 | u32 div2; | 893 | u32 div2; |
@@ -1148,6 +1112,7 @@ static int wm8990_mute(struct snd_soc_dai *dai, int mute) | |||
1148 | static int wm8990_set_bias_level(struct snd_soc_codec *codec, | 1112 | static int wm8990_set_bias_level(struct snd_soc_codec *codec, |
1149 | enum snd_soc_bias_level level) | 1113 | enum snd_soc_bias_level level) |
1150 | { | 1114 | { |
1115 | struct wm8990_priv *wm8990 = snd_soc_codec_get_drvdata(codec); | ||
1151 | int ret; | 1116 | int ret; |
1152 | 1117 | ||
1153 | switch (level) { | 1118 | switch (level) { |
@@ -1162,7 +1127,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1162 | 1127 | ||
1163 | case SND_SOC_BIAS_STANDBY: | 1128 | case SND_SOC_BIAS_STANDBY: |
1164 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1129 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { |
1165 | ret = snd_soc_cache_sync(codec); | 1130 | ret = regcache_sync(wm8990->regmap); |
1166 | if (ret < 0) { | 1131 | if (ret < 0) { |
1167 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); | 1132 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); |
1168 | return ret; | 1133 | return ret; |
@@ -1259,6 +1224,8 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1259 | 1224 | ||
1260 | /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ | 1225 | /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ |
1261 | snd_soc_write(codec, WM8990_ANTIPOP2, 0x0); | 1226 | snd_soc_write(codec, WM8990_ANTIPOP2, 0x0); |
1227 | |||
1228 | regcache_mark_dirty(wm8990->regmap); | ||
1262 | break; | 1229 | break; |
1263 | } | 1230 | } |
1264 | 1231 | ||
@@ -1327,7 +1294,7 @@ static int wm8990_probe(struct snd_soc_codec *codec) | |||
1327 | { | 1294 | { |
1328 | int ret; | 1295 | int ret; |
1329 | 1296 | ||
1330 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C); | 1297 | ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); |
1331 | if (ret < 0) { | 1298 | if (ret < 0) { |
1332 | printk(KERN_ERR "wm8990: failed to set cache I/O: %d\n", ret); | 1299 | printk(KERN_ERR "wm8990: failed to set cache I/O: %d\n", ret); |
1333 | return ret; | 1300 | return ret; |
@@ -1350,10 +1317,6 @@ static int wm8990_probe(struct snd_soc_codec *codec) | |||
1350 | snd_soc_write(codec, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); | 1317 | snd_soc_write(codec, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); |
1351 | snd_soc_write(codec, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); | 1318 | snd_soc_write(codec, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); |
1352 | 1319 | ||
1353 | snd_soc_add_codec_controls(codec, wm8990_snd_controls, | ||
1354 | ARRAY_SIZE(wm8990_snd_controls)); | ||
1355 | wm8990_add_widgets(codec); | ||
1356 | |||
1357 | return 0; | 1320 | return 0; |
1358 | } | 1321 | } |
1359 | 1322 | ||
@@ -1370,13 +1333,25 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8990 = { | |||
1370 | .suspend = wm8990_suspend, | 1333 | .suspend = wm8990_suspend, |
1371 | .resume = wm8990_resume, | 1334 | .resume = wm8990_resume, |
1372 | .set_bias_level = wm8990_set_bias_level, | 1335 | .set_bias_level = wm8990_set_bias_level, |
1373 | .reg_cache_size = ARRAY_SIZE(wm8990_reg), | 1336 | .controls = wm8990_snd_controls, |
1374 | .reg_word_size = sizeof(u16), | 1337 | .num_controls = ARRAY_SIZE(wm8990_snd_controls), |
1375 | .reg_cache_default = wm8990_reg, | 1338 | .dapm_widgets = wm8990_dapm_widgets, |
1376 | .volatile_register = wm8990_volatile_register, | 1339 | .num_dapm_widgets = ARRAY_SIZE(wm8990_dapm_widgets), |
1340 | .dapm_routes = wm8990_dapm_routes, | ||
1341 | .num_dapm_routes = ARRAY_SIZE(wm8990_dapm_routes), | ||
1342 | }; | ||
1343 | |||
1344 | static const struct regmap_config wm8990_regmap = { | ||
1345 | .reg_bits = 8, | ||
1346 | .val_bits = 16, | ||
1347 | |||
1348 | .max_register = WM8990_PLL3, | ||
1349 | .volatile_reg = wm8990_volatile_register, | ||
1350 | .reg_defaults = wm8990_reg_defaults, | ||
1351 | .num_reg_defaults = ARRAY_SIZE(wm8990_reg_defaults), | ||
1352 | .cache_type = REGCACHE_RBTREE, | ||
1377 | }; | 1353 | }; |
1378 | 1354 | ||
1379 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
1380 | static int wm8990_i2c_probe(struct i2c_client *i2c, | 1355 | static int wm8990_i2c_probe(struct i2c_client *i2c, |
1381 | const struct i2c_device_id *id) | 1356 | const struct i2c_device_id *id) |
1382 | { | 1357 | { |
@@ -1418,29 +1393,8 @@ static struct i2c_driver wm8990_i2c_driver = { | |||
1418 | .remove = wm8990_i2c_remove, | 1393 | .remove = wm8990_i2c_remove, |
1419 | .id_table = wm8990_i2c_id, | 1394 | .id_table = wm8990_i2c_id, |
1420 | }; | 1395 | }; |
1421 | #endif | ||
1422 | 1396 | ||
1423 | static int __init wm8990_modinit(void) | 1397 | module_i2c_driver(wm8990_i2c_driver); |
1424 | { | ||
1425 | int ret = 0; | ||
1426 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
1427 | ret = i2c_add_driver(&wm8990_i2c_driver); | ||
1428 | if (ret != 0) { | ||
1429 | printk(KERN_ERR "Failed to register wm8990 I2C driver: %d\n", | ||
1430 | ret); | ||
1431 | } | ||
1432 | #endif | ||
1433 | return ret; | ||
1434 | } | ||
1435 | module_init(wm8990_modinit); | ||
1436 | |||
1437 | static void __exit wm8990_exit(void) | ||
1438 | { | ||
1439 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | ||
1440 | i2c_del_driver(&wm8990_i2c_driver); | ||
1441 | #endif | ||
1442 | } | ||
1443 | module_exit(wm8990_exit); | ||
1444 | 1398 | ||
1445 | MODULE_DESCRIPTION("ASoC WM8990 driver"); | 1399 | MODULE_DESCRIPTION("ASoC WM8990 driver"); |
1446 | MODULE_AUTHOR("Liam Girdwood"); | 1400 | MODULE_AUTHOR("Liam Girdwood"); |