diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm_lib.c | 10 | ||||
-rw-r--r-- | sound/oss/soundcard.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 57 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 1 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 82 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 5 | ||||
-rw-r--r-- | sound/soc/codecs/max98088.c | 10 | ||||
-rw-r--r-- | sound/soc/codecs/wm8523.c | 9 | ||||
-rw-r--r-- | sound/soc/codecs/wm8580.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/wm8741.c | 10 | ||||
-rw-r--r-- | sound/soc/codecs/wm8753.c | 226 | ||||
-rw-r--r-- | sound/soc/codecs/wm8904.c | 40 | ||||
-rw-r--r-- | sound/soc/codecs/wm8940.c | 1 | ||||
-rw-r--r-- | sound/soc/codecs/wm8955.c | 34 | ||||
-rw-r--r-- | sound/soc/codecs/wm8960.c | 4 | ||||
-rw-r--r-- | sound/soc/codecs/wm8962.c | 45 | ||||
-rw-r--r-- | sound/soc/codecs/wm8971.c | 1 | ||||
-rw-r--r-- | sound/soc/codecs/wm9081.c | 1 | ||||
-rw-r--r-- | sound/soc/codecs/wm9090.c | 18 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 3 |
20 files changed, 278 insertions, 285 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index b75db8e9cc0f..11446a1506da 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -1070,8 +1070,10 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, | |||
1070 | struct snd_pcm_hw_rule *new; | 1070 | struct snd_pcm_hw_rule *new; |
1071 | unsigned int new_rules = constrs->rules_all + 16; | 1071 | unsigned int new_rules = constrs->rules_all + 16; |
1072 | new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL); | 1072 | new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL); |
1073 | if (!new) | 1073 | if (!new) { |
1074 | va_end(args); | ||
1074 | return -ENOMEM; | 1075 | return -ENOMEM; |
1076 | } | ||
1075 | if (constrs->rules) { | 1077 | if (constrs->rules) { |
1076 | memcpy(new, constrs->rules, | 1078 | memcpy(new, constrs->rules, |
1077 | constrs->rules_num * sizeof(*c)); | 1079 | constrs->rules_num * sizeof(*c)); |
@@ -1087,8 +1089,10 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, | |||
1087 | c->private = private; | 1089 | c->private = private; |
1088 | k = 0; | 1090 | k = 0; |
1089 | while (1) { | 1091 | while (1) { |
1090 | if (snd_BUG_ON(k >= ARRAY_SIZE(c->deps))) | 1092 | if (snd_BUG_ON(k >= ARRAY_SIZE(c->deps))) { |
1093 | va_end(args); | ||
1091 | return -EINVAL; | 1094 | return -EINVAL; |
1095 | } | ||
1092 | c->deps[k++] = dep; | 1096 | c->deps[k++] = dep; |
1093 | if (dep < 0) | 1097 | if (dep < 0) |
1094 | break; | 1098 | break; |
@@ -1097,7 +1101,7 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, | |||
1097 | constrs->rules_num++; | 1101 | constrs->rules_num++; |
1098 | va_end(args); | 1102 | va_end(args); |
1099 | return 0; | 1103 | return 0; |
1100 | } | 1104 | } |
1101 | 1105 | ||
1102 | EXPORT_SYMBOL(snd_pcm_hw_rule_add); | 1106 | EXPORT_SYMBOL(snd_pcm_hw_rule_add); |
1103 | 1107 | ||
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 46c0d03dbecc..fcb14a099822 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -87,7 +87,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) | |||
87 | int i, n; | 87 | int i, n; |
88 | 88 | ||
89 | for (i = 0; i < num_mixer_volumes; i++) { | 89 | for (i = 0; i < num_mixer_volumes; i++) { |
90 | if (strcmp(name, mixer_vols[i].name) == 0) { | 90 | if (strncmp(name, mixer_vols[i].name, 32) == 0) { |
91 | if (present) | 91 | if (present) |
92 | mixer_vols[i].num = i; | 92 | mixer_vols[i].num = i; |
93 | return mixer_vols[i].levels; | 93 | return mixer_vols[i].levels; |
@@ -99,7 +99,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) | |||
99 | } | 99 | } |
100 | n = num_mixer_volumes++; | 100 | n = num_mixer_volumes++; |
101 | 101 | ||
102 | strcpy(mixer_vols[n].name, name); | 102 | strncpy(mixer_vols[n].name, name, 32); |
103 | 103 | ||
104 | if (present) | 104 | if (present) |
105 | mixer_vols[n].num = n; | 105 | mixer_vols[n].num = n; |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 644e3f14f8ca..98b6d02a36c9 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1919,6 +1919,16 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | |||
1919 | } | 1919 | } |
1920 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); | 1920 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); |
1921 | 1921 | ||
1922 | static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name) | ||
1923 | { | ||
1924 | int idx; | ||
1925 | for (idx = 0; idx < 16; idx++) { /* 16 ctlrs should be large enough */ | ||
1926 | if (!_snd_hda_find_mixer_ctl(codec, name, idx)) | ||
1927 | return idx; | ||
1928 | } | ||
1929 | return -EBUSY; | ||
1930 | } | ||
1931 | |||
1922 | /** | 1932 | /** |
1923 | * snd_hda_ctl_add - Add a control element and assign to the codec | 1933 | * snd_hda_ctl_add - Add a control element and assign to the codec |
1924 | * @codec: HD-audio codec | 1934 | * @codec: HD-audio codec |
@@ -2654,8 +2664,6 @@ static struct snd_kcontrol_new dig_mixes[] = { | |||
2654 | { } /* end */ | 2664 | { } /* end */ |
2655 | }; | 2665 | }; |
2656 | 2666 | ||
2657 | #define SPDIF_MAX_IDX 4 /* 4 instances should be enough to probe */ | ||
2658 | |||
2659 | /** | 2667 | /** |
2660 | * snd_hda_create_spdif_out_ctls - create Output SPDIF-related controls | 2668 | * snd_hda_create_spdif_out_ctls - create Output SPDIF-related controls |
2661 | * @codec: the HDA codec | 2669 | * @codec: the HDA codec |
@@ -2673,12 +2681,8 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
2673 | struct snd_kcontrol_new *dig_mix; | 2681 | struct snd_kcontrol_new *dig_mix; |
2674 | int idx; | 2682 | int idx; |
2675 | 2683 | ||
2676 | for (idx = 0; idx < SPDIF_MAX_IDX; idx++) { | 2684 | idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch"); |
2677 | if (!_snd_hda_find_mixer_ctl(codec, "IEC958 Playback Switch", | 2685 | if (idx < 0) { |
2678 | idx)) | ||
2679 | break; | ||
2680 | } | ||
2681 | if (idx >= SPDIF_MAX_IDX) { | ||
2682 | printk(KERN_ERR "hda_codec: too many IEC958 outputs\n"); | 2686 | printk(KERN_ERR "hda_codec: too many IEC958 outputs\n"); |
2683 | return -EBUSY; | 2687 | return -EBUSY; |
2684 | } | 2688 | } |
@@ -2829,12 +2833,8 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
2829 | struct snd_kcontrol_new *dig_mix; | 2833 | struct snd_kcontrol_new *dig_mix; |
2830 | int idx; | 2834 | int idx; |
2831 | 2835 | ||
2832 | for (idx = 0; idx < SPDIF_MAX_IDX; idx++) { | 2836 | idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch"); |
2833 | if (!_snd_hda_find_mixer_ctl(codec, "IEC958 Capture Switch", | 2837 | if (idx < 0) { |
2834 | idx)) | ||
2835 | break; | ||
2836 | } | ||
2837 | if (idx >= SPDIF_MAX_IDX) { | ||
2838 | printk(KERN_ERR "hda_codec: too many IEC958 inputs\n"); | 2838 | printk(KERN_ERR "hda_codec: too many IEC958 inputs\n"); |
2839 | return -EBUSY; | 2839 | return -EBUSY; |
2840 | } | 2840 | } |
@@ -3808,21 +3808,32 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) | |||
3808 | 3808 | ||
3809 | for (; knew->name; knew++) { | 3809 | for (; knew->name; knew++) { |
3810 | struct snd_kcontrol *kctl; | 3810 | struct snd_kcontrol *kctl; |
3811 | int addr = 0, idx = 0; | ||
3811 | if (knew->iface == -1) /* skip this codec private value */ | 3812 | if (knew->iface == -1) /* skip this codec private value */ |
3812 | continue; | 3813 | continue; |
3813 | kctl = snd_ctl_new1(knew, codec); | 3814 | for (;;) { |
3814 | if (!kctl) | ||
3815 | return -ENOMEM; | ||
3816 | err = snd_hda_ctl_add(codec, 0, kctl); | ||
3817 | if (err < 0) { | ||
3818 | if (!codec->addr) | ||
3819 | return err; | ||
3820 | kctl = snd_ctl_new1(knew, codec); | 3815 | kctl = snd_ctl_new1(knew, codec); |
3821 | if (!kctl) | 3816 | if (!kctl) |
3822 | return -ENOMEM; | 3817 | return -ENOMEM; |
3823 | kctl->id.device = codec->addr; | 3818 | if (addr > 0) |
3819 | kctl->id.device = addr; | ||
3820 | if (idx > 0) | ||
3821 | kctl->id.index = idx; | ||
3824 | err = snd_hda_ctl_add(codec, 0, kctl); | 3822 | err = snd_hda_ctl_add(codec, 0, kctl); |
3825 | if (err < 0) | 3823 | if (!err) |
3824 | break; | ||
3825 | /* try first with another device index corresponding to | ||
3826 | * the codec addr; if it still fails (or it's the | ||
3827 | * primary codec), then try another control index | ||
3828 | */ | ||
3829 | if (!addr && codec->addr) | ||
3830 | addr = codec->addr; | ||
3831 | else if (!idx && !knew->index) { | ||
3832 | idx = find_empty_mixer_ctl_idx(codec, | ||
3833 | knew->name); | ||
3834 | if (idx <= 0) | ||
3835 | return err; | ||
3836 | } else | ||
3826 | return err; | 3837 | return err; |
3827 | } | 3838 | } |
3828 | } | 3839 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index b030c8eba21f..a1c4008af891 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2300,6 +2300,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
2300 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), | 2300 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
2301 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), | 2301 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
2302 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), | 2302 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), |
2303 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell Inspiron 1120", POS_FIX_LPIB), | ||
2303 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), | 2304 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
2304 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2305 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2305 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2306 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 2d7d7de8498a..552a09e9211f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -10830,7 +10830,8 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec) | |||
10830 | { | 10830 | { |
10831 | struct alc_spec *spec = codec->spec; | 10831 | struct alc_spec *spec = codec->spec; |
10832 | struct auto_pin_cfg *cfg = &spec->autocfg; | 10832 | struct auto_pin_cfg *cfg = &spec->autocfg; |
10833 | int i, err; | 10833 | int i, err, type; |
10834 | int type_idx = 0; | ||
10834 | hda_nid_t nid; | 10835 | hda_nid_t nid; |
10835 | 10836 | ||
10836 | for (i = 0; i < cfg->num_inputs; i++) { | 10837 | for (i = 0; i < cfg->num_inputs; i++) { |
@@ -10839,9 +10840,15 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec) | |||
10839 | nid = cfg->inputs[i].pin; | 10840 | nid = cfg->inputs[i].pin; |
10840 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { | 10841 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) { |
10841 | char label[32]; | 10842 | char label[32]; |
10843 | type = cfg->inputs[i].type; | ||
10844 | if (i > 0 && type == cfg->inputs[i - 1].type) | ||
10845 | type_idx++; | ||
10846 | else | ||
10847 | type_idx = 0; | ||
10842 | snprintf(label, sizeof(label), "%s Boost", | 10848 | snprintf(label, sizeof(label), "%s Boost", |
10843 | hda_get_autocfg_input_label(codec, cfg, i)); | 10849 | hda_get_autocfg_input_label(codec, cfg, i)); |
10844 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0, | 10850 | err = add_control(spec, ALC_CTL_WIDGET_VOL, label, |
10851 | type_idx, | ||
10845 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | 10852 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
10846 | if (err < 0) | 10853 | if (err < 0) |
10847 | return err; | 10854 | return err; |
@@ -14799,7 +14806,10 @@ static int alc269_resume(struct hda_codec *codec) | |||
14799 | 14806 | ||
14800 | enum { | 14807 | enum { |
14801 | ALC269_FIXUP_SONY_VAIO, | 14808 | ALC269_FIXUP_SONY_VAIO, |
14809 | ALC275_FIX_SONY_VAIO_GPIO2, | ||
14802 | ALC269_FIXUP_DELL_M101Z, | 14810 | ALC269_FIXUP_DELL_M101Z, |
14811 | ALC269_FIXUP_SKU_IGNORE, | ||
14812 | ALC269_FIXUP_ASUS_G73JW, | ||
14803 | }; | 14813 | }; |
14804 | 14814 | ||
14805 | static const struct alc_fixup alc269_fixups[] = { | 14815 | static const struct alc_fixup alc269_fixups[] = { |
@@ -14809,6 +14819,14 @@ static const struct alc_fixup alc269_fixups[] = { | |||
14809 | {} | 14819 | {} |
14810 | } | 14820 | } |
14811 | }, | 14821 | }, |
14822 | [ALC275_FIX_SONY_VAIO_GPIO2] = { | ||
14823 | .verbs = (const struct hda_verb[]) { | ||
14824 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, | ||
14825 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, | ||
14826 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | ||
14827 | { } | ||
14828 | } | ||
14829 | }, | ||
14812 | [ALC269_FIXUP_DELL_M101Z] = { | 14830 | [ALC269_FIXUP_DELL_M101Z] = { |
14813 | .verbs = (const struct hda_verb[]) { | 14831 | .verbs = (const struct hda_verb[]) { |
14814 | /* Enables internal speaker */ | 14832 | /* Enables internal speaker */ |
@@ -14817,11 +14835,26 @@ static const struct alc_fixup alc269_fixups[] = { | |||
14817 | {} | 14835 | {} |
14818 | } | 14836 | } |
14819 | }, | 14837 | }, |
14838 | [ALC269_FIXUP_SKU_IGNORE] = { | ||
14839 | .sku = ALC_FIXUP_SKU_IGNORE, | ||
14840 | }, | ||
14841 | [ALC269_FIXUP_ASUS_G73JW] = { | ||
14842 | .pins = (const struct alc_pincfg[]) { | ||
14843 | { 0x17, 0x99130111 }, /* subwoofer */ | ||
14844 | { } | ||
14845 | } | ||
14846 | }, | ||
14820 | }; | 14847 | }; |
14821 | 14848 | ||
14822 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | 14849 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
14850 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), | ||
14851 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), | ||
14852 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), | ||
14823 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | 14853 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
14824 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | 14854 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
14855 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | ||
14856 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), | ||
14857 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | ||
14825 | {} | 14858 | {} |
14826 | }; | 14859 | }; |
14827 | 14860 | ||
@@ -15071,28 +15104,29 @@ static int patch_alc269(struct hda_codec *codec) | |||
15071 | 15104 | ||
15072 | alc_auto_parse_customize_define(codec); | 15105 | alc_auto_parse_customize_define(codec); |
15073 | 15106 | ||
15074 | coef = alc_read_coef_idx(codec, 0); | 15107 | if (codec->vendor_id == 0x10ec0269) { |
15075 | if ((coef & 0x00f0) == 0x0010) { | 15108 | coef = alc_read_coef_idx(codec, 0); |
15076 | if (codec->bus->pci->subsystem_vendor == 0x1025 && | 15109 | if ((coef & 0x00f0) == 0x0010) { |
15077 | spec->cdefine.platform_type == 1) { | 15110 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
15078 | alc_codec_rename(codec, "ALC271X"); | 15111 | spec->cdefine.platform_type == 1) { |
15079 | spec->codec_variant = ALC269_TYPE_ALC271X; | 15112 | alc_codec_rename(codec, "ALC271X"); |
15080 | } else if ((coef & 0xf000) == 0x1000) { | 15113 | spec->codec_variant = ALC269_TYPE_ALC271X; |
15081 | spec->codec_variant = ALC269_TYPE_ALC270; | 15114 | } else if ((coef & 0xf000) == 0x1000) { |
15082 | } else if ((coef & 0xf000) == 0x2000) { | 15115 | spec->codec_variant = ALC269_TYPE_ALC270; |
15083 | alc_codec_rename(codec, "ALC259"); | 15116 | } else if ((coef & 0xf000) == 0x2000) { |
15084 | spec->codec_variant = ALC269_TYPE_ALC259; | 15117 | alc_codec_rename(codec, "ALC259"); |
15085 | } else if ((coef & 0xf000) == 0x3000) { | 15118 | spec->codec_variant = ALC269_TYPE_ALC259; |
15086 | alc_codec_rename(codec, "ALC258"); | 15119 | } else if ((coef & 0xf000) == 0x3000) { |
15087 | spec->codec_variant = ALC269_TYPE_ALC258; | 15120 | alc_codec_rename(codec, "ALC258"); |
15088 | } else { | 15121 | spec->codec_variant = ALC269_TYPE_ALC258; |
15089 | alc_codec_rename(codec, "ALC269VB"); | 15122 | } else { |
15090 | spec->codec_variant = ALC269_TYPE_ALC269VB; | 15123 | alc_codec_rename(codec, "ALC269VB"); |
15091 | } | 15124 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
15092 | } else | 15125 | } |
15093 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 15126 | } else |
15094 | 15127 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | |
15095 | alc269_fill_coef(codec); | 15128 | alc269_fill_coef(codec); |
15129 | } | ||
15096 | 15130 | ||
15097 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | 15131 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
15098 | alc269_models, | 15132 | alc269_models, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index efa4225f5fd6..f03b2ff90496 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -3481,6 +3481,8 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3481 | 3481 | ||
3482 | label = hda_get_input_pin_label(codec, nid, 1); | 3482 | label = hda_get_input_pin_label(codec, nid, 1); |
3483 | snd_hda_add_imux_item(dimux, label, index, &type_idx); | 3483 | snd_hda_add_imux_item(dimux, label, index, &type_idx); |
3484 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) | ||
3485 | snd_hda_add_imux_item(imux, label, index, &type_idx); | ||
3484 | 3486 | ||
3485 | err = create_elem_capture_vol(codec, nid, label, type_idx, | 3487 | err = create_elem_capture_vol(codec, nid, label, type_idx, |
3486 | HDA_INPUT); | 3488 | HDA_INPUT); |
@@ -3492,9 +3494,6 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3492 | if (err < 0) | 3494 | if (err < 0) |
3493 | return err; | 3495 | return err; |
3494 | } | 3496 | } |
3495 | |||
3496 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) | ||
3497 | snd_hda_add_imux_item(imux, label, index, NULL); | ||
3498 | } | 3497 | } |
3499 | 3498 | ||
3500 | return 0; | 3499 | return 0; |
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index d63e28773eb1..6447dbb2f123 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
@@ -40,7 +40,6 @@ struct max98088_cdata { | |||
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct max98088_priv { | 42 | struct max98088_priv { |
43 | u8 reg_cache[M98088_REG_CNT]; | ||
44 | enum max98088_type devtype; | 43 | enum max98088_type devtype; |
45 | void *control_data; | 44 | void *control_data; |
46 | struct max98088_pdata *pdata; | 45 | struct max98088_pdata *pdata; |
@@ -1588,7 +1587,7 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai, | |||
1588 | 1587 | ||
1589 | static void max98088_sync_cache(struct snd_soc_codec *codec) | 1588 | static void max98088_sync_cache(struct snd_soc_codec *codec) |
1590 | { | 1589 | { |
1591 | struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); | 1590 | u16 *reg_cache = codec->reg_cache; |
1592 | int i; | 1591 | int i; |
1593 | 1592 | ||
1594 | if (!codec->cache_sync) | 1593 | if (!codec->cache_sync) |
@@ -1599,14 +1598,14 @@ static void max98088_sync_cache(struct snd_soc_codec *codec) | |||
1599 | /* write back cached values if they're writeable and | 1598 | /* write back cached values if they're writeable and |
1600 | * different from the hardware default. | 1599 | * different from the hardware default. |
1601 | */ | 1600 | */ |
1602 | for (i = 1; i < ARRAY_SIZE(max98088->reg_cache); i++) { | 1601 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
1603 | if (!max98088_access[i].writable) | 1602 | if (!max98088_access[i].writable) |
1604 | continue; | 1603 | continue; |
1605 | 1604 | ||
1606 | if (max98088->reg_cache[i] == max98088_reg[i]) | 1605 | if (reg_cache[i] == max98088_reg[i]) |
1607 | continue; | 1606 | continue; |
1608 | 1607 | ||
1609 | snd_soc_write(codec, i, max98088->reg_cache[i]); | 1608 | snd_soc_write(codec, i, reg_cache[i]); |
1610 | } | 1609 | } |
1611 | 1610 | ||
1612 | codec->cache_sync = 0; | 1611 | codec->cache_sync = 0; |
@@ -1951,7 +1950,6 @@ static int max98088_probe(struct snd_soc_codec *codec) | |||
1951 | int ret = 0; | 1950 | int ret = 0; |
1952 | 1951 | ||
1953 | codec->cache_sync = 1; | 1952 | codec->cache_sync = 1; |
1954 | memcpy(codec->reg_cache, max98088_reg, sizeof(max98088_reg)); | ||
1955 | 1953 | ||
1956 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); | 1954 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); |
1957 | if (ret != 0) { | 1955 | if (ret != 0) { |
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index 9a433a5396cb..deca79ea2b4b 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c | |||
@@ -41,7 +41,6 @@ static const char *wm8523_supply_names[WM8523_NUM_SUPPLIES] = { | |||
41 | /* codec private data */ | 41 | /* codec private data */ |
42 | struct wm8523_priv { | 42 | struct wm8523_priv { |
43 | enum snd_soc_control_type control_type; | 43 | enum snd_soc_control_type control_type; |
44 | u16 reg_cache[WM8523_REGISTER_COUNT]; | ||
45 | struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES]; | 44 | struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES]; |
46 | unsigned int sysclk; | 45 | unsigned int sysclk; |
47 | unsigned int rate_constraint_list[WM8523_NUM_RATES]; | 46 | unsigned int rate_constraint_list[WM8523_NUM_RATES]; |
@@ -314,6 +313,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
314 | enum snd_soc_bias_level level) | 313 | enum snd_soc_bias_level level) |
315 | { | 314 | { |
316 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); | 315 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); |
316 | u16 *reg_cache = codec->reg_cache; | ||
317 | int ret, i; | 317 | int ret, i; |
318 | 318 | ||
319 | switch (level) { | 319 | switch (level) { |
@@ -344,7 +344,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
344 | /* Sync back default/cached values */ | 344 | /* Sync back default/cached values */ |
345 | for (i = WM8523_AIF_CTRL1; | 345 | for (i = WM8523_AIF_CTRL1; |
346 | i < WM8523_MAX_REGISTER; i++) | 346 | i < WM8523_MAX_REGISTER; i++) |
347 | snd_soc_write(codec, i, wm8523->reg_cache[i]); | 347 | snd_soc_write(codec, i, reg_cache[i]); |
348 | 348 | ||
349 | 349 | ||
350 | msleep(100); | 350 | msleep(100); |
@@ -414,6 +414,7 @@ static int wm8523_resume(struct snd_soc_codec *codec) | |||
414 | static int wm8523_probe(struct snd_soc_codec *codec) | 414 | static int wm8523_probe(struct snd_soc_codec *codec) |
415 | { | 415 | { |
416 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); | 416 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); |
417 | u16 *reg_cache = codec->reg_cache; | ||
417 | int ret, i; | 418 | int ret, i; |
418 | 419 | ||
419 | codec->hw_write = (hw_write_t)i2c_master_send; | 420 | codec->hw_write = (hw_write_t)i2c_master_send; |
@@ -470,8 +471,8 @@ static int wm8523_probe(struct snd_soc_codec *codec) | |||
470 | } | 471 | } |
471 | 472 | ||
472 | /* Change some default settings - latch VU and enable ZC */ | 473 | /* Change some default settings - latch VU and enable ZC */ |
473 | wm8523->reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU; | 474 | reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU; |
474 | wm8523->reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC; | 475 | reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC; |
475 | 476 | ||
476 | wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 477 | wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
477 | 478 | ||
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 879dff2714dd..8725d4e75431 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -161,7 +161,7 @@ | |||
161 | static const u16 wm8580_reg[] = { | 161 | static const u16 wm8580_reg[] = { |
162 | 0x0121, 0x017e, 0x007d, 0x0014, /*R3*/ | 162 | 0x0121, 0x017e, 0x007d, 0x0014, /*R3*/ |
163 | 0x0121, 0x017e, 0x007d, 0x0194, /*R7*/ | 163 | 0x0121, 0x017e, 0x007d, 0x0194, /*R7*/ |
164 | 0x001c, 0x0002, 0x0002, 0x00c2, /*R11*/ | 164 | 0x0010, 0x0002, 0x0002, 0x00c2, /*R11*/ |
165 | 0x0182, 0x0082, 0x000a, 0x0024, /*R15*/ | 165 | 0x0182, 0x0082, 0x000a, 0x0024, /*R15*/ |
166 | 0x0009, 0x0000, 0x00ff, 0x0000, /*R19*/ | 166 | 0x0009, 0x0000, 0x00ff, 0x0000, /*R19*/ |
167 | 0x00ff, 0x00ff, 0x00ff, 0x00ff, /*R23*/ | 167 | 0x00ff, 0x00ff, 0x00ff, 0x00ff, /*R23*/ |
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index 90e31e9aa6f7..aea60ef8aba7 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c | |||
@@ -41,7 +41,6 @@ static const char *wm8741_supply_names[WM8741_NUM_SUPPLIES] = { | |||
41 | /* codec private data */ | 41 | /* codec private data */ |
42 | struct wm8741_priv { | 42 | struct wm8741_priv { |
43 | enum snd_soc_control_type control_type; | 43 | enum snd_soc_control_type control_type; |
44 | u16 reg_cache[WM8741_REGISTER_COUNT]; | ||
45 | struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; | 44 | struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; |
46 | unsigned int sysclk; | 45 | unsigned int sysclk; |
47 | struct snd_pcm_hw_constraint_list *sysclk_constraints; | 46 | struct snd_pcm_hw_constraint_list *sysclk_constraints; |
@@ -422,6 +421,7 @@ static int wm8741_resume(struct snd_soc_codec *codec) | |||
422 | static int wm8741_probe(struct snd_soc_codec *codec) | 421 | static int wm8741_probe(struct snd_soc_codec *codec) |
423 | { | 422 | { |
424 | struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); | 423 | struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); |
424 | u16 *reg_cache = codec->reg_cache; | ||
425 | int ret = 0; | 425 | int ret = 0; |
426 | 426 | ||
427 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8741->control_type); | 427 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8741->control_type); |
@@ -437,10 +437,10 @@ static int wm8741_probe(struct snd_soc_codec *codec) | |||
437 | } | 437 | } |
438 | 438 | ||
439 | /* Change some default settings - latch VU */ | 439 | /* Change some default settings - latch VU */ |
440 | wm8741->reg_cache[WM8741_DACLLSB_ATTENUATION] |= WM8741_UPDATELL; | 440 | reg_cache[WM8741_DACLLSB_ATTENUATION] |= WM8741_UPDATELL; |
441 | wm8741->reg_cache[WM8741_DACLMSB_ATTENUATION] |= WM8741_UPDATELM; | 441 | reg_cache[WM8741_DACLMSB_ATTENUATION] |= WM8741_UPDATELM; |
442 | wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERL; | 442 | reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERL; |
443 | wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERM; | 443 | reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERM; |
444 | 444 | ||
445 | snd_soc_add_controls(codec, wm8741_snd_controls, | 445 | snd_soc_add_controls(codec, wm8741_snd_controls, |
446 | ARRAY_SIZE(wm8741_snd_controls)); | 446 | ARRAY_SIZE(wm8741_snd_controls)); |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 8f679a13f2bc..87caae59e939 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -65,22 +65,22 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec, | |||
65 | * are using 2 wire for device control, so we cache them instead. | 65 | * are using 2 wire for device control, so we cache them instead. |
66 | */ | 66 | */ |
67 | static const u16 wm8753_reg[] = { | 67 | static const u16 wm8753_reg[] = { |
68 | 0x0008, 0x0000, 0x000a, 0x000a, | 68 | 0x0000, 0x0008, 0x0000, 0x000a, |
69 | 0x0033, 0x0000, 0x0007, 0x00ff, | 69 | 0x000a, 0x0033, 0x0000, 0x0007, |
70 | 0x00ff, 0x000f, 0x000f, 0x007b, | 70 | 0x00ff, 0x00ff, 0x000f, 0x000f, |
71 | 0x0000, 0x0032, 0x0000, 0x00c3, | 71 | 0x007b, 0x0000, 0x0032, 0x0000, |
72 | 0x00c3, 0x00c0, 0x0000, 0x0000, | 72 | 0x00c3, 0x00c3, 0x00c0, 0x0000, |
73 | 0x0000, 0x0000, 0x0000, 0x0000, | 73 | 0x0000, 0x0000, 0x0000, 0x0000, |
74 | 0x0000, 0x0000, 0x0000, 0x0000, | 74 | 0x0000, 0x0000, 0x0000, 0x0000, |
75 | 0x0000, 0x0000, 0x0000, 0x0055, | ||
76 | 0x0005, 0x0050, 0x0055, 0x0050, | ||
77 | 0x0055, 0x0050, 0x0055, 0x0079, | ||
78 | 0x0079, 0x0079, 0x0079, 0x0079, | ||
79 | 0x0000, 0x0000, 0x0000, 0x0000, | 75 | 0x0000, 0x0000, 0x0000, 0x0000, |
80 | 0x0097, 0x0097, 0x0000, 0x0004, | 76 | 0x0055, 0x0005, 0x0050, 0x0055, |
81 | 0x0000, 0x0083, 0x0024, 0x01ba, | 77 | 0x0050, 0x0055, 0x0050, 0x0055, |
82 | 0x0000, 0x0083, 0x0024, 0x01ba, | 78 | 0x0079, 0x0079, 0x0079, 0x0079, |
83 | 0x0000, 0x0000, 0x0000 | 79 | 0x0079, 0x0000, 0x0000, 0x0000, |
80 | 0x0000, 0x0097, 0x0097, 0x0000, | ||
81 | 0x0004, 0x0000, 0x0083, 0x0024, | ||
82 | 0x01ba, 0x0000, 0x0083, 0x0024, | ||
83 | 0x01ba, 0x0000, 0x0000, 0x0000 | ||
84 | }; | 84 | }; |
85 | 85 | ||
86 | /* codec private data */ | 86 | /* codec private data */ |
@@ -88,57 +88,10 @@ struct wm8753_priv { | |||
88 | enum snd_soc_control_type control_type; | 88 | enum snd_soc_control_type control_type; |
89 | unsigned int sysclk; | 89 | unsigned int sysclk; |
90 | unsigned int pcmclk; | 90 | unsigned int pcmclk; |
91 | u16 reg_cache[ARRAY_SIZE(wm8753_reg)]; | ||
92 | int dai_func; | 91 | int dai_func; |
93 | }; | 92 | }; |
94 | 93 | ||
95 | /* | 94 | #define wm8753_reset(c) snd_soc_write(c, WM8753_RESET, 0) |
96 | * read wm8753 register cache | ||
97 | */ | ||
98 | static inline unsigned int wm8753_read_reg_cache(struct snd_soc_codec *codec, | ||
99 | unsigned int reg) | ||
100 | { | ||
101 | u16 *cache = codec->reg_cache; | ||
102 | if (reg < 1 || reg >= (ARRAY_SIZE(wm8753_reg) + 1)) | ||
103 | return -1; | ||
104 | return cache[reg - 1]; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * write wm8753 register cache | ||
109 | */ | ||
110 | static inline void wm8753_write_reg_cache(struct snd_soc_codec *codec, | ||
111 | unsigned int reg, unsigned int value) | ||
112 | { | ||
113 | u16 *cache = codec->reg_cache; | ||
114 | if (reg < 1 || reg >= (ARRAY_SIZE(wm8753_reg) + 1)) | ||
115 | return; | ||
116 | cache[reg - 1] = value; | ||
117 | } | ||
118 | |||
119 | /* | ||
120 | * write to the WM8753 register space | ||
121 | */ | ||
122 | static int wm8753_write(struct snd_soc_codec *codec, unsigned int reg, | ||
123 | unsigned int value) | ||
124 | { | ||
125 | u8 data[2]; | ||
126 | |||
127 | /* data is | ||
128 | * D15..D9 WM8753 register offset | ||
129 | * D8...D0 register data | ||
130 | */ | ||
131 | data[0] = (reg << 1) | ((value >> 8) & 0x0001); | ||
132 | data[1] = value & 0x00ff; | ||
133 | |||
134 | wm8753_write_reg_cache(codec, reg, value); | ||
135 | if (codec->hw_write(codec->control_data, data, 2) == 2) | ||
136 | return 0; | ||
137 | else | ||
138 | return -EIO; | ||
139 | } | ||
140 | |||
141 | #define wm8753_reset(c) wm8753_write(c, WM8753_RESET, 0) | ||
142 | 95 | ||
143 | /* | 96 | /* |
144 | * WM8753 Controls | 97 | * WM8753 Controls |
@@ -218,7 +171,7 @@ static int wm8753_get_dai(struct snd_kcontrol *kcontrol, | |||
218 | struct snd_ctl_elem_value *ucontrol) | 171 | struct snd_ctl_elem_value *ucontrol) |
219 | { | 172 | { |
220 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 173 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
221 | int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); | 174 | int mode = snd_soc_read(codec, WM8753_IOCTL); |
222 | 175 | ||
223 | ucontrol->value.integer.value[0] = (mode & 0xc) >> 2; | 176 | ucontrol->value.integer.value[0] = (mode & 0xc) >> 2; |
224 | return 0; | 177 | return 0; |
@@ -228,7 +181,7 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, | |||
228 | struct snd_ctl_elem_value *ucontrol) | 181 | struct snd_ctl_elem_value *ucontrol) |
229 | { | 182 | { |
230 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 183 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
231 | int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); | 184 | int mode = snd_soc_read(codec, WM8753_IOCTL); |
232 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 185 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
233 | 186 | ||
234 | if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0]) | 187 | if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0]) |
@@ -738,17 +691,17 @@ static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, | |||
738 | if (pll_id == WM8753_PLL1) { | 691 | if (pll_id == WM8753_PLL1) { |
739 | offset = 0; | 692 | offset = 0; |
740 | enable = 0x10; | 693 | enable = 0x10; |
741 | reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xffef; | 694 | reg = snd_soc_read(codec, WM8753_CLOCK) & 0xffef; |
742 | } else { | 695 | } else { |
743 | offset = 4; | 696 | offset = 4; |
744 | enable = 0x8; | 697 | enable = 0x8; |
745 | reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfff7; | 698 | reg = snd_soc_read(codec, WM8753_CLOCK) & 0xfff7; |
746 | } | 699 | } |
747 | 700 | ||
748 | if (!freq_in || !freq_out) { | 701 | if (!freq_in || !freq_out) { |
749 | /* disable PLL */ | 702 | /* disable PLL */ |
750 | wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0026); | 703 | snd_soc_write(codec, WM8753_PLL1CTL1 + offset, 0x0026); |
751 | wm8753_write(codec, WM8753_CLOCK, reg); | 704 | snd_soc_write(codec, WM8753_CLOCK, reg); |
752 | return 0; | 705 | return 0; |
753 | } else { | 706 | } else { |
754 | u16 value = 0; | 707 | u16 value = 0; |
@@ -759,20 +712,20 @@ static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, | |||
759 | /* set up N and K PLL divisor ratios */ | 712 | /* set up N and K PLL divisor ratios */ |
760 | /* bits 8:5 = PLL_N, bits 3:0 = PLL_K[21:18] */ | 713 | /* bits 8:5 = PLL_N, bits 3:0 = PLL_K[21:18] */ |
761 | value = (pll_div.n << 5) + ((pll_div.k & 0x3c0000) >> 18); | 714 | value = (pll_div.n << 5) + ((pll_div.k & 0x3c0000) >> 18); |
762 | wm8753_write(codec, WM8753_PLL1CTL2 + offset, value); | 715 | snd_soc_write(codec, WM8753_PLL1CTL2 + offset, value); |
763 | 716 | ||
764 | /* bits 8:0 = PLL_K[17:9] */ | 717 | /* bits 8:0 = PLL_K[17:9] */ |
765 | value = (pll_div.k & 0x03fe00) >> 9; | 718 | value = (pll_div.k & 0x03fe00) >> 9; |
766 | wm8753_write(codec, WM8753_PLL1CTL3 + offset, value); | 719 | snd_soc_write(codec, WM8753_PLL1CTL3 + offset, value); |
767 | 720 | ||
768 | /* bits 8:0 = PLL_K[8:0] */ | 721 | /* bits 8:0 = PLL_K[8:0] */ |
769 | value = pll_div.k & 0x0001ff; | 722 | value = pll_div.k & 0x0001ff; |
770 | wm8753_write(codec, WM8753_PLL1CTL4 + offset, value); | 723 | snd_soc_write(codec, WM8753_PLL1CTL4 + offset, value); |
771 | 724 | ||
772 | /* set PLL as input and enable */ | 725 | /* set PLL as input and enable */ |
773 | wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0027 | | 726 | snd_soc_write(codec, WM8753_PLL1CTL1 + offset, 0x0027 | |
774 | (pll_div.div2 << 3)); | 727 | (pll_div.div2 << 3)); |
775 | wm8753_write(codec, WM8753_CLOCK, reg | enable); | 728 | snd_soc_write(codec, WM8753_CLOCK, reg | enable); |
776 | } | 729 | } |
777 | return 0; | 730 | return 0; |
778 | } | 731 | } |
@@ -879,7 +832,7 @@ static int wm8753_vdac_adc_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
879 | unsigned int fmt) | 832 | unsigned int fmt) |
880 | { | 833 | { |
881 | struct snd_soc_codec *codec = codec_dai->codec; | 834 | struct snd_soc_codec *codec = codec_dai->codec; |
882 | u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01ec; | 835 | u16 voice = snd_soc_read(codec, WM8753_PCM) & 0x01ec; |
883 | 836 | ||
884 | /* interface format */ | 837 | /* interface format */ |
885 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 838 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
@@ -901,7 +854,7 @@ static int wm8753_vdac_adc_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
901 | return -EINVAL; | 854 | return -EINVAL; |
902 | } | 855 | } |
903 | 856 | ||
904 | wm8753_write(codec, WM8753_PCM, voice); | 857 | snd_soc_write(codec, WM8753_PCM, voice); |
905 | return 0; | 858 | return 0; |
906 | } | 859 | } |
907 | 860 | ||
@@ -922,8 +875,8 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream, | |||
922 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 875 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
923 | struct snd_soc_codec *codec = rtd->codec; | 876 | struct snd_soc_codec *codec = rtd->codec; |
924 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 877 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
925 | u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01f3; | 878 | u16 voice = snd_soc_read(codec, WM8753_PCM) & 0x01f3; |
926 | u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x017f; | 879 | u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x017f; |
927 | 880 | ||
928 | /* bit size */ | 881 | /* bit size */ |
929 | switch (params_format(params)) { | 882 | switch (params_format(params)) { |
@@ -943,9 +896,9 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream, | |||
943 | /* sample rate */ | 896 | /* sample rate */ |
944 | if (params_rate(params) * 384 == wm8753->pcmclk) | 897 | if (params_rate(params) * 384 == wm8753->pcmclk) |
945 | srate |= 0x80; | 898 | srate |= 0x80; |
946 | wm8753_write(codec, WM8753_SRATE1, srate); | 899 | snd_soc_write(codec, WM8753_SRATE1, srate); |
947 | 900 | ||
948 | wm8753_write(codec, WM8753_PCM, voice); | 901 | snd_soc_write(codec, WM8753_PCM, voice); |
949 | return 0; | 902 | return 0; |
950 | } | 903 | } |
951 | 904 | ||
@@ -958,8 +911,8 @@ static int wm8753_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
958 | struct snd_soc_codec *codec = codec_dai->codec; | 911 | struct snd_soc_codec *codec = codec_dai->codec; |
959 | u16 voice, ioctl; | 912 | u16 voice, ioctl; |
960 | 913 | ||
961 | voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x011f; | 914 | voice = snd_soc_read(codec, WM8753_PCM) & 0x011f; |
962 | ioctl = wm8753_read_reg_cache(codec, WM8753_IOCTL) & 0x015d; | 915 | ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x015d; |
963 | 916 | ||
964 | /* set master/slave audio interface */ | 917 | /* set master/slave audio interface */ |
965 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 918 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
@@ -1013,8 +966,8 @@ static int wm8753_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1013 | return -EINVAL; | 966 | return -EINVAL; |
1014 | } | 967 | } |
1015 | 968 | ||
1016 | wm8753_write(codec, WM8753_PCM, voice); | 969 | snd_soc_write(codec, WM8753_PCM, voice); |
1017 | wm8753_write(codec, WM8753_IOCTL, ioctl); | 970 | snd_soc_write(codec, WM8753_IOCTL, ioctl); |
1018 | return 0; | 971 | return 0; |
1019 | } | 972 | } |
1020 | 973 | ||
@@ -1026,16 +979,16 @@ static int wm8753_set_dai_clkdiv(struct snd_soc_dai *codec_dai, | |||
1026 | 979 | ||
1027 | switch (div_id) { | 980 | switch (div_id) { |
1028 | case WM8753_PCMDIV: | 981 | case WM8753_PCMDIV: |
1029 | reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0x003f; | 982 | reg = snd_soc_read(codec, WM8753_CLOCK) & 0x003f; |
1030 | wm8753_write(codec, WM8753_CLOCK, reg | div); | 983 | snd_soc_write(codec, WM8753_CLOCK, reg | div); |
1031 | break; | 984 | break; |
1032 | case WM8753_BCLKDIV: | 985 | case WM8753_BCLKDIV: |
1033 | reg = wm8753_read_reg_cache(codec, WM8753_SRATE2) & 0x01c7; | 986 | reg = snd_soc_read(codec, WM8753_SRATE2) & 0x01c7; |
1034 | wm8753_write(codec, WM8753_SRATE2, reg | div); | 987 | snd_soc_write(codec, WM8753_SRATE2, reg | div); |
1035 | break; | 988 | break; |
1036 | case WM8753_VXCLKDIV: | 989 | case WM8753_VXCLKDIV: |
1037 | reg = wm8753_read_reg_cache(codec, WM8753_SRATE2) & 0x003f; | 990 | reg = snd_soc_read(codec, WM8753_SRATE2) & 0x003f; |
1038 | wm8753_write(codec, WM8753_SRATE2, reg | div); | 991 | snd_soc_write(codec, WM8753_SRATE2, reg | div); |
1039 | break; | 992 | break; |
1040 | default: | 993 | default: |
1041 | return -EINVAL; | 994 | return -EINVAL; |
@@ -1050,7 +1003,7 @@ static int wm8753_hdac_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1050 | unsigned int fmt) | 1003 | unsigned int fmt) |
1051 | { | 1004 | { |
1052 | struct snd_soc_codec *codec = codec_dai->codec; | 1005 | struct snd_soc_codec *codec = codec_dai->codec; |
1053 | u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01e0; | 1006 | u16 hifi = snd_soc_read(codec, WM8753_HIFI) & 0x01e0; |
1054 | 1007 | ||
1055 | /* interface format */ | 1008 | /* interface format */ |
1056 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 1009 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
@@ -1072,7 +1025,7 @@ static int wm8753_hdac_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1072 | return -EINVAL; | 1025 | return -EINVAL; |
1073 | } | 1026 | } |
1074 | 1027 | ||
1075 | wm8753_write(codec, WM8753_HIFI, hifi); | 1028 | snd_soc_write(codec, WM8753_HIFI, hifi); |
1076 | return 0; | 1029 | return 0; |
1077 | } | 1030 | } |
1078 | 1031 | ||
@@ -1085,8 +1038,8 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1085 | struct snd_soc_codec *codec = codec_dai->codec; | 1038 | struct snd_soc_codec *codec = codec_dai->codec; |
1086 | u16 ioctl, hifi; | 1039 | u16 ioctl, hifi; |
1087 | 1040 | ||
1088 | hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x011f; | 1041 | hifi = snd_soc_read(codec, WM8753_HIFI) & 0x011f; |
1089 | ioctl = wm8753_read_reg_cache(codec, WM8753_IOCTL) & 0x00ae; | 1042 | ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x00ae; |
1090 | 1043 | ||
1091 | /* set master/slave audio interface */ | 1044 | /* set master/slave audio interface */ |
1092 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 1045 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
@@ -1140,8 +1093,8 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1140 | return -EINVAL; | 1093 | return -EINVAL; |
1141 | } | 1094 | } |
1142 | 1095 | ||
1143 | wm8753_write(codec, WM8753_HIFI, hifi); | 1096 | snd_soc_write(codec, WM8753_HIFI, hifi); |
1144 | wm8753_write(codec, WM8753_IOCTL, ioctl); | 1097 | snd_soc_write(codec, WM8753_IOCTL, ioctl); |
1145 | return 0; | 1098 | return 0; |
1146 | } | 1099 | } |
1147 | 1100 | ||
@@ -1162,8 +1115,8 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream, | |||
1162 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 1115 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
1163 | struct snd_soc_codec *codec = rtd->codec; | 1116 | struct snd_soc_codec *codec = rtd->codec; |
1164 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 1117 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
1165 | u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x01c0; | 1118 | u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x01c0; |
1166 | u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01f3; | 1119 | u16 hifi = snd_soc_read(codec, WM8753_HIFI) & 0x01f3; |
1167 | int coeff; | 1120 | int coeff; |
1168 | 1121 | ||
1169 | /* is digital filter coefficient valid ? */ | 1122 | /* is digital filter coefficient valid ? */ |
@@ -1172,7 +1125,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream, | |||
1172 | printk(KERN_ERR "wm8753 invalid MCLK or rate\n"); | 1125 | printk(KERN_ERR "wm8753 invalid MCLK or rate\n"); |
1173 | return coeff; | 1126 | return coeff; |
1174 | } | 1127 | } |
1175 | wm8753_write(codec, WM8753_SRATE1, srate | (coeff_div[coeff].sr << 1) | | 1128 | snd_soc_write(codec, WM8753_SRATE1, srate | (coeff_div[coeff].sr << 1) | |
1176 | coeff_div[coeff].usb); | 1129 | coeff_div[coeff].usb); |
1177 | 1130 | ||
1178 | /* bit size */ | 1131 | /* bit size */ |
@@ -1190,7 +1143,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream, | |||
1190 | break; | 1143 | break; |
1191 | } | 1144 | } |
1192 | 1145 | ||
1193 | wm8753_write(codec, WM8753_HIFI, hifi); | 1146 | snd_soc_write(codec, WM8753_HIFI, hifi); |
1194 | return 0; | 1147 | return 0; |
1195 | } | 1148 | } |
1196 | 1149 | ||
@@ -1201,8 +1154,8 @@ static int wm8753_mode1v_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1201 | u16 clock; | 1154 | u16 clock; |
1202 | 1155 | ||
1203 | /* set clk source as pcmclk */ | 1156 | /* set clk source as pcmclk */ |
1204 | clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; | 1157 | clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb; |
1205 | wm8753_write(codec, WM8753_CLOCK, clock); | 1158 | snd_soc_write(codec, WM8753_CLOCK, clock); |
1206 | 1159 | ||
1207 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) | 1160 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) |
1208 | return -EINVAL; | 1161 | return -EINVAL; |
@@ -1224,8 +1177,8 @@ static int wm8753_mode2_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1224 | u16 clock; | 1177 | u16 clock; |
1225 | 1178 | ||
1226 | /* set clk source as pcmclk */ | 1179 | /* set clk source as pcmclk */ |
1227 | clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; | 1180 | clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb; |
1228 | wm8753_write(codec, WM8753_CLOCK, clock); | 1181 | snd_soc_write(codec, WM8753_CLOCK, clock); |
1229 | 1182 | ||
1230 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) | 1183 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) |
1231 | return -EINVAL; | 1184 | return -EINVAL; |
@@ -1239,8 +1192,8 @@ static int wm8753_mode3_4_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1239 | u16 clock; | 1192 | u16 clock; |
1240 | 1193 | ||
1241 | /* set clk source as mclk */ | 1194 | /* set clk source as mclk */ |
1242 | clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; | 1195 | clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb; |
1243 | wm8753_write(codec, WM8753_CLOCK, clock | 0x4); | 1196 | snd_soc_write(codec, WM8753_CLOCK, clock | 0x4); |
1244 | 1197 | ||
1245 | if (wm8753_hdac_set_dai_fmt(codec_dai, fmt) < 0) | 1198 | if (wm8753_hdac_set_dai_fmt(codec_dai, fmt) < 0) |
1246 | return -EINVAL; | 1199 | return -EINVAL; |
@@ -1252,19 +1205,19 @@ static int wm8753_mode3_4_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
1252 | static int wm8753_mute(struct snd_soc_dai *dai, int mute) | 1205 | static int wm8753_mute(struct snd_soc_dai *dai, int mute) |
1253 | { | 1206 | { |
1254 | struct snd_soc_codec *codec = dai->codec; | 1207 | struct snd_soc_codec *codec = dai->codec; |
1255 | u16 mute_reg = wm8753_read_reg_cache(codec, WM8753_DAC) & 0xfff7; | 1208 | u16 mute_reg = snd_soc_read(codec, WM8753_DAC) & 0xfff7; |
1256 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 1209 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
1257 | 1210 | ||
1258 | /* the digital mute covers the HiFi and Voice DAC's on the WM8753. | 1211 | /* the digital mute covers the HiFi and Voice DAC's on the WM8753. |
1259 | * make sure we check if they are not both active when we mute */ | 1212 | * make sure we check if they are not both active when we mute */ |
1260 | if (mute && wm8753->dai_func == 1) { | 1213 | if (mute && wm8753->dai_func == 1) { |
1261 | if (!codec->active) | 1214 | if (!codec->active) |
1262 | wm8753_write(codec, WM8753_DAC, mute_reg | 0x8); | 1215 | snd_soc_write(codec, WM8753_DAC, mute_reg | 0x8); |
1263 | } else { | 1216 | } else { |
1264 | if (mute) | 1217 | if (mute) |
1265 | wm8753_write(codec, WM8753_DAC, mute_reg | 0x8); | 1218 | snd_soc_write(codec, WM8753_DAC, mute_reg | 0x8); |
1266 | else | 1219 | else |
1267 | wm8753_write(codec, WM8753_DAC, mute_reg); | 1220 | snd_soc_write(codec, WM8753_DAC, mute_reg); |
1268 | } | 1221 | } |
1269 | 1222 | ||
1270 | return 0; | 1223 | return 0; |
@@ -1273,23 +1226,23 @@ static int wm8753_mute(struct snd_soc_dai *dai, int mute) | |||
1273 | static int wm8753_set_bias_level(struct snd_soc_codec *codec, | 1226 | static int wm8753_set_bias_level(struct snd_soc_codec *codec, |
1274 | enum snd_soc_bias_level level) | 1227 | enum snd_soc_bias_level level) |
1275 | { | 1228 | { |
1276 | u16 pwr_reg = wm8753_read_reg_cache(codec, WM8753_PWR1) & 0xfe3e; | 1229 | u16 pwr_reg = snd_soc_read(codec, WM8753_PWR1) & 0xfe3e; |
1277 | 1230 | ||
1278 | switch (level) { | 1231 | switch (level) { |
1279 | case SND_SOC_BIAS_ON: | 1232 | case SND_SOC_BIAS_ON: |
1280 | /* set vmid to 50k and unmute dac */ | 1233 | /* set vmid to 50k and unmute dac */ |
1281 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); | 1234 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); |
1282 | break; | 1235 | break; |
1283 | case SND_SOC_BIAS_PREPARE: | 1236 | case SND_SOC_BIAS_PREPARE: |
1284 | /* set vmid to 5k for quick power up */ | 1237 | /* set vmid to 5k for quick power up */ |
1285 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); | 1238 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); |
1286 | break; | 1239 | break; |
1287 | case SND_SOC_BIAS_STANDBY: | 1240 | case SND_SOC_BIAS_STANDBY: |
1288 | /* mute dac and set vmid to 500k, enable VREF */ | 1241 | /* mute dac and set vmid to 500k, enable VREF */ |
1289 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x0141); | 1242 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x0141); |
1290 | break; | 1243 | break; |
1291 | case SND_SOC_BIAS_OFF: | 1244 | case SND_SOC_BIAS_OFF: |
1292 | wm8753_write(codec, WM8753_PWR1, 0x0001); | 1245 | snd_soc_write(codec, WM8753_PWR1, 0x0001); |
1293 | break; | 1246 | break; |
1294 | } | 1247 | } |
1295 | codec->bias_level = level; | 1248 | codec->bias_level = level; |
@@ -1477,7 +1430,7 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec, | |||
1477 | else | 1430 | else |
1478 | dai->driver = &wm8753_all_dai[(wm8753->dai_func << 1) + 1]; | 1431 | dai->driver = &wm8753_all_dai[(wm8753->dai_func << 1) + 1]; |
1479 | } | 1432 | } |
1480 | wm8753_write(codec, WM8753_IOCTL, wm8753->dai_func); | 1433 | snd_soc_write(codec, WM8753_IOCTL, wm8753->dai_func); |
1481 | } | 1434 | } |
1482 | 1435 | ||
1483 | static void wm8753_work(struct work_struct *work) | 1436 | static void wm8753_work(struct work_struct *work) |
@@ -1495,22 +1448,19 @@ static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state) | |||
1495 | 1448 | ||
1496 | static int wm8753_resume(struct snd_soc_codec *codec) | 1449 | static int wm8753_resume(struct snd_soc_codec *codec) |
1497 | { | 1450 | { |
1451 | u16 *reg_cache = codec->reg_cache; | ||
1498 | int i; | 1452 | int i; |
1499 | u8 data[2]; | ||
1500 | u16 *cache = codec->reg_cache; | ||
1501 | 1453 | ||
1502 | /* Sync reg_cache with the hardware */ | 1454 | /* Sync reg_cache with the hardware */ |
1503 | for (i = 0; i < ARRAY_SIZE(wm8753_reg); i++) { | 1455 | for (i = 1; i < ARRAY_SIZE(wm8753_reg); i++) { |
1504 | if (i + 1 == WM8753_RESET) | 1456 | if (i == WM8753_RESET) |
1505 | continue; | 1457 | continue; |
1506 | 1458 | ||
1507 | /* No point in writing hardware default values back */ | 1459 | /* No point in writing hardware default values back */ |
1508 | if (cache[i] == wm8753_reg[i]) | 1460 | if (reg_cache[i] == wm8753_reg[i]) |
1509 | continue; | 1461 | continue; |
1510 | 1462 | ||
1511 | data[0] = ((i + 1) << 1) | ((cache[i] >> 8) & 0x0001); | 1463 | snd_soc_write(codec, i, reg_cache[i]); |
1512 | data[1] = cache[i] & 0x00ff; | ||
1513 | codec->hw_write(codec->control_data, data, 2); | ||
1514 | } | 1464 | } |
1515 | 1465 | ||
1516 | wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1466 | wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
@@ -1548,7 +1498,7 @@ static int run_delayed_work(struct delayed_work *dwork) | |||
1548 | static int wm8753_probe(struct snd_soc_codec *codec) | 1498 | static int wm8753_probe(struct snd_soc_codec *codec) |
1549 | { | 1499 | { |
1550 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 1500 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
1551 | int ret = 0, reg; | 1501 | int ret; |
1552 | 1502 | ||
1553 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); | 1503 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); |
1554 | 1504 | ||
@@ -1573,26 +1523,16 @@ static int wm8753_probe(struct snd_soc_codec *codec) | |||
1573 | msecs_to_jiffies(caps_charge)); | 1523 | msecs_to_jiffies(caps_charge)); |
1574 | 1524 | ||
1575 | /* set the update bits */ | 1525 | /* set the update bits */ |
1576 | reg = wm8753_read_reg_cache(codec, WM8753_LDAC); | 1526 | snd_soc_update_bits(codec, WM8753_LDAC, 0x0100, 0x0100); |
1577 | wm8753_write(codec, WM8753_LDAC, reg | 0x0100); | 1527 | snd_soc_update_bits(codec, WM8753_RDAC, 0x0100, 0x0100); |
1578 | reg = wm8753_read_reg_cache(codec, WM8753_RDAC); | 1528 | snd_soc_update_bits(codec, WM8753_LDAC, 0x0100, 0x0100); |
1579 | wm8753_write(codec, WM8753_RDAC, reg | 0x0100); | 1529 | snd_soc_update_bits(codec, WM8753_RDAC, 0x0100, 0x0100); |
1580 | reg = wm8753_read_reg_cache(codec, WM8753_LADC); | 1530 | snd_soc_update_bits(codec, WM8753_LOUT1V, 0x0100, 0x0100); |
1581 | wm8753_write(codec, WM8753_LADC, reg | 0x0100); | 1531 | snd_soc_update_bits(codec, WM8753_ROUT1V, 0x0100, 0x0100); |
1582 | reg = wm8753_read_reg_cache(codec, WM8753_RADC); | 1532 | snd_soc_update_bits(codec, WM8753_LOUT2V, 0x0100, 0x0100); |
1583 | wm8753_write(codec, WM8753_RADC, reg | 0x0100); | 1533 | snd_soc_update_bits(codec, WM8753_ROUT2V, 0x0100, 0x0100); |
1584 | reg = wm8753_read_reg_cache(codec, WM8753_LOUT1V); | 1534 | snd_soc_update_bits(codec, WM8753_LINVOL, 0x0100, 0x0100); |
1585 | wm8753_write(codec, WM8753_LOUT1V, reg | 0x0100); | 1535 | snd_soc_update_bits(codec, WM8753_RINVOL, 0x0100, 0x0100); |
1586 | reg = wm8753_read_reg_cache(codec, WM8753_ROUT1V); | ||
1587 | wm8753_write(codec, WM8753_ROUT1V, reg | 0x0100); | ||
1588 | reg = wm8753_read_reg_cache(codec, WM8753_LOUT2V); | ||
1589 | wm8753_write(codec, WM8753_LOUT2V, reg | 0x0100); | ||
1590 | reg = wm8753_read_reg_cache(codec, WM8753_ROUT2V); | ||
1591 | wm8753_write(codec, WM8753_ROUT2V, reg | 0x0100); | ||
1592 | reg = wm8753_read_reg_cache(codec, WM8753_LINVOL); | ||
1593 | wm8753_write(codec, WM8753_LINVOL, reg | 0x0100); | ||
1594 | reg = wm8753_read_reg_cache(codec, WM8753_RINVOL); | ||
1595 | wm8753_write(codec, WM8753_RINVOL, reg | 0x0100); | ||
1596 | 1536 | ||
1597 | snd_soc_add_controls(codec, wm8753_snd_controls, | 1537 | snd_soc_add_controls(codec, wm8753_snd_controls, |
1598 | ARRAY_SIZE(wm8753_snd_controls)); | 1538 | ARRAY_SIZE(wm8753_snd_controls)); |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index fca60a0b57b8..1ec12eff0620 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -50,8 +50,6 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = { | |||
50 | /* codec private data */ | 50 | /* codec private data */ |
51 | struct wm8904_priv { | 51 | struct wm8904_priv { |
52 | 52 | ||
53 | u16 reg_cache[WM8904_MAX_REGISTER + 1]; | ||
54 | |||
55 | enum wm8904_type devtype; | 53 | enum wm8904_type devtype; |
56 | void *control_data; | 54 | void *control_data; |
57 | 55 | ||
@@ -818,7 +816,8 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, | |||
818 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 816 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
819 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 817 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
820 | 818 | ||
821 | return wm8904->deemph; | 819 | ucontrol->value.enumerated.item[0] = wm8904->deemph; |
820 | return 0; | ||
822 | } | 821 | } |
823 | 822 | ||
824 | static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, | 823 | static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, |
@@ -2093,7 +2092,7 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute) | |||
2093 | 2092 | ||
2094 | static void wm8904_sync_cache(struct snd_soc_codec *codec) | 2093 | static void wm8904_sync_cache(struct snd_soc_codec *codec) |
2095 | { | 2094 | { |
2096 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2095 | u16 *reg_cache = codec->reg_cache; |
2097 | int i; | 2096 | int i; |
2098 | 2097 | ||
2099 | if (!codec->cache_sync) | 2098 | if (!codec->cache_sync) |
@@ -2104,14 +2103,14 @@ static void wm8904_sync_cache(struct snd_soc_codec *codec) | |||
2104 | /* Sync back cached values if they're different from the | 2103 | /* Sync back cached values if they're different from the |
2105 | * hardware default. | 2104 | * hardware default. |
2106 | */ | 2105 | */ |
2107 | for (i = 1; i < ARRAY_SIZE(wm8904->reg_cache); i++) { | 2106 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
2108 | if (!wm8904_access[i].writable) | 2107 | if (!wm8904_access[i].writable) |
2109 | continue; | 2108 | continue; |
2110 | 2109 | ||
2111 | if (wm8904->reg_cache[i] == wm8904_reg[i]) | 2110 | if (reg_cache[i] == wm8904_reg[i]) |
2112 | continue; | 2111 | continue; |
2113 | 2112 | ||
2114 | snd_soc_write(codec, i, wm8904->reg_cache[i]); | 2113 | snd_soc_write(codec, i, reg_cache[i]); |
2115 | } | 2114 | } |
2116 | 2115 | ||
2117 | codec->cache_sync = 0; | 2116 | codec->cache_sync = 0; |
@@ -2370,6 +2369,7 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
2370 | { | 2369 | { |
2371 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2370 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
2372 | struct wm8904_pdata *pdata = wm8904->pdata; | 2371 | struct wm8904_pdata *pdata = wm8904->pdata; |
2372 | u16 *reg_cache = codec->reg_cache; | ||
2373 | int ret, i; | 2373 | int ret, i; |
2374 | 2374 | ||
2375 | codec->cache_sync = 1; | 2375 | codec->cache_sync = 1; |
@@ -2436,19 +2436,19 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
2436 | } | 2436 | } |
2437 | 2437 | ||
2438 | /* Change some default settings - latch VU and enable ZC */ | 2438 | /* Change some default settings - latch VU and enable ZC */ |
2439 | wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU; | 2439 | reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU; |
2440 | wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU; | 2440 | reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU; |
2441 | wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU; | 2441 | reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU; |
2442 | wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU; | 2442 | reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU; |
2443 | wm8904->reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU | | 2443 | reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU | |
2444 | WM8904_HPOUTLZC; | 2444 | WM8904_HPOUTLZC; |
2445 | wm8904->reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU | | 2445 | reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU | |
2446 | WM8904_HPOUTRZC; | 2446 | WM8904_HPOUTRZC; |
2447 | wm8904->reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU | | 2447 | reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU | |
2448 | WM8904_LINEOUTLZC; | 2448 | WM8904_LINEOUTLZC; |
2449 | wm8904->reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU | | 2449 | reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU | |
2450 | WM8904_LINEOUTRZC; | 2450 | WM8904_LINEOUTRZC; |
2451 | wm8904->reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE; | 2451 | reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE; |
2452 | 2452 | ||
2453 | /* Apply configuration from the platform data. */ | 2453 | /* Apply configuration from the platform data. */ |
2454 | if (wm8904->pdata) { | 2454 | if (wm8904->pdata) { |
@@ -2456,23 +2456,23 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
2456 | if (!pdata->gpio_cfg[i]) | 2456 | if (!pdata->gpio_cfg[i]) |
2457 | continue; | 2457 | continue; |
2458 | 2458 | ||
2459 | wm8904->reg_cache[WM8904_GPIO_CONTROL_1 + i] | 2459 | reg_cache[WM8904_GPIO_CONTROL_1 + i] |
2460 | = pdata->gpio_cfg[i] & 0xffff; | 2460 | = pdata->gpio_cfg[i] & 0xffff; |
2461 | } | 2461 | } |
2462 | 2462 | ||
2463 | /* Zero is the default value for these anyway */ | 2463 | /* Zero is the default value for these anyway */ |
2464 | for (i = 0; i < WM8904_MIC_REGS; i++) | 2464 | for (i = 0; i < WM8904_MIC_REGS; i++) |
2465 | wm8904->reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] | 2465 | reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] |
2466 | = pdata->mic_cfg[i]; | 2466 | = pdata->mic_cfg[i]; |
2467 | } | 2467 | } |
2468 | 2468 | ||
2469 | /* Set Class W by default - this will be managed by the Class | 2469 | /* Set Class W by default - this will be managed by the Class |
2470 | * G widget at runtime where bypass paths are available. | 2470 | * G widget at runtime where bypass paths are available. |
2471 | */ | 2471 | */ |
2472 | wm8904->reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR; | 2472 | reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR; |
2473 | 2473 | ||
2474 | /* Use normal bias source */ | 2474 | /* Use normal bias source */ |
2475 | wm8904->reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL; | 2475 | reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL; |
2476 | 2476 | ||
2477 | wm8904_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 2477 | wm8904_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
2478 | 2478 | ||
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 2cb16f895c46..23086e2c976a 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -768,6 +768,7 @@ static __devinit int wm8940_i2c_probe(struct i2c_client *i2c, | |||
768 | 768 | ||
769 | i2c_set_clientdata(i2c, wm8940); | 769 | i2c_set_clientdata(i2c, wm8940); |
770 | wm8940->control_data = i2c; | 770 | wm8940->control_data = i2c; |
771 | wm8940->control_type = SND_SOC_I2C; | ||
771 | 772 | ||
772 | ret = snd_soc_register_codec(&i2c->dev, | 773 | ret = snd_soc_register_codec(&i2c->dev, |
773 | &soc_codec_dev_wm8940, &wm8940_dai, 1); | 774 | &soc_codec_dev_wm8940, &wm8940_dai, 1); |
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index f89ad6c9a80b..2ac35b0be86a 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
@@ -42,8 +42,6 @@ static const char *wm8955_supply_names[WM8955_NUM_SUPPLIES] = { | |||
42 | struct wm8955_priv { | 42 | struct wm8955_priv { |
43 | enum snd_soc_control_type control_type; | 43 | enum snd_soc_control_type control_type; |
44 | 44 | ||
45 | u16 reg_cache[WM8955_MAX_REGISTER + 1]; | ||
46 | |||
47 | unsigned int mclk_rate; | 45 | unsigned int mclk_rate; |
48 | 46 | ||
49 | int deemph; | 47 | int deemph; |
@@ -380,7 +378,8 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol, | |||
380 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 378 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
381 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 379 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
382 | 380 | ||
383 | return wm8955->deemph; | 381 | ucontrol->value.enumerated.item[0] = wm8955->deemph; |
382 | return 0; | ||
384 | } | 383 | } |
385 | 384 | ||
386 | static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, | 385 | static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, |
@@ -767,6 +766,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec, | |||
767 | enum snd_soc_bias_level level) | 766 | enum snd_soc_bias_level level) |
768 | { | 767 | { |
769 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 768 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
769 | u16 *reg_cache = codec->reg_cache; | ||
770 | int ret, i; | 770 | int ret, i; |
771 | 771 | ||
772 | switch (level) { | 772 | switch (level) { |
@@ -799,14 +799,14 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec, | |||
799 | /* Sync back cached values if they're | 799 | /* Sync back cached values if they're |
800 | * different from the hardware default. | 800 | * different from the hardware default. |
801 | */ | 801 | */ |
802 | for (i = 0; i < ARRAY_SIZE(wm8955->reg_cache); i++) { | 802 | for (i = 0; i < codec->driver->reg_cache_size; i++) { |
803 | if (i == WM8955_RESET) | 803 | if (i == WM8955_RESET) |
804 | continue; | 804 | continue; |
805 | 805 | ||
806 | if (wm8955->reg_cache[i] == wm8955_reg[i]) | 806 | if (reg_cache[i] == wm8955_reg[i]) |
807 | continue; | 807 | continue; |
808 | 808 | ||
809 | snd_soc_write(codec, i, wm8955->reg_cache[i]); | 809 | snd_soc_write(codec, i, reg_cache[i]); |
810 | } | 810 | } |
811 | 811 | ||
812 | /* Enable VREF and VMID */ | 812 | /* Enable VREF and VMID */ |
@@ -901,6 +901,7 @@ static int wm8955_probe(struct snd_soc_codec *codec) | |||
901 | { | 901 | { |
902 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 902 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
903 | struct wm8955_pdata *pdata = dev_get_platdata(codec->dev); | 903 | struct wm8955_pdata *pdata = dev_get_platdata(codec->dev); |
904 | u16 *reg_cache = codec->reg_cache; | ||
904 | int ret, i; | 905 | int ret, i; |
905 | 906 | ||
906 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type); | 907 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type); |
@@ -933,25 +934,25 @@ static int wm8955_probe(struct snd_soc_codec *codec) | |||
933 | } | 934 | } |
934 | 935 | ||
935 | /* Change some default settings - latch VU and enable ZC */ | 936 | /* Change some default settings - latch VU and enable ZC */ |
936 | wm8955->reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU; | 937 | reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU; |
937 | wm8955->reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU; | 938 | reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU; |
938 | wm8955->reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC; | 939 | reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC; |
939 | wm8955->reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC; | 940 | reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC; |
940 | wm8955->reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC; | 941 | reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC; |
941 | wm8955->reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC; | 942 | reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC; |
942 | wm8955->reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC; | 943 | reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC; |
943 | 944 | ||
944 | /* Also enable adaptive bass boost by default */ | 945 | /* Also enable adaptive bass boost by default */ |
945 | wm8955->reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB; | 946 | reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB; |
946 | 947 | ||
947 | /* Set platform data values */ | 948 | /* Set platform data values */ |
948 | if (pdata) { | 949 | if (pdata) { |
949 | if (pdata->out2_speaker) | 950 | if (pdata->out2_speaker) |
950 | wm8955->reg_cache[WM8955_ADDITIONAL_CONTROL_2] | 951 | reg_cache[WM8955_ADDITIONAL_CONTROL_2] |
951 | |= WM8955_ROUT2INV; | 952 | |= WM8955_ROUT2INV; |
952 | 953 | ||
953 | if (pdata->monoin_diff) | 954 | if (pdata->monoin_diff) |
954 | wm8955->reg_cache[WM8955_MONO_OUT_MIX_1] | 955 | reg_cache[WM8955_MONO_OUT_MIX_1] |
955 | |= WM8955_DMEN; | 956 | |= WM8955_DMEN; |
956 | } | 957 | } |
957 | 958 | ||
@@ -1002,6 +1003,7 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c, | |||
1002 | return -ENOMEM; | 1003 | return -ENOMEM; |
1003 | 1004 | ||
1004 | i2c_set_clientdata(i2c, wm8955); | 1005 | i2c_set_clientdata(i2c, wm8955); |
1006 | wm8955->control_type = SND_SOC_I2C; | ||
1005 | 1007 | ||
1006 | ret = snd_soc_register_codec(&i2c->dev, | 1008 | ret = snd_soc_register_codec(&i2c->dev, |
1007 | &soc_codec_dev_wm8955, &wm8955_dai, 1); | 1009 | &soc_codec_dev_wm8955, &wm8955_dai, 1); |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 8d5efb333c33..ff6ff2f529d2 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -138,7 +138,8 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol, | |||
138 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 138 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
139 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); | 139 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); |
140 | 140 | ||
141 | return wm8960->deemph; | 141 | ucontrol->value.enumerated.item[0] = wm8960->deemph; |
142 | return 0; | ||
142 | } | 143 | } |
143 | 144 | ||
144 | static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, | 145 | static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, |
@@ -1012,6 +1013,7 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c, | |||
1012 | return -ENOMEM; | 1013 | return -ENOMEM; |
1013 | 1014 | ||
1014 | i2c_set_clientdata(i2c, wm8960); | 1015 | i2c_set_clientdata(i2c, wm8960); |
1016 | wm8960->control_type = SND_SOC_I2C; | ||
1015 | wm8960->control_data = i2c; | 1017 | wm8960->control_data = i2c; |
1016 | 1018 | ||
1017 | ret = snd_soc_register_codec(&i2c->dev, | 1019 | ret = snd_soc_register_codec(&i2c->dev, |
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 1304ca91a11c..7c421cc837bd 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -52,8 +52,6 @@ static const char *wm8962_supply_names[WM8962_NUM_SUPPLIES] = { | |||
52 | struct wm8962_priv { | 52 | struct wm8962_priv { |
53 | struct snd_soc_codec *codec; | 53 | struct snd_soc_codec *codec; |
54 | 54 | ||
55 | u16 reg_cache[WM8962_MAX_REGISTER + 1]; | ||
56 | |||
57 | int sysclk; | 55 | int sysclk; |
58 | int sysclk_rate; | 56 | int sysclk_rate; |
59 | 57 | ||
@@ -1991,8 +1989,7 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol, | |||
1991 | struct snd_ctl_elem_value *ucontrol) | 1989 | struct snd_ctl_elem_value *ucontrol) |
1992 | { | 1990 | { |
1993 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1991 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
1994 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 1992 | u16 *reg_cache = codec->reg_cache; |
1995 | u16 *reg_cache = wm8962->reg_cache; | ||
1996 | int ret; | 1993 | int ret; |
1997 | 1994 | ||
1998 | /* Apply the update (if any) */ | 1995 | /* Apply the update (if any) */ |
@@ -2020,8 +2017,7 @@ static int wm8962_put_spk_sw(struct snd_kcontrol *kcontrol, | |||
2020 | struct snd_ctl_elem_value *ucontrol) | 2017 | struct snd_ctl_elem_value *ucontrol) |
2021 | { | 2018 | { |
2022 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 2019 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
2023 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 2020 | u16 *reg_cache = codec->reg_cache; |
2024 | u16 *reg_cache = wm8962->reg_cache; | ||
2025 | int ret; | 2021 | int ret; |
2026 | 2022 | ||
2027 | /* Apply the update (if any) */ | 2023 | /* Apply the update (if any) */ |
@@ -2329,8 +2325,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
2329 | struct snd_kcontrol *kcontrol, int event) | 2325 | struct snd_kcontrol *kcontrol, int event) |
2330 | { | 2326 | { |
2331 | struct snd_soc_codec *codec = w->codec; | 2327 | struct snd_soc_codec *codec = w->codec; |
2332 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 2328 | u16 *reg_cache = codec->reg_cache; |
2333 | u16 *reg_cache = wm8962->reg_cache; | ||
2334 | int reg; | 2329 | int reg; |
2335 | 2330 | ||
2336 | switch (w->shift) { | 2331 | switch (w->shift) { |
@@ -2719,7 +2714,7 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec) | |||
2719 | 2714 | ||
2720 | static void wm8962_sync_cache(struct snd_soc_codec *codec) | 2715 | static void wm8962_sync_cache(struct snd_soc_codec *codec) |
2721 | { | 2716 | { |
2722 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 2717 | u16 *reg_cache = codec->reg_cache; |
2723 | int i; | 2718 | int i; |
2724 | 2719 | ||
2725 | if (!codec->cache_sync) | 2720 | if (!codec->cache_sync) |
@@ -2732,13 +2727,13 @@ static void wm8962_sync_cache(struct snd_soc_codec *codec) | |||
2732 | /* Sync back cached values if they're different from the | 2727 | /* Sync back cached values if they're different from the |
2733 | * hardware default. | 2728 | * hardware default. |
2734 | */ | 2729 | */ |
2735 | for (i = 1; i < ARRAY_SIZE(wm8962->reg_cache); i++) { | 2730 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
2736 | if (i == WM8962_SOFTWARE_RESET) | 2731 | if (i == WM8962_SOFTWARE_RESET) |
2737 | continue; | 2732 | continue; |
2738 | if (wm8962->reg_cache[i] == wm8962_reg[i]) | 2733 | if (reg_cache[i] == wm8962_reg[i]) |
2739 | continue; | 2734 | continue; |
2740 | 2735 | ||
2741 | snd_soc_write(codec, i, wm8962->reg_cache[i]); | 2736 | snd_soc_write(codec, i, reg_cache[i]); |
2742 | } | 2737 | } |
2743 | 2738 | ||
2744 | codec->cache_sync = 0; | 2739 | codec->cache_sync = 0; |
@@ -3406,12 +3401,11 @@ EXPORT_SYMBOL_GPL(wm8962_mic_detect); | |||
3406 | #ifdef CONFIG_PM | 3401 | #ifdef CONFIG_PM |
3407 | static int wm8962_resume(struct snd_soc_codec *codec) | 3402 | static int wm8962_resume(struct snd_soc_codec *codec) |
3408 | { | 3403 | { |
3409 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | ||
3410 | u16 *reg_cache = codec->reg_cache; | 3404 | u16 *reg_cache = codec->reg_cache; |
3411 | int i; | 3405 | int i; |
3412 | 3406 | ||
3413 | /* Restore the registers */ | 3407 | /* Restore the registers */ |
3414 | for (i = 1; i < ARRAY_SIZE(wm8962->reg_cache); i++) { | 3408 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
3415 | switch (i) { | 3409 | switch (i) { |
3416 | case WM8962_SOFTWARE_RESET: | 3410 | case WM8962_SOFTWARE_RESET: |
3417 | continue; | 3411 | continue; |
@@ -3705,6 +3699,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) | |||
3705 | struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); | 3699 | struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); |
3706 | struct i2c_client *i2c = container_of(codec->dev, struct i2c_client, | 3700 | struct i2c_client *i2c = container_of(codec->dev, struct i2c_client, |
3707 | dev); | 3701 | dev); |
3702 | u16 *reg_cache = codec->reg_cache; | ||
3708 | int i, trigger, irq_pol; | 3703 | int i, trigger, irq_pol; |
3709 | 3704 | ||
3710 | wm8962->codec = codec; | 3705 | wm8962->codec = codec; |
@@ -3804,7 +3799,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) | |||
3804 | 3799 | ||
3805 | /* Put the speakers into mono mode? */ | 3800 | /* Put the speakers into mono mode? */ |
3806 | if (pdata->spk_mono) | 3801 | if (pdata->spk_mono) |
3807 | wm8962->reg_cache[WM8962_CLASS_D_CONTROL_2] | 3802 | reg_cache[WM8962_CLASS_D_CONTROL_2] |
3808 | |= WM8962_SPK_MONO; | 3803 | |= WM8962_SPK_MONO; |
3809 | 3804 | ||
3810 | /* Micbias setup, detection enable and detection | 3805 | /* Micbias setup, detection enable and detection |
@@ -3819,16 +3814,16 @@ static int wm8962_probe(struct snd_soc_codec *codec) | |||
3819 | } | 3814 | } |
3820 | 3815 | ||
3821 | /* Latch volume update bits */ | 3816 | /* Latch volume update bits */ |
3822 | wm8962->reg_cache[WM8962_LEFT_INPUT_VOLUME] |= WM8962_IN_VU; | 3817 | reg_cache[WM8962_LEFT_INPUT_VOLUME] |= WM8962_IN_VU; |
3823 | wm8962->reg_cache[WM8962_RIGHT_INPUT_VOLUME] |= WM8962_IN_VU; | 3818 | reg_cache[WM8962_RIGHT_INPUT_VOLUME] |= WM8962_IN_VU; |
3824 | wm8962->reg_cache[WM8962_LEFT_ADC_VOLUME] |= WM8962_ADC_VU; | 3819 | reg_cache[WM8962_LEFT_ADC_VOLUME] |= WM8962_ADC_VU; |
3825 | wm8962->reg_cache[WM8962_RIGHT_ADC_VOLUME] |= WM8962_ADC_VU; | 3820 | reg_cache[WM8962_RIGHT_ADC_VOLUME] |= WM8962_ADC_VU; |
3826 | wm8962->reg_cache[WM8962_LEFT_DAC_VOLUME] |= WM8962_DAC_VU; | 3821 | reg_cache[WM8962_LEFT_DAC_VOLUME] |= WM8962_DAC_VU; |
3827 | wm8962->reg_cache[WM8962_RIGHT_DAC_VOLUME] |= WM8962_DAC_VU; | 3822 | reg_cache[WM8962_RIGHT_DAC_VOLUME] |= WM8962_DAC_VU; |
3828 | wm8962->reg_cache[WM8962_SPKOUTL_VOLUME] |= WM8962_SPKOUT_VU; | 3823 | reg_cache[WM8962_SPKOUTL_VOLUME] |= WM8962_SPKOUT_VU; |
3829 | wm8962->reg_cache[WM8962_SPKOUTR_VOLUME] |= WM8962_SPKOUT_VU; | 3824 | reg_cache[WM8962_SPKOUTR_VOLUME] |= WM8962_SPKOUT_VU; |
3830 | wm8962->reg_cache[WM8962_HPOUTL_VOLUME] |= WM8962_HPOUT_VU; | 3825 | reg_cache[WM8962_HPOUTL_VOLUME] |= WM8962_HPOUT_VU; |
3831 | wm8962->reg_cache[WM8962_HPOUTR_VOLUME] |= WM8962_HPOUT_VU; | 3826 | reg_cache[WM8962_HPOUTR_VOLUME] |= WM8962_HPOUT_VU; |
3832 | 3827 | ||
3833 | wm8962_add_widgets(codec); | 3828 | wm8962_add_widgets(codec); |
3834 | 3829 | ||
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 63f6dbf5d070..9f18db6e167c 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c | |||
@@ -718,6 +718,7 @@ static __devinit int wm8971_i2c_probe(struct i2c_client *i2c, | |||
718 | if (wm8971 == NULL) | 718 | if (wm8971 == NULL) |
719 | return -ENOMEM; | 719 | return -ENOMEM; |
720 | 720 | ||
721 | wm8971->control_type = SND_SOC_I2C; | ||
721 | i2c_set_clientdata(i2c, wm8971); | 722 | i2c_set_clientdata(i2c, wm8971); |
722 | 723 | ||
723 | ret = snd_soc_register_codec(&i2c->dev, | 724 | ret = snd_soc_register_codec(&i2c->dev, |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index ecc7c37180c7..a486670966bd 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -1335,6 +1335,7 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, | |||
1335 | return -ENOMEM; | 1335 | return -ENOMEM; |
1336 | 1336 | ||
1337 | i2c_set_clientdata(i2c, wm9081); | 1337 | i2c_set_clientdata(i2c, wm9081); |
1338 | wm9081->control_type = SND_SOC_I2C; | ||
1338 | wm9081->control_data = i2c; | 1339 | wm9081->control_data = i2c; |
1339 | 1340 | ||
1340 | ret = snd_soc_register_codec(&i2c->dev, | 1341 | ret = snd_soc_register_codec(&i2c->dev, |
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 99c046ba46bb..6e5f64f627cb 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c | |||
@@ -141,7 +141,6 @@ static const u16 wm9090_reg_defaults[] = { | |||
141 | /* This struct is used to save the context */ | 141 | /* This struct is used to save the context */ |
142 | struct wm9090_priv { | 142 | struct wm9090_priv { |
143 | struct mutex mutex; | 143 | struct mutex mutex; |
144 | u16 reg_cache[WM9090_MAX_REGISTER + 1]; | ||
145 | struct wm9090_platform_data pdata; | 144 | struct wm9090_platform_data pdata; |
146 | void *control_data; | 145 | void *control_data; |
147 | }; | 146 | }; |
@@ -552,6 +551,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, | |||
552 | static int wm9090_probe(struct snd_soc_codec *codec) | 551 | static int wm9090_probe(struct snd_soc_codec *codec) |
553 | { | 552 | { |
554 | struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); | 553 | struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); |
554 | u16 *reg_cache = codec->reg_cache; | ||
555 | int ret; | 555 | int ret; |
556 | 556 | ||
557 | codec->control_data = wm9090->control_data; | 557 | codec->control_data = wm9090->control_data; |
@@ -576,22 +576,22 @@ static int wm9090_probe(struct snd_soc_codec *codec) | |||
576 | /* Configure some defaults; they will be written out when we | 576 | /* Configure some defaults; they will be written out when we |
577 | * bring the bias up. | 577 | * bring the bias up. |
578 | */ | 578 | */ |
579 | wm9090->reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU | 579 | reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU |
580 | | WM9090_IN1A_ZC; | 580 | | WM9090_IN1A_ZC; |
581 | wm9090->reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU | 581 | reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU |
582 | | WM9090_IN1B_ZC; | 582 | | WM9090_IN1B_ZC; |
583 | wm9090->reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU | 583 | reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU |
584 | | WM9090_IN2A_ZC; | 584 | | WM9090_IN2A_ZC; |
585 | wm9090->reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU | 585 | reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU |
586 | | WM9090_IN2B_ZC; | 586 | | WM9090_IN2B_ZC; |
587 | wm9090->reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |= | 587 | reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |= |
588 | WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC; | 588 | WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC; |
589 | wm9090->reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |= | 589 | reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |= |
590 | WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC; | 590 | WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC; |
591 | wm9090->reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |= | 591 | reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |= |
592 | WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC; | 592 | WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC; |
593 | 593 | ||
594 | wm9090->reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA; | 594 | reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA; |
595 | 595 | ||
596 | wm9090_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 596 | wm9090_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
597 | 597 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 75ed6491222d..c721502833bc 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -944,6 +944,9 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) | |||
944 | case SND_SOC_DAPM_STREAM_RESUME: | 944 | case SND_SOC_DAPM_STREAM_RESUME: |
945 | sys_power = 1; | 945 | sys_power = 1; |
946 | break; | 946 | break; |
947 | case SND_SOC_DAPM_STREAM_STOP: | ||
948 | sys_power = !!codec->active; | ||
949 | break; | ||
947 | case SND_SOC_DAPM_STREAM_SUSPEND: | 950 | case SND_SOC_DAPM_STREAM_SUSPEND: |
948 | sys_power = 0; | 951 | sys_power = 0; |
949 | break; | 952 | break; |