2 * drivers/sound/vidc_mixer.c
4 * Mixer routines for VIDC
6 * Copyright (C) 1997 Russell King <rmk@arm.uk.linux.org>
9 #include "sound_config.h"
14 static int vidc_get_volume(void)
19 static int vidc_set_volume(int newvol
)
22 /* printk ("vidc_set_volume: %X\n", newvol); */
26 static int vidc_default_mixer_ioctl(int dev
, unsigned int cmd
, caddr_t arg
)
32 case SOUND_MIXER_READ_VOLUME
:
33 ret
= vidc_get_volume();
36 case SOUND_MIXER_WRITE_VOLUME
:
37 if (get_user(ret
, (int *) arg
))
39 ret
= vidc_set_volume(ret
);
42 case SOUND_MIXER_READ_BASS
:
43 case SOUND_MIXER_WRITE_BASS
:
44 case SOUND_MIXER_READ_TREBLE
:
45 case SOUND_MIXER_WRITE_TREBLE
:
49 case SOUND_MIXER_READ_SYNTH
:
50 // ret = vidc_synth_get_volume();
54 case SOUND_MIXER_WRITE_SYNTH
:
55 if (get_user(ret
, (int *) arg
))
57 // ret = vidc_synth_set_volume(ret);
61 case SOUND_MIXER_READ_PCM
:
62 ret
= vidc_audio_get_volume();
65 case SOUND_MIXER_WRITE_PCM
:
66 if (get_user(ret
, (int *) arg
))
68 ret
= vidc_audio_set_volume(ret
);
71 case SOUND_MIXER_READ_SPEAKER
:
75 case SOUND_MIXER_WRITE_SPEAKER
:
79 case SOUND_MIXER_READ_LINE
:
80 case SOUND_MIXER_WRITE_LINE
:
81 case SOUND_MIXER_READ_MIC
:
82 case SOUND_MIXER_WRITE_MIC
:
86 case SOUND_MIXER_READ_CD
:
87 case SOUND_MIXER_WRITE_CD
:
88 ret
= 100 | (100 << 8);
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
:
104 case SOUND_MIXER_READ_RECSRC
:
108 case SOUND_MIXER_WRITE_RECSRC
:
112 case SOUND_MIXER_READ_DEVMASK
:
113 ret
= SOUND_MASK_VOLUME
| SOUND_MASK_PCM
| SOUND_MASK_SYNTH
;
116 case SOUND_MIXER_READ_RECMASK
:
120 case SOUND_MIXER_READ_STEREODEVS
:
121 ret
= SOUND_MASK_VOLUME
| SOUND_MASK_PCM
| SOUND_MASK_SYNTH
;
124 case SOUND_MIXER_READ_CAPS
:
128 case SOUND_MIXER_READ_MUTE
:
136 return put_user(ret
, (int *) arg
);
139 static struct mixer_operations vidc_mixer_operations
= {
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
;