aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2006-01-24 15:34:47 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2006-01-24 15:34:47 -0500
commit0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch)
tree7b42490a676cf39ae0691b6859ecf7fd410f229b /sound/i2c
parent4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff)
parent3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff)
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'sound/i2c')
-rw-r--r--sound/i2c/cs8427.c142
-rw-r--r--sound/i2c/i2c.c79
-rw-r--r--sound/i2c/l3/uda1341.c233
-rw-r--r--sound/i2c/other/ak4114.c122
-rw-r--r--sound/i2c/other/ak4117.c122
-rw-r--r--sound/i2c/other/ak4xxx-adda.c49
-rw-r--r--sound/i2c/other/tea575x-tuner.c8
-rw-r--r--sound/i2c/tea6330t.c88
8 files changed, 503 insertions, 340 deletions
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c
index 1a05cfbdc7..9deba80a58 100644
--- a/sound/i2c/cs8427.c
+++ b/sound/i2c/cs8427.c
@@ -30,7 +30,7 @@
30#include <sound/cs8427.h> 30#include <sound/cs8427.h>
31#include <sound/asoundef.h> 31#include <sound/asoundef.h>
32 32
33static void snd_cs8427_reset(snd_i2c_device_t *cs8427); 33static void snd_cs8427_reset(struct snd_i2c_device *cs8427);
34 34
35MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 35MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
36MODULE_DESCRIPTION("IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic"); 36MODULE_DESCRIPTION("IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic");
@@ -38,22 +38,22 @@ MODULE_LICENSE("GPL");
38 38
39#define CS8427_ADDR (0x20>>1) /* fixed address */ 39#define CS8427_ADDR (0x20>>1) /* fixed address */
40 40
41typedef struct { 41struct cs8427_stream {
42 snd_pcm_substream_t *substream; 42 struct snd_pcm_substream *substream;
43 char hw_status[24]; /* hardware status */ 43 char hw_status[24]; /* hardware status */
44 char def_status[24]; /* default status */ 44 char def_status[24]; /* default status */
45 char pcm_status[24]; /* PCM private status */ 45 char pcm_status[24]; /* PCM private status */
46 char hw_udata[32]; 46 char hw_udata[32];
47 snd_kcontrol_t *pcm_ctl; 47 struct snd_kcontrol *pcm_ctl;
48} cs8427_stream_t; 48};
49 49
50typedef struct { 50struct cs8427 {
51 unsigned char regmap[0x14]; /* map of first 1 + 13 registers */ 51 unsigned char regmap[0x14]; /* map of first 1 + 13 registers */
52 unsigned int rate; 52 unsigned int rate;
53 unsigned int reset_timeout; 53 unsigned int reset_timeout;
54 cs8427_stream_t playback; 54 struct cs8427_stream playback;
55 cs8427_stream_t capture; 55 struct cs8427_stream capture;
56} cs8427_t; 56};
57 57
58static unsigned char swapbits(unsigned char val) 58static unsigned char swapbits(unsigned char val)
59{ 59{
@@ -67,7 +67,8 @@ static unsigned char swapbits(unsigned char val)
67 return res; 67 return res;
68} 68}
69 69
70int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val) 70int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
71 unsigned char val)
71{ 72{
72 int err; 73 int err;
73 unsigned char buf[2]; 74 unsigned char buf[2];
@@ -81,7 +82,7 @@ int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned c
81 return 0; 82 return 0;
82} 83}
83 84
84static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg) 85static int snd_cs8427_reg_read(struct snd_i2c_device *device, unsigned char reg)
85{ 86{
86 int err; 87 int err;
87 unsigned char buf; 88 unsigned char buf;
@@ -97,28 +98,29 @@ static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg)
97 return buf; 98 return buf;
98} 99}
99 100
100static int snd_cs8427_select_corudata(snd_i2c_device_t *device, int udata) 101static int snd_cs8427_select_corudata(struct snd_i2c_device *device, int udata)
101{ 102{
102 cs8427_t *chip = device->private_data; 103 struct cs8427 *chip = device->private_data;
103 int err; 104 int err;
104 105
105 udata = udata ? CS8427_BSEL : 0; 106 udata = udata ? CS8427_BSEL : 0;
106 if (udata != (chip->regmap[CS8427_REG_CSDATABUF] & udata)) { 107 if (udata != (chip->regmap[CS8427_REG_CSDATABUF] & udata)) {
107 chip->regmap[CS8427_REG_CSDATABUF] &= ~CS8427_BSEL; 108 chip->regmap[CS8427_REG_CSDATABUF] &= ~CS8427_BSEL;
108 chip->regmap[CS8427_REG_CSDATABUF] |= udata; 109 chip->regmap[CS8427_REG_CSDATABUF] |= udata;
109 err = snd_cs8427_reg_write(device, CS8427_REG_CSDATABUF, chip->regmap[CS8427_REG_CSDATABUF]); 110 err = snd_cs8427_reg_write(device, CS8427_REG_CSDATABUF,
111 chip->regmap[CS8427_REG_CSDATABUF]);
110 if (err < 0) 112 if (err < 0)
111 return err; 113 return err;
112 } 114 }
113 return 0; 115 return 0;
114} 116}
115 117
116static int snd_cs8427_send_corudata(snd_i2c_device_t *device, 118static int snd_cs8427_send_corudata(struct snd_i2c_device *device,
117 int udata, 119 int udata,
118 unsigned char *ndata, 120 unsigned char *ndata,
119 int count) 121 int count)
120{ 122{
121 cs8427_t *chip = device->private_data; 123 struct cs8427 *chip = device->private_data;
122 char *hw_data = udata ? chip->playback.hw_udata : chip->playback.hw_status; 124 char *hw_data = udata ? chip->playback.hw_udata : chip->playback.hw_status;
123 char data[32]; 125 char data[32];
124 int err, idx; 126 int err, idx;
@@ -133,7 +135,8 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device,
133 if (memcmp(hw_data, data, count) == 0) { 135 if (memcmp(hw_data, data, count) == 0) {
134 chip->regmap[CS8427_REG_UDATABUF] &= ~CS8427_UBMMASK; 136 chip->regmap[CS8427_REG_UDATABUF] &= ~CS8427_UBMMASK;
135 chip->regmap[CS8427_REG_UDATABUF] |= CS8427_UBMZEROS | CS8427_EFTUI; 137 chip->regmap[CS8427_REG_UDATABUF] |= CS8427_UBMZEROS | CS8427_EFTUI;
136 if ((err = snd_cs8427_reg_write(device, CS8427_REG_UDATABUF, chip->regmap[CS8427_REG_UDATABUF])) < 0) 138 if ((err = snd_cs8427_reg_write(device, CS8427_REG_UDATABUF,
139 chip->regmap[CS8427_REG_UDATABUF])) < 0)
137 return err; 140 return err;
138 return 0; 141 return 0;
139 } 142 }
@@ -146,15 +149,15 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device,
146 return 1; 149 return 1;
147} 150}
148 151
149static void snd_cs8427_free(snd_i2c_device_t *device) 152static void snd_cs8427_free(struct snd_i2c_device *device)
150{ 153{
151 kfree(device->private_data); 154 kfree(device->private_data);
152} 155}
153 156
154int snd_cs8427_create(snd_i2c_bus_t *bus, 157int snd_cs8427_create(struct snd_i2c_bus *bus,
155 unsigned char addr, 158 unsigned char addr,
156 unsigned int reset_timeout, 159 unsigned int reset_timeout,
157 snd_i2c_device_t **r_cs8427) 160 struct snd_i2c_device **r_cs8427)
158{ 161{
159 static unsigned char initvals1[] = { 162 static unsigned char initvals1[] = {
160 CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC, 163 CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC,
@@ -194,11 +197,12 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
194 CS8427_UD | CS8427_EFTUI | CS8427_DETUI, 197 CS8427_UD | CS8427_EFTUI | CS8427_DETUI,
195 }; 198 };
196 int err; 199 int err;
197 cs8427_t *chip; 200 struct cs8427 *chip;
198 snd_i2c_device_t *device; 201 struct snd_i2c_device *device;
199 unsigned char buf[24]; 202 unsigned char buf[24];
200 203
201 if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0) 204 if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7),
205 &device)) < 0)
202 return err; 206 return err;
203 chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); 207 chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
204 if (chip == NULL) { 208 if (chip == NULL) {
@@ -208,9 +212,13 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
208 device->private_free = snd_cs8427_free; 212 device->private_free = snd_cs8427_free;
209 213
210 snd_i2c_lock(bus); 214 snd_i2c_lock(bus);
211 if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) != CS8427_VER8427A) { 215 if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) !=
216 CS8427_VER8427A) {
212 snd_i2c_unlock(bus); 217 snd_i2c_unlock(bus);
213 snd_printk(KERN_ERR "unable to find CS8427 signature (expected 0x%x, read 0x%x), initialization is not completed\n", CS8427_VER8427A, err); 218 snd_printk(KERN_ERR "unable to find CS8427 signature "
219 "(expected 0x%x, read 0x%x),\n",
220 CS8427_VER8427A, err);
221 snd_printk(KERN_ERR " initialization is not completed\n");
214 return -EFAULT; 222 return -EFAULT;
215 } 223 }
216 /* turn off run bit while making changes to configuration */ 224 /* turn off run bit while making changes to configuration */
@@ -279,9 +287,9 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
279 * put back AES3INPUT. This workaround is described in latest 287 * put back AES3INPUT. This workaround is described in latest
280 * CS8427 datasheet, otherwise TXDSERIAL will not work. 288 * CS8427 datasheet, otherwise TXDSERIAL will not work.
281 */ 289 */
282static void snd_cs8427_reset(snd_i2c_device_t *cs8427) 290static void snd_cs8427_reset(struct snd_i2c_device *cs8427)
283{ 291{
284 cs8427_t *chip; 292 struct cs8427 *chip;
285 unsigned long end_time; 293 unsigned long end_time;
286 int data; 294 int data;
287 295
@@ -289,10 +297,12 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
289 chip = cs8427->private_data; 297 chip = cs8427->private_data;
290 snd_i2c_lock(cs8427->bus); 298 snd_i2c_lock(cs8427->bus);
291 chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~(CS8427_RUN | CS8427_RXDMASK); 299 chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~(CS8427_RUN | CS8427_RXDMASK);
292 snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE, chip->regmap[CS8427_REG_CLOCKSOURCE]); 300 snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,
301 chip->regmap[CS8427_REG_CLOCKSOURCE]);
293 udelay(200); 302 udelay(200);
294 chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RUN | CS8427_RXDILRCK; 303 chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RUN | CS8427_RXDILRCK;
295 snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE, chip->regmap[CS8427_REG_CLOCKSOURCE]); 304 snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,
305 chip->regmap[CS8427_REG_CLOCKSOURCE]);
296 udelay(200); 306 udelay(200);
297 snd_i2c_unlock(cs8427->bus); 307 snd_i2c_unlock(cs8427->bus);
298 end_time = jiffies + chip->reset_timeout; 308 end_time = jiffies + chip->reset_timeout;
@@ -307,12 +317,13 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
307 snd_i2c_lock(cs8427->bus); 317 snd_i2c_lock(cs8427->bus);
308 chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK; 318 chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK;
309 chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RXDAES3INPUT; 319 chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RXDAES3INPUT;
310 snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE, chip->regmap[CS8427_REG_CLOCKSOURCE]); 320 snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,
321 chip->regmap[CS8427_REG_CLOCKSOURCE]);
311 snd_i2c_unlock(cs8427->bus); 322 snd_i2c_unlock(cs8427->bus);
312} 323}
313 324
314static int snd_cs8427_in_status_info(snd_kcontrol_t *kcontrol, 325static int snd_cs8427_in_status_info(struct snd_kcontrol *kcontrol,
315 snd_ctl_elem_info_t *uinfo) 326 struct snd_ctl_elem_info *uinfo)
316{ 327{
317 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 328 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
318 uinfo->count = 1; 329 uinfo->count = 1;
@@ -321,10 +332,10 @@ static int snd_cs8427_in_status_info(snd_kcontrol_t *kcontrol,
321 return 0; 332 return 0;
322} 333}
323 334
324static int snd_cs8427_in_status_get(snd_kcontrol_t *kcontrol, 335static int snd_cs8427_in_status_get(struct snd_kcontrol *kcontrol,
325 snd_ctl_elem_value_t *ucontrol) 336 struct snd_ctl_elem_value *ucontrol)
326{ 337{
327 snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); 338 struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
328 int data; 339 int data;
329 340
330 snd_i2c_lock(device->bus); 341 snd_i2c_lock(device->bus);
@@ -336,18 +347,18 @@ static int snd_cs8427_in_status_get(snd_kcontrol_t *kcontrol,
336 return 0; 347 return 0;
337} 348}
338 349
339static int snd_cs8427_qsubcode_info(snd_kcontrol_t *kcontrol, 350static int snd_cs8427_qsubcode_info(struct snd_kcontrol *kcontrol,
340 snd_ctl_elem_info_t *uinfo) 351 struct snd_ctl_elem_info *uinfo)
341{ 352{
342 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; 353 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
343 uinfo->count = 10; 354 uinfo->count = 10;
344 return 0; 355 return 0;
345} 356}
346 357
347static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol, 358static int snd_cs8427_qsubcode_get(struct snd_kcontrol *kcontrol,
348 snd_ctl_elem_value_t *ucontrol) 359 struct snd_ctl_elem_value *ucontrol)
349{ 360{
350 snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); 361 struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
351 unsigned char reg = CS8427_REG_QSUBCODE; 362 unsigned char reg = CS8427_REG_QSUBCODE;
352 int err; 363 int err;
353 364
@@ -366,18 +377,18 @@ static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol,
366 return 0; 377 return 0;
367} 378}
368 379
369static int snd_cs8427_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 380static int snd_cs8427_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
370{ 381{
371 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 382 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
372 uinfo->count = 1; 383 uinfo->count = 1;
373 return 0; 384 return 0;
374} 385}
375 386
376static int snd_cs8427_spdif_get(snd_kcontrol_t * kcontrol, 387static int snd_cs8427_spdif_get(struct snd_kcontrol *kcontrol,
377 snd_ctl_elem_value_t * ucontrol) 388 struct snd_ctl_elem_value *ucontrol)
378{ 389{
379 snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); 390 struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
380 cs8427_t *chip = device->private_data; 391 struct cs8427 *chip = device->private_data;
381 392
382 snd_i2c_lock(device->bus); 393 snd_i2c_lock(device->bus);
383 memcpy(ucontrol->value.iec958.status, chip->playback.def_status, 24); 394 memcpy(ucontrol->value.iec958.status, chip->playback.def_status, 24);
@@ -385,13 +396,15 @@ static int snd_cs8427_spdif_get(snd_kcontrol_t * kcontrol,
385 return 0; 396 return 0;
386} 397}
387 398
388static int snd_cs8427_spdif_put(snd_kcontrol_t * kcontrol, 399static int snd_cs8427_spdif_put(struct snd_kcontrol *kcontrol,
389 snd_ctl_elem_value_t * ucontrol) 400 struct snd_ctl_elem_value *ucontrol)
390{ 401{
391 snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); 402 struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
392 cs8427_t *chip = device->private_data; 403 struct cs8427 *chip = device->private_data;
393 unsigned char *status = kcontrol->private_value ? chip->playback.pcm_status : chip->playback.def_status; 404 unsigned char *status = kcontrol->private_value ?
394 snd_pcm_runtime_t *runtime = chip->playback.substream ? chip->playback.substream->runtime : NULL; 405 chip->playback.pcm_status : chip->playback.def_status;
406 struct snd_pcm_runtime *runtime = chip->playback.substream ?
407 chip->playback.substream->runtime : NULL;
395 int err, change; 408 int err, change;
396 409
397 snd_i2c_lock(device->bus); 410 snd_i2c_lock(device->bus);
@@ -406,21 +419,22 @@ static int snd_cs8427_spdif_put(snd_kcontrol_t * kcontrol,
406 return change; 419 return change;
407} 420}
408 421
409static int snd_cs8427_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 422static int snd_cs8427_spdif_mask_info(struct snd_kcontrol *kcontrol,
423 struct snd_ctl_elem_info *uinfo)
410{ 424{
411 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 425 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
412 uinfo->count = 1; 426 uinfo->count = 1;
413 return 0; 427 return 0;
414} 428}
415 429
416static int snd_cs8427_spdif_mask_get(snd_kcontrol_t * kcontrol, 430static int snd_cs8427_spdif_mask_get(struct snd_kcontrol *kcontrol,
417 snd_ctl_elem_value_t * ucontrol) 431 struct snd_ctl_elem_value *ucontrol)
418{ 432{
419 memset(ucontrol->value.iec958.status, 0xff, 24); 433 memset(ucontrol->value.iec958.status, 0xff, 24);
420 return 0; 434 return 0;
421} 435}
422 436
423static snd_kcontrol_new_t snd_cs8427_iec958_controls[] = { 437static struct snd_kcontrol_new snd_cs8427_iec958_controls[] = {
424{ 438{
425 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 439 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
426 .info = snd_cs8427_in_status_info, 440 .info = snd_cs8427_in_status_info,
@@ -469,12 +483,12 @@ static snd_kcontrol_new_t snd_cs8427_iec958_controls[] = {
469 .get = snd_cs8427_qsubcode_get 483 .get = snd_cs8427_qsubcode_get
470}}; 484}};
471 485
472int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, 486int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
473 snd_pcm_substream_t *play_substream, 487 struct snd_pcm_substream *play_substream,
474 snd_pcm_substream_t *cap_substream) 488 struct snd_pcm_substream *cap_substream)
475{ 489{
476 cs8427_t *chip = cs8427->private_data; 490 struct cs8427 *chip = cs8427->private_data;
477 snd_kcontrol_t *kctl; 491 struct snd_kcontrol *kctl;
478 unsigned int idx; 492 unsigned int idx;
479 int err; 493 int err;
480 494
@@ -498,9 +512,9 @@ int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427,
498 return 0; 512 return 0;
499} 513}
500 514
501int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active) 515int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active)
502{ 516{
503 cs8427_t *chip; 517 struct cs8427 *chip;
504 518
505 snd_assert(cs8427, return -ENXIO); 519 snd_assert(cs8427, return -ENXIO);
506 chip = cs8427->private_data; 520 chip = cs8427->private_data;
@@ -512,9 +526,9 @@ int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active)
512 return 0; 526 return 0;
513} 527}
514 528
515int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate) 529int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate)
516{ 530{
517 cs8427_t *chip; 531 struct cs8427 *chip;
518 char *status; 532 char *status;
519 int err, reset; 533 int err, reset;
520 534
diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c
index e4e505b9d8..c4e1f2c23c 100644
--- a/sound/i2c/i2c.c
+++ b/sound/i2c/i2c.c
@@ -32,20 +32,23 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
32MODULE_DESCRIPTION("Generic i2c interface for ALSA"); 32MODULE_DESCRIPTION("Generic i2c interface for ALSA");
33MODULE_LICENSE("GPL"); 33MODULE_LICENSE("GPL");
34 34
35static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 35static int snd_i2c_bit_sendbytes(struct snd_i2c_device *device,
36static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); 36 unsigned char *bytes, int count);
37static int snd_i2c_bit_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); 37static int snd_i2c_bit_readbytes(struct snd_i2c_device *device,
38 38 unsigned char *bytes, int count);
39static snd_i2c_ops_t snd_i2c_bit_ops = { 39static int snd_i2c_bit_probeaddr(struct snd_i2c_bus *bus,
40 unsigned short addr);
41
42static struct snd_i2c_ops snd_i2c_bit_ops = {
40 .sendbytes = snd_i2c_bit_sendbytes, 43 .sendbytes = snd_i2c_bit_sendbytes,
41 .readbytes = snd_i2c_bit_readbytes, 44 .readbytes = snd_i2c_bit_readbytes,
42 .probeaddr = snd_i2c_bit_probeaddr, 45 .probeaddr = snd_i2c_bit_probeaddr,
43}; 46};
44 47
45static int snd_i2c_bus_free(snd_i2c_bus_t *bus) 48static int snd_i2c_bus_free(struct snd_i2c_bus *bus)
46{ 49{
47 snd_i2c_bus_t *slave; 50 struct snd_i2c_bus *slave;
48 snd_i2c_device_t *device; 51 struct snd_i2c_device *device;
49 52
50 snd_assert(bus != NULL, return -EINVAL); 53 snd_assert(bus != NULL, return -EINVAL);
51 while (!list_empty(&bus->devices)) { 54 while (!list_empty(&bus->devices)) {
@@ -66,17 +69,18 @@ static int snd_i2c_bus_free(snd_i2c_bus_t *bus)
66 return 0; 69 return 0;
67} 70}
68 71
69static int snd_i2c_bus_dev_free(snd_device_t *device) 72static int snd_i2c_bus_dev_free(struct snd_device *device)
70{ 73{
71 snd_i2c_bus_t *bus = device->device_data; 74 struct snd_i2c_bus *bus = device->device_data;
72 return snd_i2c_bus_free(bus); 75 return snd_i2c_bus_free(bus);
73} 76}
74 77
75int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c) 78int snd_i2c_bus_create(struct snd_card *card, const char *name,
79 struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c)
76{ 80{
77 snd_i2c_bus_t *bus; 81 struct snd_i2c_bus *bus;
78 int err; 82 int err;
79 static snd_device_ops_t ops = { 83 static struct snd_device_ops ops = {
80 .dev_free = snd_i2c_bus_dev_free, 84 .dev_free = snd_i2c_bus_dev_free,
81 }; 85 };
82 86
@@ -102,9 +106,10 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master
102 return 0; 106 return 0;
103} 107}
104 108
105int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice) 109int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
110 unsigned char addr, struct snd_i2c_device **rdevice)
106{ 111{
107 snd_i2c_device_t *device; 112 struct snd_i2c_device *device;
108 113
109 *rdevice = NULL; 114 *rdevice = NULL;
110 snd_assert(bus != NULL, return -EINVAL); 115 snd_assert(bus != NULL, return -EINVAL);
@@ -119,7 +124,7 @@ int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char ad
119 return 0; 124 return 0;
120} 125}
121 126
122int snd_i2c_device_free(snd_i2c_device_t *device) 127int snd_i2c_device_free(struct snd_i2c_device *device)
123{ 128{
124 if (device->bus) 129 if (device->bus)
125 list_del(&device->list); 130 list_del(&device->list);
@@ -129,18 +134,18 @@ int snd_i2c_device_free(snd_i2c_device_t *device)
129 return 0; 134 return 0;
130} 135}
131 136
132int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) 137int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count)
133{ 138{
134 return device->bus->ops->sendbytes(device, bytes, count); 139 return device->bus->ops->sendbytes(device, bytes, count);
135} 140}
136 141
137 142
138int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) 143int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count)
139{ 144{
140 return device->bus->ops->readbytes(device, bytes, count); 145 return device->bus->ops->readbytes(device, bytes, count);
141} 146}
142 147
143int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr) 148int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr)
144{ 149{
145 return bus->ops->probeaddr(bus, addr); 150 return bus->ops->probeaddr(bus, addr);
146} 151}
@@ -149,31 +154,31 @@ int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr)
149 * bit-operations 154 * bit-operations
150 */ 155 */
151 156
152static inline void snd_i2c_bit_hw_start(snd_i2c_bus_t *bus) 157static inline void snd_i2c_bit_hw_start(struct snd_i2c_bus *bus)
153{ 158{
154 if (bus->hw_ops.bit->start) 159 if (bus->hw_ops.bit->start)
155 bus->hw_ops.bit->start(bus); 160 bus->hw_ops.bit->start(bus);
156} 161}
157 162
158static inline void snd_i2c_bit_hw_stop(snd_i2c_bus_t *bus) 163static inline void snd_i2c_bit_hw_stop(struct snd_i2c_bus *bus)
159{ 164{
160 if (bus->hw_ops.bit->stop) 165 if (bus->hw_ops.bit->stop)
161 bus->hw_ops.bit->stop(bus); 166 bus->hw_ops.bit->stop(bus);
162} 167}
163 168
164static void snd_i2c_bit_direction(snd_i2c_bus_t *bus, int clock, int data) 169static void snd_i2c_bit_direction(struct snd_i2c_bus *bus, int clock, int data)
165{ 170{
166 if (bus->hw_ops.bit->direction) 171 if (bus->hw_ops.bit->direction)
167 bus->hw_ops.bit->direction(bus, clock, data); 172 bus->hw_ops.bit->direction(bus, clock, data);
168} 173}
169 174
170static void snd_i2c_bit_set(snd_i2c_bus_t *bus, int clock, int data) 175static void snd_i2c_bit_set(struct snd_i2c_bus *bus, int clock, int data)
171{ 176{
172 bus->hw_ops.bit->setlines(bus, clock, data); 177 bus->hw_ops.bit->setlines(bus, clock, data);
173} 178}
174 179
175#if 0 180#if 0
176static int snd_i2c_bit_clock(snd_i2c_bus_t *bus) 181static int snd_i2c_bit_clock(struct snd_i2c_bus *bus)
177{ 182{
178 if (bus->hw_ops.bit->getclock) 183 if (bus->hw_ops.bit->getclock)
179 return bus->hw_ops.bit->getclock(bus); 184 return bus->hw_ops.bit->getclock(bus);
@@ -181,12 +186,12 @@ static int snd_i2c_bit_clock(snd_i2c_bus_t *bus)
181} 186}
182#endif 187#endif
183 188
184static int snd_i2c_bit_data(snd_i2c_bus_t *bus, int ack) 189static int snd_i2c_bit_data(struct snd_i2c_bus *bus, int ack)
185{ 190{
186 return bus->hw_ops.bit->getdata(bus, ack); 191 return bus->hw_ops.bit->getdata(bus, ack);
187} 192}
188 193
189static void snd_i2c_bit_start(snd_i2c_bus_t *bus) 194static void snd_i2c_bit_start(struct snd_i2c_bus *bus)
190{ 195{
191 snd_i2c_bit_hw_start(bus); 196 snd_i2c_bit_hw_start(bus);
192 snd_i2c_bit_direction(bus, 1, 1); /* SCL - wr, SDA - wr */ 197 snd_i2c_bit_direction(bus, 1, 1); /* SCL - wr, SDA - wr */
@@ -195,7 +200,7 @@ static void snd_i2c_bit_start(snd_i2c_bus_t *bus)
195 snd_i2c_bit_set(bus, 0, 0); 200 snd_i2c_bit_set(bus, 0, 0);
196} 201}
197 202
198static void snd_i2c_bit_stop(snd_i2c_bus_t *bus) 203static void snd_i2c_bit_stop(struct snd_i2c_bus *bus)
199{ 204{
200 snd_i2c_bit_set(bus, 0, 0); 205 snd_i2c_bit_set(bus, 0, 0);
201 snd_i2c_bit_set(bus, 1, 0); 206 snd_i2c_bit_set(bus, 1, 0);
@@ -203,14 +208,14 @@ static void snd_i2c_bit_stop(snd_i2c_bus_t *bus)
203 snd_i2c_bit_hw_stop(bus); 208 snd_i2c_bit_hw_stop(bus);
204} 209}
205 210
206static void snd_i2c_bit_send(snd_i2c_bus_t *bus, int data) 211static void snd_i2c_bit_send(struct snd_i2c_bus *bus, int data)
207{ 212{
208 snd_i2c_bit_set(bus, 0, data); 213 snd_i2c_bit_set(bus, 0, data);
209 snd_i2c_bit_set(bus, 1, data); 214 snd_i2c_bit_set(bus, 1, data);
210 snd_i2c_bit_set(bus, 0, data); 215 snd_i2c_bit_set(bus, 0, data);
211} 216}
212 217
213static int snd_i2c_bit_ack(snd_i2c_bus_t *bus) 218static int snd_i2c_bit_ack(struct snd_i2c_bus *bus)
214{ 219{
215 int ack; 220 int ack;
216 221
@@ -223,7 +228,7 @@ static int snd_i2c_bit_ack(snd_i2c_bus_t *bus)
223 return ack ? -EIO : 0; 228 return ack ? -EIO : 0;
224} 229}
225 230
226static int snd_i2c_bit_sendbyte(snd_i2c_bus_t *bus, unsigned char data) 231static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data)
227{ 232{
228 int i, err; 233 int i, err;
229 234
@@ -234,7 +239,7 @@ static int snd_i2c_bit_sendbyte(snd_i2c_bus_t *bus, unsigned char data)
234 return 0; 239 return 0;
235} 240}
236 241
237static int snd_i2c_bit_readbyte(snd_i2c_bus_t *bus, int last) 242static int snd_i2c_bit_readbyte(struct snd_i2c_bus *bus, int last)
238{ 243{
239 int i; 244 int i;
240 unsigned char data = 0; 245 unsigned char data = 0;
@@ -252,9 +257,10 @@ static int snd_i2c_bit_readbyte(snd_i2c_bus_t *bus, int last)
252 return data; 257 return data;
253} 258}
254 259
255static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) 260static int snd_i2c_bit_sendbytes(struct snd_i2c_device *device,
261 unsigned char *bytes, int count)
256{ 262{
257 snd_i2c_bus_t *bus = device->bus; 263 struct snd_i2c_bus *bus = device->bus;
258 int err, res = 0; 264 int err, res = 0;
259 265
260 if (device->flags & SND_I2C_DEVICE_ADDRTEN) 266 if (device->flags & SND_I2C_DEVICE_ADDRTEN)
@@ -275,9 +281,10 @@ static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes,
275 return res; 281 return res;
276} 282}
277 283
278static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) 284static int snd_i2c_bit_readbytes(struct snd_i2c_device *device,
285 unsigned char *bytes, int count)
279{ 286{
280 snd_i2c_bus_t *bus = device->bus; 287 struct snd_i2c_bus *bus = device->bus;
281 int err, res = 0; 288 int err, res = 0;
282 289
283 if (device->flags & SND_I2C_DEVICE_ADDRTEN) 290 if (device->flags & SND_I2C_DEVICE_ADDRTEN)
@@ -299,7 +306,7 @@ static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes,
299 return res; 306 return res;
300} 307}
301 308
302static int snd_i2c_bit_probeaddr(snd_i2c_bus_t *bus, unsigned short addr) 309static int snd_i2c_bit_probeaddr(struct snd_i2c_bus *bus, unsigned short addr)
303{ 310{
304 int err; 311 int err;
305 312
diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c
index 103a7dcd0d..746500e069 100644
--- a/sound/i2c/l3/uda1341.c
+++ b/sound/i2c/l3/uda1341.c
@@ -17,7 +17,7 @@
17 * 2002-05-12 Tomas Kasparek another code cleanup 17 * 2002-05-12 Tomas Kasparek another code cleanup
18 */ 18 */
19 19
20/* $Id: uda1341.c,v 1.16 2005/09/09 13:22:34 tiwai Exp $ */ 20/* $Id: uda1341.c,v 1.18 2005/11/17 14:17:21 tiwai Exp $ */
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23#include <linux/module.h> 23#include <linux/module.h>
@@ -56,6 +56,33 @@
56 56
57/* }}} */ 57/* }}} */
58 58
59
60static const char *peak_names[] = {
61 "before",
62 "after",
63};
64
65static const char *filter_names[] = {
66 "flat",
67 "min",
68 "min",
69 "max",
70};
71
72static const char *mixer_names[] = {
73 "double differential",
74 "input channel 1 (line in)",
75 "input channel 2 (microphone)",
76 "digital mixer",
77};
78
79static const char *deemp_names[] = {
80 "none",
81 "32 kHz",
82 "44.1 kHz",
83 "48 kHz",
84};
85
59enum uda1341_regs_names { 86enum uda1341_regs_names {
60 stat0, 87 stat0,
61 stat1, 88 stat1,
@@ -73,7 +100,7 @@ enum uda1341_regs_names {
73 uda1341_reg_last, 100 uda1341_reg_last,
74}; 101};
75 102
76const char *uda1341_reg_names[] = { 103static const char *uda1341_reg_names[] = {
77 "stat 0 ", 104 "stat 0 ",
78 "stat 1 ", 105 "stat 1 ",
79 "data 00", 106 "data 00",
@@ -89,7 +116,7 @@ const char *uda1341_reg_names[] = {
89 "ext 6", 116 "ext 6",
90}; 117};
91 118
92const int uda1341_enum_items[] = { 119static const int uda1341_enum_items[] = {
93 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
94 2, //peak - before/after 121 2, //peak - before/after
95 4, //deemp - none/32/44.1/48 122 4, //deemp - none/32/44.1/48
@@ -100,7 +127,7 @@ const int uda1341_enum_items[] = {
100 0, 0, 0, 0, 0, 127 0, 0, 0, 0, 0,
101}; 128};
102 129
103const char ** uda1341_enum_names[] = { 130static const char ** uda1341_enum_names[] = {
104 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 131 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
105 peak_names, //peak - before/after 132 peak_names, //peak - before/after
106 deemp_names, //deemp - none/32/44.1/48 133 deemp_names, //deemp - none/32/44.1/48
@@ -113,15 +140,13 @@ const char ** uda1341_enum_names[] = {
113 140
114typedef int uda1341_cfg[CMD_LAST]; 141typedef int uda1341_cfg[CMD_LAST];
115 142
116typedef struct uda1341 uda1341_t;
117
118struct uda1341 { 143struct uda1341 {
119 int (*write) (struct l3_client *uda1341, unsigned short reg, unsigned short val); 144 int (*write) (struct l3_client *uda1341, unsigned short reg, unsigned short val);
120 int (*read) (struct l3_client *uda1341, unsigned short reg); 145 int (*read) (struct l3_client *uda1341, unsigned short reg);
121 unsigned char regs[uda1341_reg_last]; 146 unsigned char regs[uda1341_reg_last];
122 int active; 147 int active;
123 spinlock_t reg_lock; 148 spinlock_t reg_lock;
124 snd_card_t *card; 149 struct snd_card *card;
125 uda1341_cfg cfg; 150 uda1341_cfg cfg;
126#ifdef CONFIG_PM 151#ifdef CONFIG_PM
127 unsigned char suspend_regs[uda1341_reg_last]; 152 unsigned char suspend_regs[uda1341_reg_last];
@@ -129,11 +154,9 @@ struct uda1341 {
129#endif 154#endif
130}; 155};
131 156
132//hack for ALSA magic casting
133typedef struct l3_client l3_client_t;
134
135/* transfer 8bit integer into string with binary representation */ 157/* transfer 8bit integer into string with binary representation */
136void int2str_bin8(uint8_t val, char *buf){ 158static void int2str_bin8(uint8_t val, char *buf)
159{
137 const int size = sizeof(val) * 8; 160 const int size = sizeof(val) * 8;
138 int i; 161 int i;
139 162
@@ -146,7 +169,7 @@ void int2str_bin8(uint8_t val, char *buf){
146 169
147/* {{{ HW manipulation routines */ 170/* {{{ HW manipulation routines */
148 171
149int snd_uda1341_codec_write(struct l3_client *clnt, unsigned short reg, unsigned short val) 172static int snd_uda1341_codec_write(struct l3_client *clnt, unsigned short reg, unsigned short val)
150{ 173{
151 struct uda1341 *uda = clnt->driver_data; 174 struct uda1341 *uda = clnt->driver_data;
152 unsigned char buf[2] = { 0xc0, 0xe0 }; // for EXT addressing 175 unsigned char buf[2] = { 0xc0, 0xe0 }; // for EXT addressing
@@ -171,7 +194,7 @@ int snd_uda1341_codec_write(struct l3_client *clnt, unsigned short reg, unsigned
171 return err; 194 return err;
172} 195}
173 196
174int snd_uda1341_codec_read(struct l3_client *clnt, unsigned short reg) 197static int snd_uda1341_codec_read(struct l3_client *clnt, unsigned short reg)
175{ 198{
176 unsigned char val; 199 unsigned char val;
177 int err; 200 int err;
@@ -188,8 +211,9 @@ static inline int snd_uda1341_valid_reg(struct l3_client *clnt, unsigned short r
188 return reg < uda1341_reg_last; 211 return reg < uda1341_reg_last;
189} 212}
190 213
191int snd_uda1341_update_bits(struct l3_client *clnt, unsigned short reg, unsigned short mask, 214static int snd_uda1341_update_bits(struct l3_client *clnt, unsigned short reg,
192 unsigned short shift, unsigned short value, int flush) 215 unsigned short mask, unsigned short shift,
216 unsigned short value, int flush)
193{ 217{
194 int change; 218 int change;
195 unsigned short old, new; 219 unsigned short old, new;
@@ -214,8 +238,8 @@ int snd_uda1341_update_bits(struct l3_client *clnt, unsigned short reg, unsigned
214 return change; 238 return change;
215} 239}
216 240
217int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what, 241static int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what,
218 unsigned short value, int flush) 242 unsigned short value, int flush)
219{ 243{
220 struct uda1341 *uda = clnt->driver_data; 244 struct uda1341 *uda = clnt->driver_data;
221 int ret = 0; 245 int ret = 0;
@@ -327,9 +351,84 @@ int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what,
327/* }}} */ 351/* }}} */
328 352
329/* {{{ Proc interface */ 353/* {{{ Proc interface */
354#ifdef CONFIG_PROC_FS
355
356static const char *format_names[] = {
357 "I2S-bus",
358 "LSB 16bits",
359 "LSB 18bits",
360 "LSB 20bits",
361 "MSB",
362 "in LSB 16bits/out MSB",
363 "in LSB 18bits/out MSB",
364 "in LSB 20bits/out MSB",
365};
366
367static const char *fs_names[] = {
368 "512*fs",
369 "384*fs",
370 "256*fs",
371 "Unused - bad value!",
372};
373
374static const char* bass_values[][16] = {
375 {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB",
376 "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat
377 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
378 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
379 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
380 "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
381 {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB",
382 "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max
383};
384
385static const char *mic_sens_value[] = {
386 "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used",
387};
388
389static const unsigned short AGC_atime[] = {
390 11, 16, 11, 16, 21, 11, 16, 21,
391};
392
393static const unsigned short AGC_dtime[] = {
394 100, 100, 200, 200, 200, 400, 400, 400,
395};
330 396
331static void snd_uda1341_proc_read(snd_info_entry_t *entry, 397static const char *AGC_level[] = {
332 snd_info_buffer_t * buffer) 398 "-9.0", "-11.5", "-15.0", "-17.5",
399};
400
401static const char *ig_small_value[] = {
402 "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5",
403};
404
405/*
406 * this was computed as peak_value[i] = pow((63-i)*1.42,1.013)
407 *
408 * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2
409 * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29
410 * [61]=-2.78, [62] = -1.48, [63] = 0.0
411 * I tried to compute it, but using but even using logarithm with base either 10 or 2
412 * i was'n able to get values in the table from the formula. So I constructed another
413 * formula (see above) to interpolate the values as good as possible. If there is some
414 * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks.
415 * UDA1341TS datasheet is available at:
416 * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf
417 */
418static const char *peak_value[] = {
419 "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB",
420 "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB",
421 "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB",
422 "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB",
423 "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB",
424 "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB",
425 "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB",
426 "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB",
427 "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB",
428};
429
430static void snd_uda1341_proc_read(struct snd_info_entry *entry,
431 struct snd_info_buffer *buffer)
333{ 432{
334 struct l3_client *clnt = entry->private_data; 433 struct l3_client *clnt = entry->private_data;
335 struct uda1341 *uda = clnt->driver_data; 434 struct uda1341 *uda = clnt->driver_data;
@@ -393,15 +492,14 @@ static void snd_uda1341_proc_read(snd_info_entry_t *entry,
393 snd_iprintf(buffer, "Input Amp. Gain ch 2: %s dB\n", ig_small_value[uda->cfg[CMD_IG]]); 492 snd_iprintf(buffer, "Input Amp. Gain ch 2: %s dB\n", ig_small_value[uda->cfg[CMD_IG]]);
394} 493}
395 494
396static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, 495static void snd_uda1341_proc_regs_read(struct snd_info_entry *entry,
397 snd_info_buffer_t * buffer) 496 struct snd_info_buffer *buffer)
398{ 497{
399 struct l3_client *clnt = entry->private_data; 498 struct l3_client *clnt = entry->private_data;
400 struct uda1341 *uda = clnt->driver_data; 499 struct uda1341 *uda = clnt->driver_data;
401 int reg; 500 int reg;
402 char buf[12]; 501 char buf[12];
403 502
404 spin_lock(&uda->reg_lock);
405 for (reg = 0; reg < uda1341_reg_last; reg ++) { 503 for (reg = 0; reg < uda1341_reg_last; reg ++) {
406 if (reg == empty) 504 if (reg == empty)
407 continue; 505 continue;
@@ -411,13 +509,12 @@ static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry,
411 509
412 int2str_bin8(snd_uda1341_codec_read(clnt, UDA1341_DATA1), buf); 510 int2str_bin8(snd_uda1341_codec_read(clnt, UDA1341_DATA1), buf);
413 snd_iprintf(buffer, "DATA1 = %s\n", buf); 511 snd_iprintf(buffer, "DATA1 = %s\n", buf);
414
415 spin_unlock(&uda->reg_lock);
416} 512}
513#endif /* CONFIG_PROC_FS */
417 514
418static void __devinit snd_uda1341_proc_init(snd_card_t *card, struct l3_client *clnt) 515static void __devinit snd_uda1341_proc_init(struct snd_card *card, struct l3_client *clnt)
419{ 516{
420 snd_info_entry_t *entry; 517 struct snd_info_entry *entry;
421 518
422 if (! snd_card_proc_new(card, "uda1341", &entry)) 519 if (! snd_card_proc_new(card, "uda1341", &entry))
423 snd_info_set_text_ops(entry, clnt, 1024, snd_uda1341_proc_read); 520 snd_info_set_text_ops(entry, clnt, 1024, snd_uda1341_proc_read);
@@ -437,7 +534,8 @@ static void __devinit snd_uda1341_proc_init(snd_card_t *card, struct l3_client *
437 .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \ 534 .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \
438} 535}
439 536
440static int snd_uda1341_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 537static int snd_uda1341_info_single(struct snd_kcontrol *kcontrol,
538 struct snd_ctl_elem_info *uinfo)
441{ 539{
442 int mask = (kcontrol->private_value >> 12) & 63; 540 int mask = (kcontrol->private_value >> 12) & 63;
443 541
@@ -448,10 +546,11 @@ static int snd_uda1341_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
448 return 0; 546 return 0;
449} 547}
450 548
451static int snd_uda1341_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 549static int snd_uda1341_get_single(struct snd_kcontrol *kcontrol,
550 struct snd_ctl_elem_value *ucontrol)
452{ 551{
453 struct l3_client *clnt = snd_kcontrol_chip(kcontrol); 552 struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
454 uda1341_t *uda = clnt->driver_data; 553 struct uda1341 *uda = clnt->driver_data;
455 int where = kcontrol->private_value & 31; 554 int where = kcontrol->private_value & 31;
456 int mask = (kcontrol->private_value >> 12) & 63; 555 int mask = (kcontrol->private_value >> 12) & 63;
457 int invert = (kcontrol->private_value >> 18) & 1; 556 int invert = (kcontrol->private_value >> 18) & 1;
@@ -463,10 +562,11 @@ static int snd_uda1341_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
463 return 0; 562 return 0;
464} 563}
465 564
466static int snd_uda1341_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 565static int snd_uda1341_put_single(struct snd_kcontrol *kcontrol,
566 struct snd_ctl_elem_value *ucontrol)
467{ 567{
468 struct l3_client *clnt = snd_kcontrol_chip(kcontrol); 568 struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
469 uda1341_t *uda = clnt->driver_data; 569 struct uda1341 *uda = clnt->driver_data;
470 int where = kcontrol->private_value & 31; 570 int where = kcontrol->private_value & 31;
471 int reg = (kcontrol->private_value >> 5) & 15; 571 int reg = (kcontrol->private_value >> 5) & 15;
472 int shift = (kcontrol->private_value >> 9) & 7; 572 int shift = (kcontrol->private_value >> 9) & 7;
@@ -492,7 +592,8 @@ static int snd_uda1341_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
492 .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \ 592 .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \
493} 593}
494 594
495static int snd_uda1341_info_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 595static int snd_uda1341_info_enum(struct snd_kcontrol *kcontrol,
596 struct snd_ctl_elem_info *uinfo)
496{ 597{
497 int where = kcontrol->private_value & 31; 598 int where = kcontrol->private_value & 31;
498 const char **texts; 599 const char **texts;
@@ -513,20 +614,22 @@ static int snd_uda1341_info_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *
513 return 0; 614 return 0;
514} 615}
515 616
516static int snd_uda1341_get_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 617static int snd_uda1341_get_enum(struct snd_kcontrol *kcontrol,
618 struct snd_ctl_elem_value *ucontrol)
517{ 619{
518 struct l3_client *clnt = snd_kcontrol_chip(kcontrol); 620 struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
519 uda1341_t *uda = clnt->driver_data; 621 struct uda1341 *uda = clnt->driver_data;
520 int where = kcontrol->private_value & 31; 622 int where = kcontrol->private_value & 31;
521 623
522 ucontrol->value.enumerated.item[0] = uda->cfg[where]; 624 ucontrol->value.enumerated.item[0] = uda->cfg[where];
523 return 0; 625 return 0;
524} 626}
525 627
526static int snd_uda1341_put_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 628static int snd_uda1341_put_enum(struct snd_kcontrol *kcontrol,
629 struct snd_ctl_elem_value *ucontrol)
527{ 630{
528 struct l3_client *clnt = snd_kcontrol_chip(kcontrol); 631 struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
529 uda1341_t *uda = clnt->driver_data; 632 struct uda1341 *uda = clnt->driver_data;
530 int where = kcontrol->private_value & 31; 633 int where = kcontrol->private_value & 31;
531 int reg = (kcontrol->private_value >> 5) & 15; 634 int reg = (kcontrol->private_value >> 5) & 15;
532 int shift = (kcontrol->private_value >> 9) & 7; 635 int shift = (kcontrol->private_value >> 9) & 7;
@@ -549,7 +652,8 @@ static int snd_uda1341_put_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
549} 652}
550 653
551 654
552static int snd_uda1341_info_2regs(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 655static int snd_uda1341_info_2regs(struct snd_kcontrol *kcontrol,
656 struct snd_ctl_elem_info *uinfo)
553{ 657{
554 int mask_1 = (kcontrol->private_value >> 19) & 63; 658 int mask_1 = (kcontrol->private_value >> 19) & 63;
555 int mask_2 = (kcontrol->private_value >> 25) & 63; 659 int mask_2 = (kcontrol->private_value >> 25) & 63;
@@ -563,10 +667,11 @@ static int snd_uda1341_info_2regs(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
563 return 0; 667 return 0;
564} 668}
565 669
566static int snd_uda1341_get_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 670static int snd_uda1341_get_2regs(struct snd_kcontrol *kcontrol,
671 struct snd_ctl_elem_value *ucontrol)
567{ 672{
568 struct l3_client *clnt = snd_kcontrol_chip(kcontrol); 673 struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
569 uda1341_t *uda = clnt->driver_data; 674 struct uda1341 *uda = clnt->driver_data;
570 int where = kcontrol->private_value & 31; 675 int where = kcontrol->private_value & 31;
571 int mask_1 = (kcontrol->private_value >> 19) & 63; 676 int mask_1 = (kcontrol->private_value >> 19) & 63;
572 int mask_2 = (kcontrol->private_value >> 25) & 63; 677 int mask_2 = (kcontrol->private_value >> 25) & 63;
@@ -581,10 +686,11 @@ static int snd_uda1341_get_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
581 return 0; 686 return 0;
582} 687}
583 688
584static int snd_uda1341_put_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 689static int snd_uda1341_put_2regs(struct snd_kcontrol *kcontrol,
690 struct snd_ctl_elem_value *ucontrol)
585{ 691{
586 struct l3_client *clnt = snd_kcontrol_chip(kcontrol); 692 struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
587 uda1341_t *uda = clnt->driver_data; 693 struct uda1341 *uda = clnt->driver_data;
588 int where = kcontrol->private_value & 31; 694 int where = kcontrol->private_value & 31;
589 int reg_1 = (kcontrol->private_value >> 5) & 15; 695 int reg_1 = (kcontrol->private_value >> 5) & 15;
590 int reg_2 = (kcontrol->private_value >> 9) & 15; 696 int reg_2 = (kcontrol->private_value >> 9) & 15;
@@ -617,7 +723,7 @@ static int snd_uda1341_put_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
617 723
618/* }}} */ 724/* }}} */
619 725
620static snd_kcontrol_new_t snd_uda1341_controls[] = { 726static struct snd_kcontrol_new snd_uda1341_controls[] = {
621 UDA1341_SINGLE("Master Playback Switch", CMD_MUTE, data0_2, 2, 1, 1), 727 UDA1341_SINGLE("Master Playback Switch", CMD_MUTE, data0_2, 2, 1, 1),
622 UDA1341_SINGLE("Master Playback Volume", CMD_VOLUME, data0_0, 0, 63, 1), 728 UDA1341_SINGLE("Master Playback Volume", CMD_VOLUME, data0_0, 0, 63, 1),
623 729
@@ -647,54 +753,55 @@ static snd_kcontrol_new_t snd_uda1341_controls[] = {
647 UDA1341_2REGS("Gain Input Amplifier Gain (channel 2)", CMD_IG, ext4, ext5, 0, 0, 3, 31, 0), 753 UDA1341_2REGS("Gain Input Amplifier Gain (channel 2)", CMD_IG, ext4, ext5, 0, 0, 3, 31, 0),
648}; 754};
649 755
650static void uda1341_free(struct l3_client *uda1341) 756static void uda1341_free(struct l3_client *clnt)
651{ 757{
652 l3_detach_client(uda1341); // calls kfree for driver_data (uda1341_t) 758 l3_detach_client(clnt); // calls kfree for driver_data (struct uda1341)
653 kfree(uda1341); 759 kfree(clnt);
654} 760}
655 761
656static int uda1341_dev_free(snd_device_t *device) 762static int uda1341_dev_free(struct snd_device *device)
657{ 763{
658 struct l3_client *clnt = device->device_data; 764 struct l3_client *clnt = device->device_data;
659 uda1341_free(clnt); 765 uda1341_free(clnt);
660 return 0; 766 return 0;
661} 767}
662 768
663int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt) 769int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clntp)
664{ 770{
665 static snd_device_ops_t ops = { 771 static struct snd_device_ops ops = {
666 .dev_free = uda1341_dev_free, 772 .dev_free = uda1341_dev_free,
667 }; 773 };
668 struct l3_client *uda1341; 774 struct l3_client *clnt;
669 int idx, err; 775 int idx, err;
670 776
671 snd_assert(card != NULL, return -EINVAL); 777 snd_assert(card != NULL, return -EINVAL);
672 778
673 uda1341 = kzalloc(sizeof(*uda1341), GFP_KERNEL); 779 clnt = kzalloc(sizeof(*clnt), GFP_KERNEL);
674 if (uda1341 == NULL) 780 if (clnt == NULL)
675 return -ENOMEM; 781 return -ENOMEM;
676 782
677 if ((err = l3_attach_client(uda1341, "l3-bit-sa1100-gpio", "snd-uda1341"))) { 783 if ((err = l3_attach_client(clnt, "l3-bit-sa1100-gpio", UDA1341_ALSA_NAME))) {
678 kfree(uda1341); 784 kfree(clnt);
679 return err;
680 }
681
682 if ((err = snd_device_new(card, SNDRV_DEV_CODEC, uda1341, &ops)) < 0) {
683 l3_detach_client(uda1341);
684 kfree(uda1341);
685 return err; 785 return err;
686 } 786 }
687 787
688 for (idx = 0; idx < ARRAY_SIZE(snd_uda1341_controls); idx++) { 788 for (idx = 0; idx < ARRAY_SIZE(snd_uda1341_controls); idx++) {
689 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_uda1341_controls[idx], uda1341))) < 0) 789 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_uda1341_controls[idx], clnt))) < 0) {
790 uda1341_free(clnt);
690 return err; 791 return err;
792 }
793 }
794
795 if ((err = snd_device_new(card, SNDRV_DEV_CODEC, clnt, &ops)) < 0) {
796 uda1341_free(clnt);
797 return err;
691 } 798 }
692 799
693 *clnt = uda1341; 800 *clntp = clnt;
694 strcpy(card->mixername, "UDA1341TS Mixer"); 801 strcpy(card->mixername, "UDA1341TS Mixer");
695 ((uda1341_t *)uda1341->driver_data)->card = card; 802 ((struct uda1341 *)clnt->driver_data)->card = card;
696 803
697 snd_uda1341_proc_init(card, uda1341); 804 snd_uda1341_proc_init(card, clnt);
698 805
699 return 0; 806 return 0;
700} 807}
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index d351b3aa19..12ffffc9e8 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;
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c
index 35b4584483..4e45952dd9 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;
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c
index db2b7274a9..045e32a311 100644
--- a/sound/i2c/other/ak4xxx-adda.c
+++ b/sound/i2c/other/ak4xxx-adda.c
@@ -34,7 +34,7 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Takashi Iwai <tiwai@suse.de>");
34MODULE_DESCRIPTION("Routines for control of AK452x / AK43xx AD/DA converters"); 34MODULE_DESCRIPTION("Routines for control of AK452x / AK43xx AD/DA converters");
35MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
36 36
37void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val) 37void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val)
38{ 38{
39 ak->ops.lock(ak, chip); 39 ak->ops.lock(ak, chip);
40 ak->ops.write(ak, chip, reg, val); 40 ak->ops.write(ak, chip, reg, val);
@@ -58,7 +58,7 @@ void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char
58 * 58 *
59 * assert the reset operation and restores the register values to the chips. 59 * assert the reset operation and restores the register values to the chips.
60 */ 60 */
61void snd_akm4xxx_reset(akm4xxx_t *ak, int state) 61void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state)
62{ 62{
63 unsigned int chip; 63 unsigned int chip;
64 unsigned char reg; 64 unsigned char reg;
@@ -109,7 +109,7 @@ void snd_akm4xxx_reset(akm4xxx_t *ak, int state)
109/* 109/*
110 * initialize all the ak4xxx chips 110 * initialize all the ak4xxx chips
111 */ 111 */
112void snd_akm4xxx_init(akm4xxx_t *ak) 112void snd_akm4xxx_init(struct snd_akm4xxx *ak)
113{ 113{
114 static unsigned char inits_ak4524[] = { 114 static unsigned char inits_ak4524[] = {
115 0x00, 0x07, /* 0: all power up */ 115 0x00, 0x07, /* 0: all power up */
@@ -247,7 +247,8 @@ void snd_akm4xxx_init(akm4xxx_t *ak)
247#define AK_COMPOSE(chip,addr,shift,mask) (((chip) << 8) | (addr) | ((shift) << 16) | ((mask) << 24)) 247#define AK_COMPOSE(chip,addr,shift,mask) (((chip) << 8) | (addr) | ((shift) << 16) | ((mask) << 24))
248#define AK_INVERT (1<<23) 248#define AK_INVERT (1<<23)
249 249
250static int snd_akm4xxx_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 250static int snd_akm4xxx_volume_info(struct snd_kcontrol *kcontrol,
251 struct snd_ctl_elem_info *uinfo)
251{ 252{
252 unsigned int mask = AK_GET_MASK(kcontrol->private_value); 253 unsigned int mask = AK_GET_MASK(kcontrol->private_value);
253 254
@@ -258,9 +259,10 @@ static int snd_akm4xxx_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
258 return 0; 259 return 0;
259} 260}
260 261
261static int snd_akm4xxx_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 262static int snd_akm4xxx_volume_get(struct snd_kcontrol *kcontrol,
263 struct snd_ctl_elem_value *ucontrol)
262{ 264{
263 akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); 265 struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
264 int chip = AK_GET_CHIP(kcontrol->private_value); 266 int chip = AK_GET_CHIP(kcontrol->private_value);
265 int addr = AK_GET_ADDR(kcontrol->private_value); 267 int addr = AK_GET_ADDR(kcontrol->private_value);
266 int invert = AK_GET_INVERT(kcontrol->private_value); 268 int invert = AK_GET_INVERT(kcontrol->private_value);
@@ -271,9 +273,10 @@ static int snd_akm4xxx_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
271 return 0; 273 return 0;
272} 274}
273 275
274static int snd_akm4xxx_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 276static int snd_akm4xxx_volume_put(struct snd_kcontrol *kcontrol,
277 struct snd_ctl_elem_value *ucontrol)
275{ 278{
276 akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); 279 struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
277 int chip = AK_GET_CHIP(kcontrol->private_value); 280 int chip = AK_GET_CHIP(kcontrol->private_value);
278 int addr = AK_GET_ADDR(kcontrol->private_value); 281 int addr = AK_GET_ADDR(kcontrol->private_value);
279 int invert = AK_GET_INVERT(kcontrol->private_value); 282 int invert = AK_GET_INVERT(kcontrol->private_value);
@@ -289,7 +292,8 @@ static int snd_akm4xxx_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
289 return change; 292 return change;
290} 293}
291 294
292static int snd_akm4xxx_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 295static int snd_akm4xxx_ipga_gain_info(struct snd_kcontrol *kcontrol,
296 struct snd_ctl_elem_info *uinfo)
293{ 297{
294 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 298 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
295 uinfo->count = 1; 299 uinfo->count = 1;
@@ -298,18 +302,20 @@ static int snd_akm4xxx_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
298 return 0; 302 return 0;
299} 303}
300 304
301static int snd_akm4xxx_ipga_gain_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 305static int snd_akm4xxx_ipga_gain_get(struct snd_kcontrol *kcontrol,
306 struct snd_ctl_elem_value *ucontrol)
302{ 307{
303 akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); 308 struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
304 int chip = AK_GET_CHIP(kcontrol->private_value); 309 int chip = AK_GET_CHIP(kcontrol->private_value);
305 int addr = AK_GET_ADDR(kcontrol->private_value); 310 int addr = AK_GET_ADDR(kcontrol->private_value);
306 ucontrol->value.integer.value[0] = snd_akm4xxx_get_ipga(ak, chip, addr) & 0x7f; 311 ucontrol->value.integer.value[0] = snd_akm4xxx_get_ipga(ak, chip, addr) & 0x7f;
307 return 0; 312 return 0;
308} 313}
309 314
310static int snd_akm4xxx_ipga_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 315static int snd_akm4xxx_ipga_gain_put(struct snd_kcontrol *kcontrol,
316 struct snd_ctl_elem_value *ucontrol)
311{ 317{
312 akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); 318 struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
313 int chip = AK_GET_CHIP(kcontrol->private_value); 319 int chip = AK_GET_CHIP(kcontrol->private_value);
314 int addr = AK_GET_ADDR(kcontrol->private_value); 320 int addr = AK_GET_ADDR(kcontrol->private_value);
315 unsigned char nval = (ucontrol->value.integer.value[0] % 37) | 0x80; 321 unsigned char nval = (ucontrol->value.integer.value[0] % 37) | 0x80;
@@ -319,7 +325,8 @@ static int snd_akm4xxx_ipga_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu
319 return change; 325 return change;
320} 326}
321 327
322static int snd_akm4xxx_deemphasis_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 328static int snd_akm4xxx_deemphasis_info(struct snd_kcontrol *kcontrol,
329 struct snd_ctl_elem_info *uinfo)
323{ 330{
324 static char *texts[4] = { 331 static char *texts[4] = {
325 "44.1kHz", "Off", "48kHz", "32kHz", 332 "44.1kHz", "Off", "48kHz", "32kHz",
@@ -333,9 +340,10 @@ static int snd_akm4xxx_deemphasis_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_in
333 return 0; 340 return 0;
334} 341}
335 342
336static int snd_akm4xxx_deemphasis_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) 343static int snd_akm4xxx_deemphasis_get(struct snd_kcontrol *kcontrol,
344 struct snd_ctl_elem_value *ucontrol)
337{ 345{
338 akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); 346 struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
339 int chip = AK_GET_CHIP(kcontrol->private_value); 347 int chip = AK_GET_CHIP(kcontrol->private_value);
340 int addr = AK_GET_ADDR(kcontrol->private_value); 348 int addr = AK_GET_ADDR(kcontrol->private_value);
341 int shift = AK_GET_SHIFT(kcontrol->private_value); 349 int shift = AK_GET_SHIFT(kcontrol->private_value);
@@ -343,9 +351,10 @@ static int snd_akm4xxx_deemphasis_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_va
343 return 0; 351 return 0;
344} 352}
345 353
346static int snd_akm4xxx_deemphasis_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 354static int snd_akm4xxx_deemphasis_put(struct snd_kcontrol *kcontrol,
355 struct snd_ctl_elem_value *ucontrol)
347{ 356{
348 akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); 357 struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
349 int chip = AK_GET_CHIP(kcontrol->private_value); 358 int chip = AK_GET_CHIP(kcontrol->private_value);
350 int addr = AK_GET_ADDR(kcontrol->private_value); 359 int addr = AK_GET_ADDR(kcontrol->private_value);
351 int shift = AK_GET_SHIFT(kcontrol->private_value); 360 int shift = AK_GET_SHIFT(kcontrol->private_value);
@@ -363,10 +372,10 @@ static int snd_akm4xxx_deemphasis_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val
363 * build AK4xxx controls 372 * build AK4xxx controls
364 */ 373 */
365 374
366int snd_akm4xxx_build_controls(akm4xxx_t *ak) 375int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak)
367{ 376{
368 unsigned int idx, num_emphs; 377 unsigned int idx, num_emphs;
369 snd_kcontrol_t *ctl; 378 struct snd_kcontrol *ctl;
370 int err; 379 int err;
371 380
372 ctl = kmalloc(sizeof(*ctl), GFP_KERNEL); 381 ctl = kmalloc(sizeof(*ctl), GFP_KERNEL);
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index 0f05a2b9a3..4c2fd14c10 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -58,7 +58,7 @@ MODULE_LICENSE("GPL");
58 * lowlevel part 58 * lowlevel part
59 */ 59 */
60 60
61static void snd_tea575x_set_freq(tea575x_t *tea) 61static void snd_tea575x_set_freq(struct snd_tea575x *tea)
62{ 62{
63 unsigned long freq; 63 unsigned long freq;
64 64
@@ -89,7 +89,7 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file,
89 unsigned int cmd, unsigned long data) 89 unsigned int cmd, unsigned long data)
90{ 90{
91 struct video_device *dev = video_devdata(file); 91 struct video_device *dev = video_devdata(file);
92 tea575x_t *tea = video_get_drvdata(dev); 92 struct snd_tea575x *tea = video_get_drvdata(dev);
93 void __user *arg = (void __user *)data; 93 void __user *arg = (void __user *)data;
94 94
95 switch(cmd) { 95 switch(cmd) {
@@ -175,7 +175,7 @@ static void snd_tea575x_release(struct video_device *vfd)
175/* 175/*
176 * initialize all the tea575x chips 176 * initialize all the tea575x chips
177 */ 177 */
178void snd_tea575x_init(tea575x_t *tea) 178void snd_tea575x_init(struct snd_tea575x *tea)
179{ 179{
180 unsigned int val; 180 unsigned int val;
181 181
@@ -209,7 +209,7 @@ void snd_tea575x_init(tea575x_t *tea)
209 snd_tea575x_set_freq(tea); 209 snd_tea575x_set_freq(tea);
210} 210}
211 211
212void snd_tea575x_exit(tea575x_t *tea) 212void snd_tea575x_exit(struct snd_tea575x *tea)
213{ 213{
214 if (tea->vd_registered) { 214 if (tea->vd_registered) {
215 video_unregister_device(&tea->vd); 215 video_unregister_device(&tea->vd);
diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c
index 4fdd1fb57d..ae5b1e3a68 100644
--- a/sound/i2c/tea6330t.c
+++ b/sound/i2c/tea6330t.c
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <sound/core.h> 26#include <sound/core.h>
27#include <sound/control.h>
27#include <sound/tea6330t.h> 28#include <sound/tea6330t.h>
28 29
29MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 30MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
@@ -43,7 +44,20 @@ MODULE_LICENSE("GPL");
43#define TEA6330T_GMU 0x80 /* mute control, general mute */ 44#define TEA6330T_GMU 0x80 /* mute control, general mute */
44#define TEA6330T_EQN 0x40 /* equalizer switchover (0=equalizer-on) */ 45#define TEA6330T_EQN 0x40 /* equalizer switchover (0=equalizer-on) */
45 46
46int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer) 47
48struct tea6330t {
49 struct snd_i2c_device *device;
50 struct snd_i2c_bus *bus;
51 int equalizer;
52 int fader;
53 unsigned char regs[8];
54 unsigned char mleft, mright;
55 unsigned char bass, treble;
56 unsigned char max_bass, max_treble;
57};
58
59
60int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer)
47{ 61{
48 int res; 62 int res;
49 63
@@ -54,7 +68,7 @@ int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer)
54} 68}
55 69
56#if 0 70#if 0
57static void snd_tea6330t_set(tea6330t_t *tea, 71static void snd_tea6330t_set(struct tea6330t *tea,
58 unsigned char addr, unsigned char value) 72 unsigned char addr, unsigned char value)
59{ 73{
60#if 0 74#if 0
@@ -69,7 +83,8 @@ static void snd_tea6330t_set(tea6330t_t *tea,
69 .info = snd_tea6330t_info_master_volume, \ 83 .info = snd_tea6330t_info_master_volume, \
70 .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 }
71 85
72static 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)
73{ 88{
74 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 89 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
75 uinfo->count = 2; 90 uinfo->count = 2;
@@ -78,9 +93,10 @@ static int snd_tea6330t_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_ele
78 return 0; 93 return 0;
79} 94}
80 95
81static 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)
82{ 98{
83 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 99 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
84 100
85 snd_i2c_lock(tea->bus); 101 snd_i2c_lock(tea->bus);
86 ucontrol->value.integer.value[0] = tea->mleft - 0x14; 102 ucontrol->value.integer.value[0] = tea->mleft - 0x14;
@@ -89,9 +105,10 @@ static int snd_tea6330t_get_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele
89 return 0; 105 return 0;
90} 106}
91 107
92static 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)
93{ 110{
94 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 111 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
95 int change, count, err; 112 int change, count, err;
96 unsigned char bytes[3]; 113 unsigned char bytes[3];
97 unsigned char val1, val2; 114 unsigned char val1, val2;
@@ -125,7 +142,8 @@ static int snd_tea6330t_put_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele
125 .info = snd_tea6330t_info_master_switch, \ 142 .info = snd_tea6330t_info_master_switch, \
126 .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 }
127 144
128static 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)
129{ 147{
130 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 148 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
131 uinfo->count = 2; 149 uinfo->count = 2;
@@ -134,9 +152,10 @@ static int snd_tea6330t_info_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_ele
134 return 0; 152 return 0;
135} 153}
136 154
137static 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)
138{ 157{
139 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 158 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
140 159
141 snd_i2c_lock(tea->bus); 160 snd_i2c_lock(tea->bus);
142 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;
@@ -145,9 +164,10 @@ static int snd_tea6330t_get_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele
145 return 0; 164 return 0;
146} 165}
147 166
148static 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)
149{ 169{
150 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 170 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
151 int change, err; 171 int change, err;
152 unsigned char bytes[3]; 172 unsigned char bytes[3];
153 unsigned char oval1, oval2, val1, val2; 173 unsigned char oval1, oval2, val1, val2;
@@ -174,9 +194,10 @@ static int snd_tea6330t_put_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele
174 .info = snd_tea6330t_info_bass, \ 194 .info = snd_tea6330t_info_bass, \
175 .get = snd_tea6330t_get_bass, .put = snd_tea6330t_put_bass } 195 .get = snd_tea6330t_get_bass, .put = snd_tea6330t_put_bass }
176 196
177static 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)
178{ 199{
179 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 200 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
180 201
181 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 202 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
182 uinfo->count = 1; 203 uinfo->count = 1;
@@ -185,17 +206,19 @@ static int snd_tea6330t_info_bass(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
185 return 0; 206 return 0;
186} 207}
187 208
188static 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)
189{ 211{
190 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 212 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
191 213
192 ucontrol->value.integer.value[0] = tea->bass; 214 ucontrol->value.integer.value[0] = tea->bass;
193 return 0; 215 return 0;
194} 216}
195 217
196static 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)
197{ 220{
198 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 221 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
199 int change, err; 222 int change, err;
200 unsigned char bytes[2]; 223 unsigned char bytes[2];
201 unsigned char val1; 224 unsigned char val1;
@@ -218,9 +241,10 @@ static int snd_tea6330t_put_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
218 .info = snd_tea6330t_info_treble, \ 241 .info = snd_tea6330t_info_treble, \
219 .get = snd_tea6330t_get_treble, .put = snd_tea6330t_put_treble } 242 .get = snd_tea6330t_get_treble, .put = snd_tea6330t_put_treble }
220 243
221static 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)
222{ 246{
223 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 247 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
224 248
225 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 249 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
226 uinfo->count = 1; 250 uinfo->count = 1;
@@ -229,17 +253,19 @@ static int snd_tea6330t_info_treble(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_
229 return 0; 253 return 0;
230} 254}
231 255
232static 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)
233{ 258{
234 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 259 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
235 260
236 ucontrol->value.integer.value[0] = tea->treble; 261 ucontrol->value.integer.value[0] = tea->treble;
237 return 0; 262 return 0;
238} 263}
239 264
240static 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)
241{ 267{
242 tea6330t_t *tea = snd_kcontrol_chip(kcontrol); 268 struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
243 int change, err; 269 int change, err;
244 unsigned char bytes[2]; 270 unsigned char bytes[2];
245 unsigned char val1; 271 unsigned char val1;
@@ -257,25 +283,25 @@ static int snd_tea6330t_put_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
257 return change; 283 return change;
258} 284}
259 285
260static snd_kcontrol_new_t snd_tea6330t_controls[] = { 286static struct snd_kcontrol_new snd_tea6330t_controls[] = {
261TEA6330T_MASTER_SWITCH("Master Playback Switch", 0), 287TEA6330T_MASTER_SWITCH("Master Playback Switch", 0),
262TEA6330T_MASTER_VOLUME("Master Playback Volume", 0), 288TEA6330T_MASTER_VOLUME("Master Playback Volume", 0),
263TEA6330T_BASS("Tone Control - Bass", 0), 289TEA6330T_BASS("Tone Control - Bass", 0),
264TEA6330T_TREBLE("Tone Control - Treble", 0) 290TEA6330T_TREBLE("Tone Control - Treble", 0)
265}; 291};
266 292
267static void snd_tea6330_free(snd_i2c_device_t *device) 293static void snd_tea6330_free(struct snd_i2c_device *device)
268{ 294{
269 kfree(device->private_data); 295 kfree(device->private_data);
270} 296}
271 297
272int snd_tea6330t_update_mixer(snd_card_t * card, 298int snd_tea6330t_update_mixer(struct snd_card *card,
273 snd_i2c_bus_t *bus, 299 struct snd_i2c_bus *bus,
274 int equalizer, int fader) 300 int equalizer, int fader)
275{ 301{
276 snd_i2c_device_t *device; 302 struct snd_i2c_device *device;
277 tea6330t_t *tea; 303 struct tea6330t *tea;
278 snd_kcontrol_new_t *knew; 304 struct snd_kcontrol_new *knew;
279 unsigned int idx; 305 unsigned int idx;
280 int err = -ENOMEM; 306 int err = -ENOMEM;
281 u8 default_treble, default_bass; 307 u8 default_treble, default_bass;