aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c/tea6330t.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/i2c/tea6330t.c')
-rw-r--r--sound/i2c/tea6330t.c84
1 files changed, 49 insertions, 35 deletions
diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c
index 7bd4948c2a3b..ae5b1e3a68ce 100644
--- a/sound/i2c/tea6330t.c
+++ b/sound/i2c/tea6330t.c
@@ -44,18 +44,20 @@ MODULE_LICENSE("GPL");
44#define TEA6330T_GMU 0x80 /* mute control, general mute */ 44#define TEA6330T_GMU 0x80 /* mute control, general mute */
45#define TEA6330T_EQN 0x40 /* equalizer switchover (0=equalizer-on) */ 45#define TEA6330T_EQN 0x40 /* equalizer switchover (0=equalizer-on) */
46 46
47typedef struct { 47
48 snd_i2c_device_t *device; 48struct tea6330t {
49 snd_i2c_bus_t *bus; 49 struct snd_i2c_device *device;
50 struct snd_i2c_bus *bus;
50 int equalizer; 51 int equalizer;
51 int fader; 52 int fader;
52 unsigned char regs[8]; 53 unsigned char regs[8];
53 unsigned char mleft, mright; 54 unsigned char mleft, mright;
54 unsigned char bass, treble; 55 unsigned char bass, treble;
55 unsigned char max_bass, max_treble; 56 unsigned char max_bass, max_treble;
56} tea6330t_t; 57};
58
57 59
58int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer) 60int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer)
59{ 61{
60 int res; 62 int res;
61 63
@@ -66,7 +68,7 @@ int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer)
66} 68}
67 69
68#if 0 70#if 0
69static void snd_tea6330t_set(tea6330t_t *tea, 71static void snd_tea6330t_set(struct tea6330t *tea,
70 unsigned char addr, unsigned char value) 72 unsigned char addr, unsigned char value)
71{ 73{
72#if 0 74#if 0
@@ -81,7 +83,8 @@ static void snd_tea6330t_set(tea6330t_t *tea,
81 .info = snd_tea6330t_info_master_volume, \ 83 .info = snd_tea6330t_info_master_volume, \
82 .get = snd_tea6330t_get_master_volume, .put = snd_tea6330t_put_master_volume } 84 .get = snd_tea6330t_get_master_volume, .put = snd_tea6330t_put_master_volume }
83 85
84static int snd_tea6330t_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 86static int snd_tea6330t_info_master_volume(struct snd_kcontrol *kcontrol,
87 struct snd_ctl_elem_info *uinfo)
85{ 88{
86 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 89 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
87 uinfo->count = 2; 90 uinfo->count = 2;
@@ -90,9 +93,10 @@ static int snd_tea6330t_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_ele
90 return 0; 93 return 0;
91} 94}
92 95
93static int snd_tea6330t_get_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 96static int snd_tea6330t_get_master_volume(struct snd_kcontrol *kcontrol,
97 struct snd_ctl_elem_value *ucontrol)
94{ 98{
95 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 99 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
96 100
97 snd_i2c_lock(tea->bus); 101 snd_i2c_lock(tea->bus);
98 ucontrol->value.integer.value[0] = tea->mleft - 0x14; 102 ucontrol->value.integer.value[0] = tea->mleft - 0x14;
@@ -101,9 +105,10 @@ static int snd_tea6330t_get_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele
101 return 0; 105 return 0;
102} 106}
103 107
104static int snd_tea6330t_put_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 108static int snd_tea6330t_put_master_volume(struct snd_kcontrol *kcontrol,
109 struct snd_ctl_elem_value *ucontrol)
105{ 110{
106 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 111 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
107 int change, count, err; 112 int change, count, err;
108 unsigned char bytes[3]; 113 unsigned char bytes[3];
109 unsigned char val1, val2; 114 unsigned char val1, val2;
@@ -137,7 +142,8 @@ static int snd_tea6330t_put_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele
137 .info = snd_tea6330t_info_master_switch, \ 142 .info = snd_tea6330t_info_master_switch, \
138 .get = snd_tea6330t_get_master_switch, .put = snd_tea6330t_put_master_switch } 143 .get = snd_tea6330t_get_master_switch, .put = snd_tea6330t_put_master_switch }
139 144
140static int snd_tea6330t_info_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 145static int snd_tea6330t_info_master_switch(struct snd_kcontrol *kcontrol,
146 struct snd_ctl_elem_info *uinfo)
141{ 147{
142 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 148 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
143 uinfo->count = 2; 149 uinfo->count = 2;
@@ -146,9 +152,10 @@ static int snd_tea6330t_info_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_ele
146 return 0; 152 return 0;
147} 153}
148 154
149static int snd_tea6330t_get_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 155static int snd_tea6330t_get_master_switch(struct snd_kcontrol *kcontrol,
156 struct snd_ctl_elem_value *ucontrol)
150{ 157{
151 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 158 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
152 159
153 snd_i2c_lock(tea->bus); 160 snd_i2c_lock(tea->bus);
154 ucontrol->value.integer.value[0] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] == 0 ? 0 : 1; 161 ucontrol->value.integer.value[0] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] == 0 ? 0 : 1;
@@ -157,9 +164,10 @@ static int snd_tea6330t_get_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele
157 return 0; 164 return 0;
158} 165}
159 166
160static int snd_tea6330t_put_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 167static int snd_tea6330t_put_master_switch(struct snd_kcontrol *kcontrol,
168 struct snd_ctl_elem_value *ucontrol)
161{ 169{
162 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 170 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
163 int change, err; 171 int change, err;
164 unsigned char bytes[3]; 172 unsigned char bytes[3];
165 unsigned char oval1, oval2, val1, val2; 173 unsigned char oval1, oval2, val1, val2;
@@ -186,9 +194,10 @@ static int snd_tea6330t_put_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele
186 .info = snd_tea6330t_info_bass, \ 194 .info = snd_tea6330t_info_bass, \
187 .get = snd_tea6330t_get_bass, .put = snd_tea6330t_put_bass } 195 .get = snd_tea6330t_get_bass, .put = snd_tea6330t_put_bass }
188 196
189static int snd_tea6330t_info_bass(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 197static int snd_tea6330t_info_bass(struct snd_kcontrol *kcontrol,
198 struct snd_ctl_elem_info *uinfo)
190{ 199{
191 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 200 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
192 201
193 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 202 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
194 uinfo->count = 1; 203 uinfo->count = 1;
@@ -197,17 +206,19 @@ static int snd_tea6330t_info_bass(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
197 return 0; 206 return 0;
198} 207}
199 208
200static int snd_tea6330t_get_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 209static int snd_tea6330t_get_bass(struct snd_kcontrol *kcontrol,
210 struct snd_ctl_elem_value *ucontrol)
201{ 211{
202 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 212 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
203 213
204 ucontrol->value.integer.value[0] = tea->bass; 214 ucontrol->value.integer.value[0] = tea->bass;
205 return 0; 215 return 0;
206} 216}
207 217
208static int snd_tea6330t_put_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 218static int snd_tea6330t_put_bass(struct snd_kcontrol *kcontrol,
219 struct snd_ctl_elem_value *ucontrol)
209{ 220{
210 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 221 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
211 int change, err; 222 int change, err;
212 unsigned char bytes[2]; 223 unsigned char bytes[2];
213 unsigned char val1; 224 unsigned char val1;
@@ -230,9 +241,10 @@ static int snd_tea6330t_put_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
230 .info = snd_tea6330t_info_treble, \ 241 .info = snd_tea6330t_info_treble, \
231 .get = snd_tea6330t_get_treble, .put = snd_tea6330t_put_treble } 242 .get = snd_tea6330t_get_treble, .put = snd_tea6330t_put_treble }
232 243
233static int snd_tea6330t_info_treble(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 244static int snd_tea6330t_info_treble(struct snd_kcontrol *kcontrol,
245 struct snd_ctl_elem_info *uinfo)
234{ 246{
235 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 247 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
236 248
237 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 249 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
238 uinfo->count = 1; 250 uinfo->count = 1;
@@ -241,17 +253,19 @@ static int snd_tea6330t_info_treble(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_
241 return 0; 253 return 0;
242} 254}
243 255
244static int snd_tea6330t_get_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 256static int snd_tea6330t_get_treble(struct snd_kcontrol *kcontrol,
257 struct snd_ctl_elem_value *ucontrol)
245{ 258{
246 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 259 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
247 260
248 ucontrol->value.integer.value[0] = tea->treble; 261 ucontrol->value.integer.value[0] = tea->treble;
249 return 0; 262 return 0;
250} 263}
251 264
252static int snd_tea6330t_put_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 265static int snd_tea6330t_put_treble(struct snd_kcontrol *kcontrol,
266 struct snd_ctl_elem_value *ucontrol)
253{ 267{
254 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 268 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
255 int change, err; 269 int change, err;
256 unsigned char bytes[2]; 270 unsigned char bytes[2];
257 unsigned char val1; 271 unsigned char val1;
@@ -269,25 +283,25 @@ static int snd_tea6330t_put_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
269 return change; 283 return change;
270} 284}
271 285
272static snd_kcontrol_new_t snd_tea6330t_controls[] = { 286static struct snd_kcontrol_new snd_tea6330t_controls[] = {
273TEA6330T_MASTER_SWITCH("Master Playback Switch", 0), 287TEA6330T_MASTER_SWITCH("Master Playback Switch", 0),
274TEA6330T_MASTER_VOLUME("Master Playback Volume", 0), 288TEA6330T_MASTER_VOLUME("Master Playback Volume", 0),
275TEA6330T_BASS("Tone Control - Bass", 0), 289TEA6330T_BASS("Tone Control - Bass", 0),
276TEA6330T_TREBLE("Tone Control - Treble", 0) 290TEA6330T_TREBLE("Tone Control - Treble", 0)
277}; 291};
278 292
279static void snd_tea6330_free(snd_i2c_device_t *device) 293static void snd_tea6330_free(struct snd_i2c_device *device)
280{ 294{
281 kfree(device->private_data); 295 kfree(device->private_data);
282} 296}
283 297
284int snd_tea6330t_update_mixer(snd_card_t * card, 298int snd_tea6330t_update_mixer(struct snd_card *card,
285 snd_i2c_bus_t *bus, 299 struct snd_i2c_bus *bus,
286 int equalizer, int fader) 300 int equalizer, int fader)
287{ 301{
288 snd_i2c_device_t *device; 302 struct snd_i2c_device *device;
289 tea6330t_t *tea; 303 struct tea6330t *tea;
290 snd_kcontrol_new_t *knew; 304 struct snd_kcontrol_new *knew;
291 unsigned int idx; 305 unsigned int idx;
292 int err = -ENOMEM; 306 int err = -ENOMEM;
293 u8 default_treble, default_bass; 307 u8 default_treble, default_bass;