diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-01-18 07:36:07 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:30:05 -0500 |
commit | 7cda8ba9f4e471dfba914ecf67fd14ebffb17c16 (patch) | |
tree | 5786b450d9099809b974929ea356b444c9f2bc07 /sound | |
parent | 797760ab14db4e82a50c06a9916dd5c6147b415b (diff) |
[ALSA] ice1712, ice1724 - Code clean up
Clean up ice1712/ice1724 codes. The board-specific data is allocated
locally in each code instead of having an ungly union in struct ice1712.
Also, fix coding issues in prodigy_hifi.c.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ice1712/aureon.c | 113 | ||||
-rw-r--r-- | sound/pci/ice1712/ews.c | 91 | ||||
-rw-r--r-- | sound/pci/ice1712/hoontech.c | 183 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.c | 1 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.h | 51 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 1 | ||||
-rw-r--r-- | sound/pci/ice1712/juli.c | 22 | ||||
-rw-r--r-- | sound/pci/ice1712/phase.c | 82 | ||||
-rw-r--r-- | sound/pci/ice1712/prodigy192.c | 35 | ||||
-rw-r--r-- | sound/pci/ice1712/prodigy_hifi.c | 301 | ||||
-rw-r--r-- | sound/pci/ice1712/revo.c | 23 | ||||
-rw-r--r-- | sound/pci/ice1712/se.c | 61 |
12 files changed, 557 insertions, 407 deletions
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 337489187614..868ae291b960 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c | |||
@@ -61,6 +61,15 @@ | |||
61 | #include "aureon.h" | 61 | #include "aureon.h" |
62 | #include <sound/tlv.h> | 62 | #include <sound/tlv.h> |
63 | 63 | ||
64 | /* AC97 register cache for Aureon */ | ||
65 | struct aureon_spec { | ||
66 | unsigned short stac9744[64]; | ||
67 | unsigned int cs8415_mux; | ||
68 | unsigned short master[2]; | ||
69 | unsigned short vol[8]; | ||
70 | unsigned char pca9554_out; | ||
71 | }; | ||
72 | |||
64 | /* WM8770 registers */ | 73 | /* WM8770 registers */ |
65 | #define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */ | 74 | #define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */ |
66 | #define WM_DAC_MASTER_ATTEN 0x08 /* DAC master analog attenuation */ | 75 | #define WM_DAC_MASTER_ATTEN 0x08 /* DAC master analog attenuation */ |
@@ -204,7 +213,8 @@ static int aureon_universe_inmux_get(struct snd_kcontrol *kcontrol, | |||
204 | struct snd_ctl_elem_value *ucontrol) | 213 | struct snd_ctl_elem_value *ucontrol) |
205 | { | 214 | { |
206 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 215 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
207 | ucontrol->value.enumerated.item[0] = ice->spec.aureon.pca9554_out; | 216 | struct aureon_spec *spec = ice->spec; |
217 | ucontrol->value.enumerated.item[0] = spec->pca9554_out; | ||
208 | return 0; | 218 | return 0; |
209 | } | 219 | } |
210 | 220 | ||
@@ -212,6 +222,7 @@ static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol, | |||
212 | struct snd_ctl_elem_value *ucontrol) | 222 | struct snd_ctl_elem_value *ucontrol) |
213 | { | 223 | { |
214 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 224 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
225 | struct aureon_spec *spec = ice->spec; | ||
215 | unsigned char oval, nval; | 226 | unsigned char oval, nval; |
216 | int change; | 227 | int change; |
217 | 228 | ||
@@ -219,10 +230,10 @@ static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol, | |||
219 | if (nval >= 3) | 230 | if (nval >= 3) |
220 | return -EINVAL; | 231 | return -EINVAL; |
221 | snd_ice1712_save_gpio_status(ice); | 232 | snd_ice1712_save_gpio_status(ice); |
222 | oval = ice->spec.aureon.pca9554_out; | 233 | oval = spec->pca9554_out; |
223 | if ((change = (oval != nval))) { | 234 | if ((change = (oval != nval))) { |
224 | aureon_pca9554_write(ice, PCA9554_OUT, nval); | 235 | aureon_pca9554_write(ice, PCA9554_OUT, nval); |
225 | ice->spec.aureon.pca9554_out = nval; | 236 | spec->pca9554_out = nval; |
226 | } | 237 | } |
227 | snd_ice1712_restore_gpio_status(ice); | 238 | snd_ice1712_restore_gpio_status(ice); |
228 | 239 | ||
@@ -233,6 +244,7 @@ static int aureon_universe_inmux_put(struct snd_kcontrol *kcontrol, | |||
233 | static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, | 244 | static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, |
234 | unsigned short val) | 245 | unsigned short val) |
235 | { | 246 | { |
247 | struct aureon_spec *spec = ice->spec; | ||
236 | unsigned int tmp; | 248 | unsigned int tmp; |
237 | 249 | ||
238 | /* Send address to XILINX chip */ | 250 | /* Send address to XILINX chip */ |
@@ -280,12 +292,13 @@ static void aureon_ac97_write(struct snd_ice1712 *ice, unsigned short reg, | |||
280 | udelay(10); | 292 | udelay(10); |
281 | 293 | ||
282 | /* Store the data in out private buffer */ | 294 | /* Store the data in out private buffer */ |
283 | ice->spec.aureon.stac9744[(reg & 0x7F) >> 1] = val; | 295 | spec->stac9744[(reg & 0x7F) >> 1] = val; |
284 | } | 296 | } |
285 | 297 | ||
286 | static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short reg) | 298 | static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short reg) |
287 | { | 299 | { |
288 | return ice->spec.aureon.stac9744[(reg & 0x7F) >> 1]; | 300 | struct aureon_spec *spec = ice->spec; |
301 | return spec->stac9744[(reg & 0x7F) >> 1]; | ||
289 | } | 302 | } |
290 | 303 | ||
291 | /* | 304 | /* |
@@ -293,6 +306,7 @@ static unsigned short aureon_ac97_read(struct snd_ice1712 *ice, unsigned short r | |||
293 | */ | 306 | */ |
294 | static int aureon_ac97_init (struct snd_ice1712 *ice) | 307 | static int aureon_ac97_init (struct snd_ice1712 *ice) |
295 | { | 308 | { |
309 | struct aureon_spec *spec = ice->spec; | ||
296 | int i; | 310 | int i; |
297 | static const unsigned short ac97_defaults[] = { | 311 | static const unsigned short ac97_defaults[] = { |
298 | 0x00, 0x9640, | 312 | 0x00, 0x9640, |
@@ -330,9 +344,9 @@ static int aureon_ac97_init (struct snd_ice1712 *ice) | |||
330 | snd_ice1712_gpio_write(ice, tmp); | 344 | snd_ice1712_gpio_write(ice, tmp); |
331 | udelay(3); | 345 | udelay(3); |
332 | 346 | ||
333 | memset(&ice->spec.aureon.stac9744, 0, sizeof(ice->spec.aureon.stac9744)); | 347 | memset(&spec->stac9744, 0, sizeof(spec->stac9744)); |
334 | for (i=0; ac97_defaults[i] != (unsigned short)-1; i+=2) | 348 | for (i=0; ac97_defaults[i] != (unsigned short)-1; i+=2) |
335 | ice->spec.aureon.stac9744[(ac97_defaults[i]) >> 1] = ac97_defaults[i+1]; | 349 | spec->stac9744[(ac97_defaults[i]) >> 1] = ac97_defaults[i+1]; |
336 | 350 | ||
337 | aureon_ac97_write(ice, AC97_MASTER, 0x0000); // Unmute AC'97 master volume permanently - muting is done by WM8770 | 351 | aureon_ac97_write(ice, AC97_MASTER, 0x0000); // Unmute AC'97 master volume permanently - muting is done by WM8770 |
338 | 352 | ||
@@ -744,15 +758,18 @@ static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
744 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 758 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
745 | { | 759 | { |
746 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 760 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
761 | struct aureon_spec *spec = ice->spec; | ||
747 | int i; | 762 | int i; |
748 | for (i=0; i<2; i++) | 763 | for (i=0; i<2; i++) |
749 | ucontrol->value.integer.value[i] = ice->spec.aureon.master[i] & ~WM_VOL_MUTE; | 764 | ucontrol->value.integer.value[i] = |
765 | spec->master[i] & ~WM_VOL_MUTE; | ||
750 | return 0; | 766 | return 0; |
751 | } | 767 | } |
752 | 768 | ||
753 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 769 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
754 | { | 770 | { |
755 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 771 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
772 | struct aureon_spec *spec = ice->spec; | ||
756 | int ch, change = 0; | 773 | int ch, change = 0; |
757 | 774 | ||
758 | snd_ice1712_save_gpio_status(ice); | 775 | snd_ice1712_save_gpio_status(ice); |
@@ -760,14 +777,14 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
760 | unsigned int vol = ucontrol->value.integer.value[ch]; | 777 | unsigned int vol = ucontrol->value.integer.value[ch]; |
761 | if (vol > WM_VOL_MAX) | 778 | if (vol > WM_VOL_MAX) |
762 | continue; | 779 | continue; |
763 | vol |= ice->spec.aureon.master[ch] & WM_VOL_MUTE; | 780 | vol |= spec->master[ch] & WM_VOL_MUTE; |
764 | if (vol != ice->spec.aureon.master[ch]) { | 781 | if (vol != spec->master[ch]) { |
765 | int dac; | 782 | int dac; |
766 | ice->spec.aureon.master[ch] = vol; | 783 | spec->master[ch] = vol; |
767 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) | 784 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) |
768 | wm_set_vol(ice, WM_DAC_ATTEN + dac + ch, | 785 | wm_set_vol(ice, WM_DAC_ATTEN + dac + ch, |
769 | ice->spec.aureon.vol[dac + ch], | 786 | spec->vol[dac + ch], |
770 | ice->spec.aureon.master[ch]); | 787 | spec->master[ch]); |
771 | change = 1; | 788 | change = 1; |
772 | } | 789 | } |
773 | } | 790 | } |
@@ -791,18 +808,21 @@ static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info * | |||
791 | static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 808 | static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
792 | { | 809 | { |
793 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 810 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
811 | struct aureon_spec *spec = ice->spec; | ||
794 | int i, ofs, voices; | 812 | int i, ofs, voices; |
795 | 813 | ||
796 | voices = kcontrol->private_value >> 8; | 814 | voices = kcontrol->private_value >> 8; |
797 | ofs = kcontrol->private_value & 0xff; | 815 | ofs = kcontrol->private_value & 0xff; |
798 | for (i = 0; i < voices; i++) | 816 | for (i = 0; i < voices; i++) |
799 | ucontrol->value.integer.value[i] = ice->spec.aureon.vol[ofs+i] & ~WM_VOL_MUTE; | 817 | ucontrol->value.integer.value[i] = |
818 | spec->vol[ofs+i] & ~WM_VOL_MUTE; | ||
800 | return 0; | 819 | return 0; |
801 | } | 820 | } |
802 | 821 | ||
803 | static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 822 | static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
804 | { | 823 | { |
805 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 824 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
825 | struct aureon_spec *spec = ice->spec; | ||
806 | int i, idx, ofs, voices; | 826 | int i, idx, ofs, voices; |
807 | int change = 0; | 827 | int change = 0; |
808 | 828 | ||
@@ -813,12 +833,12 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value * | |||
813 | unsigned int vol = ucontrol->value.integer.value[i]; | 833 | unsigned int vol = ucontrol->value.integer.value[i]; |
814 | if (vol > 0x7f) | 834 | if (vol > 0x7f) |
815 | continue; | 835 | continue; |
816 | vol |= ice->spec.aureon.vol[ofs+i]; | 836 | vol |= spec->vol[ofs+i]; |
817 | if (vol != ice->spec.aureon.vol[ofs+i]) { | 837 | if (vol != spec->vol[ofs+i]) { |
818 | ice->spec.aureon.vol[ofs+i] = vol; | 838 | spec->vol[ofs+i] = vol; |
819 | idx = WM_DAC_ATTEN + ofs + i; | 839 | idx = WM_DAC_ATTEN + ofs + i; |
820 | wm_set_vol(ice, idx, ice->spec.aureon.vol[ofs+i], | 840 | wm_set_vol(ice, idx, spec->vol[ofs + i], |
821 | ice->spec.aureon.master[i]); | 841 | spec->master[i]); |
822 | change = 1; | 842 | change = 1; |
823 | } | 843 | } |
824 | } | 844 | } |
@@ -840,19 +860,22 @@ static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info | |||
840 | static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 860 | static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
841 | { | 861 | { |
842 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 862 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
863 | struct aureon_spec *spec = ice->spec; | ||
843 | int voices, ofs, i; | 864 | int voices, ofs, i; |
844 | 865 | ||
845 | voices = kcontrol->private_value >> 8; | 866 | voices = kcontrol->private_value >> 8; |
846 | ofs = kcontrol->private_value & 0xFF; | 867 | ofs = kcontrol->private_value & 0xFF; |
847 | 868 | ||
848 | for (i = 0; i < voices; i++) | 869 | for (i = 0; i < voices; i++) |
849 | ucontrol->value.integer.value[i] = (ice->spec.aureon.vol[ofs+i] & WM_VOL_MUTE) ? 0 : 1; | 870 | ucontrol->value.integer.value[i] = |
871 | (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; | ||
850 | return 0; | 872 | return 0; |
851 | } | 873 | } |
852 | 874 | ||
853 | static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 875 | static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
854 | { | 876 | { |
855 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 877 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
878 | struct aureon_spec *spec = ice->spec; | ||
856 | int change = 0, voices, ofs, i; | 879 | int change = 0, voices, ofs, i; |
857 | 880 | ||
858 | voices = kcontrol->private_value >> 8; | 881 | voices = kcontrol->private_value >> 8; |
@@ -860,13 +883,13 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
860 | 883 | ||
861 | snd_ice1712_save_gpio_status(ice); | 884 | snd_ice1712_save_gpio_status(ice); |
862 | for (i = 0; i < voices; i++) { | 885 | for (i = 0; i < voices; i++) { |
863 | int val = (ice->spec.aureon.vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; | 886 | int val = (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; |
864 | if (ucontrol->value.integer.value[i] != val) { | 887 | if (ucontrol->value.integer.value[i] != val) { |
865 | ice->spec.aureon.vol[ofs + i] &= ~WM_VOL_MUTE; | 888 | spec->vol[ofs + i] &= ~WM_VOL_MUTE; |
866 | ice->spec.aureon.vol[ofs + i] |= | 889 | spec->vol[ofs + i] |= |
867 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; | 890 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; |
868 | wm_set_vol(ice, ofs + i, ice->spec.aureon.vol[ofs + i], | 891 | wm_set_vol(ice, ofs + i, spec->vol[ofs + i], |
869 | ice->spec.aureon.master[i]); | 892 | spec->master[i]); |
870 | change = 1; | 893 | change = 1; |
871 | } | 894 | } |
872 | } | 895 | } |
@@ -883,29 +906,33 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
883 | static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 906 | static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
884 | { | 907 | { |
885 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 908 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
909 | struct aureon_spec *spec = ice->spec; | ||
886 | 910 | ||
887 | ucontrol->value.integer.value[0] = (ice->spec.aureon.master[0] & WM_VOL_MUTE) ? 0 : 1; | 911 | ucontrol->value.integer.value[0] = |
888 | ucontrol->value.integer.value[1] = (ice->spec.aureon.master[1] & WM_VOL_MUTE) ? 0 : 1; | 912 | (spec->master[0] & WM_VOL_MUTE) ? 0 : 1; |
913 | ucontrol->value.integer.value[1] = | ||
914 | (spec->master[1] & WM_VOL_MUTE) ? 0 : 1; | ||
889 | return 0; | 915 | return 0; |
890 | } | 916 | } |
891 | 917 | ||
892 | static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 918 | static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
893 | { | 919 | { |
894 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 920 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
921 | struct aureon_spec *spec = ice->spec; | ||
895 | int change = 0, i; | 922 | int change = 0, i; |
896 | 923 | ||
897 | snd_ice1712_save_gpio_status(ice); | 924 | snd_ice1712_save_gpio_status(ice); |
898 | for (i = 0; i < 2; i++) { | 925 | for (i = 0; i < 2; i++) { |
899 | int val = (ice->spec.aureon.master[i] & WM_VOL_MUTE) ? 0 : 1; | 926 | int val = (spec->master[i] & WM_VOL_MUTE) ? 0 : 1; |
900 | if (ucontrol->value.integer.value[i] != val) { | 927 | if (ucontrol->value.integer.value[i] != val) { |
901 | int dac; | 928 | int dac; |
902 | ice->spec.aureon.master[i] &= ~WM_VOL_MUTE; | 929 | spec->master[i] &= ~WM_VOL_MUTE; |
903 | ice->spec.aureon.master[i] |= | 930 | spec->master[i] |= |
904 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; | 931 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; |
905 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) | 932 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) |
906 | wm_set_vol(ice, WM_DAC_ATTEN + dac + i, | 933 | wm_set_vol(ice, WM_DAC_ATTEN + dac + i, |
907 | ice->spec.aureon.vol[dac + i], | 934 | spec->vol[dac + i], |
908 | ice->spec.aureon.master[i]); | 935 | spec->master[i]); |
909 | change = 1; | 936 | change = 1; |
910 | } | 937 | } |
911 | } | 938 | } |
@@ -1151,10 +1178,11 @@ static int aureon_cs8415_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
1151 | static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1178 | static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1152 | { | 1179 | { |
1153 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1180 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1181 | struct aureon_spec *spec = ice->spec; | ||
1154 | 1182 | ||
1155 | //snd_ice1712_save_gpio_status(ice); | 1183 | //snd_ice1712_save_gpio_status(ice); |
1156 | //val = aureon_cs8415_get(ice, CS8415_CTRL2); | 1184 | //val = aureon_cs8415_get(ice, CS8415_CTRL2); |
1157 | ucontrol->value.enumerated.item[0] = ice->spec.aureon.cs8415_mux; | 1185 | ucontrol->value.enumerated.item[0] = spec->cs8415_mux; |
1158 | //snd_ice1712_restore_gpio_status(ice); | 1186 | //snd_ice1712_restore_gpio_status(ice); |
1159 | return 0; | 1187 | return 0; |
1160 | } | 1188 | } |
@@ -1162,6 +1190,7 @@ static int aureon_cs8415_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
1162 | static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1190 | static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1163 | { | 1191 | { |
1164 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 1192 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
1193 | struct aureon_spec *spec = ice->spec; | ||
1165 | unsigned short oval, nval; | 1194 | unsigned short oval, nval; |
1166 | int change; | 1195 | int change; |
1167 | 1196 | ||
@@ -1173,7 +1202,7 @@ static int aureon_cs8415_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
1173 | if (change) | 1202 | if (change) |
1174 | aureon_cs8415_put(ice, CS8415_CTRL2, nval); | 1203 | aureon_cs8415_put(ice, CS8415_CTRL2, nval); |
1175 | snd_ice1712_restore_gpio_status(ice); | 1204 | snd_ice1712_restore_gpio_status(ice); |
1176 | ice->spec.aureon.cs8415_mux = ucontrol->value.enumerated.item[0]; | 1205 | spec->cs8415_mux = ucontrol->value.enumerated.item[0]; |
1177 | return change; | 1206 | return change; |
1178 | } | 1207 | } |
1179 | 1208 | ||
@@ -2009,10 +2038,16 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) | |||
2009 | 0x0605, /* slave, 24bit, MSB on second OSCLK, SDOUT for right channel when OLRCK is high */ | 2038 | 0x0605, /* slave, 24bit, MSB on second OSCLK, SDOUT for right channel when OLRCK is high */ |
2010 | (unsigned short)-1 | 2039 | (unsigned short)-1 |
2011 | }; | 2040 | }; |
2041 | struct aureon_spec *spec; | ||
2012 | unsigned int tmp; | 2042 | unsigned int tmp; |
2013 | const unsigned short *p; | 2043 | const unsigned short *p; |
2014 | int err, i; | 2044 | int err, i; |
2015 | 2045 | ||
2046 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
2047 | if (!spec) | ||
2048 | return -ENOMEM; | ||
2049 | ice->spec = spec; | ||
2050 | |||
2016 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) { | 2051 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) { |
2017 | ice->num_total_dacs = 6; | 2052 | ice->num_total_dacs = 6; |
2018 | ice->num_total_adcs = 2; | 2053 | ice->num_total_adcs = 2; |
@@ -2063,7 +2098,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) | |||
2063 | ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) { | 2098 | ice->eeprom.subvendor != VT1724_SUBDEVICE_PRODIGY71XT) { |
2064 | for (p = cs_inits; *p != (unsigned short)-1; p++) | 2099 | for (p = cs_inits; *p != (unsigned short)-1; p++) |
2065 | aureon_spi_write(ice, AUREON_CS8415_CS, *p | 0x200000, 24); | 2100 | aureon_spi_write(ice, AUREON_CS8415_CS, *p | 0x200000, 24); |
2066 | ice->spec.aureon.cs8415_mux = 1; | 2101 | spec->cs8415_mux = 1; |
2067 | 2102 | ||
2068 | aureon_set_headphone_amp(ice, 1); | 2103 | aureon_set_headphone_amp(ice, 1); |
2069 | } | 2104 | } |
@@ -2074,11 +2109,11 @@ static int __devinit aureon_init(struct snd_ice1712 *ice) | |||
2074 | aureon_pca9554_write(ice, PCA9554_DIR, 0x00); | 2109 | aureon_pca9554_write(ice, PCA9554_DIR, 0x00); |
2075 | aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */ | 2110 | aureon_pca9554_write(ice, PCA9554_OUT, 0x00); /* internal AUX */ |
2076 | 2111 | ||
2077 | ice->spec.aureon.master[0] = WM_VOL_MUTE; | 2112 | spec->master[0] = WM_VOL_MUTE; |
2078 | ice->spec.aureon.master[1] = WM_VOL_MUTE; | 2113 | spec->master[1] = WM_VOL_MUTE; |
2079 | for (i = 0; i < ice->num_total_dacs; i++) { | 2114 | for (i = 0; i < ice->num_total_dacs; i++) { |
2080 | ice->spec.aureon.vol[i] = WM_VOL_MUTE; | 2115 | spec->vol[i] = WM_VOL_MUTE; |
2081 | wm_set_vol(ice, i, ice->spec.aureon.vol[i], ice->spec.aureon.master[i % 2]); | 2116 | wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); |
2082 | } | 2117 | } |
2083 | 2118 | ||
2084 | return 0; | 2119 | return 0; |
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index 6f65da48e00d..064760d2a027 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c | |||
@@ -44,6 +44,11 @@ enum { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | 46 | ||
47 | /* additional i2c devices for EWS boards */ | ||
48 | struct ews_spec { | ||
49 | struct snd_i2c_device *i2cdevs[3]; | ||
50 | }; | ||
51 | |||
47 | /* | 52 | /* |
48 | * access via i2c mode (for EWX 24/96, EWS 88MT&D) | 53 | * access via i2c mode (for EWX 24/96, EWS 88MT&D) |
49 | */ | 54 | */ |
@@ -141,15 +146,17 @@ static struct snd_i2c_bit_ops snd_ice1712_ewx_cs8427_bit_ops = { | |||
141 | /* AK4524 chip select; address 0x48 bit 0-3 */ | 146 | /* AK4524 chip select; address 0x48 bit 0-3 */ |
142 | static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mask) | 147 | static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mask) |
143 | { | 148 | { |
149 | struct ews_spec *spec = ice->spec; | ||
144 | unsigned char data, ndata; | 150 | unsigned char data, ndata; |
145 | 151 | ||
146 | snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return -EINVAL); | 152 | snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return -EINVAL); |
147 | snd_i2c_lock(ice->i2c); | 153 | snd_i2c_lock(ice->i2c); |
148 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) | 154 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) |
149 | goto __error; | 155 | goto __error; |
150 | ndata = (data & 0xf0) | chip_mask; | 156 | ndata = (data & 0xf0) | chip_mask; |
151 | if (ndata != data) | 157 | if (ndata != data) |
152 | if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &ndata, 1) != 1) | 158 | if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2], &ndata, 1) |
159 | != 1) | ||
153 | goto __error; | 160 | goto __error; |
154 | snd_i2c_unlock(ice->i2c); | 161 | snd_i2c_unlock(ice->i2c); |
155 | return 0; | 162 | return 0; |
@@ -223,6 +230,7 @@ static void dmx6fire_ak4524_lock(struct snd_akm4xxx *ak, int chip) | |||
223 | 230 | ||
224 | static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned char bits) | 231 | static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned char bits) |
225 | { | 232 | { |
233 | struct ews_spec *spec = ice->spec; | ||
226 | unsigned char bytes[2]; | 234 | unsigned char bytes[2]; |
227 | 235 | ||
228 | snd_i2c_lock(ice->i2c); | 236 | snd_i2c_lock(ice->i2c); |
@@ -230,15 +238,18 @@ static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned | |||
230 | case ICE1712_SUBDEVICE_EWS88MT: | 238 | case ICE1712_SUBDEVICE_EWS88MT: |
231 | case ICE1712_SUBDEVICE_EWS88MT_NEW: | 239 | case ICE1712_SUBDEVICE_EWS88MT_NEW: |
232 | case ICE1712_SUBDEVICE_PHASE88: | 240 | case ICE1712_SUBDEVICE_PHASE88: |
233 | if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_CS8404], &bits, 1) != 1) | 241 | if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_CS8404], &bits, 1) |
242 | != 1) | ||
234 | goto _error; | 243 | goto _error; |
235 | break; | 244 | break; |
236 | case ICE1712_SUBDEVICE_EWS88D: | 245 | case ICE1712_SUBDEVICE_EWS88D: |
237 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], bytes, 2) != 2) | 246 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], bytes, 2) |
247 | != 2) | ||
238 | goto _error; | 248 | goto _error; |
239 | if (bits != bytes[1]) { | 249 | if (bits != bytes[1]) { |
240 | bytes[1] = bits; | 250 | bytes[1] = bits; |
241 | if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_88D], bytes, 2) != 2) | 251 | if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D], |
252 | bytes, 2) != 2) | ||
242 | goto _error; | 253 | goto _error; |
243 | } | 254 | } |
244 | break; | 255 | break; |
@@ -411,6 +422,7 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice) | |||
411 | { | 422 | { |
412 | int err; | 423 | int err; |
413 | struct snd_akm4xxx *ak; | 424 | struct snd_akm4xxx *ak; |
425 | struct ews_spec *spec; | ||
414 | 426 | ||
415 | /* set the analog DACs */ | 427 | /* set the analog DACs */ |
416 | switch (ice->eeprom.subvendor) { | 428 | switch (ice->eeprom.subvendor) { |
@@ -435,6 +447,11 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice) | |||
435 | break; | 447 | break; |
436 | } | 448 | } |
437 | 449 | ||
450 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
451 | if (!spec) | ||
452 | return -ENOMEM; | ||
453 | ice->spec = spec; | ||
454 | |||
438 | /* create i2c */ | 455 | /* create i2c */ |
439 | if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { | 456 | if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { |
440 | snd_printk(KERN_ERR "unable to create I2C bus\n"); | 457 | snd_printk(KERN_ERR "unable to create I2C bus\n"); |
@@ -446,7 +463,10 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice) | |||
446 | /* create i2c devices */ | 463 | /* create i2c devices */ |
447 | switch (ice->eeprom.subvendor) { | 464 | switch (ice->eeprom.subvendor) { |
448 | case ICE1712_SUBDEVICE_DMX6FIRE: | 465 | case ICE1712_SUBDEVICE_DMX6FIRE: |
449 | if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", ICE1712_6FIRE_PCF9554_ADDR, &ice->spec.i2cdevs[EWS_I2C_6FIRE])) < 0) { | 466 | err = snd_i2c_device_create(ice->i2c, "PCF9554", |
467 | ICE1712_6FIRE_PCF9554_ADDR, | ||
468 | &spec->i2cdevs[EWS_I2C_6FIRE]); | ||
469 | if (err < 0) { | ||
450 | snd_printk(KERN_ERR "PCF9554 initialization failed\n"); | 470 | snd_printk(KERN_ERR "PCF9554 initialization failed\n"); |
451 | return err; | 471 | return err; |
452 | } | 472 | } |
@@ -455,18 +475,30 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice) | |||
455 | case ICE1712_SUBDEVICE_EWS88MT: | 475 | case ICE1712_SUBDEVICE_EWS88MT: |
456 | case ICE1712_SUBDEVICE_EWS88MT_NEW: | 476 | case ICE1712_SUBDEVICE_EWS88MT_NEW: |
457 | case ICE1712_SUBDEVICE_PHASE88: | 477 | case ICE1712_SUBDEVICE_PHASE88: |
458 | if ((err = snd_i2c_device_create(ice->i2c, "CS8404", ICE1712_EWS88MT_CS8404_ADDR, &ice->spec.i2cdevs[EWS_I2C_CS8404])) < 0) | 478 | err = snd_i2c_device_create(ice->i2c, "CS8404", |
479 | ICE1712_EWS88MT_CS8404_ADDR, | ||
480 | &spec->i2cdevs[EWS_I2C_CS8404]); | ||
481 | if (err < 0) | ||
459 | return err; | 482 | return err; |
460 | if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", ICE1712_EWS88MT_INPUT_ADDR, &ice->spec.i2cdevs[EWS_I2C_PCF1])) < 0) | 483 | err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", |
484 | ICE1712_EWS88MT_INPUT_ADDR, | ||
485 | &spec->i2cdevs[EWS_I2C_PCF1]); | ||
486 | if (err < 0) | ||
461 | return err; | 487 | return err; |
462 | if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", ICE1712_EWS88MT_OUTPUT_ADDR, &ice->spec.i2cdevs[EWS_I2C_PCF2])) < 0) | 488 | err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", |
489 | ICE1712_EWS88MT_OUTPUT_ADDR, | ||
490 | &spec->i2cdevs[EWS_I2C_PCF2]); | ||
491 | if (err < 0) | ||
463 | return err; | 492 | return err; |
464 | /* Check if the front module is connected */ | 493 | /* Check if the front module is connected */ |
465 | if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0) | 494 | if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0) |
466 | return err; | 495 | return err; |
467 | break; | 496 | break; |
468 | case ICE1712_SUBDEVICE_EWS88D: | 497 | case ICE1712_SUBDEVICE_EWS88D: |
469 | if ((err = snd_i2c_device_create(ice->i2c, "PCF8575", ICE1712_EWS88D_PCF_ADDR, &ice->spec.i2cdevs[EWS_I2C_88D])) < 0) | 498 | err = snd_i2c_device_create(ice->i2c, "PCF8575", |
499 | ICE1712_EWS88D_PCF_ADDR, | ||
500 | &spec->i2cdevs[EWS_I2C_88D]); | ||
501 | if (err < 0) | ||
470 | return err; | 502 | return err; |
471 | break; | 503 | break; |
472 | } | 504 | } |
@@ -506,7 +538,7 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice) | |||
506 | } | 538 | } |
507 | 539 | ||
508 | /* analog section */ | 540 | /* analog section */ |
509 | ak = ice->akm = kmalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | 541 | ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); |
510 | if (! ak) | 542 | if (! ak) |
511 | return -ENOMEM; | 543 | return -ENOMEM; |
512 | ice->akm_codecs = 1; | 544 | ice->akm_codecs = 1; |
@@ -604,10 +636,11 @@ static struct snd_kcontrol_new snd_ice1712_ewx2496_controls[] __devinitdata = { | |||
604 | static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 636 | static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
605 | { | 637 | { |
606 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 638 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
639 | struct ews_spec *spec = ice->spec; | ||
607 | unsigned char data; | 640 | unsigned char data; |
608 | 641 | ||
609 | snd_i2c_lock(ice->i2c); | 642 | snd_i2c_lock(ice->i2c); |
610 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) { | 643 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) { |
611 | snd_i2c_unlock(ice->i2c); | 644 | snd_i2c_unlock(ice->i2c); |
612 | return -EIO; | 645 | return -EIO; |
613 | } | 646 | } |
@@ -620,15 +653,17 @@ static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, s | |||
620 | static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 653 | static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
621 | { | 654 | { |
622 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 655 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
656 | struct ews_spec *spec = ice->spec; | ||
623 | unsigned char data, ndata; | 657 | unsigned char data, ndata; |
624 | 658 | ||
625 | snd_i2c_lock(ice->i2c); | 659 | snd_i2c_lock(ice->i2c); |
626 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) { | 660 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) { |
627 | snd_i2c_unlock(ice->i2c); | 661 | snd_i2c_unlock(ice->i2c); |
628 | return -EIO; | 662 | return -EIO; |
629 | } | 663 | } |
630 | ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0); | 664 | ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0); |
631 | if (ndata != data && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF2], &ndata, 1) != 1) { | 665 | if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2], |
666 | &ndata, 1) != 1) { | ||
632 | snd_i2c_unlock(ice->i2c); | 667 | snd_i2c_unlock(ice->i2c); |
633 | return -EIO; | 668 | return -EIO; |
634 | } | 669 | } |
@@ -640,12 +675,13 @@ static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, s | |||
640 | static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 675 | static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
641 | { | 676 | { |
642 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 677 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
678 | struct ews_spec *spec = ice->spec; | ||
643 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 679 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
644 | unsigned char data; | 680 | unsigned char data; |
645 | 681 | ||
646 | snd_assert(channel >= 0 && channel <= 7, return 0); | 682 | snd_assert(channel >= 0 && channel <= 7, return 0); |
647 | snd_i2c_lock(ice->i2c); | 683 | snd_i2c_lock(ice->i2c); |
648 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { | 684 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { |
649 | snd_i2c_unlock(ice->i2c); | 685 | snd_i2c_unlock(ice->i2c); |
650 | return -EIO; | 686 | return -EIO; |
651 | } | 687 | } |
@@ -659,17 +695,19 @@ static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, st | |||
659 | static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 695 | static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
660 | { | 696 | { |
661 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 697 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
698 | struct ews_spec *spec = ice->spec; | ||
662 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 699 | int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
663 | unsigned char data, ndata; | 700 | unsigned char data, ndata; |
664 | 701 | ||
665 | snd_assert(channel >= 0 && channel <= 7, return 0); | 702 | snd_assert(channel >= 0 && channel <= 7, return 0); |
666 | snd_i2c_lock(ice->i2c); | 703 | snd_i2c_lock(ice->i2c); |
667 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { | 704 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) { |
668 | snd_i2c_unlock(ice->i2c); | 705 | snd_i2c_unlock(ice->i2c); |
669 | return -EIO; | 706 | return -EIO; |
670 | } | 707 | } |
671 | ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel)); | 708 | ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel)); |
672 | if (ndata != data && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_PCF1], &ndata, 1) != 1) { | 709 | if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF1], |
710 | &ndata, 1) != 1) { | ||
673 | snd_i2c_unlock(ice->i2c); | 711 | snd_i2c_unlock(ice->i2c); |
674 | return -EIO; | 712 | return -EIO; |
675 | } | 713 | } |
@@ -704,12 +742,13 @@ static struct snd_kcontrol_new snd_ice1712_ews88mt_output_sense __devinitdata = | |||
704 | static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 742 | static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
705 | { | 743 | { |
706 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 744 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
745 | struct ews_spec *spec = ice->spec; | ||
707 | int shift = kcontrol->private_value & 0xff; | 746 | int shift = kcontrol->private_value & 0xff; |
708 | int invert = (kcontrol->private_value >> 8) & 1; | 747 | int invert = (kcontrol->private_value >> 8) & 1; |
709 | unsigned char data[2]; | 748 | unsigned char data[2]; |
710 | 749 | ||
711 | snd_i2c_lock(ice->i2c); | 750 | snd_i2c_lock(ice->i2c); |
712 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) { | 751 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) { |
713 | snd_i2c_unlock(ice->i2c); | 752 | snd_i2c_unlock(ice->i2c); |
714 | return -EIO; | 753 | return -EIO; |
715 | } | 754 | } |
@@ -724,13 +763,14 @@ static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct | |||
724 | static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 763 | static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
725 | { | 764 | { |
726 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 765 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
766 | struct ews_spec *spec = ice->spec; | ||
727 | int shift = kcontrol->private_value & 0xff; | 767 | int shift = kcontrol->private_value & 0xff; |
728 | int invert = (kcontrol->private_value >> 8) & 1; | 768 | int invert = (kcontrol->private_value >> 8) & 1; |
729 | unsigned char data[2], ndata[2]; | 769 | unsigned char data[2], ndata[2]; |
730 | int change; | 770 | int change; |
731 | 771 | ||
732 | snd_i2c_lock(ice->i2c); | 772 | snd_i2c_lock(ice->i2c); |
733 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) { | 773 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) { |
734 | snd_i2c_unlock(ice->i2c); | 774 | snd_i2c_unlock(ice->i2c); |
735 | return -EIO; | 775 | return -EIO; |
736 | } | 776 | } |
@@ -743,7 +783,8 @@ static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct | |||
743 | ndata[shift >> 3] |= (1 << (shift & 7)); | 783 | ndata[shift >> 3] |= (1 << (shift & 7)); |
744 | } | 784 | } |
745 | change = (data[shift >> 3] != ndata[shift >> 3]); | 785 | change = (data[shift >> 3] != ndata[shift >> 3]); |
746 | if (change && snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_88D], data, 2) != 2) { | 786 | if (change && |
787 | snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) { | ||
747 | snd_i2c_unlock(ice->i2c); | 788 | snd_i2c_unlock(ice->i2c); |
748 | return -EIO; | 789 | return -EIO; |
749 | } | 790 | } |
@@ -777,11 +818,13 @@ static struct snd_kcontrol_new snd_ice1712_ews88d_controls[] __devinitdata = { | |||
777 | static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg) | 818 | static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg) |
778 | { | 819 | { |
779 | unsigned char byte; | 820 | unsigned char byte; |
821 | struct ews_spec *spec = ice->spec; | ||
822 | |||
780 | snd_i2c_lock(ice->i2c); | 823 | snd_i2c_lock(ice->i2c); |
781 | byte = reg; | 824 | byte = reg; |
782 | snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1); | 825 | snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1); |
783 | byte = 0; | 826 | byte = 0; |
784 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { | 827 | if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { |
785 | snd_i2c_unlock(ice->i2c); | 828 | snd_i2c_unlock(ice->i2c); |
786 | printk(KERN_ERR "cannot read pca\n"); | 829 | printk(KERN_ERR "cannot read pca\n"); |
787 | return -EIO; | 830 | return -EIO; |
@@ -793,10 +836,12 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg | |||
793 | static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data) | 836 | static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data) |
794 | { | 837 | { |
795 | unsigned char bytes[2]; | 838 | unsigned char bytes[2]; |
839 | struct ews_spec *spec = ice->spec; | ||
840 | |||
796 | snd_i2c_lock(ice->i2c); | 841 | snd_i2c_lock(ice->i2c); |
797 | bytes[0] = reg; | 842 | bytes[0] = reg; |
798 | bytes[1] = data; | 843 | bytes[1] = data; |
799 | if (snd_i2c_sendbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], bytes, 2) != 2) { | 844 | if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], bytes, 2) != 2) { |
800 | snd_i2c_unlock(ice->i2c); | 845 | snd_i2c_unlock(ice->i2c); |
801 | return -EIO; | 846 | return -EIO; |
802 | } | 847 | } |
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index b042e5cfc3cd..cf5c7c0898fd 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c | |||
@@ -33,6 +33,12 @@ | |||
33 | #include "ice1712.h" | 33 | #include "ice1712.h" |
34 | #include "hoontech.h" | 34 | #include "hoontech.h" |
35 | 35 | ||
36 | /* Hoontech-specific setting */ | ||
37 | struct hoontech_spec { | ||
38 | unsigned char boxbits[4]; | ||
39 | unsigned int config; | ||
40 | unsigned short boxconfig[4]; | ||
41 | }; | ||
36 | 42 | ||
37 | static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte) | 43 | static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte) |
38 | { | 44 | { |
@@ -49,169 +55,182 @@ static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, un | |||
49 | 55 | ||
50 | static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) | 56 | static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) |
51 | { | 57 | { |
58 | struct hoontech_spec *spec = ice->spec; | ||
52 | mutex_lock(&ice->gpio_mutex); | 59 | mutex_lock(&ice->gpio_mutex); |
53 | ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, activate); | 60 | ICE1712_STDSP24_0_DAREAR(spec->boxbits, activate); |
54 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); | 61 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); |
55 | mutex_unlock(&ice->gpio_mutex); | 62 | mutex_unlock(&ice->gpio_mutex); |
56 | } | 63 | } |
57 | 64 | ||
58 | static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) | 65 | static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) |
59 | { | 66 | { |
67 | struct hoontech_spec *spec = ice->spec; | ||
60 | mutex_lock(&ice->gpio_mutex); | 68 | mutex_lock(&ice->gpio_mutex); |
61 | ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, activate); | 69 | ICE1712_STDSP24_3_MUTE(spec->boxbits, activate); |
62 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 70 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
63 | mutex_unlock(&ice->gpio_mutex); | 71 | mutex_unlock(&ice->gpio_mutex); |
64 | } | 72 | } |
65 | 73 | ||
66 | static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) | 74 | static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) |
67 | { | 75 | { |
76 | struct hoontech_spec *spec = ice->spec; | ||
68 | mutex_lock(&ice->gpio_mutex); | 77 | mutex_lock(&ice->gpio_mutex); |
69 | ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, activate); | 78 | ICE1712_STDSP24_3_INSEL(spec->boxbits, activate); |
70 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 79 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
71 | mutex_unlock(&ice->gpio_mutex); | 80 | mutex_unlock(&ice->gpio_mutex); |
72 | } | 81 | } |
73 | 82 | ||
74 | static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) | 83 | static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) |
75 | { | 84 | { |
85 | struct hoontech_spec *spec = ice->spec; | ||
86 | |||
76 | mutex_lock(&ice->gpio_mutex); | 87 | mutex_lock(&ice->gpio_mutex); |
77 | 88 | ||
78 | /* select box */ | 89 | /* select box */ |
79 | ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); | 90 | ICE1712_STDSP24_0_BOX(spec->boxbits, box); |
80 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); | 91 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); |
81 | 92 | ||
82 | /* prepare for write */ | 93 | /* prepare for write */ |
83 | if (chn == 3) | 94 | if (chn == 3) |
84 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 0); | 95 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 0); |
85 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, activate); | 96 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, activate); |
86 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 97 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
87 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 98 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
88 | 99 | ||
89 | ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); | 100 | ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); |
90 | ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); | 101 | ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); |
91 | ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); | 102 | ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); |
92 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); | 103 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); |
93 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); | 104 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); |
94 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 105 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
95 | udelay(100); | 106 | udelay(100); |
96 | if (chn == 3) { | 107 | if (chn == 3) { |
97 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 0); | 108 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 0); |
98 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 109 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
99 | } else { | 110 | } else { |
100 | switch (chn) { | 111 | switch (chn) { |
101 | case 0: ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 0); break; | 112 | case 0: ICE1712_STDSP24_1_CHN1(spec->boxbits, 0); break; |
102 | case 1: ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 0); break; | 113 | case 1: ICE1712_STDSP24_1_CHN2(spec->boxbits, 0); break; |
103 | case 2: ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 0); break; | 114 | case 2: ICE1712_STDSP24_1_CHN3(spec->boxbits, 0); break; |
104 | } | 115 | } |
105 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); | 116 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); |
106 | } | 117 | } |
107 | udelay(100); | 118 | udelay(100); |
108 | ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); | 119 | ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); |
109 | ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); | 120 | ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); |
110 | ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); | 121 | ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); |
111 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); | 122 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); |
112 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); | 123 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); |
113 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 124 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
114 | udelay(100); | 125 | udelay(100); |
115 | 126 | ||
116 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0); | 127 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0); |
117 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 128 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
118 | 129 | ||
119 | mutex_unlock(&ice->gpio_mutex); | 130 | mutex_unlock(&ice->gpio_mutex); |
120 | } | 131 | } |
121 | 132 | ||
122 | static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) | 133 | static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) |
123 | { | 134 | { |
135 | struct hoontech_spec *spec = ice->spec; | ||
136 | |||
124 | mutex_lock(&ice->gpio_mutex); | 137 | mutex_lock(&ice->gpio_mutex); |
125 | 138 | ||
126 | /* select box */ | 139 | /* select box */ |
127 | ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); | 140 | ICE1712_STDSP24_0_BOX(spec->boxbits, box); |
128 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); | 141 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); |
129 | 142 | ||
130 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); | 143 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); |
131 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, master); | 144 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, master); |
132 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 145 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
133 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 146 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
134 | 147 | ||
135 | udelay(100); | 148 | udelay(100); |
136 | 149 | ||
137 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 0); | 150 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 0); |
138 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 151 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
139 | 152 | ||
140 | mdelay(10); | 153 | mdelay(10); |
141 | 154 | ||
142 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); | 155 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); |
143 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 156 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
144 | 157 | ||
145 | mutex_unlock(&ice->gpio_mutex); | 158 | mutex_unlock(&ice->gpio_mutex); |
146 | } | 159 | } |
147 | 160 | ||
148 | static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) | 161 | static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) |
149 | { | 162 | { |
163 | struct hoontech_spec *spec = ice->spec; | ||
150 | mutex_lock(&ice->gpio_mutex); | 164 | mutex_lock(&ice->gpio_mutex); |
151 | ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, activate); | 165 | ICE1712_STDSP24_3_MIDI2(spec->boxbits, activate); |
152 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 166 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
153 | mutex_unlock(&ice->gpio_mutex); | 167 | mutex_unlock(&ice->gpio_mutex); |
154 | } | 168 | } |
155 | 169 | ||
156 | static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice) | 170 | static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice) |
157 | { | 171 | { |
172 | struct hoontech_spec *spec; | ||
158 | int box, chn; | 173 | int box, chn; |
159 | 174 | ||
160 | ice->num_total_dacs = 8; | 175 | ice->num_total_dacs = 8; |
161 | ice->num_total_adcs = 8; | 176 | ice->num_total_adcs = 8; |
162 | 177 | ||
163 | ice->spec.hoontech.boxbits[0] = | 178 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
164 | ice->spec.hoontech.boxbits[1] = | 179 | if (!spec) |
165 | ice->spec.hoontech.boxbits[2] = | 180 | return -ENOMEM; |
166 | ice->spec.hoontech.boxbits[3] = 0; /* should be already */ | 181 | ice->spec = spec; |
167 | 182 | ||
168 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 0); | 183 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 0); |
169 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 0, 1); | 184 | ICE1712_STDSP24_CLOCK(spec->boxbits, 0, 1); |
170 | ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, 0); | 185 | ICE1712_STDSP24_0_BOX(spec->boxbits, 0); |
171 | ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, 0); | 186 | ICE1712_STDSP24_0_DAREAR(spec->boxbits, 0); |
172 | 187 | ||
173 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 1); | 188 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 1); |
174 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 1, 1); | 189 | ICE1712_STDSP24_CLOCK(spec->boxbits, 1, 1); |
175 | ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); | 190 | ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); |
176 | ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); | 191 | ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); |
177 | ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); | 192 | ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); |
178 | 193 | ||
179 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 2); | 194 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 2); |
180 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 2, 1); | 195 | ICE1712_STDSP24_CLOCK(spec->boxbits, 2, 1); |
181 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); | 196 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); |
182 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); | 197 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); |
183 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0); | 198 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0); |
184 | 199 | ||
185 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 3); | 200 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 3); |
186 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 3, 1); | 201 | ICE1712_STDSP24_CLOCK(spec->boxbits, 3, 1); |
187 | ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, 0); | 202 | ICE1712_STDSP24_3_MIDI2(spec->boxbits, 0); |
188 | ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, 1); | 203 | ICE1712_STDSP24_3_MUTE(spec->boxbits, 1); |
189 | ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, 0); | 204 | ICE1712_STDSP24_3_INSEL(spec->boxbits, 0); |
190 | 205 | ||
191 | /* let's go - activate only functions in first box */ | 206 | /* let's go - activate only functions in first box */ |
192 | ice->spec.hoontech.config = 0; | 207 | spec->config = 0; |
193 | /* ICE1712_STDSP24_MUTE | | 208 | /* ICE1712_STDSP24_MUTE | |
194 | ICE1712_STDSP24_INSEL | | 209 | ICE1712_STDSP24_INSEL | |
195 | ICE1712_STDSP24_DAREAR; */ | 210 | ICE1712_STDSP24_DAREAR; */ |
196 | ice->spec.hoontech.boxconfig[0] = ICE1712_STDSP24_BOX_CHN1 | | 211 | spec->boxconfig[0] = ICE1712_STDSP24_BOX_CHN1 | |
197 | ICE1712_STDSP24_BOX_CHN2 | | 212 | ICE1712_STDSP24_BOX_CHN2 | |
198 | ICE1712_STDSP24_BOX_CHN3 | | 213 | ICE1712_STDSP24_BOX_CHN3 | |
199 | ICE1712_STDSP24_BOX_CHN4 | | 214 | ICE1712_STDSP24_BOX_CHN4 | |
200 | ICE1712_STDSP24_BOX_MIDI1 | | 215 | ICE1712_STDSP24_BOX_MIDI1 | |
201 | ICE1712_STDSP24_BOX_MIDI2; | 216 | ICE1712_STDSP24_BOX_MIDI2; |
202 | ice->spec.hoontech.boxconfig[1] = | 217 | spec->boxconfig[1] = |
203 | ice->spec.hoontech.boxconfig[2] = | 218 | spec->boxconfig[2] = |
204 | ice->spec.hoontech.boxconfig[3] = 0; | 219 | spec->boxconfig[3] = 0; |
205 | snd_ice1712_stdsp24_darear(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_DAREAR) ? 1 : 0); | 220 | snd_ice1712_stdsp24_darear(ice, |
206 | snd_ice1712_stdsp24_mute(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_MUTE) ? 1 : 0); | 221 | (spec->config & ICE1712_STDSP24_DAREAR) ? 1 : 0); |
207 | snd_ice1712_stdsp24_insel(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_INSEL) ? 1 : 0); | 222 | snd_ice1712_stdsp24_mute(ice, |
223 | (spec->config & ICE1712_STDSP24_MUTE) ? 1 : 0); | ||
224 | snd_ice1712_stdsp24_insel(ice, | ||
225 | (spec->config & ICE1712_STDSP24_INSEL) ? 1 : 0); | ||
208 | for (box = 0; box < 1; box++) { | 226 | for (box = 0; box < 1; box++) { |
209 | if (ice->spec.hoontech.boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) | 227 | if (spec->boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) |
210 | snd_ice1712_stdsp24_midi2(ice, 1); | 228 | snd_ice1712_stdsp24_midi2(ice, 1); |
211 | for (chn = 0; chn < 4; chn++) | 229 | for (chn = 0; chn < 4; chn++) |
212 | snd_ice1712_stdsp24_box_channel(ice, box, chn, (ice->spec.hoontech.boxconfig[box] & (1 << chn)) ? 1 : 0); | 230 | snd_ice1712_stdsp24_box_channel(ice, box, chn, |
231 | (spec->boxconfig[box] & (1 << chn)) ? 1 : 0); | ||
213 | snd_ice1712_stdsp24_box_midi(ice, box, | 232 | snd_ice1712_stdsp24_box_midi(ice, box, |
214 | (ice->spec.hoontech.boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0); | 233 | (spec->boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0); |
215 | } | 234 | } |
216 | 235 | ||
217 | return 0; | 236 | return 0; |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 47d77376bcd5..df292af67381 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -2490,6 +2490,7 @@ static int snd_ice1712_free(struct snd_ice1712 *ice) | |||
2490 | pci_release_regions(ice->pci); | 2490 | pci_release_regions(ice->pci); |
2491 | snd_ice1712_akm4xxx_free(ice); | 2491 | snd_ice1712_akm4xxx_free(ice); |
2492 | pci_disable_device(ice->pci); | 2492 | pci_disable_device(ice->pci); |
2493 | kfree(ice->spec); | ||
2493 | kfree(ice); | 2494 | kfree(ice); |
2494 | return 0; | 2495 | return 0; |
2495 | } | 2496 | } |
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 86e418e0b3ef..303cffe08bd8 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h | |||
@@ -366,56 +366,7 @@ struct snd_ice1712 { | |||
366 | struct mutex gpio_mutex; | 366 | struct mutex gpio_mutex; |
367 | 367 | ||
368 | /* other board-specific data */ | 368 | /* other board-specific data */ |
369 | union { | 369 | void *spec; |
370 | /* additional i2c devices for EWS boards */ | ||
371 | struct snd_i2c_device *i2cdevs[3]; | ||
372 | /* AC97 register cache for Aureon */ | ||
373 | struct aureon_spec { | ||
374 | unsigned short stac9744[64]; | ||
375 | unsigned int cs8415_mux; | ||
376 | unsigned short master[2]; | ||
377 | unsigned short vol[8]; | ||
378 | unsigned char pca9554_out; | ||
379 | } aureon; | ||
380 | /* AC97 register cache for Phase28 */ | ||
381 | struct phase28_spec { | ||
382 | unsigned short master[2]; | ||
383 | unsigned short vol[8]; | ||
384 | } phase28; | ||
385 | /* a non-standard I2C device for revo51 */ | ||
386 | struct revo51_spec { | ||
387 | struct snd_i2c_device *dev; | ||
388 | struct snd_pt2258 *pt2258; | ||
389 | } revo51; | ||
390 | /* Hoontech-specific setting */ | ||
391 | struct hoontech_spec { | ||
392 | unsigned char boxbits[4]; | ||
393 | unsigned int config; | ||
394 | unsigned short boxconfig[4]; | ||
395 | } hoontech; | ||
396 | struct { | ||
397 | struct ak4114 *ak4114; | ||
398 | unsigned int analog: 1; | ||
399 | } juli; | ||
400 | struct { | ||
401 | struct ak4114 *ak4114; | ||
402 | /* rate change needs atomic mute/unmute of all dacs*/ | ||
403 | struct mutex mute_mutex; | ||
404 | } prodigy192; | ||
405 | struct { | ||
406 | struct { | ||
407 | unsigned char ch1, ch2; | ||
408 | } vol[8]; | ||
409 | } se; | ||
410 | struct prodigy_hifi_spec { | ||
411 | unsigned short master[2]; | ||
412 | unsigned short vol[8]; | ||
413 | } prodigy_hifi; | ||
414 | struct prodigy_hd2_spec { | ||
415 | unsigned short vol[2]; | ||
416 | } prodigy_hd2; | ||
417 | } spec; | ||
418 | |||
419 | }; | 370 | }; |
420 | 371 | ||
421 | 372 | ||
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index c89a4fe72a49..f533850ec6e7 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -2176,6 +2176,7 @@ static int snd_vt1724_free(struct snd_ice1712 *ice) | |||
2176 | pci_release_regions(ice->pci); | 2176 | pci_release_regions(ice->pci); |
2177 | snd_ice1712_akm4xxx_free(ice); | 2177 | snd_ice1712_akm4xxx_free(ice); |
2178 | pci_disable_device(ice->pci); | 2178 | pci_disable_device(ice->pci); |
2179 | kfree(ice->spec); | ||
2179 | kfree(ice); | 2180 | kfree(ice); |
2180 | return 0; | 2181 | return 0; |
2181 | } | 2182 | } |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 1a435df423c6..e8038c0ceb72 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -32,6 +32,11 @@ | |||
32 | #include "envy24ht.h" | 32 | #include "envy24ht.h" |
33 | #include "juli.h" | 33 | #include "juli.h" |
34 | 34 | ||
35 | struct juli_spec { | ||
36 | struct ak4114 *ak4114; | ||
37 | unsigned int analog: 1; | ||
38 | }; | ||
39 | |||
35 | /* | 40 | /* |
36 | * chip addresses on I2C bus | 41 | * chip addresses on I2C bus |
37 | */ | 42 | */ |
@@ -137,12 +142,13 @@ static struct snd_akm4xxx akm_juli_dac __devinitdata = { | |||
137 | 142 | ||
138 | static int __devinit juli_add_controls(struct snd_ice1712 *ice) | 143 | static int __devinit juli_add_controls(struct snd_ice1712 *ice) |
139 | { | 144 | { |
145 | struct juli_spec *spec = ice->spec; | ||
140 | int err; | 146 | int err; |
141 | err = snd_ice1712_akm4xxx_build_controls(ice); | 147 | err = snd_ice1712_akm4xxx_build_controls(ice); |
142 | if (err < 0) | 148 | if (err < 0) |
143 | return err; | 149 | return err; |
144 | /* only capture SPDIF over AK4114 */ | 150 | /* only capture SPDIF over AK4114 */ |
145 | err = snd_ak4114_build(ice->spec.juli.ak4114, NULL, | 151 | err = snd_ak4114_build(spec->ak4114, NULL, |
146 | ice->pcm_pro->streams[SNDRV_PCM_STREAM_CAPTURE].substream); | 152 | ice->pcm_pro->streams[SNDRV_PCM_STREAM_CAPTURE].substream); |
147 | if (err < 0) | 153 | if (err < 0) |
148 | return err; | 154 | return err; |
@@ -166,13 +172,19 @@ static int __devinit juli_init(struct snd_ice1712 *ice) | |||
166 | 0x41, 0x02, 0x2c, 0x00, 0x00 | 172 | 0x41, 0x02, 0x2c, 0x00, 0x00 |
167 | }; | 173 | }; |
168 | int err; | 174 | int err; |
175 | struct juli_spec *spec; | ||
169 | struct snd_akm4xxx *ak; | 176 | struct snd_akm4xxx *ak; |
170 | 177 | ||
178 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
179 | if (!spec) | ||
180 | return -ENOMEM; | ||
181 | ice->spec = spec; | ||
182 | |||
171 | err = snd_ak4114_create(ice->card, | 183 | err = snd_ak4114_create(ice->card, |
172 | juli_ak4114_read, | 184 | juli_ak4114_read, |
173 | juli_ak4114_write, | 185 | juli_ak4114_write, |
174 | ak4114_init_vals, ak4114_init_txcsb, | 186 | ak4114_init_vals, ak4114_init_txcsb, |
175 | ice, &ice->spec.juli.ak4114); | 187 | ice, &spec->ak4114); |
176 | if (err < 0) | 188 | if (err < 0) |
177 | return err; | 189 | return err; |
178 | 190 | ||
@@ -180,12 +192,12 @@ static int __devinit juli_init(struct snd_ice1712 *ice) | |||
180 | /* it seems that the analog doughter board detection does not work | 192 | /* it seems that the analog doughter board detection does not work |
181 | reliably, so force the analog flag; it should be very rare | 193 | reliably, so force the analog flag; it should be very rare |
182 | to use Juli@ without the analog doughter board */ | 194 | to use Juli@ without the analog doughter board */ |
183 | ice->spec.juli.analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1; | 195 | spec->analog = (ice->gpio.get_data(ice) & GPIO_ANALOG_PRESENT) ? 0 : 1; |
184 | #else | 196 | #else |
185 | ice->spec.juli.analog = 1; | 197 | spec->analog = 1; |
186 | #endif | 198 | #endif |
187 | 199 | ||
188 | if (ice->spec.juli.analog) { | 200 | if (spec->analog) { |
189 | printk(KERN_INFO "juli@: analog I/O detected\n"); | 201 | printk(KERN_INFO "juli@: analog I/O detected\n"); |
190 | ice->num_total_dacs = 2; | 202 | ice->num_total_dacs = 2; |
191 | ice->num_total_adcs = 2; | 203 | ice->num_total_adcs = 2; |
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c index 718e9359e1f2..9ab4a9f383cb 100644 --- a/sound/pci/ice1712/phase.c +++ b/sound/pci/ice1712/phase.c | |||
@@ -47,6 +47,12 @@ | |||
47 | #include "phase.h" | 47 | #include "phase.h" |
48 | #include <sound/tlv.h> | 48 | #include <sound/tlv.h> |
49 | 49 | ||
50 | /* AC97 register cache for Phase28 */ | ||
51 | struct phase28_spec { | ||
52 | unsigned short master[2]; | ||
53 | unsigned short vol[8]; | ||
54 | } phase28; | ||
55 | |||
50 | /* WM8770 registers */ | 56 | /* WM8770 registers */ |
51 | #define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */ | 57 | #define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */ |
52 | #define WM_DAC_MASTER_ATTEN 0x08 /* DAC master analog attenuation */ | 58 | #define WM_DAC_MASTER_ATTEN 0x08 /* DAC master analog attenuation */ |
@@ -312,15 +318,17 @@ static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
312 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 318 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
313 | { | 319 | { |
314 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 320 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
321 | struct phase28_spec *spec = ice->spec; | ||
315 | int i; | 322 | int i; |
316 | for (i=0; i<2; i++) | 323 | for (i=0; i<2; i++) |
317 | ucontrol->value.integer.value[i] = ice->spec.phase28.master[i] & ~WM_VOL_MUTE; | 324 | ucontrol->value.integer.value[i] = spec->master[i] & ~WM_VOL_MUTE; |
318 | return 0; | 325 | return 0; |
319 | } | 326 | } |
320 | 327 | ||
321 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 328 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
322 | { | 329 | { |
323 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 330 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
331 | struct phase28_spec *spec = ice->spec; | ||
324 | int ch, change = 0; | 332 | int ch, change = 0; |
325 | 333 | ||
326 | snd_ice1712_save_gpio_status(ice); | 334 | snd_ice1712_save_gpio_status(ice); |
@@ -328,14 +336,14 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
328 | unsigned int vol = ucontrol->value.integer.value[ch]; | 336 | unsigned int vol = ucontrol->value.integer.value[ch]; |
329 | if (vol > WM_VOL_MAX) | 337 | if (vol > WM_VOL_MAX) |
330 | continue; | 338 | continue; |
331 | vol |= ice->spec.phase28.master[ch] & WM_VOL_MUTE; | 339 | vol |= spec->master[ch] & WM_VOL_MUTE; |
332 | if (vol != ice->spec.phase28.master[ch]) { | 340 | if (vol != spec->master[ch]) { |
333 | int dac; | 341 | int dac; |
334 | ice->spec.phase28.master[ch] = vol; | 342 | spec->master[ch] = vol; |
335 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) | 343 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) |
336 | wm_set_vol(ice, WM_DAC_ATTEN + dac + ch, | 344 | wm_set_vol(ice, WM_DAC_ATTEN + dac + ch, |
337 | ice->spec.phase28.vol[dac + ch], | 345 | spec->vol[dac + ch], |
338 | ice->spec.phase28.master[ch]); | 346 | spec->master[ch]); |
339 | change = 1; | 347 | change = 1; |
340 | } | 348 | } |
341 | } | 349 | } |
@@ -384,12 +392,18 @@ static int __devinit phase28_init(struct snd_ice1712 *ice) | |||
384 | 392 | ||
385 | unsigned int tmp; | 393 | unsigned int tmp; |
386 | struct snd_akm4xxx *ak; | 394 | struct snd_akm4xxx *ak; |
395 | struct phase28_spec *spec; | ||
387 | const unsigned short *p; | 396 | const unsigned short *p; |
388 | int i; | 397 | int i; |
389 | 398 | ||
390 | ice->num_total_dacs = 8; | 399 | ice->num_total_dacs = 8; |
391 | ice->num_total_adcs = 2; | 400 | ice->num_total_adcs = 2; |
392 | 401 | ||
402 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
403 | if (!spec) | ||
404 | return -ENOMEM; | ||
405 | ice->spec = spec; | ||
406 | |||
393 | // Initialize analog chips | 407 | // Initialize analog chips |
394 | ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | 408 | ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); |
395 | if (!ak) | 409 | if (!ak) |
@@ -419,11 +433,11 @@ static int __devinit phase28_init(struct snd_ice1712 *ice) | |||
419 | 433 | ||
420 | snd_ice1712_restore_gpio_status(ice); | 434 | snd_ice1712_restore_gpio_status(ice); |
421 | 435 | ||
422 | ice->spec.phase28.master[0] = WM_VOL_MUTE; | 436 | spec->master[0] = WM_VOL_MUTE; |
423 | ice->spec.phase28.master[1] = WM_VOL_MUTE; | 437 | spec->master[1] = WM_VOL_MUTE; |
424 | for (i = 0; i < ice->num_total_dacs; i++) { | 438 | for (i = 0; i < ice->num_total_dacs; i++) { |
425 | ice->spec.phase28.vol[i] = WM_VOL_MUTE; | 439 | spec->vol[i] = WM_VOL_MUTE; |
426 | wm_set_vol(ice, i, ice->spec.phase28.vol[i], ice->spec.phase28.master[i % 2]); | 440 | wm_set_vol(ice, i, spec->vol[i], spec->master[i % 2]); |
427 | } | 441 | } |
428 | 442 | ||
429 | return 0; | 443 | return 0; |
@@ -445,18 +459,21 @@ static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info * | |||
445 | static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 459 | static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
446 | { | 460 | { |
447 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 461 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
462 | struct phase28_spec *spec = ice->spec; | ||
448 | int i, ofs, voices; | 463 | int i, ofs, voices; |
449 | 464 | ||
450 | voices = kcontrol->private_value >> 8; | 465 | voices = kcontrol->private_value >> 8; |
451 | ofs = kcontrol->private_value & 0xff; | 466 | ofs = kcontrol->private_value & 0xff; |
452 | for (i = 0; i < voices; i++) | 467 | for (i = 0; i < voices; i++) |
453 | ucontrol->value.integer.value[i] = ice->spec.phase28.vol[ofs+i] & ~WM_VOL_MUTE; | 468 | ucontrol->value.integer.value[i] = |
469 | spec->vol[ofs+i] & ~WM_VOL_MUTE; | ||
454 | return 0; | 470 | return 0; |
455 | } | 471 | } |
456 | 472 | ||
457 | static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 473 | static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
458 | { | 474 | { |
459 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 475 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
476 | struct phase28_spec *spec = ice->spec; | ||
460 | int i, idx, ofs, voices; | 477 | int i, idx, ofs, voices; |
461 | int change = 0; | 478 | int change = 0; |
462 | 479 | ||
@@ -468,12 +485,12 @@ static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value * | |||
468 | vol = ucontrol->value.integer.value[i]; | 485 | vol = ucontrol->value.integer.value[i]; |
469 | if (vol > 0x7f) | 486 | if (vol > 0x7f) |
470 | continue; | 487 | continue; |
471 | vol |= ice->spec.phase28.vol[ofs+i] & WM_VOL_MUTE; | 488 | vol |= spec->vol[ofs+i] & WM_VOL_MUTE; |
472 | if (vol != ice->spec.phase28.vol[ofs+i]) { | 489 | if (vol != spec->vol[ofs+i]) { |
473 | ice->spec.phase28.vol[ofs+i] = vol; | 490 | spec->vol[ofs+i] = vol; |
474 | idx = WM_DAC_ATTEN + ofs + i; | 491 | idx = WM_DAC_ATTEN + ofs + i; |
475 | wm_set_vol(ice, idx, ice->spec.phase28.vol[ofs+i], | 492 | wm_set_vol(ice, idx, spec->vol[ofs+i], |
476 | ice->spec.phase28.master[i]); | 493 | spec->master[i]); |
477 | change = 1; | 494 | change = 1; |
478 | } | 495 | } |
479 | } | 496 | } |
@@ -495,19 +512,22 @@ static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info | |||
495 | static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 512 | static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
496 | { | 513 | { |
497 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 514 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
515 | struct phase28_spec *spec = ice->spec; | ||
498 | int voices, ofs, i; | 516 | int voices, ofs, i; |
499 | 517 | ||
500 | voices = kcontrol->private_value >> 8; | 518 | voices = kcontrol->private_value >> 8; |
501 | ofs = kcontrol->private_value & 0xFF; | 519 | ofs = kcontrol->private_value & 0xFF; |
502 | 520 | ||
503 | for (i = 0; i < voices; i++) | 521 | for (i = 0; i < voices; i++) |
504 | ucontrol->value.integer.value[i] = (ice->spec.phase28.vol[ofs+i] & WM_VOL_MUTE) ? 0 : 1; | 522 | ucontrol->value.integer.value[i] = |
523 | (spec->vol[ofs+i] & WM_VOL_MUTE) ? 0 : 1; | ||
505 | return 0; | 524 | return 0; |
506 | } | 525 | } |
507 | 526 | ||
508 | static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 527 | static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
509 | { | 528 | { |
510 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 529 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
530 | struct phase28_spec *spec = ice->spec; | ||
511 | int change = 0, voices, ofs, i; | 531 | int change = 0, voices, ofs, i; |
512 | 532 | ||
513 | voices = kcontrol->private_value >> 8; | 533 | voices = kcontrol->private_value >> 8; |
@@ -515,13 +535,13 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
515 | 535 | ||
516 | snd_ice1712_save_gpio_status(ice); | 536 | snd_ice1712_save_gpio_status(ice); |
517 | for (i = 0; i < voices; i++) { | 537 | for (i = 0; i < voices; i++) { |
518 | int val = (ice->spec.phase28.vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; | 538 | int val = (spec->vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1; |
519 | if (ucontrol->value.integer.value[i] != val) { | 539 | if (ucontrol->value.integer.value[i] != val) { |
520 | ice->spec.phase28.vol[ofs + i] &= ~WM_VOL_MUTE; | 540 | spec->vol[ofs + i] &= ~WM_VOL_MUTE; |
521 | ice->spec.phase28.vol[ofs + i] |= | 541 | spec->vol[ofs + i] |= |
522 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; | 542 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; |
523 | wm_set_vol(ice, ofs + i, ice->spec.phase28.vol[ofs + i], | 543 | wm_set_vol(ice, ofs + i, spec->vol[ofs + i], |
524 | ice->spec.phase28.master[i]); | 544 | spec->master[i]); |
525 | change = 1; | 545 | change = 1; |
526 | } | 546 | } |
527 | } | 547 | } |
@@ -538,29 +558,33 @@ static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value | |||
538 | static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 558 | static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
539 | { | 559 | { |
540 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 560 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
561 | struct phase28_spec *spec = ice->spec; | ||
541 | 562 | ||
542 | ucontrol->value.integer.value[0] = (ice->spec.phase28.master[0] & WM_VOL_MUTE) ? 0 : 1; | 563 | ucontrol->value.integer.value[0] = |
543 | ucontrol->value.integer.value[1] = (ice->spec.phase28.master[1] & WM_VOL_MUTE) ? 0 : 1; | 564 | (spec->master[0] & WM_VOL_MUTE) ? 0 : 1; |
565 | ucontrol->value.integer.value[1] = | ||
566 | (spec->master[1] & WM_VOL_MUTE) ? 0 : 1; | ||
544 | return 0; | 567 | return 0; |
545 | } | 568 | } |
546 | 569 | ||
547 | static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 570 | static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
548 | { | 571 | { |
549 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 572 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
573 | struct phase28_spec *spec = ice->spec; | ||
550 | int change = 0, i; | 574 | int change = 0, i; |
551 | 575 | ||
552 | snd_ice1712_save_gpio_status(ice); | 576 | snd_ice1712_save_gpio_status(ice); |
553 | for (i = 0; i < 2; i++) { | 577 | for (i = 0; i < 2; i++) { |
554 | int val = (ice->spec.phase28.master[i] & WM_VOL_MUTE) ? 0 : 1; | 578 | int val = (spec->master[i] & WM_VOL_MUTE) ? 0 : 1; |
555 | if (ucontrol->value.integer.value[i] != val) { | 579 | if (ucontrol->value.integer.value[i] != val) { |
556 | int dac; | 580 | int dac; |
557 | ice->spec.phase28.master[i] &= ~WM_VOL_MUTE; | 581 | spec->master[i] &= ~WM_VOL_MUTE; |
558 | ice->spec.phase28.master[i] |= | 582 | spec->master[i] |= |
559 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; | 583 | ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE; |
560 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) | 584 | for (dac = 0; dac < ice->num_total_dacs; dac += 2) |
561 | wm_set_vol(ice, WM_DAC_ATTEN + dac + i, | 585 | wm_set_vol(ice, WM_DAC_ATTEN + dac + i, |
562 | ice->spec.phase28.vol[dac + i], | 586 | spec->vol[dac + i], |
563 | ice->spec.phase28.master[i]); | 587 | spec->master[i]); |
564 | change = 1; | 588 | change = 1; |
565 | } | 589 | } |
566 | } | 590 | } |
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 733937807da3..48cf40a8f32a 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c | |||
@@ -67,6 +67,12 @@ | |||
67 | #include "stac946x.h" | 67 | #include "stac946x.h" |
68 | #include <sound/tlv.h> | 68 | #include <sound/tlv.h> |
69 | 69 | ||
70 | struct prodigy192_spec { | ||
71 | struct ak4114 *ak4114; | ||
72 | /* rate change needs atomic mute/unmute of all dacs*/ | ||
73 | struct mutex mute_mutex; | ||
74 | }; | ||
75 | |||
70 | static inline void stac9460_put(struct snd_ice1712 *ice, int reg, unsigned char val) | 76 | static inline void stac9460_put(struct snd_ice1712 *ice, int reg, unsigned char val) |
71 | { | 77 | { |
72 | snd_vt1724_write_i2c(ice, PRODIGY192_STAC9460_ADDR, reg, val); | 78 | snd_vt1724_write_i2c(ice, PRODIGY192_STAC9460_ADDR, reg, val); |
@@ -118,6 +124,7 @@ static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
118 | static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 124 | static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
119 | { | 125 | { |
120 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 126 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
127 | struct prodigy192_spec *spec = ice->spec; | ||
121 | int idx, change; | 128 | int idx, change; |
122 | 129 | ||
123 | if (kcontrol->private_value) | 130 | if (kcontrol->private_value) |
@@ -125,11 +132,11 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
125 | else | 132 | else |
126 | idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; | 133 | idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; |
127 | /* due to possible conflicts with stac9460_set_rate_val, mutexing */ | 134 | /* due to possible conflicts with stac9460_set_rate_val, mutexing */ |
128 | mutex_lock(&ice->spec.prodigy192.mute_mutex); | 135 | mutex_lock(&spec->mute_mutex); |
129 | /*printk("Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, | 136 | /*printk("Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, |
130 | ucontrol->value.integer.value[0]);*/ | 137 | ucontrol->value.integer.value[0]);*/ |
131 | change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); | 138 | change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); |
132 | mutex_unlock(&ice->spec.prodigy192.mute_mutex); | 139 | mutex_unlock(&spec->mute_mutex); |
133 | return change; | 140 | return change; |
134 | } | 141 | } |
135 | 142 | ||
@@ -318,6 +325,7 @@ static void stac9460_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) | |||
318 | int idx; | 325 | int idx; |
319 | unsigned char changed[7]; | 326 | unsigned char changed[7]; |
320 | struct snd_ice1712 *ice = ak->private_data[0]; | 327 | struct snd_ice1712 *ice = ak->private_data[0]; |
328 | struct prodigy192_spec *spec = ice->spec; | ||
321 | 329 | ||
322 | if (rate == 0) /* no hint - S/PDIF input is master, simply return */ | 330 | if (rate == 0) /* no hint - S/PDIF input is master, simply return */ |
323 | return; | 331 | return; |
@@ -332,7 +340,7 @@ static void stac9460_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) | |||
332 | return; | 340 | return; |
333 | /* change detected, setting master clock, muting first */ | 341 | /* change detected, setting master clock, muting first */ |
334 | /* due to possible conflicts with mute controls - mutexing */ | 342 | /* due to possible conflicts with mute controls - mutexing */ |
335 | mutex_lock(&ice->spec.prodigy192.mute_mutex); | 343 | mutex_lock(&spec->mute_mutex); |
336 | /* we have to remember current mute status for each DAC */ | 344 | /* we have to remember current mute status for each DAC */ |
337 | for (idx = 0; idx < 7 ; ++idx) | 345 | for (idx = 0; idx < 7 ; ++idx) |
338 | changed[idx] = stac9460_dac_mute(ice, | 346 | changed[idx] = stac9460_dac_mute(ice, |
@@ -346,7 +354,7 @@ static void stac9460_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) | |||
346 | if (changed[idx]) | 354 | if (changed[idx]) |
347 | stac9460_dac_mute(ice, STAC946X_MASTER_VOLUME + idx, 1); | 355 | stac9460_dac_mute(ice, STAC946X_MASTER_VOLUME + idx, 1); |
348 | } | 356 | } |
349 | mutex_unlock(&ice->spec.prodigy192.mute_mutex); | 357 | mutex_unlock(&spec->mute_mutex); |
350 | } | 358 | } |
351 | 359 | ||
352 | /* using akm infrastructure for setting rate of the codec */ | 360 | /* using akm infrastructure for setting rate of the codec */ |
@@ -633,12 +641,13 @@ static int prodigy192_ak4114_init(struct snd_ice1712 *ice) | |||
633 | static const unsigned char ak4114_init_txcsb[] = { | 641 | static const unsigned char ak4114_init_txcsb[] = { |
634 | 0x41, 0x02, 0x2c, 0x00, 0x00 | 642 | 0x41, 0x02, 0x2c, 0x00, 0x00 |
635 | }; | 643 | }; |
644 | struct prodigy192_spec *spec = ice->spec; | ||
636 | 645 | ||
637 | return snd_ak4114_create(ice->card, | 646 | return snd_ak4114_create(ice->card, |
638 | prodigy192_ak4114_read, | 647 | prodigy192_ak4114_read, |
639 | prodigy192_ak4114_write, | 648 | prodigy192_ak4114_write, |
640 | ak4114_init_vals, ak4114_init_txcsb, | 649 | ak4114_init_vals, ak4114_init_txcsb, |
641 | ice, &ice->spec.prodigy192.ak4114); | 650 | ice, &spec->ak4114); |
642 | } | 651 | } |
643 | 652 | ||
644 | static void stac9460_proc_regs_read(struct snd_info_entry *entry, | 653 | static void stac9460_proc_regs_read(struct snd_info_entry *entry, |
@@ -664,6 +673,7 @@ static void stac9460_proc_init(struct snd_ice1712 *ice) | |||
664 | 673 | ||
665 | static int __devinit prodigy192_add_controls(struct snd_ice1712 *ice) | 674 | static int __devinit prodigy192_add_controls(struct snd_ice1712 *ice) |
666 | { | 675 | { |
676 | struct prodigy192_spec *spec = ice->spec; | ||
667 | unsigned int i; | 677 | unsigned int i; |
668 | int err; | 678 | int err; |
669 | 679 | ||
@@ -673,7 +683,7 @@ static int __devinit prodigy192_add_controls(struct snd_ice1712 *ice) | |||
673 | if (err < 0) | 683 | if (err < 0) |
674 | return err; | 684 | return err; |
675 | } | 685 | } |
676 | if (ice->spec.prodigy192.ak4114) { | 686 | if (spec->ak4114) { |
677 | /* ak4114 is connected */ | 687 | /* ak4114 is connected */ |
678 | for (i = 0; i < ARRAY_SIZE(ak4114_controls); i++) { | 688 | for (i = 0; i < ARRAY_SIZE(ak4114_controls); i++) { |
679 | err = snd_ctl_add(ice->card, | 689 | err = snd_ctl_add(ice->card, |
@@ -682,7 +692,7 @@ static int __devinit prodigy192_add_controls(struct snd_ice1712 *ice) | |||
682 | if (err < 0) | 692 | if (err < 0) |
683 | return err; | 693 | return err; |
684 | } | 694 | } |
685 | err = snd_ak4114_build(ice->spec.prodigy192.ak4114, | 695 | err = snd_ak4114_build(spec->ak4114, |
686 | NULL, /* ak4114 in MIO/DI/O handles no IEC958 output */ | 696 | NULL, /* ak4114 in MIO/DI/O handles no IEC958 output */ |
687 | ice->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); | 697 | ice->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); |
688 | if (err < 0) | 698 | if (err < 0) |
@@ -734,12 +744,19 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) | |||
734 | const unsigned short *p; | 744 | const unsigned short *p; |
735 | int err = 0; | 745 | int err = 0; |
736 | struct snd_akm4xxx *ak; | 746 | struct snd_akm4xxx *ak; |
747 | struct prodigy192_spec *spec; | ||
737 | 748 | ||
738 | /* prodigy 192 */ | 749 | /* prodigy 192 */ |
739 | ice->num_total_dacs = 6; | 750 | ice->num_total_dacs = 6; |
740 | ice->num_total_adcs = 2; | 751 | ice->num_total_adcs = 2; |
741 | ice->vt1720 = 0; /* ice1724, e.g. 23 GPIOs */ | 752 | ice->vt1720 = 0; /* ice1724, e.g. 23 GPIOs */ |
742 | 753 | ||
754 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
755 | if (!spec) | ||
756 | return -ENOMEM; | ||
757 | ice->spec = spec; | ||
758 | mutex_init(&spec->mute_mutex); | ||
759 | |||
743 | /* initialize codec */ | 760 | /* initialize codec */ |
744 | p = stac_inits_prodigy; | 761 | p = stac_inits_prodigy; |
745 | for (; *p != (unsigned short)-1; p += 2) | 762 | for (; *p != (unsigned short)-1; p += 2) |
@@ -758,7 +775,7 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) | |||
758 | if (prodigy192_miodio_exists(ice)) { | 775 | if (prodigy192_miodio_exists(ice)) { |
759 | err = prodigy192_ak4114_init(ice); | 776 | err = prodigy192_ak4114_init(ice); |
760 | /* from this moment if err = 0 then | 777 | /* from this moment if err = 0 then |
761 | * ice->spec.prodigy192.ak4114 should not be null | 778 | * spec->ak4114 should not be null |
762 | */ | 779 | */ |
763 | snd_printdd("AK4114 initialized with status %d\n", err); | 780 | snd_printdd("AK4114 initialized with status %d\n", err); |
764 | } else | 781 | } else |
@@ -766,8 +783,6 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice) | |||
766 | if (err < 0) | 783 | if (err < 0) |
767 | return err; | 784 | return err; |
768 | 785 | ||
769 | mutex_init(&ice->spec.prodigy192.mute_mutex); | ||
770 | |||
771 | return 0; | 786 | return 0; |
772 | } | 787 | } |
773 | 788 | ||
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c index 6ec1aa44c184..043a93879bd5 100644 --- a/sound/pci/ice1712/prodigy_hifi.c +++ b/sound/pci/ice1712/prodigy_hifi.c | |||
@@ -40,6 +40,11 @@ | |||
40 | #include "envy24ht.h" | 40 | #include "envy24ht.h" |
41 | #include "prodigy_hifi.h" | 41 | #include "prodigy_hifi.h" |
42 | 42 | ||
43 | struct prodigy_hifi_spec { | ||
44 | unsigned short master[2]; | ||
45 | unsigned short vol[8]; | ||
46 | }; | ||
47 | |||
43 | /* I2C addresses */ | 48 | /* I2C addresses */ |
44 | #define WM_DEV 0x34 | 49 | #define WM_DEV 0x34 |
45 | 50 | ||
@@ -177,7 +182,8 @@ static void wm8766_spi_send_word(struct snd_ice1712 *ice, unsigned int data) | |||
177 | } | 182 | } |
178 | } | 183 | } |
179 | 184 | ||
180 | static void wm8766_spi_write(struct snd_ice1712 *ice, unsigned int reg, unsigned int data) | 185 | static void wm8766_spi_write(struct snd_ice1712 *ice, unsigned int reg, |
186 | unsigned int data) | ||
181 | { | 187 | { |
182 | unsigned int block; | 188 | unsigned int block; |
183 | 189 | ||
@@ -216,7 +222,8 @@ static void ak4396_send_word(struct snd_ice1712 *ice, unsigned int data) | |||
216 | } | 222 | } |
217 | } | 223 | } |
218 | 224 | ||
219 | static void ak4396_write(struct snd_ice1712 *ice, unsigned int reg, unsigned int data) | 225 | static void ak4396_write(struct snd_ice1712 *ice, unsigned int reg, |
226 | unsigned int data) | ||
220 | { | 227 | { |
221 | unsigned int block; | 228 | unsigned int block; |
222 | 229 | ||
@@ -246,7 +253,8 @@ static void ak4396_write(struct snd_ice1712 *ice, unsigned int reg, unsigned int | |||
246 | * DAC volume attenuation mixer control (-64dB to 0dB) | 253 | * DAC volume attenuation mixer control (-64dB to 0dB) |
247 | */ | 254 | */ |
248 | 255 | ||
249 | static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 256 | static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, |
257 | struct snd_ctl_elem_info *uinfo) | ||
250 | { | 258 | { |
251 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 259 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
252 | uinfo->count = 2; | 260 | uinfo->count = 2; |
@@ -255,31 +263,32 @@ static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
255 | return 0; | 263 | return 0; |
256 | } | 264 | } |
257 | 265 | ||
258 | static int ak4396_dac_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 266 | static int ak4396_dac_vol_get(struct snd_kcontrol *kcontrol, |
267 | struct snd_ctl_elem_value *ucontrol) | ||
259 | { | 268 | { |
260 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 269 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
270 | struct prodigy_hifi_spec *spec = ice->spec; | ||
261 | int i; | 271 | int i; |
262 | 272 | ||
263 | for (i = 0; i < 2; i++) { | 273 | for (i = 0; i < 2; i++) |
264 | ucontrol->value.integer.value[i] =ice->spec.prodigy_hd2.vol[i]; | 274 | ucontrol->value.integer.value[i] = spec->vol[i]; |
265 | } | 275 | |
266 | return 0; | 276 | return 0; |
267 | } | 277 | } |
268 | 278 | ||
269 | static int ak4396_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 279 | static int ak4396_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
270 | { | 280 | { |
271 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 281 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
282 | struct prodigy_hifi_spec *spec = ice->spec; | ||
272 | int i; | 283 | int i; |
273 | int change = 0; | 284 | int change = 0; |
274 | 285 | ||
275 | mutex_lock(&ice->gpio_mutex); | 286 | mutex_lock(&ice->gpio_mutex); |
276 | for (i = 0; i < 2; i++) { | 287 | for (i = 0; i < 2; i++) { |
277 | if (ucontrol->value.integer.value[i] != | 288 | if (ucontrol->value.integer.value[i] != spec->vol[i]) { |
278 | ice->spec.prodigy_hd2.vol[i]) { | 289 | spec->vol[i] = ucontrol->value.integer.value[i]; |
279 | ice->spec.prodigy_hd2.vol[i] = | 290 | ak4396_write(ice, AK4396_LCH_ATT + i, |
280 | ucontrol->value.integer.value[i]; | 291 | spec->vol[i] & 0xff); |
281 | ak4396_write(ice, AK4396_LCH_ATT+i, | ||
282 | (ice->spec.prodigy_hd2.vol[i] & 0xff)); | ||
283 | change = 1; | 292 | change = 1; |
284 | } | 293 | } |
285 | } | 294 | } |
@@ -333,7 +342,8 @@ static const unsigned char wm_vol[256] = { | |||
333 | #define DAC_MIN (DAC_0dB - DAC_RES) | 342 | #define DAC_MIN (DAC_0dB - DAC_RES) |
334 | 343 | ||
335 | 344 | ||
336 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) | 345 | static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, |
346 | unsigned short vol, unsigned short master) | ||
337 | { | 347 | { |
338 | unsigned char nvol; | 348 | unsigned char nvol; |
339 | 349 | ||
@@ -349,7 +359,8 @@ static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned sho | |||
349 | wm_put_nocache(ice, index, 0x100 | nvol); | 359 | wm_put_nocache(ice, index, 0x100 | nvol); |
350 | } | 360 | } |
351 | 361 | ||
352 | static void wm8766_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master) | 362 | static void wm8766_set_vol(struct snd_ice1712 *ice, unsigned int index, |
363 | unsigned short vol, unsigned short master) | ||
353 | { | 364 | { |
354 | unsigned char nvol; | 365 | unsigned char nvol; |
355 | 366 | ||
@@ -360,7 +371,6 @@ static void wm8766_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned | |||
360 | & WM_VOL_MAX; | 371 | & WM_VOL_MAX; |
361 | nvol = (nvol ? (nvol + DAC_MIN) : 0) & 0xff; | 372 | nvol = (nvol ? (nvol + DAC_MIN) : 0) & 0xff; |
362 | } | 373 | } |
363 | |||
364 | 374 | ||
365 | wm8766_spi_write(ice, index, (0x0100 | nvol)); | 375 | wm8766_spi_write(ice, index, (0x0100 | nvol)); |
366 | } | 376 | } |
@@ -370,7 +380,8 @@ static void wm8766_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned | |||
370 | * DAC volume attenuation mixer control (-64dB to 0dB) | 380 | * DAC volume attenuation mixer control (-64dB to 0dB) |
371 | */ | 381 | */ |
372 | 382 | ||
373 | static int wm_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 383 | static int wm_dac_vol_info(struct snd_kcontrol *kcontrol, |
384 | struct snd_ctl_elem_info *uinfo) | ||
374 | { | 385 | { |
375 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 386 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
376 | uinfo->count = 2; | 387 | uinfo->count = 2; |
@@ -379,33 +390,32 @@ static int wm_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
379 | return 0; | 390 | return 0; |
380 | } | 391 | } |
381 | 392 | ||
382 | static int wm_dac_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 393 | static int wm_dac_vol_get(struct snd_kcontrol *kcontrol, |
394 | struct snd_ctl_elem_value *ucontrol) | ||
383 | { | 395 | { |
384 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 396 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
397 | struct prodigy_hifi_spec *spec = ice->spec; | ||
385 | int i; | 398 | int i; |
386 | 399 | ||
387 | for (i = 0; i < 2; i++) { | 400 | for (i = 0; i < 2; i++) |
388 | ucontrol->value.integer.value[i] = | 401 | ucontrol->value.integer.value[i] = |
389 | ice->spec.prodigy_hifi.vol[2+i] & ~WM_VOL_MUTE; | 402 | spec->vol[2 + i] & ~WM_VOL_MUTE; |
390 | } | ||
391 | return 0; | 403 | return 0; |
392 | } | 404 | } |
393 | 405 | ||
394 | static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 406 | static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
395 | { | 407 | { |
396 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 408 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
409 | struct prodigy_hifi_spec *spec = ice->spec; | ||
397 | int i, idx, change = 0; | 410 | int i, idx, change = 0; |
398 | 411 | ||
399 | mutex_lock(&ice->gpio_mutex); | 412 | mutex_lock(&ice->gpio_mutex); |
400 | for (i = 0; i < 2; i++) { | 413 | for (i = 0; i < 2; i++) { |
401 | if (ucontrol->value.integer.value[i] != | 414 | if (ucontrol->value.integer.value[i] != spec->vol[2 + i]) { |
402 | ice->spec.prodigy_hifi.vol[2+i]) { | ||
403 | idx = WM_DAC_ATTEN_L + i; | 415 | idx = WM_DAC_ATTEN_L + i; |
404 | ice->spec.prodigy_hifi.vol[2+i] &= WM_VOL_MUTE; | 416 | spec->vol[2 + i] &= WM_VOL_MUTE; |
405 | ice->spec.prodigy_hifi.vol[2+i] |= | 417 | spec->vol[2 + i] |= ucontrol->value.integer.value[i]; |
406 | ucontrol->value.integer.value[i]; | 418 | wm_set_vol(ice, idx, spec->vol[2 + i], spec->master[i]); |
407 | wm_set_vol(ice, idx, ice->spec.prodigy_hifi.vol[2+i], | ||
408 | ice->spec.prodigy_hifi.master[i]); | ||
409 | change = 1; | 419 | change = 1; |
410 | } | 420 | } |
411 | } | 421 | } |
@@ -417,7 +427,8 @@ static int wm_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
417 | /* | 427 | /* |
418 | * WM8766 DAC volume attenuation mixer control | 428 | * WM8766 DAC volume attenuation mixer control |
419 | */ | 429 | */ |
420 | static int wm8766_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 430 | static int wm8766_vol_info(struct snd_kcontrol *kcontrol, |
431 | struct snd_ctl_elem_info *uinfo) | ||
421 | { | 432 | { |
422 | int voices = kcontrol->private_value >> 8; | 433 | int voices = kcontrol->private_value >> 8; |
423 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 434 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
@@ -427,22 +438,24 @@ static int wm8766_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
427 | return 0; | 438 | return 0; |
428 | } | 439 | } |
429 | 440 | ||
430 | static int wm8766_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 441 | static int wm8766_vol_get(struct snd_kcontrol *kcontrol, |
442 | struct snd_ctl_elem_value *ucontrol) | ||
431 | { | 443 | { |
432 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 444 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
445 | struct prodigy_hifi_spec *spec = ice->spec; | ||
433 | int i, ofs, voices; | 446 | int i, ofs, voices; |
434 | 447 | ||
435 | voices = kcontrol->private_value >> 8; | 448 | voices = kcontrol->private_value >> 8; |
436 | ofs = kcontrol->private_value & 0xff; | 449 | ofs = kcontrol->private_value & 0xff; |
437 | for (i = 0; i < voices; i++) | 450 | for (i = 0; i < voices; i++) |
438 | ucontrol->value.integer.value[i] = | 451 | ucontrol->value.integer.value[i] = spec->vol[ofs + i]; |
439 | ice->spec.prodigy_hifi.vol[ofs+i]; | ||
440 | return 0; | 452 | return 0; |
441 | } | 453 | } |
442 | 454 | ||
443 | static int wm8766_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 455 | static int wm8766_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
444 | { | 456 | { |
445 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 457 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
458 | struct prodigy_hifi_spec *spec = ice->spec; | ||
446 | int i, idx, ofs, voices; | 459 | int i, idx, ofs, voices; |
447 | int change = 0; | 460 | int change = 0; |
448 | 461 | ||
@@ -450,15 +463,12 @@ static int wm8766_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
450 | ofs = kcontrol->private_value & 0xff; | 463 | ofs = kcontrol->private_value & 0xff; |
451 | mutex_lock(&ice->gpio_mutex); | 464 | mutex_lock(&ice->gpio_mutex); |
452 | for (i = 0; i < voices; i++) { | 465 | for (i = 0; i < voices; i++) { |
453 | if (ucontrol->value.integer.value[i] != | 466 | if (ucontrol->value.integer.value[i] != spec->vol[ofs + i]) { |
454 | ice->spec.prodigy_hifi.vol[ofs+i]) { | ||
455 | idx = WM8766_LDA1 + ofs + i; | 467 | idx = WM8766_LDA1 + ofs + i; |
456 | ice->spec.prodigy_hifi.vol[ofs+i] &= WM_VOL_MUTE; | 468 | spec->vol[ofs + i] &= WM_VOL_MUTE; |
457 | ice->spec.prodigy_hifi.vol[ofs+i] |= | 469 | spec->vol[ofs + i] |= ucontrol->value.integer.value[i]; |
458 | ucontrol->value.integer.value[i]; | ||
459 | wm8766_set_vol(ice, idx, | 470 | wm8766_set_vol(ice, idx, |
460 | ice->spec.prodigy_hifi.vol[ofs+i], | 471 | spec->vol[ofs + i], spec->master[i]); |
461 | ice->spec.prodigy_hifi.master[i]); | ||
462 | change = 1; | 472 | change = 1; |
463 | } | 473 | } |
464 | } | 474 | } |
@@ -469,7 +479,8 @@ static int wm8766_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
469 | /* | 479 | /* |
470 | * Master volume attenuation mixer control / applied to WM8776+WM8766 | 480 | * Master volume attenuation mixer control / applied to WM8776+WM8766 |
471 | */ | 481 | */ |
472 | static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 482 | static int wm_master_vol_info(struct snd_kcontrol *kcontrol, |
483 | struct snd_ctl_elem_info *uinfo) | ||
473 | { | 484 | { |
474 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 485 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
475 | uinfo->count = 2; | 486 | uinfo->count = 2; |
@@ -478,45 +489,41 @@ static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
478 | return 0; | 489 | return 0; |
479 | } | 490 | } |
480 | 491 | ||
481 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 492 | static int wm_master_vol_get(struct snd_kcontrol *kcontrol, |
493 | struct snd_ctl_elem_value *ucontrol) | ||
482 | { | 494 | { |
483 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 495 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
496 | struct prodigy_hifi_spec *spec = ice->spec; | ||
484 | int i; | 497 | int i; |
485 | for (i=0; i<2; i++) | 498 | for (i = 0; i < 2; i++) |
486 | ucontrol->value.integer.value[i] = | 499 | ucontrol->value.integer.value[i] = spec->master[i]; |
487 | ice->spec.prodigy_hifi.master[i]; | ||
488 | return 0; | 500 | return 0; |
489 | } | 501 | } |
490 | 502 | ||
491 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 503 | static int wm_master_vol_put(struct snd_kcontrol *kcontrol, |
504 | struct snd_ctl_elem_value *ucontrol) | ||
492 | { | 505 | { |
493 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 506 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
507 | struct prodigy_hifi_spec *spec = ice->spec; | ||
494 | int ch, change = 0; | 508 | int ch, change = 0; |
495 | 509 | ||
496 | mutex_lock(&ice->gpio_mutex); | 510 | mutex_lock(&ice->gpio_mutex); |
497 | for (ch = 0; ch < 2; ch++) { | 511 | for (ch = 0; ch < 2; ch++) { |
498 | if (ucontrol->value.integer.value[ch] != | 512 | if (ucontrol->value.integer.value[ch] != spec->master[ch]) { |
499 | ice->spec.prodigy_hifi.master[ch]) { | 513 | spec->master[ch] = ucontrol->value.integer.value[ch]; |
500 | ice->spec.prodigy_hifi.master[ch] &= 0x00; | ||
501 | ice->spec.prodigy_hifi.master[ch] |= | ||
502 | ucontrol->value.integer.value[ch]; | ||
503 | 514 | ||
504 | /* Apply to front DAC */ | 515 | /* Apply to front DAC */ |
505 | wm_set_vol(ice, WM_DAC_ATTEN_L + ch, | 516 | wm_set_vol(ice, WM_DAC_ATTEN_L + ch, |
506 | ice->spec.prodigy_hifi.vol[2 + ch], | 517 | spec->vol[2 + ch], spec->master[ch]); |
507 | ice->spec.prodigy_hifi.master[ch]); | ||
508 | 518 | ||
509 | wm8766_set_vol(ice, WM8766_LDA1 + ch, | 519 | wm8766_set_vol(ice, WM8766_LDA1 + ch, |
510 | ice->spec.prodigy_hifi.vol[0 + ch], | 520 | spec->vol[0 + ch], spec->master[ch]); |
511 | ice->spec.prodigy_hifi.master[ch]); | ||
512 | 521 | ||
513 | wm8766_set_vol(ice, WM8766_LDA2 + ch, | 522 | wm8766_set_vol(ice, WM8766_LDA2 + ch, |
514 | ice->spec.prodigy_hifi.vol[4 + ch], | 523 | spec->vol[4 + ch], spec->master[ch]); |
515 | ice->spec.prodigy_hifi.master[ch]); | ||
516 | 524 | ||
517 | wm8766_set_vol(ice, WM8766_LDA3 + ch, | 525 | wm8766_set_vol(ice, WM8766_LDA3 + ch, |
518 | ice->spec.prodigy_hifi.vol[6 + ch], | 526 | spec->vol[6 + ch], spec->master[ch]); |
519 | ice->spec.prodigy_hifi.master[ch]); | ||
520 | change = 1; | 527 | change = 1; |
521 | } | 528 | } |
522 | } | 529 | } |
@@ -525,64 +532,71 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_ | |||
525 | } | 532 | } |
526 | 533 | ||
527 | 534 | ||
528 | |||
529 | /* KONSTI */ | 535 | /* KONSTI */ |
530 | 536 | ||
531 | static int wm_adc_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 537 | static int wm_adc_mux_enum_info(struct snd_kcontrol *kcontrol, |
538 | struct snd_ctl_elem_info *uinfo) | ||
532 | { | 539 | { |
533 | static char* texts[32] = {"NULL", WM_AIN1, WM_AIN2, WM_AIN1 "+" WM_AIN2, | 540 | static char* texts[32] = { |
534 | WM_AIN3, WM_AIN1 "+" WM_AIN3, WM_AIN2 "+" WM_AIN3, | 541 | "NULL", WM_AIN1, WM_AIN2, WM_AIN1 "+" WM_AIN2, |
535 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3, | 542 | WM_AIN3, WM_AIN1 "+" WM_AIN3, WM_AIN2 "+" WM_AIN3, |
536 | WM_AIN4, WM_AIN1 "+" WM_AIN4, WM_AIN2 "+" WM_AIN4, | 543 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3, |
537 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN4, | 544 | WM_AIN4, WM_AIN1 "+" WM_AIN4, WM_AIN2 "+" WM_AIN4, |
538 | WM_AIN3 "+" WM_AIN4, WM_AIN1 "+" WM_AIN3 "+" WM_AIN4, | 545 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN4, |
539 | WM_AIN2 "+" WM_AIN3 "+" WM_AIN4, | 546 | WM_AIN3 "+" WM_AIN4, WM_AIN1 "+" WM_AIN3 "+" WM_AIN4, |
540 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3 "+" WM_AIN4, | 547 | WM_AIN2 "+" WM_AIN3 "+" WM_AIN4, |
541 | WM_AIN5, WM_AIN1 "+" WM_AIN5, WM_AIN2 "+" WM_AIN5, | 548 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3 "+" WM_AIN4, |
542 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN5, | 549 | WM_AIN5, WM_AIN1 "+" WM_AIN5, WM_AIN2 "+" WM_AIN5, |
543 | WM_AIN3 "+" WM_AIN5, WM_AIN1 "+" WM_AIN3 "+" WM_AIN5, | 550 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN5, |
544 | WM_AIN2 "+" WM_AIN3 "+" WM_AIN5, | 551 | WM_AIN3 "+" WM_AIN5, WM_AIN1 "+" WM_AIN3 "+" WM_AIN5, |
545 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3 "+" WM_AIN5, | 552 | WM_AIN2 "+" WM_AIN3 "+" WM_AIN5, |
546 | WM_AIN4 "+" WM_AIN5, WM_AIN1 "+" WM_AIN4 "+" WM_AIN5, | 553 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3 "+" WM_AIN5, |
547 | WM_AIN2 "+" WM_AIN4 "+" WM_AIN5, | 554 | WM_AIN4 "+" WM_AIN5, WM_AIN1 "+" WM_AIN4 "+" WM_AIN5, |
548 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN4 "+" WM_AIN5, | 555 | WM_AIN2 "+" WM_AIN4 "+" WM_AIN5, |
549 | WM_AIN3 "+" WM_AIN4 "+" WM_AIN5, | 556 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN4 "+" WM_AIN5, |
550 | WM_AIN1 "+" WM_AIN3 "+" WM_AIN4 "+" WM_AIN5, | 557 | WM_AIN3 "+" WM_AIN4 "+" WM_AIN5, |
551 | WM_AIN2 "+" WM_AIN3 "+" WM_AIN4 "+" WM_AIN5, | 558 | WM_AIN1 "+" WM_AIN3 "+" WM_AIN4 "+" WM_AIN5, |
552 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3 "+" WM_AIN4 "+" WM_AIN5}; | 559 | WM_AIN2 "+" WM_AIN3 "+" WM_AIN4 "+" WM_AIN5, |
560 | WM_AIN1 "+" WM_AIN2 "+" WM_AIN3 "+" WM_AIN4 "+" WM_AIN5 | ||
561 | }; | ||
553 | 562 | ||
554 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 563 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
555 | uinfo->count = 1; | 564 | uinfo->count = 1; |
556 | uinfo->value.enumerated.items = 32; | 565 | uinfo->value.enumerated.items = 32; |
557 | if (uinfo->value.enumerated.item > 31) | 566 | if (uinfo->value.enumerated.item > 31) |
558 | uinfo->value.enumerated.item = 31; | 567 | uinfo->value.enumerated.item = 31; |
559 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 568 | strcpy(uinfo->value.enumerated.name, |
569 | texts[uinfo->value.enumerated.item]); | ||
560 | return 0; | 570 | return 0; |
561 | } | 571 | } |
562 | 572 | ||
563 | static int wm_adc_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 573 | static int wm_adc_mux_enum_get(struct snd_kcontrol *kcontrol, |
574 | struct snd_ctl_elem_value *ucontrol) | ||
564 | { | 575 | { |
565 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 576 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
566 | 577 | ||
567 | mutex_lock(&ice->gpio_mutex); | 578 | mutex_lock(&ice->gpio_mutex); |
568 | ucontrol->value.integer.value[0]=wm_get(ice, WM_ADC_MUX) & 0x1f; | 579 | ucontrol->value.integer.value[0] = wm_get(ice, WM_ADC_MUX) & 0x1f; |
569 | mutex_unlock(&ice->gpio_mutex); | 580 | mutex_unlock(&ice->gpio_mutex); |
570 | return 0; | 581 | return 0; |
571 | } | 582 | } |
572 | 583 | ||
573 | static int wm_adc_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 584 | static int wm_adc_mux_enum_put(struct snd_kcontrol *kcontrol, |
585 | struct snd_ctl_elem_value *ucontrol) | ||
574 | { | 586 | { |
575 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 587 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
576 | unsigned short oval, nval; | 588 | unsigned short oval, nval; |
589 | int change = 0; | ||
577 | 590 | ||
578 | mutex_lock(&ice->gpio_mutex); | 591 | mutex_lock(&ice->gpio_mutex); |
579 | oval = wm_get(ice, WM_ADC_MUX); | 592 | oval = wm_get(ice, WM_ADC_MUX); |
580 | nval = ( oval & 0xe0 ) | ucontrol->value.integer.value[0] ; | 593 | nval = (oval & 0xe0) | ucontrol->value.integer.value[0]; |
581 | if ( nval != oval ) { | 594 | if (nval != oval) { |
582 | wm_put(ice, WM_ADC_MUX, nval); | 595 | wm_put(ice, WM_ADC_MUX, nval); |
596 | change = 1; | ||
583 | } | 597 | } |
584 | mutex_unlock(&ice->gpio_mutex); | 598 | mutex_unlock(&ice->gpio_mutex); |
585 | return 0; | 599 | return change; |
586 | } | 600 | } |
587 | 601 | ||
588 | /* KONSTI */ | 602 | /* KONSTI */ |
@@ -595,7 +609,8 @@ static int wm_adc_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
595 | #define ADC_RES 128 | 609 | #define ADC_RES 128 |
596 | #define ADC_MIN (ADC_0dB - ADC_RES) | 610 | #define ADC_MIN (ADC_0dB - ADC_RES) |
597 | 611 | ||
598 | static int wm_adc_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 612 | static int wm_adc_vol_info(struct snd_kcontrol *kcontrol, |
613 | struct snd_ctl_elem_info *uinfo) | ||
599 | { | 614 | { |
600 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 615 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
601 | uinfo->count = 2; | 616 | uinfo->count = 2; |
@@ -604,7 +619,8 @@ static int wm_adc_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
604 | return 0; | 619 | return 0; |
605 | } | 620 | } |
606 | 621 | ||
607 | static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 622 | static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, |
623 | struct snd_ctl_elem_value *ucontrol) | ||
608 | { | 624 | { |
609 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 625 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
610 | unsigned short val; | 626 | unsigned short val; |
@@ -620,7 +636,8 @@ static int wm_adc_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
620 | return 0; | 636 | return 0; |
621 | } | 637 | } |
622 | 638 | ||
623 | static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 639 | static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, |
640 | struct snd_ctl_elem_value *ucontrol) | ||
624 | { | 641 | { |
625 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 642 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
626 | unsigned short ovol, nvol; | 643 | unsigned short ovol, nvol; |
@@ -644,27 +661,23 @@ static int wm_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
644 | /* | 661 | /* |
645 | * ADC input mux mixer control | 662 | * ADC input mux mixer control |
646 | */ | 663 | */ |
647 | static int wm_adc_mux_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 664 | #define wm_adc_mux_info snd_ctl_boolean_mono_info |
648 | { | ||
649 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
650 | uinfo->count = 1; | ||
651 | uinfo->value.integer.min = 0; | ||
652 | uinfo->value.integer.max = 1; | ||
653 | return 0; | ||
654 | } | ||
655 | 665 | ||
656 | static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 666 | static int wm_adc_mux_get(struct snd_kcontrol *kcontrol, |
667 | struct snd_ctl_elem_value *ucontrol) | ||
657 | { | 668 | { |
658 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 669 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
659 | int bit = kcontrol->private_value; | 670 | int bit = kcontrol->private_value; |
660 | 671 | ||
661 | mutex_lock(&ice->gpio_mutex); | 672 | mutex_lock(&ice->gpio_mutex); |
662 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0; | 673 | ucontrol->value.integer.value[0] = |
674 | (wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0; | ||
663 | mutex_unlock(&ice->gpio_mutex); | 675 | mutex_unlock(&ice->gpio_mutex); |
664 | return 0; | 676 | return 0; |
665 | } | 677 | } |
666 | 678 | ||
667 | static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 679 | static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, |
680 | struct snd_ctl_elem_value *ucontrol) | ||
668 | { | 681 | { |
669 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 682 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
670 | int bit = kcontrol->private_value; | 683 | int bit = kcontrol->private_value; |
@@ -688,26 +701,22 @@ static int wm_adc_mux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
688 | /* | 701 | /* |
689 | * Analog bypass (In -> Out) | 702 | * Analog bypass (In -> Out) |
690 | */ | 703 | */ |
691 | static int wm_bypass_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 704 | #define wm_bypass_info snd_ctl_boolean_mono_info |
692 | { | ||
693 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
694 | uinfo->count = 1; | ||
695 | uinfo->value.integer.min = 0; | ||
696 | uinfo->value.integer.max = 1; | ||
697 | return 0; | ||
698 | } | ||
699 | 705 | ||
700 | static int wm_bypass_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 706 | static int wm_bypass_get(struct snd_kcontrol *kcontrol, |
707 | struct snd_ctl_elem_value *ucontrol) | ||
701 | { | 708 | { |
702 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 709 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
703 | 710 | ||
704 | mutex_lock(&ice->gpio_mutex); | 711 | mutex_lock(&ice->gpio_mutex); |
705 | ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0; | 712 | ucontrol->value.integer.value[0] = |
713 | (wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0; | ||
706 | mutex_unlock(&ice->gpio_mutex); | 714 | mutex_unlock(&ice->gpio_mutex); |
707 | return 0; | 715 | return 0; |
708 | } | 716 | } |
709 | 717 | ||
710 | static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 718 | static int wm_bypass_put(struct snd_kcontrol *kcontrol, |
719 | struct snd_ctl_elem_value *ucontrol) | ||
711 | { | 720 | { |
712 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 721 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
713 | unsigned short val, oval; | 722 | unsigned short val, oval; |
@@ -730,16 +739,10 @@ static int wm_bypass_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu | |||
730 | /* | 739 | /* |
731 | * Left/Right swap | 740 | * Left/Right swap |
732 | */ | 741 | */ |
733 | static int wm_chswap_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 742 | #define wm_chswap_info snd_ctl_boolean_mono_info |
734 | { | ||
735 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
736 | uinfo->count = 1; | ||
737 | uinfo->value.integer.min = 0; | ||
738 | uinfo->value.integer.max = 1; | ||
739 | return 0; | ||
740 | } | ||
741 | 743 | ||
742 | static int wm_chswap_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 744 | static int wm_chswap_get(struct snd_kcontrol *kcontrol, |
745 | struct snd_ctl_elem_value *ucontrol) | ||
743 | { | 746 | { |
744 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 747 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
745 | 748 | ||
@@ -750,7 +753,8 @@ static int wm_chswap_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu | |||
750 | return 0; | 753 | return 0; |
751 | } | 754 | } |
752 | 755 | ||
753 | static int wm_chswap_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 756 | static int wm_chswap_put(struct snd_kcontrol *kcontrol, |
757 | struct snd_ctl_elem_value *ucontrol) | ||
754 | { | 758 | { |
755 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); | 759 | struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); |
756 | unsigned short val, oval; | 760 | unsigned short val, oval; |
@@ -894,9 +898,10 @@ static struct snd_kcontrol_new prodigy_hifi_controls[] __devinitdata = { | |||
894 | /* | 898 | /* |
895 | * WM codec registers | 899 | * WM codec registers |
896 | */ | 900 | */ |
897 | static void wm_proc_regs_write(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | 901 | static void wm_proc_regs_write(struct snd_info_entry *entry, |
902 | struct snd_info_buffer *buffer) | ||
898 | { | 903 | { |
899 | struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data; | 904 | struct snd_ice1712 *ice = entry->private_data; |
900 | char line[64]; | 905 | char line[64]; |
901 | unsigned int reg, val; | 906 | unsigned int reg, val; |
902 | mutex_lock(&ice->gpio_mutex); | 907 | mutex_lock(&ice->gpio_mutex); |
@@ -909,9 +914,10 @@ static void wm_proc_regs_write(struct snd_info_entry *entry, struct snd_info_buf | |||
909 | mutex_unlock(&ice->gpio_mutex); | 914 | mutex_unlock(&ice->gpio_mutex); |
910 | } | 915 | } |
911 | 916 | ||
912 | static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | 917 | static void wm_proc_regs_read(struct snd_info_entry *entry, |
918 | struct snd_info_buffer *buffer) | ||
913 | { | 919 | { |
914 | struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data; | 920 | struct snd_ice1712 *ice = entry->private_data; |
915 | int reg, val; | 921 | int reg, val; |
916 | 922 | ||
917 | mutex_lock(&ice->gpio_mutex); | 923 | mutex_lock(&ice->gpio_mutex); |
@@ -925,7 +931,7 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff | |||
925 | static void wm_proc_init(struct snd_ice1712 *ice) | 931 | static void wm_proc_init(struct snd_ice1712 *ice) |
926 | { | 932 | { |
927 | struct snd_info_entry *entry; | 933 | struct snd_info_entry *entry; |
928 | if (! snd_card_proc_new(ice->card, "wm_codec", &entry)) { | 934 | if (!snd_card_proc_new(ice->card, "wm_codec", &entry)) { |
929 | snd_info_set_text_ops(entry, ice, wm_proc_regs_read); | 935 | snd_info_set_text_ops(entry, ice, wm_proc_regs_read); |
930 | entry->mode |= S_IWUSR; | 936 | entry->mode |= S_IWUSR; |
931 | entry->c.text.write = wm_proc_regs_write; | 937 | entry->c.text.write = wm_proc_regs_write; |
@@ -938,7 +944,8 @@ static int __devinit prodigy_hifi_add_controls(struct snd_ice1712 *ice) | |||
938 | int err; | 944 | int err; |
939 | 945 | ||
940 | for (i = 0; i < ARRAY_SIZE(prodigy_hifi_controls); i++) { | 946 | for (i = 0; i < ARRAY_SIZE(prodigy_hifi_controls); i++) { |
941 | err = snd_ctl_add(ice->card, snd_ctl_new1(&prodigy_hifi_controls[i], ice)); | 947 | err = snd_ctl_add(ice->card, |
948 | snd_ctl_new1(&prodigy_hifi_controls[i], ice)); | ||
942 | if (err < 0) | 949 | if (err < 0) |
943 | return err; | 950 | return err; |
944 | } | 951 | } |
@@ -950,18 +957,19 @@ static int __devinit prodigy_hifi_add_controls(struct snd_ice1712 *ice) | |||
950 | 957 | ||
951 | static int __devinit prodigy_hd2_add_controls(struct snd_ice1712 *ice) | 958 | static int __devinit prodigy_hd2_add_controls(struct snd_ice1712 *ice) |
952 | { | 959 | { |
953 | unsigned int i; | 960 | unsigned int i; |
954 | int err; | 961 | int err; |
955 | 962 | ||
956 | for (i = 0; i < ARRAY_SIZE(prodigy_hd2_controls); i++) { | 963 | for (i = 0; i < ARRAY_SIZE(prodigy_hd2_controls); i++) { |
957 | err = snd_ctl_add(ice->card, snd_ctl_new1(&prodigy_hd2_controls[i], ice)); | 964 | err = snd_ctl_add(ice->card, |
958 | if (err < 0) | 965 | snd_ctl_new1(&prodigy_hd2_controls[i], ice)); |
959 | return err; | 966 | if (err < 0) |
960 | } | 967 | return err; |
968 | } | ||
961 | 969 | ||
962 | wm_proc_init(ice); | 970 | wm_proc_init(ice); |
963 | 971 | ||
964 | return 0; | 972 | return 0; |
965 | } | 973 | } |
966 | 974 | ||
967 | 975 | ||
@@ -1025,7 +1033,7 @@ static int __devinit prodigy_hifi_init(struct snd_ice1712 *ice) | |||
1025 | WM8766_MUTE2, 0x0000, | 1033 | WM8766_MUTE2, 0x0000, |
1026 | }; | 1034 | }; |
1027 | 1035 | ||
1028 | 1036 | struct prodigy_hifi_spec *spec; | |
1029 | unsigned int i; | 1037 | unsigned int i; |
1030 | 1038 | ||
1031 | ice->vt1720 = 0; | 1039 | ice->vt1720 = 0; |
@@ -1033,7 +1041,6 @@ static int __devinit prodigy_hifi_init(struct snd_ice1712 *ice) | |||
1033 | 1041 | ||
1034 | ice->num_total_dacs = 8; | 1042 | ice->num_total_dacs = 8; |
1035 | ice->num_total_adcs = 1; | 1043 | ice->num_total_adcs = 1; |
1036 | ice->akm_codecs = 2; | ||
1037 | 1044 | ||
1038 | /* HACK - use this as the SPDIF source. | 1045 | /* HACK - use this as the SPDIF source. |
1039 | * don't call snd_ice1712_gpio_get/put(), otherwise it's overwritten | 1046 | * don't call snd_ice1712_gpio_get/put(), otherwise it's overwritten |
@@ -1044,7 +1051,12 @@ static int __devinit prodigy_hifi_init(struct snd_ice1712 *ice) | |||
1044 | ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); | 1051 | ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL); |
1045 | if (! ice->akm) | 1052 | if (! ice->akm) |
1046 | return -ENOMEM; | 1053 | return -ENOMEM; |
1047 | ice->akm_codecs = 1; | 1054 | ice->akm_codecs = 1; |
1055 | |||
1056 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
1057 | if (!spec) | ||
1058 | return -ENOMEM; | ||
1059 | ice->spec = spec; | ||
1048 | 1060 | ||
1049 | /* initialize WM8776 codec */ | 1061 | /* initialize WM8776 codec */ |
1050 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) | 1062 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) |
@@ -1054,7 +1066,6 @@ static int __devinit prodigy_hifi_init(struct snd_ice1712 *ice) | |||
1054 | wm_put(ice, wm_inits2[i], wm_inits2[i+1]); | 1066 | wm_put(ice, wm_inits2[i], wm_inits2[i+1]); |
1055 | 1067 | ||
1056 | /* initialize WM8766 codec */ | 1068 | /* initialize WM8766 codec */ |
1057 | |||
1058 | for (i = 0; i < ARRAY_SIZE(wm8766_inits); i += 2) | 1069 | for (i = 0; i < ARRAY_SIZE(wm8766_inits); i += 2) |
1059 | wm8766_spi_write(ice, wm8766_inits[i], wm8766_inits[i+1]); | 1070 | wm8766_spi_write(ice, wm8766_inits[i], wm8766_inits[i+1]); |
1060 | 1071 | ||
@@ -1076,7 +1087,7 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | |||
1076 | AK4396_RCH_ATT, 0x00, | 1087 | AK4396_RCH_ATT, 0x00, |
1077 | }; | 1088 | }; |
1078 | 1089 | ||
1079 | 1090 | struct prodigy_hifi_spec *spec; | |
1080 | unsigned int i; | 1091 | unsigned int i; |
1081 | 1092 | ||
1082 | ice->vt1720 = 0; | 1093 | ice->vt1720 = 0; |
@@ -1084,7 +1095,6 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | |||
1084 | 1095 | ||
1085 | ice->num_total_dacs = 1; | 1096 | ice->num_total_dacs = 1; |
1086 | ice->num_total_adcs = 1; | 1097 | ice->num_total_adcs = 1; |
1087 | ice->akm_codecs = 1; | ||
1088 | 1098 | ||
1089 | /* HACK - use this as the SPDIF source. | 1099 | /* HACK - use this as the SPDIF source. |
1090 | * don't call snd_ice1712_gpio_get/put(), otherwise it's overwritten | 1100 | * don't call snd_ice1712_gpio_get/put(), otherwise it's overwritten |
@@ -1097,6 +1107,11 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) | |||
1097 | return -ENOMEM; | 1107 | return -ENOMEM; |
1098 | ice->akm_codecs = 1; | 1108 | ice->akm_codecs = 1; |
1099 | 1109 | ||
1110 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
1111 | if (!spec) | ||
1112 | return -ENOMEM; | ||
1113 | ice->spec = spec; | ||
1114 | |||
1100 | /* initialize ak4396 codec */ | 1115 | /* initialize ak4396 codec */ |
1101 | /* reset codec */ | 1116 | /* reset codec */ |
1102 | ak4396_write(ice, AK4396_CTRL1, 0x86); | 1117 | ak4396_write(ice, AK4396_CTRL1, 0x86); |
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index 05a751c59893..ddd5fc8d4fe1 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c | |||
@@ -32,6 +32,12 @@ | |||
32 | #include "envy24ht.h" | 32 | #include "envy24ht.h" |
33 | #include "revo.h" | 33 | #include "revo.h" |
34 | 34 | ||
35 | /* a non-standard I2C device for revo51 */ | ||
36 | struct revo51_spec { | ||
37 | struct snd_i2c_device *dev; | ||
38 | struct snd_pt2258 *pt2258; | ||
39 | } revo51; | ||
40 | |||
35 | static void revo_i2s_mclk_changed(struct snd_ice1712 *ice) | 41 | static void revo_i2s_mclk_changed(struct snd_ice1712 *ice) |
36 | { | 42 | { |
37 | /* assert PRST# to converters; MT05 bit 7 */ | 43 | /* assert PRST# to converters; MT05 bit 7 */ |
@@ -152,8 +158,14 @@ static struct snd_i2c_bit_ops revo51_bit_ops = { | |||
152 | static int revo51_i2c_init(struct snd_ice1712 *ice, | 158 | static int revo51_i2c_init(struct snd_ice1712 *ice, |
153 | struct snd_pt2258 *pt) | 159 | struct snd_pt2258 *pt) |
154 | { | 160 | { |
161 | struct revo51_spec *spec; | ||
155 | int err; | 162 | int err; |
156 | 163 | ||
164 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
165 | if (!spec) | ||
166 | return -ENOMEM; | ||
167 | ice->spec = spec; | ||
168 | |||
157 | /* create the I2C bus */ | 169 | /* create the I2C bus */ |
158 | err = snd_i2c_bus_create(ice->card, "ICE1724 GPIO6", NULL, &ice->i2c); | 170 | err = snd_i2c_bus_create(ice->card, "ICE1724 GPIO6", NULL, &ice->i2c); |
159 | if (err < 0) | 171 | if (err < 0) |
@@ -163,15 +175,14 @@ static int revo51_i2c_init(struct snd_ice1712 *ice, | |||
163 | ice->i2c->hw_ops.bit = &revo51_bit_ops; | 175 | ice->i2c->hw_ops.bit = &revo51_bit_ops; |
164 | 176 | ||
165 | /* create the I2C device */ | 177 | /* create the I2C device */ |
166 | err = snd_i2c_device_create(ice->i2c, "PT2258", 0x40, | 178 | err = snd_i2c_device_create(ice->i2c, "PT2258", 0x40, &spec->dev); |
167 | &ice->spec.revo51.dev); | ||
168 | if (err < 0) | 179 | if (err < 0) |
169 | return err; | 180 | return err; |
170 | 181 | ||
171 | pt->card = ice->card; | 182 | pt->card = ice->card; |
172 | pt->i2c_bus = ice->i2c; | 183 | pt->i2c_bus = ice->i2c; |
173 | pt->i2c_dev = ice->spec.revo51.dev; | 184 | pt->i2c_dev = spec->dev; |
174 | ice->spec.revo51.pt2258 = pt; | 185 | spec->pt2258 = pt; |
175 | 186 | ||
176 | snd_pt2258_reset(pt); | 187 | snd_pt2258_reset(pt); |
177 | 188 | ||
@@ -555,6 +566,7 @@ static int __devinit revo_init(struct snd_ice1712 *ice) | |||
555 | 566 | ||
556 | static int __devinit revo_add_controls(struct snd_ice1712 *ice) | 567 | static int __devinit revo_add_controls(struct snd_ice1712 *ice) |
557 | { | 568 | { |
569 | struct revo51_spec *spec; | ||
558 | int err; | 570 | int err; |
559 | 571 | ||
560 | switch (ice->eeprom.subvendor) { | 572 | switch (ice->eeprom.subvendor) { |
@@ -567,7 +579,8 @@ static int __devinit revo_add_controls(struct snd_ice1712 *ice) | |||
567 | err = snd_ice1712_akm4xxx_build_controls(ice); | 579 | err = snd_ice1712_akm4xxx_build_controls(ice); |
568 | if (err < 0) | 580 | if (err < 0) |
569 | return err; | 581 | return err; |
570 | err = snd_pt2258_build_controls(ice->spec.revo51.pt2258); | 582 | spec = ice->spec; |
583 | err = snd_pt2258_build_controls(spec->pt2258); | ||
571 | if (err < 0) | 584 | if (err < 0) |
572 | return err; | 585 | return err; |
573 | break; | 586 | break; |
diff --git a/sound/pci/ice1712/se.c b/sound/pci/ice1712/se.c index 6661f65a6f2e..69673b95869d 100644 --- a/sound/pci/ice1712/se.c +++ b/sound/pci/ice1712/se.c | |||
@@ -34,6 +34,11 @@ | |||
34 | #include "envy24ht.h" | 34 | #include "envy24ht.h" |
35 | #include "se.h" | 35 | #include "se.h" |
36 | 36 | ||
37 | struct se_spec { | ||
38 | struct { | ||
39 | unsigned char ch1, ch2; | ||
40 | } vol[8]; | ||
41 | }; | ||
37 | 42 | ||
38 | /****************************************************************************/ | 43 | /****************************************************************************/ |
39 | /* ONKYO WAVIO SE-200PCI */ | 44 | /* ONKYO WAVIO SE-200PCI */ |
@@ -462,9 +467,10 @@ static int se200pci_cont_volume_get(struct snd_kcontrol *kc, | |||
462 | struct snd_ctl_elem_value *uc) | 467 | struct snd_ctl_elem_value *uc) |
463 | { | 468 | { |
464 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); | 469 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); |
470 | struct se_spec *spec = ice->spec; | ||
465 | int n = kc->private_value; | 471 | int n = kc->private_value; |
466 | uc->value.integer.value[0] = ice->spec.se.vol[n].ch1; | 472 | uc->value.integer.value[0] = spec->vol[n].ch1; |
467 | uc->value.integer.value[1] = ice->spec.se.vol[n].ch2; | 473 | uc->value.integer.value[1] = spec->vol[n].ch2; |
468 | return 0; | 474 | return 0; |
469 | } | 475 | } |
470 | 476 | ||
@@ -472,8 +478,9 @@ static int se200pci_cont_boolean_get(struct snd_kcontrol *kc, | |||
472 | struct snd_ctl_elem_value *uc) | 478 | struct snd_ctl_elem_value *uc) |
473 | { | 479 | { |
474 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); | 480 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); |
481 | struct se_spec *spec = ice->spec; | ||
475 | int n = kc->private_value; | 482 | int n = kc->private_value; |
476 | uc->value.integer.value[0] = ice->spec.se.vol[n].ch1; | 483 | uc->value.integer.value[0] = spec->vol[n].ch1; |
477 | return 0; | 484 | return 0; |
478 | } | 485 | } |
479 | 486 | ||
@@ -481,44 +488,46 @@ static int se200pci_cont_enum_get(struct snd_kcontrol *kc, | |||
481 | struct snd_ctl_elem_value *uc) | 488 | struct snd_ctl_elem_value *uc) |
482 | { | 489 | { |
483 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); | 490 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); |
491 | struct se_spec *spec = ice->spec; | ||
484 | int n = kc->private_value; | 492 | int n = kc->private_value; |
485 | uc->value.enumerated.item[0] = ice->spec.se.vol[n].ch1; | 493 | uc->value.enumerated.item[0] = spec->vol[n].ch1; |
486 | return 0; | 494 | return 0; |
487 | } | 495 | } |
488 | 496 | ||
489 | static void se200pci_cont_update(struct snd_ice1712 *ice, int n) | 497 | static void se200pci_cont_update(struct snd_ice1712 *ice, int n) |
490 | { | 498 | { |
499 | struct se_spec *spec = ice->spec; | ||
491 | switch (se200pci_cont[n].target) { | 500 | switch (se200pci_cont[n].target) { |
492 | case WM8766: | 501 | case WM8766: |
493 | se200pci_WM8766_set_volume(ice, | 502 | se200pci_WM8766_set_volume(ice, |
494 | se200pci_cont[n].ch, | 503 | se200pci_cont[n].ch, |
495 | ice->spec.se.vol[n].ch1, | 504 | spec->vol[n].ch1, |
496 | ice->spec.se.vol[n].ch2); | 505 | spec->vol[n].ch2); |
497 | break; | 506 | break; |
498 | 507 | ||
499 | case WM8776in: | 508 | case WM8776in: |
500 | se200pci_WM8776_set_input_volume(ice, | 509 | se200pci_WM8776_set_input_volume(ice, |
501 | ice->spec.se.vol[n].ch1, | 510 | spec->vol[n].ch1, |
502 | ice->spec.se.vol[n].ch2); | 511 | spec->vol[n].ch2); |
503 | break; | 512 | break; |
504 | 513 | ||
505 | case WM8776out: | 514 | case WM8776out: |
506 | se200pci_WM8776_set_output_volume(ice, | 515 | se200pci_WM8776_set_output_volume(ice, |
507 | ice->spec.se.vol[n].ch1, | 516 | spec->vol[n].ch1, |
508 | ice->spec.se.vol[n].ch2); | 517 | spec->vol[n].ch2); |
509 | break; | 518 | break; |
510 | 519 | ||
511 | case WM8776sel: | 520 | case WM8776sel: |
512 | se200pci_WM8776_set_input_selector(ice, | 521 | se200pci_WM8776_set_input_selector(ice, |
513 | ice->spec.se.vol[n].ch1); | 522 | spec->vol[n].ch1); |
514 | break; | 523 | break; |
515 | 524 | ||
516 | case WM8776agc: | 525 | case WM8776agc: |
517 | se200pci_WM8776_set_agc(ice, ice->spec.se.vol[n].ch1); | 526 | se200pci_WM8776_set_agc(ice, spec->vol[n].ch1); |
518 | break; | 527 | break; |
519 | 528 | ||
520 | case WM8776afl: | 529 | case WM8776afl: |
521 | se200pci_WM8776_set_afl(ice, ice->spec.se.vol[n].ch1); | 530 | se200pci_WM8776_set_afl(ice, spec->vol[n].ch1); |
522 | break; | 531 | break; |
523 | 532 | ||
524 | default: | 533 | default: |
@@ -530,6 +539,7 @@ static int se200pci_cont_volume_put(struct snd_kcontrol *kc, | |||
530 | struct snd_ctl_elem_value *uc) | 539 | struct snd_ctl_elem_value *uc) |
531 | { | 540 | { |
532 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); | 541 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); |
542 | struct se_spec *spec = ice->spec; | ||
533 | int n = kc->private_value; | 543 | int n = kc->private_value; |
534 | unsigned int vol1, vol2; | 544 | unsigned int vol1, vol2; |
535 | int changed; | 545 | int changed; |
@@ -537,12 +547,12 @@ static int se200pci_cont_volume_put(struct snd_kcontrol *kc, | |||
537 | changed = 0; | 547 | changed = 0; |
538 | vol1 = uc->value.integer.value[0] & 0xff; | 548 | vol1 = uc->value.integer.value[0] & 0xff; |
539 | vol2 = uc->value.integer.value[1] & 0xff; | 549 | vol2 = uc->value.integer.value[1] & 0xff; |
540 | if (ice->spec.se.vol[n].ch1 != vol1) { | 550 | if (spec->vol[n].ch1 != vol1) { |
541 | ice->spec.se.vol[n].ch1 = vol1; | 551 | spec->vol[n].ch1 = vol1; |
542 | changed = 1; | 552 | changed = 1; |
543 | } | 553 | } |
544 | if (ice->spec.se.vol[n].ch2 != vol2) { | 554 | if (spec->vol[n].ch2 != vol2) { |
545 | ice->spec.se.vol[n].ch2 = vol2; | 555 | spec->vol[n].ch2 = vol2; |
546 | changed = 1; | 556 | changed = 1; |
547 | } | 557 | } |
548 | if (changed) | 558 | if (changed) |
@@ -555,12 +565,13 @@ static int se200pci_cont_boolean_put(struct snd_kcontrol *kc, | |||
555 | struct snd_ctl_elem_value *uc) | 565 | struct snd_ctl_elem_value *uc) |
556 | { | 566 | { |
557 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); | 567 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); |
568 | struct se_spec *spec = ice->spec; | ||
558 | int n = kc->private_value; | 569 | int n = kc->private_value; |
559 | unsigned int vol1; | 570 | unsigned int vol1; |
560 | 571 | ||
561 | vol1 = !!uc->value.integer.value[0]; | 572 | vol1 = !!uc->value.integer.value[0]; |
562 | if (ice->spec.se.vol[n].ch1 != vol1) { | 573 | if (spec->vol[n].ch1 != vol1) { |
563 | ice->spec.se.vol[n].ch1 = vol1; | 574 | spec->vol[n].ch1 = vol1; |
564 | se200pci_cont_update(ice, n); | 575 | se200pci_cont_update(ice, n); |
565 | return 1; | 576 | return 1; |
566 | } | 577 | } |
@@ -571,14 +582,15 @@ static int se200pci_cont_enum_put(struct snd_kcontrol *kc, | |||
571 | struct snd_ctl_elem_value *uc) | 582 | struct snd_ctl_elem_value *uc) |
572 | { | 583 | { |
573 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); | 584 | struct snd_ice1712 *ice = snd_kcontrol_chip(kc); |
585 | struct se_spec *spec = ice->spec; | ||
574 | int n = kc->private_value; | 586 | int n = kc->private_value; |
575 | unsigned int vol1; | 587 | unsigned int vol1; |
576 | 588 | ||
577 | vol1 = uc->value.enumerated.item[0]; | 589 | vol1 = uc->value.enumerated.item[0]; |
578 | if (vol1 >= se200pci_get_enum_count(n)) | 590 | if (vol1 >= se200pci_get_enum_count(n)) |
579 | return -EINVAL; | 591 | return -EINVAL; |
580 | if (ice->spec.se.vol[n].ch1 != vol1) { | 592 | if (spec->vol[n].ch1 != vol1) { |
581 | ice->spec.se.vol[n].ch1 = vol1; | 593 | spec->vol[n].ch1 = vol1; |
582 | se200pci_cont_update(ice, n); | 594 | se200pci_cont_update(ice, n); |
583 | return 1; | 595 | return 1; |
584 | } | 596 | } |
@@ -668,6 +680,13 @@ static int __devinit se200pci_add_controls(struct snd_ice1712 *ice) | |||
668 | 680 | ||
669 | static int __devinit se_init(struct snd_ice1712 *ice) | 681 | static int __devinit se_init(struct snd_ice1712 *ice) |
670 | { | 682 | { |
683 | struct se_spec *spec; | ||
684 | |||
685 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
686 | if (!spec) | ||
687 | return -ENOMEM; | ||
688 | ice->spec = spec; | ||
689 | |||
671 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_SE90PCI) { | 690 | if (ice->eeprom.subvendor == VT1724_SUBDEVICE_SE90PCI) { |
672 | ice->num_total_dacs = 2; | 691 | ice->num_total_dacs = 2; |
673 | ice->num_total_adcs = 0; | 692 | ice->num_total_adcs = 0; |