aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c/other/ak4117.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 08:17:19 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:18:08 -0500
commit97f02e05f246a2346275c1c93a3079e8933e74b2 (patch)
tree218d0a71f8bdeb5e6d2660339c29c46dab1adaa7 /sound/i2c/other/ak4117.c
parenta42dd420bea7a5cd130162183d95f640c299a337 (diff)
[ALSA] Remove xxx_t typedefs: I2C drivers
Remove xxx_t typedefs from the i2c drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/i2c/other/ak4117.c')
-rw-r--r--sound/i2c/other/ak4117.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c
index 35b4584483a3..4e45952dd95a 100644
--- a/sound/i2c/other/ak4117.c
+++ b/sound/i2c/other/ak4117.c
@@ -37,20 +37,20 @@ MODULE_LICENSE("GPL");
37 37
38static void snd_ak4117_timer(unsigned long data); 38static void snd_ak4117_timer(unsigned long data);
39 39
40static void reg_write(ak4117_t *ak4117, unsigned char reg, unsigned char val) 40static void reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char val)
41{ 41{
42 ak4117->write(ak4117->private_data, reg, val); 42 ak4117->write(ak4117->private_data, reg, val);
43 if (reg < sizeof(ak4117->regmap)) 43 if (reg < sizeof(ak4117->regmap))
44 ak4117->regmap[reg] = val; 44 ak4117->regmap[reg] = val;
45} 45}
46 46
47static inline unsigned char reg_read(ak4117_t *ak4117, unsigned char reg) 47static inline unsigned char reg_read(struct ak4117 *ak4117, unsigned char reg)
48{ 48{
49 return ak4117->read(ak4117->private_data, reg); 49 return ak4117->read(ak4117->private_data, reg);
50} 50}
51 51
52#if 0 52#if 0
53static void reg_dump(ak4117_t *ak4117) 53static void reg_dump(struct ak4117 *ak4117)
54{ 54{
55 int i; 55 int i;
56 56
@@ -60,26 +60,26 @@ static void reg_dump(ak4117_t *ak4117)
60} 60}
61#endif 61#endif
62 62
63static void snd_ak4117_free(ak4117_t *chip) 63static void snd_ak4117_free(struct ak4117 *chip)
64{ 64{
65 del_timer(&chip->timer); 65 del_timer(&chip->timer);
66 kfree(chip); 66 kfree(chip);
67} 67}
68 68
69static int snd_ak4117_dev_free(snd_device_t *device) 69static int snd_ak4117_dev_free(struct snd_device *device)
70{ 70{
71 ak4117_t *chip = device->device_data; 71 struct ak4117 *chip = device->device_data;
72 snd_ak4117_free(chip); 72 snd_ak4117_free(chip);
73 return 0; 73 return 0;
74} 74}
75 75
76int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *write, 76int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write,
77 unsigned char pgm[5], void *private_data, ak4117_t **r_ak4117) 77 unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117)
78{ 78{
79 ak4117_t *chip; 79 struct ak4117 *chip;
80 int err = 0; 80 int err = 0;
81 unsigned char reg; 81 unsigned char reg;
82 static snd_device_ops_t ops = { 82 static struct snd_device_ops ops = {
83 .dev_free = snd_ak4117_dev_free, 83 .dev_free = snd_ak4117_dev_free,
84 }; 84 };
85 85
@@ -115,14 +115,14 @@ int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *wri
115 return err < 0 ? err : -EIO; 115 return err < 0 ? err : -EIO;
116} 116}
117 117
118void snd_ak4117_reg_write(ak4117_t *chip, unsigned char reg, unsigned char mask, unsigned char val) 118void snd_ak4117_reg_write(struct ak4117 *chip, unsigned char reg, unsigned char mask, unsigned char val)
119{ 119{
120 if (reg >= 5) 120 if (reg >= 5)
121 return; 121 return;
122 reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val); 122 reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val);
123} 123}
124 124
125void snd_ak4117_reinit(ak4117_t *chip) 125void snd_ak4117_reinit(struct ak4117 *chip)
126{ 126{
127 unsigned char old = chip->regmap[AK4117_REG_PWRDN], reg; 127 unsigned char old = chip->regmap[AK4117_REG_PWRDN], reg;
128 128
@@ -157,8 +157,8 @@ static unsigned int external_rate(unsigned char rcs1)
157 } 157 }
158} 158}
159 159
160static int snd_ak4117_in_error_info(snd_kcontrol_t *kcontrol, 160static int snd_ak4117_in_error_info(struct snd_kcontrol *kcontrol,
161 snd_ctl_elem_info_t *uinfo) 161 struct snd_ctl_elem_info *uinfo)
162{ 162{
163 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 163 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
164 uinfo->count = 1; 164 uinfo->count = 1;
@@ -167,10 +167,10 @@ static int snd_ak4117_in_error_info(snd_kcontrol_t *kcontrol,
167 return 0; 167 return 0;
168} 168}
169 169
170static int snd_ak4117_in_error_get(snd_kcontrol_t *kcontrol, 170static int snd_ak4117_in_error_get(struct snd_kcontrol *kcontrol,
171 snd_ctl_elem_value_t *ucontrol) 171 struct snd_ctl_elem_value *ucontrol)
172{ 172{
173 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 173 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
174 long *ptr; 174 long *ptr;
175 175
176 spin_lock_irq(&chip->lock); 176 spin_lock_irq(&chip->lock);
@@ -181,8 +181,8 @@ static int snd_ak4117_in_error_get(snd_kcontrol_t *kcontrol,
181 return 0; 181 return 0;
182} 182}
183 183
184static int snd_ak4117_in_bit_info(snd_kcontrol_t *kcontrol, 184static int snd_ak4117_in_bit_info(struct snd_kcontrol *kcontrol,
185 snd_ctl_elem_info_t *uinfo) 185 struct snd_ctl_elem_info *uinfo)
186{ 186{
187 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 187 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
188 uinfo->count = 1; 188 uinfo->count = 1;
@@ -191,10 +191,10 @@ static int snd_ak4117_in_bit_info(snd_kcontrol_t *kcontrol,
191 return 0; 191 return 0;
192} 192}
193 193
194static int snd_ak4117_in_bit_get(snd_kcontrol_t *kcontrol, 194static int snd_ak4117_in_bit_get(struct snd_kcontrol *kcontrol,
195 snd_ctl_elem_value_t *ucontrol) 195 struct snd_ctl_elem_value *ucontrol)
196{ 196{
197 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 197 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
198 unsigned char reg = kcontrol->private_value & 0xff; 198 unsigned char reg = kcontrol->private_value & 0xff;
199 unsigned char bit = (kcontrol->private_value >> 8) & 0xff; 199 unsigned char bit = (kcontrol->private_value >> 8) & 0xff;
200 unsigned char inv = (kcontrol->private_value >> 31) & 1; 200 unsigned char inv = (kcontrol->private_value >> 31) & 1;
@@ -203,8 +203,8 @@ static int snd_ak4117_in_bit_get(snd_kcontrol_t *kcontrol,
203 return 0; 203 return 0;
204} 204}
205 205
206static int snd_ak4117_rx_info(snd_kcontrol_t *kcontrol, 206static int snd_ak4117_rx_info(struct snd_kcontrol *kcontrol,
207 snd_ctl_elem_info_t *uinfo) 207 struct snd_ctl_elem_info *uinfo)
208{ 208{
209 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 209 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
210 uinfo->count = 1; 210 uinfo->count = 1;
@@ -213,19 +213,19 @@ static int snd_ak4117_rx_info(snd_kcontrol_t *kcontrol,
213 return 0; 213 return 0;
214} 214}
215 215
216static int snd_ak4117_rx_get(snd_kcontrol_t *kcontrol, 216static int snd_ak4117_rx_get(struct snd_kcontrol *kcontrol,
217 snd_ctl_elem_value_t *ucontrol) 217 struct snd_ctl_elem_value *ucontrol)
218{ 218{
219 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 219 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
220 220
221 ucontrol->value.integer.value[0] = (chip->regmap[AK4117_REG_IO] & AK4117_IPS) ? 1 : 0; 221 ucontrol->value.integer.value[0] = (chip->regmap[AK4117_REG_IO] & AK4117_IPS) ? 1 : 0;
222 return 0; 222 return 0;
223} 223}
224 224
225static int snd_ak4117_rx_put(snd_kcontrol_t *kcontrol, 225static int snd_ak4117_rx_put(struct snd_kcontrol *kcontrol,
226 snd_ctl_elem_value_t *ucontrol) 226 struct snd_ctl_elem_value *ucontrol)
227{ 227{
228 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 228 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
229 int change; 229 int change;
230 u8 old_val; 230 u8 old_val;
231 231
@@ -238,8 +238,8 @@ static int snd_ak4117_rx_put(snd_kcontrol_t *kcontrol,
238 return change; 238 return change;
239} 239}
240 240
241static int snd_ak4117_rate_info(snd_kcontrol_t *kcontrol, 241static int snd_ak4117_rate_info(struct snd_kcontrol *kcontrol,
242 snd_ctl_elem_info_t *uinfo) 242 struct snd_ctl_elem_info *uinfo)
243{ 243{
244 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 244 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
245 uinfo->count = 1; 245 uinfo->count = 1;
@@ -248,26 +248,26 @@ static int snd_ak4117_rate_info(snd_kcontrol_t *kcontrol,
248 return 0; 248 return 0;
249} 249}
250 250
251static int snd_ak4117_rate_get(snd_kcontrol_t *kcontrol, 251static int snd_ak4117_rate_get(struct snd_kcontrol *kcontrol,
252 snd_ctl_elem_value_t *ucontrol) 252 struct snd_ctl_elem_value *ucontrol)
253{ 253{
254 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 254 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
255 255
256 ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4117_REG_RCS1)); 256 ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4117_REG_RCS1));
257 return 0; 257 return 0;
258} 258}
259 259
260static int snd_ak4117_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 260static int snd_ak4117_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
261{ 261{
262 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 262 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
263 uinfo->count = 1; 263 uinfo->count = 1;
264 return 0; 264 return 0;
265} 265}
266 266
267static int snd_ak4117_spdif_get(snd_kcontrol_t * kcontrol, 267static int snd_ak4117_spdif_get(struct snd_kcontrol *kcontrol,
268 snd_ctl_elem_value_t * ucontrol) 268 struct snd_ctl_elem_value *ucontrol)
269{ 269{
270 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 270 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
271 unsigned i; 271 unsigned i;
272 272
273 for (i = 0; i < AK4117_REG_RXCSB_SIZE; i++) 273 for (i = 0; i < AK4117_REG_RXCSB_SIZE; i++)
@@ -275,21 +275,21 @@ static int snd_ak4117_spdif_get(snd_kcontrol_t * kcontrol,
275 return 0; 275 return 0;
276} 276}
277 277
278static int snd_ak4117_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 278static int snd_ak4117_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
279{ 279{
280 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 280 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
281 uinfo->count = 1; 281 uinfo->count = 1;
282 return 0; 282 return 0;
283} 283}
284 284
285static int snd_ak4117_spdif_mask_get(snd_kcontrol_t * kcontrol, 285static int snd_ak4117_spdif_mask_get(struct snd_kcontrol *kcontrol,
286 snd_ctl_elem_value_t * ucontrol) 286 struct snd_ctl_elem_value *ucontrol)
287{ 287{
288 memset(ucontrol->value.iec958.status, 0xff, AK4117_REG_RXCSB_SIZE); 288 memset(ucontrol->value.iec958.status, 0xff, AK4117_REG_RXCSB_SIZE);
289 return 0; 289 return 0;
290} 290}
291 291
292static int snd_ak4117_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 292static int snd_ak4117_spdif_pinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
293{ 293{
294 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 294 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
295 uinfo->value.integer.min = 0; 295 uinfo->value.integer.min = 0;
@@ -298,10 +298,10 @@ static int snd_ak4117_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
298 return 0; 298 return 0;
299} 299}
300 300
301static int snd_ak4117_spdif_pget(snd_kcontrol_t * kcontrol, 301static int snd_ak4117_spdif_pget(struct snd_kcontrol *kcontrol,
302 snd_ctl_elem_value_t * ucontrol) 302 struct snd_ctl_elem_value *ucontrol)
303{ 303{
304 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 304 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
305 unsigned short tmp; 305 unsigned short tmp;
306 306
307 ucontrol->value.integer.value[0] = 0xf8f2; 307 ucontrol->value.integer.value[0] = 0xf8f2;
@@ -313,17 +313,17 @@ static int snd_ak4117_spdif_pget(snd_kcontrol_t * kcontrol,
313 return 0; 313 return 0;
314} 314}
315 315
316static int snd_ak4117_spdif_qinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 316static int snd_ak4117_spdif_qinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
317{ 317{
318 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; 318 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
319 uinfo->count = AK4117_REG_QSUB_SIZE; 319 uinfo->count = AK4117_REG_QSUB_SIZE;
320 return 0; 320 return 0;
321} 321}
322 322
323static int snd_ak4117_spdif_qget(snd_kcontrol_t * kcontrol, 323static int snd_ak4117_spdif_qget(struct snd_kcontrol *kcontrol,
324 snd_ctl_elem_value_t * ucontrol) 324 struct snd_ctl_elem_value *ucontrol)
325{ 325{
326 ak4117_t *chip = snd_kcontrol_chip(kcontrol); 326 struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
327 unsigned i; 327 unsigned i;
328 328
329 for (i = 0; i < AK4117_REG_QSUB_SIZE; i++) 329 for (i = 0; i < AK4117_REG_QSUB_SIZE; i++)
@@ -332,14 +332,14 @@ static int snd_ak4117_spdif_qget(snd_kcontrol_t * kcontrol,
332} 332}
333 333
334/* Don't forget to change AK4117_CONTROLS define!!! */ 334/* Don't forget to change AK4117_CONTROLS define!!! */
335static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { 335static struct snd_kcontrol_new snd_ak4117_iec958_controls[] = {
336{ 336{
337 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 337 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
338 .name = "IEC958 Parity Errors", 338 .name = "IEC958 Parity Errors",
339 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 339 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
340 .info = snd_ak4117_in_error_info, 340 .info = snd_ak4117_in_error_info,
341 .get = snd_ak4117_in_error_get, 341 .get = snd_ak4117_in_error_get,
342 .private_value = offsetof(ak4117_t, parity_errors), 342 .private_value = offsetof(struct ak4117, parity_errors),
343}, 343},
344{ 344{
345 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 345 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -347,7 +347,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
347 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 347 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
348 .info = snd_ak4117_in_error_info, 348 .info = snd_ak4117_in_error_info,
349 .get = snd_ak4117_in_error_get, 349 .get = snd_ak4117_in_error_get,
350 .private_value = offsetof(ak4117_t, v_bit_errors), 350 .private_value = offsetof(struct ak4117, v_bit_errors),
351}, 351},
352{ 352{
353 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 353 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -355,7 +355,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
355 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 355 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
356 .info = snd_ak4117_in_error_info, 356 .info = snd_ak4117_in_error_info,
357 .get = snd_ak4117_in_error_get, 357 .get = snd_ak4117_in_error_get,
358 .private_value = offsetof(ak4117_t, ccrc_errors), 358 .private_value = offsetof(struct ak4117, ccrc_errors),
359}, 359},
360{ 360{
361 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 361 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -363,7 +363,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
363 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 363 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
364 .info = snd_ak4117_in_error_info, 364 .info = snd_ak4117_in_error_info,
365 .get = snd_ak4117_in_error_get, 365 .get = snd_ak4117_in_error_get,
366 .private_value = offsetof(ak4117_t, qcrc_errors), 366 .private_value = offsetof(struct ak4117, qcrc_errors),
367}, 367},
368{ 368{
369 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 369 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -434,9 +434,9 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
434} 434}
435}; 435};
436 436
437int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *cap_substream) 437int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *cap_substream)
438{ 438{
439 snd_kcontrol_t *kctl; 439 struct snd_kcontrol *kctl;
440 unsigned int idx; 440 unsigned int idx;
441 int err; 441 int err;
442 442
@@ -456,7 +456,7 @@ int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *cap_substream)
456 return 0; 456 return 0;
457} 457}
458 458
459int snd_ak4117_external_rate(ak4117_t *ak4117) 459int snd_ak4117_external_rate(struct ak4117 *ak4117)
460{ 460{
461 unsigned char rcs1; 461 unsigned char rcs1;
462 462
@@ -464,9 +464,9 @@ int snd_ak4117_external_rate(ak4117_t *ak4117)
464 return external_rate(rcs1); 464 return external_rate(rcs1);
465} 465}
466 466
467int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags) 467int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags)
468{ 468{
469 snd_pcm_runtime_t *runtime = ak4117->substream ? ak4117->substream->runtime : NULL; 469 struct snd_pcm_runtime *runtime = ak4117->substream ? ak4117->substream->runtime : NULL;
470 unsigned long _flags; 470 unsigned long _flags;
471 int res = 0; 471 int res = 0;
472 unsigned char rcs0, rcs1, rcs2; 472 unsigned char rcs0, rcs1, rcs2;
@@ -542,7 +542,7 @@ int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags)
542 542
543static void snd_ak4117_timer(unsigned long data) 543static void snd_ak4117_timer(unsigned long data)
544{ 544{
545 ak4117_t *chip = (ak4117_t *)data; 545 struct ak4117 *chip = (struct ak4117 *)data;
546 546
547 if (chip->init) 547 if (chip->init)
548 return; 548 return;