OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [arch/] [armnommu/] [drivers/] [sound/] [vidc_mixer.c] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * sound/vidc_mixer.c
3
 *
4
 * Mixer routines for VIDC
5
 *
6
 * Copyright (C) 1997 Russell King
7
 */
8
#include <linux/config.h>
9
#include "sound_config.h"
10
 
11
#include "vidc.h"
12
 
13
#if defined(CONFIG_VIDC)
14
 
15
int vidc_volume;
16
 
17
static int
18
vidc_get_volume (void)
19
{
20
  return vidc_volume;
21
}
22
 
23
static int
24
vidc_set_volume (int newvol)
25
{
26
  vidc_volume = newvol;
27
/*  printk ("vidc_set_volume: %X\n", newvol);*/
28
  return newvol;
29
}
30
 
31
static int
32
vidc_default_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg)
33
{
34
  switch (cmd) {
35
  case SOUND_MIXER_READ_VOLUME:
36
    return snd_ioctl_return ((int *)arg, vidc_get_volume ());
37
 
38
  case SOUND_MIXER_WRITE_VOLUME:
39
    return snd_ioctl_return ((int *)arg, vidc_set_volume (get_user ((int *)arg)));
40
 
41
  case SOUND_MIXER_READ_BASS:
42
  case SOUND_MIXER_WRITE_BASS:
43
  case SOUND_MIXER_READ_TREBLE:
44
  case SOUND_MIXER_WRITE_TREBLE:
45
    return snd_ioctl_return ((int *)arg, 50);
46
 
47
  case SOUND_MIXER_READ_SYNTH:
48
    return snd_ioctl_return ((int *)arg, vidc_synth_get_volume ());
49
 
50
  case SOUND_MIXER_WRITE_SYNTH:
51
    return snd_ioctl_return ((int *)arg, vidc_synth_set_volume (get_user ((int *)arg)));
52
 
53
  case SOUND_MIXER_READ_PCM:
54
    return snd_ioctl_return ((int *)arg, vidc_audio_get_volume ());
55
 
56
  case SOUND_MIXER_WRITE_PCM:
57
    return snd_ioctl_return ((int *)arg, vidc_audio_set_volume (get_user ((int *)arg)));
58
 
59
  case SOUND_MIXER_READ_SPEAKER:
60
    return snd_ioctl_return ((int *)arg, 100);
61
 
62
  case SOUND_MIXER_WRITE_SPEAKER:
63
    return snd_ioctl_return ((int *)arg, 100);
64
 
65
  case SOUND_MIXER_READ_LINE:
66
  case SOUND_MIXER_WRITE_LINE:
67
  case SOUND_MIXER_READ_MIC:
68
  case SOUND_MIXER_WRITE_MIC:
69
    return snd_ioctl_return ((int *)arg, 0);
70
 
71
  case SOUND_MIXER_READ_CD:
72
  case SOUND_MIXER_WRITE_CD:
73
    return snd_ioctl_return ((int *)arg, 100 | (100 << 8));
74
 
75
  case SOUND_MIXER_READ_IMIX:
76
  case SOUND_MIXER_WRITE_IMIX:
77
  case SOUND_MIXER_READ_ALTPCM:
78
  case SOUND_MIXER_WRITE_ALTPCM:
79
  case SOUND_MIXER_READ_LINE1:
80
  case SOUND_MIXER_WRITE_LINE1:
81
  case SOUND_MIXER_READ_LINE2:
82
  case SOUND_MIXER_WRITE_LINE2:
83
  case SOUND_MIXER_READ_LINE3:
84
  case SOUND_MIXER_WRITE_LINE3:
85
    return snd_ioctl_return ((int *)arg, 0);
86
 
87
  case SOUND_MIXER_READ_RECSRC:
88
    return snd_ioctl_return ((int *)arg, 0);
89
 
90
  case SOUND_MIXER_WRITE_RECSRC:
91
    return snd_ioctl_return ((int *)arg, -EINVAL);
92
 
93
  case SOUND_MIXER_READ_DEVMASK:
94
    return snd_ioctl_return ((int *)arg, SOUND_MASK_VOLUME | SOUND_MASK_PCM | SOUND_MASK_SYNTH);
95
 
96
  case SOUND_MIXER_READ_RECMASK:
97
    return snd_ioctl_return ((int *)arg, 0);
98
 
99
  case SOUND_MIXER_READ_STEREODEVS:
100
    return snd_ioctl_return ((int *)arg, SOUND_MASK_VOLUME | SOUND_MASK_PCM | SOUND_MASK_SYNTH);
101
 
102
  case SOUND_MIXER_READ_CAPS:
103
    return snd_ioctl_return ((int *)arg, 0);
104
 
105
  case SOUND_MIXER_READ_MUTE:
106
    return snd_ioctl_return ((int *)arg, -EINVAL);
107
 
108
  default:
109
    return snd_ioctl_return ((int *)arg, -EINVAL);
110
  }
111
}
112
 
113
static struct mixer_operations vidc_mixer_operations =
114
{
115
  "VIDC",
116
  "VIDCsound",
117
  vidc_default_mixer_ioctl      /* ioctl                */
118
};
119
 
120
void
121
vidc_mixer_init (struct address_info *hw_config)
122
{
123
  vidc_volume = 100 | (100 << 8);
124
  if (num_mixers < MAX_MIXER_DEV)
125
    mixer_devs[num_mixers++] = &vidc_mixer_operations;
126
}
127
 
128
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.