* added 0.99 linux version
[mascara-docs.git] / i386 / linux / linux-2.3.21 / drivers / sound / vidc_mixer.c
blob01be4925cab10e07445b37aea35d7e964e71179f
1 /*
2 * drivers/sound/vidc_mixer.c
4 * Mixer routines for VIDC
6 * Copyright (C) 1997 Russell King <rmk@arm.uk.linux.org>
7 */
9 #include "sound_config.h"
10 #include "vidc.h"
12 int vidc_volume;
14 static int vidc_get_volume(void)
16 return vidc_volume;
19 static int vidc_set_volume(int newvol)
21 vidc_volume = newvol;
22 /* printk ("vidc_set_volume: %X\n", newvol); */
23 return newvol;
26 static int vidc_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
28 int ret;
30 switch (cmd)
32 case SOUND_MIXER_READ_VOLUME:
33 ret = vidc_get_volume();
34 break;
36 case SOUND_MIXER_WRITE_VOLUME:
37 if (get_user(ret, (int *) arg))
38 return -EINVAL;
39 ret = vidc_set_volume(ret);
40 break;
42 case SOUND_MIXER_READ_BASS:
43 case SOUND_MIXER_WRITE_BASS:
44 case SOUND_MIXER_READ_TREBLE:
45 case SOUND_MIXER_WRITE_TREBLE:
46 ret = 50;
47 break;
49 case SOUND_MIXER_READ_SYNTH:
50 // ret = vidc_synth_get_volume();
51 ret = 0;
52 break;
54 case SOUND_MIXER_WRITE_SYNTH:
55 if (get_user(ret, (int *) arg))
56 return -EINVAL;
57 // ret = vidc_synth_set_volume(ret);
58 ret = 0;
59 break;
61 case SOUND_MIXER_READ_PCM:
62 ret = vidc_audio_get_volume();
63 break;
65 case SOUND_MIXER_WRITE_PCM:
66 if (get_user(ret, (int *) arg))
67 return -EINVAL;
68 ret = vidc_audio_set_volume(ret);
69 break;
71 case SOUND_MIXER_READ_SPEAKER:
72 ret = 100;
73 break;
75 case SOUND_MIXER_WRITE_SPEAKER:
76 ret = 100;
77 break;
79 case SOUND_MIXER_READ_LINE:
80 case SOUND_MIXER_WRITE_LINE:
81 case SOUND_MIXER_READ_MIC:
82 case SOUND_MIXER_WRITE_MIC:
83 ret = 0;
84 break;
86 case SOUND_MIXER_READ_CD:
87 case SOUND_MIXER_WRITE_CD:
88 ret = 100 | (100 << 8);
89 break;
91 case SOUND_MIXER_READ_IMIX:
92 case SOUND_MIXER_WRITE_IMIX:
93 case SOUND_MIXER_READ_ALTPCM:
94 case SOUND_MIXER_WRITE_ALTPCM:
95 case SOUND_MIXER_READ_LINE1:
96 case SOUND_MIXER_WRITE_LINE1:
97 case SOUND_MIXER_READ_LINE2:
98 case SOUND_MIXER_WRITE_LINE2:
99 case SOUND_MIXER_READ_LINE3:
100 case SOUND_MIXER_WRITE_LINE3:
101 ret = 0;
102 break;
104 case SOUND_MIXER_READ_RECSRC:
105 ret = 0;
106 break;
108 case SOUND_MIXER_WRITE_RECSRC:
109 return -EINVAL;
110 break;
112 case SOUND_MIXER_READ_DEVMASK:
113 ret = SOUND_MASK_VOLUME | SOUND_MASK_PCM | SOUND_MASK_SYNTH;
114 break;
116 case SOUND_MIXER_READ_RECMASK:
117 ret = 0;
118 break;
120 case SOUND_MIXER_READ_STEREODEVS:
121 ret = SOUND_MASK_VOLUME | SOUND_MASK_PCM | SOUND_MASK_SYNTH;
122 break;
124 case SOUND_MIXER_READ_CAPS:
125 ret = 0;
126 break;
128 case SOUND_MIXER_READ_MUTE:
129 return -EINVAL;
130 break;
132 default:
133 return -EINVAL;
134 break;
136 return put_user(ret, (int *) arg);
139 static struct mixer_operations vidc_mixer_operations = {
140 "VIDC",
141 "VIDCsound",
142 vidc_default_mixer_ioctl /* ioctl */
145 void vidc_mixer_init(struct address_info *hw_config)
147 int vidc_mixer = sound_alloc_mixerdev();
148 vidc_volume = 100 | (100 << 8);
149 if (num_mixers < MAX_MIXER_DEV)
150 mixer_devs[vidc_mixer] = &vidc_mixer_operations;