aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c/other/ak4114.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/i2c/other/ak4114.c')
-rw-r--r--sound/i2c/other/ak4114.c122
1 files changed, 61 insertions, 61 deletions
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index d351b3aa1916..12ffffc9e814 100644
--- a/sound/i2c/other/ak4114.c
+++ b/sound/i2c/other/ak4114.c
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
37 37
38static void ak4114_stats(void *); 38static void ak4114_stats(void *);
39 39
40static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char val) 40static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char val)
41{ 41{
42 ak4114->write(ak4114->private_data, reg, val); 42 ak4114->write(ak4114->private_data, reg, val);
43 if (reg <= AK4114_REG_INT1_MASK) 43 if (reg <= AK4114_REG_INT1_MASK)
@@ -46,13 +46,13 @@ static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char val)
46 ak4114->txcsb[reg-AK4114_REG_RXCSB0] = val; 46 ak4114->txcsb[reg-AK4114_REG_RXCSB0] = val;
47} 47}
48 48
49static inline unsigned char reg_read(ak4114_t *ak4114, unsigned char reg) 49static inline unsigned char reg_read(struct ak4114 *ak4114, unsigned char reg)
50{ 50{
51 return ak4114->read(ak4114->private_data, reg); 51 return ak4114->read(ak4114->private_data, reg);
52} 52}
53 53
54#if 0 54#if 0
55static void reg_dump(ak4114_t *ak4114) 55static void reg_dump(struct ak4114 *ak4114)
56{ 56{
57 int i; 57 int i;
58 58
@@ -62,7 +62,7 @@ static void reg_dump(ak4114_t *ak4114)
62} 62}
63#endif 63#endif
64 64
65static void snd_ak4114_free(ak4114_t *chip) 65static void snd_ak4114_free(struct ak4114 *chip)
66{ 66{
67 chip->init = 1; /* don't schedule new work */ 67 chip->init = 1; /* don't schedule new work */
68 mb(); 68 mb();
@@ -73,22 +73,22 @@ static void snd_ak4114_free(ak4114_t *chip)
73 kfree(chip); 73 kfree(chip);
74} 74}
75 75
76static int snd_ak4114_dev_free(snd_device_t *device) 76static int snd_ak4114_dev_free(struct snd_device *device)
77{ 77{
78 ak4114_t *chip = device->device_data; 78 struct ak4114 *chip = device->device_data;
79 snd_ak4114_free(chip); 79 snd_ak4114_free(chip);
80 return 0; 80 return 0;
81} 81}
82 82
83int snd_ak4114_create(snd_card_t *card, 83int snd_ak4114_create(struct snd_card *card,
84 ak4114_read_t *read, ak4114_write_t *write, 84 ak4114_read_t *read, ak4114_write_t *write,
85 unsigned char pgm[7], unsigned char txcsb[5], 85 unsigned char pgm[7], unsigned char txcsb[5],
86 void *private_data, ak4114_t **r_ak4114) 86 void *private_data, struct ak4114 **r_ak4114)
87{ 87{
88 ak4114_t *chip; 88 struct ak4114 *chip;
89 int err = 0; 89 int err = 0;
90 unsigned char reg; 90 unsigned char reg;
91 static snd_device_ops_t ops = { 91 static struct snd_device_ops ops = {
92 .dev_free = snd_ak4114_dev_free, 92 .dev_free = snd_ak4114_dev_free,
93 }; 93 };
94 94
@@ -129,7 +129,7 @@ int snd_ak4114_create(snd_card_t *card,
129 return err < 0 ? err : -EIO; 129 return err < 0 ? err : -EIO;
130} 130}
131 131
132void snd_ak4114_reg_write(ak4114_t *chip, unsigned char reg, unsigned char mask, unsigned char val) 132void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val)
133{ 133{
134 if (reg <= AK4114_REG_INT1_MASK) 134 if (reg <= AK4114_REG_INT1_MASK)
135 reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val); 135 reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val);
@@ -137,7 +137,7 @@ void snd_ak4114_reg_write(ak4114_t *chip, unsigned char reg, unsigned char mask,
137 reg_write(chip, reg, (chip->txcsb[reg] & ~mask) | val); 137 reg_write(chip, reg, (chip->txcsb[reg] & ~mask) | val);
138} 138}
139 139
140void snd_ak4114_reinit(ak4114_t *chip) 140void snd_ak4114_reinit(struct ak4114 *chip)
141{ 141{
142 unsigned char old = chip->regmap[AK4114_REG_PWRDN], reg; 142 unsigned char old = chip->regmap[AK4114_REG_PWRDN], reg;
143 143
@@ -176,8 +176,8 @@ static unsigned int external_rate(unsigned char rcs1)
176 } 176 }
177} 177}
178 178
179static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol, 179static int snd_ak4114_in_error_info(struct snd_kcontrol *kcontrol,
180 snd_ctl_elem_info_t *uinfo) 180 struct snd_ctl_elem_info *uinfo)
181{ 181{
182 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 182 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
183 uinfo->count = 1; 183 uinfo->count = 1;
@@ -186,10 +186,10 @@ static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol,
186 return 0; 186 return 0;
187} 187}
188 188
189static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol, 189static int snd_ak4114_in_error_get(struct snd_kcontrol *kcontrol,
190 snd_ctl_elem_value_t *ucontrol) 190 struct snd_ctl_elem_value *ucontrol)
191{ 191{
192 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 192 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
193 long *ptr; 193 long *ptr;
194 194
195 spin_lock_irq(&chip->lock); 195 spin_lock_irq(&chip->lock);
@@ -200,8 +200,8 @@ static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol,
200 return 0; 200 return 0;
201} 201}
202 202
203static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol, 203static int snd_ak4114_in_bit_info(struct snd_kcontrol *kcontrol,
204 snd_ctl_elem_info_t *uinfo) 204 struct snd_ctl_elem_info *uinfo)
205{ 205{
206 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 206 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
207 uinfo->count = 1; 207 uinfo->count = 1;
@@ -210,10 +210,10 @@ static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol,
210 return 0; 210 return 0;
211} 211}
212 212
213static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol, 213static int snd_ak4114_in_bit_get(struct snd_kcontrol *kcontrol,
214 snd_ctl_elem_value_t *ucontrol) 214 struct snd_ctl_elem_value *ucontrol)
215{ 215{
216 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 216 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
217 unsigned char reg = kcontrol->private_value & 0xff; 217 unsigned char reg = kcontrol->private_value & 0xff;
218 unsigned char bit = (kcontrol->private_value >> 8) & 0xff; 218 unsigned char bit = (kcontrol->private_value >> 8) & 0xff;
219 unsigned char inv = (kcontrol->private_value >> 31) & 1; 219 unsigned char inv = (kcontrol->private_value >> 31) & 1;
@@ -222,8 +222,8 @@ static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol,
222 return 0; 222 return 0;
223} 223}
224 224
225static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol, 225static int snd_ak4114_rate_info(struct snd_kcontrol *kcontrol,
226 snd_ctl_elem_info_t *uinfo) 226 struct snd_ctl_elem_info *uinfo)
227{ 227{
228 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 228 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
229 uinfo->count = 1; 229 uinfo->count = 1;
@@ -232,26 +232,26 @@ static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol,
232 return 0; 232 return 0;
233} 233}
234 234
235static int snd_ak4114_rate_get(snd_kcontrol_t *kcontrol, 235static int snd_ak4114_rate_get(struct snd_kcontrol *kcontrol,
236 snd_ctl_elem_value_t *ucontrol) 236 struct snd_ctl_elem_value *ucontrol)
237{ 237{
238 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 238 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
239 239
240 ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4114_REG_RCS1)); 240 ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4114_REG_RCS1));
241 return 0; 241 return 0;
242} 242}
243 243
244static int snd_ak4114_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 244static int snd_ak4114_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
245{ 245{
246 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 246 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
247 uinfo->count = 1; 247 uinfo->count = 1;
248 return 0; 248 return 0;
249} 249}
250 250
251static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol, 251static int snd_ak4114_spdif_get(struct snd_kcontrol *kcontrol,
252 snd_ctl_elem_value_t * ucontrol) 252 struct snd_ctl_elem_value *ucontrol)
253{ 253{
254 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 254 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
255 unsigned i; 255 unsigned i;
256 256
257 for (i = 0; i < AK4114_REG_RXCSB_SIZE; i++) 257 for (i = 0; i < AK4114_REG_RXCSB_SIZE; i++)
@@ -259,10 +259,10 @@ static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol,
259 return 0; 259 return 0;
260} 260}
261 261
262static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol, 262static int snd_ak4114_spdif_playback_get(struct snd_kcontrol *kcontrol,
263 snd_ctl_elem_value_t * ucontrol) 263 struct snd_ctl_elem_value *ucontrol)
264{ 264{
265 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 265 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
266 unsigned i; 266 unsigned i;
267 267
268 for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++) 268 for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++)
@@ -270,10 +270,10 @@ static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol,
270 return 0; 270 return 0;
271} 271}
272 272
273static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol, 273static int snd_ak4114_spdif_playback_put(struct snd_kcontrol *kcontrol,
274 snd_ctl_elem_value_t * ucontrol) 274 struct snd_ctl_elem_value *ucontrol)
275{ 275{
276 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 276 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
277 unsigned i; 277 unsigned i;
278 278
279 for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++) 279 for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++)
@@ -281,21 +281,21 @@ static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol,
281 return 0; 281 return 0;
282} 282}
283 283
284static int snd_ak4114_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 284static int snd_ak4114_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
285{ 285{
286 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 286 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
287 uinfo->count = 1; 287 uinfo->count = 1;
288 return 0; 288 return 0;
289} 289}
290 290
291static int snd_ak4114_spdif_mask_get(snd_kcontrol_t * kcontrol, 291static int snd_ak4114_spdif_mask_get(struct snd_kcontrol *kcontrol,
292 snd_ctl_elem_value_t * ucontrol) 292 struct snd_ctl_elem_value *ucontrol)
293{ 293{
294 memset(ucontrol->value.iec958.status, 0xff, AK4114_REG_RXCSB_SIZE); 294 memset(ucontrol->value.iec958.status, 0xff, AK4114_REG_RXCSB_SIZE);
295 return 0; 295 return 0;
296} 296}
297 297
298static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 298static int snd_ak4114_spdif_pinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
299{ 299{
300 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 300 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
301 uinfo->value.integer.min = 0; 301 uinfo->value.integer.min = 0;
@@ -304,10 +304,10 @@ static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
304 return 0; 304 return 0;
305} 305}
306 306
307static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol, 307static int snd_ak4114_spdif_pget(struct snd_kcontrol *kcontrol,
308 snd_ctl_elem_value_t * ucontrol) 308 struct snd_ctl_elem_value *ucontrol)
309{ 309{
310 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 310 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
311 unsigned short tmp; 311 unsigned short tmp;
312 312
313 ucontrol->value.integer.value[0] = 0xf8f2; 313 ucontrol->value.integer.value[0] = 0xf8f2;
@@ -319,17 +319,17 @@ static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol,
319 return 0; 319 return 0;
320} 320}
321 321
322static int snd_ak4114_spdif_qinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 322static int snd_ak4114_spdif_qinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
323{ 323{
324 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; 324 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
325 uinfo->count = AK4114_REG_QSUB_SIZE; 325 uinfo->count = AK4114_REG_QSUB_SIZE;
326 return 0; 326 return 0;
327} 327}
328 328
329static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol, 329static int snd_ak4114_spdif_qget(struct snd_kcontrol *kcontrol,
330 snd_ctl_elem_value_t * ucontrol) 330 struct snd_ctl_elem_value *ucontrol)
331{ 331{
332 ak4114_t *chip = snd_kcontrol_chip(kcontrol); 332 struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
333 unsigned i; 333 unsigned i;
334 334
335 for (i = 0; i < AK4114_REG_QSUB_SIZE; i++) 335 for (i = 0; i < AK4114_REG_QSUB_SIZE; i++)
@@ -338,14 +338,14 @@ static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol,
338} 338}
339 339
340/* Don't forget to change AK4114_CONTROLS define!!! */ 340/* Don't forget to change AK4114_CONTROLS define!!! */
341static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { 341static struct snd_kcontrol_new snd_ak4114_iec958_controls[] = {
342{ 342{
343 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 343 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
344 .name = "IEC958 Parity Errors", 344 .name = "IEC958 Parity Errors",
345 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 345 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
346 .info = snd_ak4114_in_error_info, 346 .info = snd_ak4114_in_error_info,
347 .get = snd_ak4114_in_error_get, 347 .get = snd_ak4114_in_error_get,
348 .private_value = offsetof(ak4114_t, parity_errors), 348 .private_value = offsetof(struct ak4114, parity_errors),
349}, 349},
350{ 350{
351 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 351 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -353,7 +353,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
353 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 353 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
354 .info = snd_ak4114_in_error_info, 354 .info = snd_ak4114_in_error_info,
355 .get = snd_ak4114_in_error_get, 355 .get = snd_ak4114_in_error_get,
356 .private_value = offsetof(ak4114_t, v_bit_errors), 356 .private_value = offsetof(struct ak4114, v_bit_errors),
357}, 357},
358{ 358{
359 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 359 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -361,7 +361,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
361 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 361 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
362 .info = snd_ak4114_in_error_info, 362 .info = snd_ak4114_in_error_info,
363 .get = snd_ak4114_in_error_get, 363 .get = snd_ak4114_in_error_get,
364 .private_value = offsetof(ak4114_t, ccrc_errors), 364 .private_value = offsetof(struct ak4114, ccrc_errors),
365}, 365},
366{ 366{
367 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 367 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -369,7 +369,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
369 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 369 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
370 .info = snd_ak4114_in_error_info, 370 .info = snd_ak4114_in_error_info,
371 .get = snd_ak4114_in_error_get, 371 .get = snd_ak4114_in_error_get,
372 .private_value = offsetof(ak4114_t, qcrc_errors), 372 .private_value = offsetof(struct ak4114, qcrc_errors),
373}, 373},
374{ 374{
375 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 375 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -447,11 +447,11 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
447} 447}
448}; 448};
449 449
450int snd_ak4114_build(ak4114_t *ak4114, 450int snd_ak4114_build(struct ak4114 *ak4114,
451 snd_pcm_substream_t *ply_substream, 451 struct snd_pcm_substream *ply_substream,
452 snd_pcm_substream_t *cap_substream) 452 struct snd_pcm_substream *cap_substream)
453{ 453{
454 snd_kcontrol_t *kctl; 454 struct snd_kcontrol *kctl;
455 unsigned int idx; 455 unsigned int idx;
456 int err; 456 int err;
457 457
@@ -482,7 +482,7 @@ int snd_ak4114_build(ak4114_t *ak4114,
482 return 0; 482 return 0;
483} 483}
484 484
485int snd_ak4114_external_rate(ak4114_t *ak4114) 485int snd_ak4114_external_rate(struct ak4114 *ak4114)
486{ 486{
487 unsigned char rcs1; 487 unsigned char rcs1;
488 488
@@ -490,9 +490,9 @@ int snd_ak4114_external_rate(ak4114_t *ak4114)
490 return external_rate(rcs1); 490 return external_rate(rcs1);
491} 491}
492 492
493int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags) 493int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags)
494{ 494{
495 snd_pcm_runtime_t *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL; 495 struct snd_pcm_runtime *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL;
496 unsigned long _flags; 496 unsigned long _flags;
497 int res = 0; 497 int res = 0;
498 unsigned char rcs0, rcs1; 498 unsigned char rcs0, rcs1;
@@ -563,7 +563,7 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags)
563 563
564static void ak4114_stats(void *data) 564static void ak4114_stats(void *data)
565{ 565{
566 ak4114_t *chip = (ak4114_t *)data; 566 struct ak4114 *chip = (struct ak4114 *)data;
567 567
568 if (chip->init) 568 if (chip->init)
569 return; 569 return;