Lines Matching +full:ouput +full:- +full:only
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (c) 2000-2004 Jaroslav Kysela <perex@perex.cz>,
18 #include <sound/ak4xxx-adda.h>
29 ak->ops.lock(ak, chip); in snd_akm4xxx_write()
30 ak->ops.write(ak, chip, reg, val); in snd_akm4xxx_write()
34 ak->ops.unlock(ak, chip); in snd_akm4xxx_write()
45 for (chip = 0; chip < ak->num_dacs/2; chip++) { in ak4524_reset()
50 for (reg = 0x04; reg < ak->total_regs; reg++) in ak4524_reset()
62 snd_akm4xxx_write(ak, 0, 0x01, 0x02); /* reset and soft-mute */ in ak435X_reset()
65 for (reg = 0x00; reg < ak->total_regs; reg++) in ak435X_reset()
69 snd_akm4xxx_write(ak, 0, 0x01, 0x01); /* un-reset, unmute */ in ak435X_reset()
77 for (chip = 0; chip < ak->num_dacs/2; chip++) { in ak4381_reset()
81 for (reg = 0x01; reg < ak->total_regs; reg++) in ak4381_reset()
95 switch (ak->type) { in snd_akm4xxx_reset()
122 * Volume conversion table for non-linear volumes
123 * from -63.5dB (mute) to 0dB step 0.5dB
125 * Used for AK4524/AK4620 input/ouput attenuation, AK4528, and
150 static const DECLARE_TLV_DB_SCALE(db_scale_vol_datt, -6350, 50, 1);
151 static const DECLARE_TLV_DB_SCALE(db_scale_8bit, -12750, 50, 1);
152 static const DECLARE_TLV_DB_SCALE(db_scale_7bit, -6350, 50, 1);
199 0x01, 0x02, /* 1: reset and soft-mute */ in snd_akm4xxx_init()
200 0x00, 0x06, /* 0: mode3(i2s), disable auto-clock detect, in snd_akm4xxx_init()
201 * disable DZF, sharp roll-off, RSTN#=0 */ in snd_akm4xxx_init()
204 0x03, 0x01, /* 3: de-emphasis off */ in snd_akm4xxx_init()
212 0x01, 0x01, /* 1: un-reset, unmute */ in snd_akm4xxx_init()
216 0x01, 0x02, /* 1: reset and soft-mute */ in snd_akm4xxx_init()
217 0x00, 0x06, /* 0: mode3(i2s), disable auto-clock detect, in snd_akm4xxx_init()
218 * disable DZF, sharp roll-off, RSTN#=0 */ in snd_akm4xxx_init()
221 0x03, 0x01, /* 3: de-emphasis off */ in snd_akm4xxx_init()
231 0x01, 0x01, /* 1: un-reset, unmute */ in snd_akm4xxx_init()
235 0x00, 0x0c, /* 0: mode3(i2s), disable auto-clock detect */ in snd_akm4xxx_init()
236 0x01, 0x02, /* 1: de-emphasis off, normal speed, in snd_akm4xxx_init()
237 * sharp roll-off, DZF off */ in snd_akm4xxx_init()
242 0x00, 0x0f, /* 0: power-up, un-reset */ in snd_akm4xxx_init()
264 memset(ak->images, 0, sizeof(ak->images)); in snd_akm4xxx_init()
265 memset(ak->volumes, 0, sizeof(ak->volumes)); in snd_akm4xxx_init()
267 switch (ak->type) { in snd_akm4xxx_init()
270 ak->num_chips = ak->num_dacs / 2; in snd_akm4xxx_init()
271 ak->name = "ak4524"; in snd_akm4xxx_init()
272 ak->total_regs = 0x08; in snd_akm4xxx_init()
276 ak->num_chips = ak->num_dacs / 2; in snd_akm4xxx_init()
277 ak->name = "ak4528"; in snd_akm4xxx_init()
278 ak->total_regs = 0x06; in snd_akm4xxx_init()
282 ak->num_chips = 1; in snd_akm4xxx_init()
283 ak->name = "ak4529"; in snd_akm4xxx_init()
284 ak->total_regs = 0x0d; in snd_akm4xxx_init()
288 ak->num_chips = 1; in snd_akm4xxx_init()
289 ak->name = "ak4355"; in snd_akm4xxx_init()
290 ak->total_regs = 0x0b; in snd_akm4xxx_init()
294 ak->num_chips = 1; in snd_akm4xxx_init()
295 ak->name = "ak4358"; in snd_akm4xxx_init()
296 ak->total_regs = 0x10; in snd_akm4xxx_init()
300 ak->num_chips = ak->num_dacs / 2; in snd_akm4xxx_init()
301 ak->name = "ak4381"; in snd_akm4xxx_init()
302 ak->total_regs = 0x05; in snd_akm4xxx_init()
306 ak->num_chips = 1; in snd_akm4xxx_init()
307 ak->name = "ak5365"; in snd_akm4xxx_init()
308 ak->total_regs = 0x08; in snd_akm4xxx_init()
312 ak->num_chips = ak->num_dacs / 2; in snd_akm4xxx_init()
313 ak->name = "ak4620"; in snd_akm4xxx_init()
314 ak->total_regs = 0x08; in snd_akm4xxx_init()
321 for (chip = 0; chip < ak->num_chips; chip++) { in snd_akm4xxx_init()
355 unsigned int mask = AK_GET_MASK(kcontrol->private_value); in snd_akm4xxx_volume_info()
357 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_akm4xxx_volume_info()
358 uinfo->count = 1; in snd_akm4xxx_volume_info()
359 uinfo->value.integer.min = 0; in snd_akm4xxx_volume_info()
360 uinfo->value.integer.max = mask; in snd_akm4xxx_volume_info()
368 int chip = AK_GET_CHIP(kcontrol->private_value); in snd_akm4xxx_volume_get()
369 int addr = AK_GET_ADDR(kcontrol->private_value); in snd_akm4xxx_volume_get()
371 ucontrol->value.integer.value[0] = snd_akm4xxx_get_vol(ak, chip, addr); in snd_akm4xxx_volume_get()
379 unsigned int mask = AK_GET_MASK(kcontrol->private_value); in put_ak_reg()
380 int chip = AK_GET_CHIP(kcontrol->private_value); in put_ak_reg()
386 if (AK_GET_VOL_CVT(kcontrol->private_value) && nval < 128) in put_ak_reg()
388 if (AK_GET_IPGA(kcontrol->private_value) && nval >= 128) in put_ak_reg()
390 if (AK_GET_INVERT(kcontrol->private_value)) in put_ak_reg()
391 nval = mask - nval; in put_ak_reg()
392 if (AK_GET_NEEDSMSB(kcontrol->private_value)) in put_ak_reg()
394 /* printk(KERN_DEBUG "DEBUG - AK writing reg: chip %x addr %x, in put_ak_reg()
403 unsigned int mask = AK_GET_MASK(kcontrol->private_value); in snd_akm4xxx_volume_put()
404 unsigned int val = ucontrol->value.integer.value[0]; in snd_akm4xxx_volume_put()
406 return -EINVAL; in snd_akm4xxx_volume_put()
407 return put_ak_reg(kcontrol, AK_GET_ADDR(kcontrol->private_value), val); in snd_akm4xxx_volume_put()
413 unsigned int mask = AK_GET_MASK(kcontrol->private_value); in snd_akm4xxx_stereo_volume_info()
415 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_akm4xxx_stereo_volume_info()
416 uinfo->count = 2; in snd_akm4xxx_stereo_volume_info()
417 uinfo->value.integer.min = 0; in snd_akm4xxx_stereo_volume_info()
418 uinfo->value.integer.max = mask; in snd_akm4xxx_stereo_volume_info()
426 int chip = AK_GET_CHIP(kcontrol->private_value); in snd_akm4xxx_stereo_volume_get()
427 int addr = AK_GET_ADDR(kcontrol->private_value); in snd_akm4xxx_stereo_volume_get()
429 ucontrol->value.integer.value[0] = snd_akm4xxx_get_vol(ak, chip, addr); in snd_akm4xxx_stereo_volume_get()
430 ucontrol->value.integer.value[1] = snd_akm4xxx_get_vol(ak, chip, addr+1); in snd_akm4xxx_stereo_volume_get()
437 int addr = AK_GET_ADDR(kcontrol->private_value); in snd_akm4xxx_stereo_volume_put()
438 unsigned int mask = AK_GET_MASK(kcontrol->private_value); in snd_akm4xxx_stereo_volume_put()
442 val[0] = ucontrol->value.integer.value[0]; in snd_akm4xxx_stereo_volume_put()
443 val[1] = ucontrol->value.integer.value[1]; in snd_akm4xxx_stereo_volume_put()
445 return -EINVAL; in snd_akm4xxx_stereo_volume_put()
464 int chip = AK_GET_CHIP(kcontrol->private_value); in snd_akm4xxx_deemphasis_get()
465 int addr = AK_GET_ADDR(kcontrol->private_value); in snd_akm4xxx_deemphasis_get()
466 int shift = AK_GET_SHIFT(kcontrol->private_value); in snd_akm4xxx_deemphasis_get()
467 ucontrol->value.enumerated.item[0] = in snd_akm4xxx_deemphasis_get()
476 int chip = AK_GET_CHIP(kcontrol->private_value); in snd_akm4xxx_deemphasis_put()
477 int addr = AK_GET_ADDR(kcontrol->private_value); in snd_akm4xxx_deemphasis_put()
478 int shift = AK_GET_SHIFT(kcontrol->private_value); in snd_akm4xxx_deemphasis_put()
479 unsigned char nval = ucontrol->value.enumerated.item[0] & 3; in snd_akm4xxx_deemphasis_put()
496 int chip = AK_GET_CHIP(kcontrol->private_value); in ak4xxx_switch_get()
497 int addr = AK_GET_ADDR(kcontrol->private_value); in ak4xxx_switch_get()
498 int shift = AK_GET_SHIFT(kcontrol->private_value); in ak4xxx_switch_get()
499 int invert = AK_GET_INVERT(kcontrol->private_value); in ak4xxx_switch_get()
500 /* we observe the (1<<shift) bit only */ in ak4xxx_switch_get()
504 ucontrol->value.integer.value[0] = (val & (1<<shift)) != 0; in ak4xxx_switch_get()
512 int chip = AK_GET_CHIP(kcontrol->private_value); in ak4xxx_switch_put()
513 int addr = AK_GET_ADDR(kcontrol->private_value); in ak4xxx_switch_put()
514 int shift = AK_GET_SHIFT(kcontrol->private_value); in ak4xxx_switch_put()
515 int invert = AK_GET_INVERT(kcontrol->private_value); in ak4xxx_switch_put()
516 long flag = ucontrol->value.integer.value[0]; in ak4xxx_switch_put()
540 input_names = ak->adc_info[mixer_ch].input_names; in ak4xxx_capture_num_inputs()
551 int mixer_ch = AK_GET_SHIFT(kcontrol->private_value); in ak4xxx_capture_source_info()
556 return -EINVAL; in ak4xxx_capture_source_info()
558 ak->adc_info[mixer_ch].input_names); in ak4xxx_capture_source_info()
565 int chip = AK_GET_CHIP(kcontrol->private_value); in ak4xxx_capture_source_get()
566 int addr = AK_GET_ADDR(kcontrol->private_value); in ak4xxx_capture_source_get()
567 int mask = AK_GET_MASK(kcontrol->private_value); in ak4xxx_capture_source_get()
571 ucontrol->value.enumerated.item[0] = val; in ak4xxx_capture_source_get()
579 int mixer_ch = AK_GET_SHIFT(kcontrol->private_value); in ak4xxx_capture_source_put()
580 int chip = AK_GET_CHIP(kcontrol->private_value); in ak4xxx_capture_source_put()
581 int addr = AK_GET_ADDR(kcontrol->private_value); in ak4xxx_capture_source_put()
582 int mask = AK_GET_MASK(kcontrol->private_value); in ak4xxx_capture_source_put()
586 if (ucontrol->value.enumerated.item[0] >= num_names) in ak4xxx_capture_source_put()
587 return -EINVAL; in ak4xxx_capture_source_put()
591 val |= ucontrol->value.enumerated.item[0] & mask; in ak4xxx_capture_source_put()
609 for (idx = 0; idx < ak->num_dacs; ) { in build_dac_controls()
610 /* mute control for Revolution 7.1 - AK4381 */ in build_dac_controls()
611 if (ak->type == SND_AK4381 in build_dac_controls()
612 && ak->dac_info[mixer_ch].switch_name) { in build_dac_controls()
617 knew.name = ak->dac_info[mixer_ch].switch_name; in build_dac_controls()
626 err = snd_ctl_add(ak->card, snd_ctl_new1(&knew, ak)); in build_dac_controls()
631 if (! ak->dac_info || ! ak->dac_info[mixer_ch].name) { in build_dac_controls()
633 knew.index = mixer_ch + ak->idx_offset * 2; in build_dac_controls()
636 knew.name = ak->dac_info[mixer_ch].name; in build_dac_controls()
637 num_stereo = ak->dac_info[mixer_ch].num_channels; in build_dac_controls()
652 switch (ak->type) { in build_dac_controls()
668 /* registers 2-7 and b,c */ in build_dac_controls()
669 int val = idx < 6 ? idx + 2 : (idx - 6) + 0xb; in build_dac_controls()
676 /* register 4-9, chip #0 only */ in build_dac_controls()
681 /* register 4-9 and 11-12, chip #0 only */ in build_dac_controls()
701 return -EINVAL; in build_dac_controls()
704 err = snd_ctl_add(ak->card, snd_ctl_new1(&knew, ak)); in build_dac_controls()
720 if (ak->type == SND_AK4528) in build_adc_controls()
722 for (idx = 0; idx < ak->num_adcs;) { in build_adc_controls()
724 if (! ak->adc_info || ! ak->adc_info[mixer_ch].name) { in build_adc_controls()
726 knew.index = mixer_ch + ak->idx_offset * 2; in build_adc_controls()
729 knew.name = ak->adc_info[mixer_ch].name; in build_adc_controls()
730 num_stereo = ak->adc_info[mixer_ch].num_channels; in build_adc_controls()
746 if (ak->type == SND_AK5365) in build_adc_controls()
754 err = snd_ctl_add(ak->card, snd_ctl_new1(&knew, ak)); in build_adc_controls()
758 if (ak->type == SND_AK5365 && (idx % 2) == 0) { in build_adc_controls()
759 if (! ak->adc_info || in build_adc_controls()
760 ! ak->adc_info[mixer_ch].switch_name) { in build_adc_controls()
762 knew.index = mixer_ch + ak->idx_offset * 2; in build_adc_controls()
764 knew.name = ak->adc_info[mixer_ch].switch_name; in build_adc_controls()
773 err = snd_ctl_add(ak->card, snd_ctl_new1(&knew, ak)); in build_adc_controls()
778 if (!ak->adc_info || in build_adc_controls()
779 !ak->adc_info[mixer_ch].selector_name) { in build_adc_controls()
781 knew.index = mixer_ch + ak->idx_offset * 2; in build_adc_controls()
783 knew.name = ak->adc_info[mixer_ch].selector_name; in build_adc_controls()
790 /* input selector control: reg. 1, bits 0-2. in build_adc_controls()
791 * mis-use 'shift' to pass mixer_ch */ in build_adc_controls()
794 err = snd_ctl_add(ak->card, snd_ctl_new1(&knew, ak)); in build_adc_controls()
813 knew.index = idx + ak->idx_offset; in build_deemphasis()
819 switch (ak->type) { in build_deemphasis()
827 int shift = idx == 3 ? 6 : (2 - idx) * 2; in build_deemphasis()
840 return -EINVAL; in build_deemphasis()
842 err = snd_ctl_add(ak->card, snd_ctl_new1(&knew, ak)); in build_deemphasis()
852 struct snd_akm4xxx *ak = entry->private_data; in proc_regs_read()
854 for (chip = 0; chip < ak->num_chips; chip++) { in proc_regs_read()
855 for (reg = 0; reg < ak->total_regs; reg++) { in proc_regs_read()
865 return snd_card_ro_proc_new(ak->card, ak->name, ak, proc_regs_read); in proc_init()
879 if (ak->type == SND_AK4355 || ak->type == SND_AK4358) in snd_akm4xxx_build_controls()
881 else if (ak->type == SND_AK4620) in snd_akm4xxx_build_controls()
884 num_emphs = ak->num_dacs / 2; in snd_akm4xxx_build_controls()