aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c/other/ak4xxx-adda.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/i2c/other/ak4xxx-adda.c')
-rw-r--r--sound/i2c/other/ak4xxx-adda.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c
index db2b7274a9d6..045e32a311e0 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);