19 #include <linux/export.h>
27 #define MSND_MIXER_VOLUME 0
28 #define MSND_MIXER_PCM 1
29 #define MSND_MIXER_AUX 2
30 #define MSND_MIXER_IMIX 3
31 #define MSND_MIXER_SYNTH 4
32 #define MSND_MIXER_SPEAKER 5
33 #define MSND_MIXER_LINE 6
34 #define MSND_MIXER_MIC 7
35 #define MSND_MIXER_RECLEV 11
36 #define MSND_MIXER_IGAIN 12
37 #define MSND_MIXER_OGAIN 13
38 #define MSND_MIXER_DIGITAL 17
42 #define MSND_MASK_VOLUME (1 << MSND_MIXER_VOLUME)
43 #define MSND_MASK_SYNTH (1 << MSND_MIXER_SYNTH)
44 #define MSND_MASK_PCM (1 << MSND_MIXER_PCM)
45 #define MSND_MASK_SPEAKER (1 << MSND_MIXER_SPEAKER)
46 #define MSND_MASK_LINE (1 << MSND_MIXER_LINE)
47 #define MSND_MASK_MIC (1 << MSND_MIXER_MIC)
48 #define MSND_MASK_IMIX (1 << MSND_MIXER_IMIX)
49 #define MSND_MASK_RECLEV (1 << MSND_MIXER_RECLEV)
50 #define MSND_MASK_IGAIN (1 << MSND_MIXER_IGAIN)
51 #define MSND_MASK_OGAIN (1 << MSND_MIXER_OGAIN)
52 #define MSND_MASK_AUX (1 << MSND_MIXER_AUX)
53 #define MSND_MASK_DIGITAL (1 << MSND_MIXER_DIGITAL)
55 static int snd_msndmix_info_mux(
struct snd_kcontrol *kcontrol,
58 static char *texts[3] = {
59 "Analog",
"MASS",
"SPDIF",
74 static int snd_msndmix_get_mux(
struct snd_kcontrol *kcontrol,
79 ucontrol->
value.enumerated.item[0] = 0;
82 ucontrol->
value.enumerated.item[0] = 1;
85 ucontrol->
value.enumerated.item[0] = 2;
92 static int snd_msndmix_set_mux(
struct snd_msnd *chip,
int val)
96 unsigned char msndbyte;
114 change = newrecsrc != chip->
recsrc;
126 static int snd_msndmix_put_mux(
struct snd_kcontrol *kcontrol,
130 return snd_msndmix_set_mux(msnd, ucontrol->
value.enumerated.item[0]);
134 static int snd_msndmix_volume_info(
struct snd_kcontrol *kcontrol,
144 static int snd_msndmix_volume_get(
struct snd_kcontrol *kcontrol,
153 ucontrol->
value.integer.value[0] /= 0xFFFF;
155 ucontrol->
value.integer.value[1] /= 0xFFFF;
156 spin_unlock_irqrestore(&msnd->
mixer_lock, flags);
160 #define update_volm(a, b) \
162 writew((dev->left_levels[a] >> 1) * \
163 readw(dev->SMA + SMA_wCurrMastVolLeft) / 0xffff, \
164 dev->SMA + SMA_##b##Left); \
165 writew((dev->right_levels[a] >> 1) * \
166 readw(dev->SMA + SMA_wCurrMastVolRight) / 0xffff, \
167 dev->SMA + SMA_##b##Right); \
170 #define update_potm(d, s, ar) \
172 writeb((dev->left_levels[d] >> 8) * \
173 readw(dev->SMA + SMA_wCurrMastVolLeft) / 0xffff, \
174 dev->SMA + SMA_##s##Left); \
175 writeb((dev->right_levels[d] >> 8) * \
176 readw(dev->SMA + SMA_wCurrMastVolRight) / 0xffff, \
177 dev->SMA + SMA_##s##Right); \
178 if (snd_msnd_send_word(dev, 0, 0, ar) == 0) \
179 snd_msnd_send_dsp_cmd(dev, HDEX_AUX_REQ); \
182 #define update_pot(d, s, ar) \
184 writeb(dev->left_levels[d] >> 8, \
185 dev->SMA + SMA_##s##Left); \
186 writeb(dev->right_levels[d] >> 8, \
187 dev->SMA + SMA_##s##Right); \
188 if (snd_msnd_send_word(dev, 0, 0, ar) == 0) \
189 snd_msnd_send_dsp_cmd(dev, HDEX_AUX_REQ); \
197 int updatemaster = 0;
202 bLeft = left * 0xff / 100;
203 wLeft = left * 0xffff / 100;
205 bRight = right * 0xff / 100;
206 wRight = right * 0xffff / 100;
262 static int snd_msndmix_volume_put(
struct snd_kcontrol *kcontrol,
270 left = ucontrol->
value.integer.value[0] % 101;
271 right = ucontrol->
value.integer.value[1] % 101;
275 snd_msndmix_set(msnd, addr, left, right);
276 spin_unlock_irqrestore(&msnd->
mixer_lock, flags);
281 #define DUMMY_VOLUME(xname, xindex, addr) \
282 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
283 .info = snd_msndmix_volume_info, \
284 .get = snd_msndmix_volume_get, .put = snd_msndmix_volume_put, \
285 .private_value = addr }
297 .name =
"Capture Source",
298 .info = snd_msndmix_info_mux,
299 .get = snd_msndmix_get_mux,
300 .put = snd_msndmix_put_mux,
316 for (idx = 0; idx <
ARRAY_SIZE(snd_msnd_controls); idx++)
342 return snd_msndmix_set_mux(dev, recsrc);