Lines Matching +full:integer +full:- +full:n

1 // SPDX-License-Identifier: GPL-2.0-or-later
23 while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) in snd_pmac_burgundy_busy_wait()
26 printk(KERN_DEBUG "burgundy_busy_wait: timeout\n"); in snd_pmac_burgundy_busy_wait()
34 while (!(in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--) in snd_pmac_burgundy_extend_wait()
37 printk(KERN_DEBUG "burgundy_extend_wait: timeout #1\n"); in snd_pmac_burgundy_extend_wait()
39 while ((in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--) in snd_pmac_burgundy_extend_wait()
42 printk(KERN_DEBUG "burgundy_extend_wait: timeout #2\n"); in snd_pmac_burgundy_extend_wait()
48 out_le32(&chip->awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff)); in snd_pmac_burgundy_wcw()
50 out_le32(&chip->awacs->codec_ctrl, addr + 0x200d00 +((val>>8) & 0xff)); in snd_pmac_burgundy_wcw()
52 out_le32(&chip->awacs->codec_ctrl, addr + 0x200e00 +((val>>16) & 0xff)); in snd_pmac_burgundy_wcw()
54 out_le32(&chip->awacs->codec_ctrl, addr + 0x200f00 +((val>>24) & 0xff)); in snd_pmac_burgundy_wcw()
64 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_burgundy_rcw()
66 out_le32(&chip->awacs->codec_ctrl, addr + 0x100000); in snd_pmac_burgundy_rcw()
69 val += (in_le32(&chip->awacs->codec_stat) >> 4) & 0xff; in snd_pmac_burgundy_rcw()
71 out_le32(&chip->awacs->codec_ctrl, addr + 0x100100); in snd_pmac_burgundy_rcw()
74 val += ((in_le32(&chip->awacs->codec_stat)>>4) & 0xff) <<8; in snd_pmac_burgundy_rcw()
76 out_le32(&chip->awacs->codec_ctrl, addr + 0x100200); in snd_pmac_burgundy_rcw()
79 val += ((in_le32(&chip->awacs->codec_stat)>>4) & 0xff) <<16; in snd_pmac_burgundy_rcw()
81 out_le32(&chip->awacs->codec_ctrl, addr + 0x100300); in snd_pmac_burgundy_rcw()
84 val += ((in_le32(&chip->awacs->codec_stat)>>4) & 0xff) <<24; in snd_pmac_burgundy_rcw()
86 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_burgundy_rcw()
95 out_le32(&chip->awacs->codec_ctrl, addr + 0x300000 + (val & 0xff)); in snd_pmac_burgundy_wcb()
105 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_burgundy_rcb()
107 out_le32(&chip->awacs->codec_ctrl, addr + 0x100000); in snd_pmac_burgundy_rcb()
110 val += (in_le32(&chip->awacs->codec_stat) >> 4) & 0xff; in snd_pmac_burgundy_rcb()
112 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_burgundy_rcb()
121 * Burgundy volume: 0 - 100, stereo, word reg
131 return; /* -EINVAL */ in snd_pmac_burgundy_write_volume()
152 volume[0] -= BURGUNDY_VOLUME_OFFSET; in snd_pmac_burgundy_read_volume()
157 volume[1] -= BURGUNDY_VOLUME_OFFSET; in snd_pmac_burgundy_read_volume()
165 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_pmac_burgundy_info_volume()
166 uinfo->count = 2; in snd_pmac_burgundy_info_volume()
167 uinfo->value.integer.min = 0; in snd_pmac_burgundy_info_volume()
168 uinfo->value.integer.max = 100; in snd_pmac_burgundy_info_volume()
176 unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); in snd_pmac_burgundy_get_volume()
177 int shift = (kcontrol->private_value >> 8) & 0xff; in snd_pmac_burgundy_get_volume()
179 ucontrol->value.integer.value, shift); in snd_pmac_burgundy_get_volume()
187 unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); in snd_pmac_burgundy_put_volume()
188 int shift = (kcontrol->private_value >> 8) & 0xff; in snd_pmac_burgundy_put_volume()
192 ucontrol->value.integer.value, shift); in snd_pmac_burgundy_put_volume()
194 return (nvoices[0] != ucontrol->value.integer.value[0] || in snd_pmac_burgundy_put_volume()
195 nvoices[1] != ucontrol->value.integer.value[1]); in snd_pmac_burgundy_put_volume()
206 * Burgundy volume: 0 - 100, stereo, 2-byte reg
228 volume[0] -= BURGUNDY_VOLUME_OFFSET; in snd_pmac_burgundy_read_volume_2b()
233 volume[1] -= BURGUNDY_VOLUME_OFFSET; in snd_pmac_burgundy_read_volume_2b()
241 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_pmac_burgundy_info_volume_2b()
242 uinfo->count = 2; in snd_pmac_burgundy_info_volume_2b()
243 uinfo->value.integer.min = 0; in snd_pmac_burgundy_info_volume_2b()
244 uinfo->value.integer.max = 100; in snd_pmac_burgundy_info_volume_2b()
252 unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); in snd_pmac_burgundy_get_volume_2b()
253 int off = kcontrol->private_value & 0x300; in snd_pmac_burgundy_get_volume_2b()
255 ucontrol->value.integer.value, off); in snd_pmac_burgundy_get_volume_2b()
263 unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); in snd_pmac_burgundy_put_volume_2b()
264 int off = kcontrol->private_value & 0x300; in snd_pmac_burgundy_put_volume_2b()
268 ucontrol->value.integer.value, off); in snd_pmac_burgundy_put_volume_2b()
270 return (nvoices[0] != ucontrol->value.integer.value[0] || in snd_pmac_burgundy_put_volume_2b()
271 nvoices[1] != ucontrol->value.integer.value[1]); in snd_pmac_burgundy_put_volume_2b()
282 * Burgundy gain/attenuation: 0 - 15, mono/stereo, byte reg
287 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_info_gain()
288 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_pmac_burgundy_info_gain()
289 uinfo->count = stereo + 1; in snd_pmac_burgundy_info_gain()
290 uinfo->value.integer.min = 0; in snd_pmac_burgundy_info_gain()
291 uinfo->value.integer.max = 15; in snd_pmac_burgundy_info_gain()
299 unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); in snd_pmac_burgundy_get_gain()
300 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_get_gain()
301 int atten = (kcontrol->private_value >> 25) & 1; in snd_pmac_burgundy_get_gain()
307 ucontrol->value.integer.value[0] = oval & 0xf; in snd_pmac_burgundy_get_gain()
309 ucontrol->value.integer.value[1] = (oval >> 4) & 0xf; in snd_pmac_burgundy_get_gain()
317 unsigned int addr = BASE2ADDR(kcontrol->private_value & 0xff); in snd_pmac_burgundy_put_gain()
318 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_put_gain()
319 int atten = (kcontrol->private_value >> 25) & 1; in snd_pmac_burgundy_put_gain()
325 val = ucontrol->value.integer.value[0]; in snd_pmac_burgundy_put_gain()
327 val |= ucontrol->value.integer.value[1] << 4; in snd_pmac_burgundy_put_gain()
329 val |= ucontrol->value.integer.value[0] << 4; in snd_pmac_burgundy_put_gain()
349 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_info_switch_w()
350 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in snd_pmac_burgundy_info_switch_w()
351 uinfo->count = stereo + 1; in snd_pmac_burgundy_info_switch_w()
352 uinfo->value.integer.min = 0; in snd_pmac_burgundy_info_switch_w()
353 uinfo->value.integer.max = 1; in snd_pmac_burgundy_info_switch_w()
361 unsigned int addr = BASE2ADDR((kcontrol->private_value >> 16) & 0xff); in snd_pmac_burgundy_get_switch_w()
362 int lmask = 1 << (kcontrol->private_value & 0xff); in snd_pmac_burgundy_get_switch_w()
363 int rmask = 1 << ((kcontrol->private_value >> 8) & 0xff); in snd_pmac_burgundy_get_switch_w()
364 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_get_switch_w()
366 ucontrol->value.integer.value[0] = (val & lmask) ? 1 : 0; in snd_pmac_burgundy_get_switch_w()
368 ucontrol->value.integer.value[1] = (val & rmask) ? 1 : 0; in snd_pmac_burgundy_get_switch_w()
376 unsigned int addr = BASE2ADDR((kcontrol->private_value >> 16) & 0xff); in snd_pmac_burgundy_put_switch_w()
377 int lmask = 1 << (kcontrol->private_value & 0xff); in snd_pmac_burgundy_put_switch_w()
378 int rmask = 1 << ((kcontrol->private_value >> 8) & 0xff); in snd_pmac_burgundy_put_switch_w()
379 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_put_switch_w()
383 if (ucontrol->value.integer.value[0]) in snd_pmac_burgundy_put_switch_w()
385 if (stereo && ucontrol->value.integer.value[1]) in snd_pmac_burgundy_put_switch_w()
405 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_info_switch_b()
406 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in snd_pmac_burgundy_info_switch_b()
407 uinfo->count = stereo + 1; in snd_pmac_burgundy_info_switch_b()
408 uinfo->value.integer.min = 0; in snd_pmac_burgundy_info_switch_b()
409 uinfo->value.integer.max = 1; in snd_pmac_burgundy_info_switch_b()
417 unsigned int addr = BASE2ADDR((kcontrol->private_value >> 16) & 0xff); in snd_pmac_burgundy_get_switch_b()
418 int lmask = kcontrol->private_value & 0xff; in snd_pmac_burgundy_get_switch_b()
419 int rmask = (kcontrol->private_value >> 8) & 0xff; in snd_pmac_burgundy_get_switch_b()
420 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_get_switch_b()
422 ucontrol->value.integer.value[0] = (val & lmask) ? 1 : 0; in snd_pmac_burgundy_get_switch_b()
424 ucontrol->value.integer.value[1] = (val & rmask) ? 1 : 0; in snd_pmac_burgundy_get_switch_b()
432 unsigned int addr = BASE2ADDR((kcontrol->private_value >> 16) & 0xff); in snd_pmac_burgundy_put_switch_b()
433 int lmask = kcontrol->private_value & 0xff; in snd_pmac_burgundy_put_switch_b()
434 int rmask = (kcontrol->private_value >> 8) & 0xff; in snd_pmac_burgundy_put_switch_b()
435 int stereo = (kcontrol->private_value >> 24) & 1; in snd_pmac_burgundy_put_switch_b()
439 if (ucontrol->value.integer.value[0]) in snd_pmac_burgundy_put_switch_b()
441 if (stereo && ucontrol->value.integer.value[1]) in snd_pmac_burgundy_put_switch_b()
562 * auto-mute stuffs
566 return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; in snd_pmac_burgundy_detect_headphone()
571 if (chip->auto_mute) { in snd_pmac_burgundy_update_automute()
593 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_pmac_burgundy_update_automute()
594 &chip->master_sw_ctl->id); in snd_pmac_burgundy_update_automute()
595 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_pmac_burgundy_update_automute()
596 &chip->speaker_sw_ctl->id); in snd_pmac_burgundy_update_automute()
597 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_pmac_burgundy_update_automute()
598 &chip->hp_detect_ctl->id); in snd_pmac_burgundy_update_automute()
614 if ((in_le32(&chip->awacs->codec_ctrl) & MASK_ERRCODE) == 0xf0000) { in snd_pmac_burgundy_init()
615 printk(KERN_WARNING "pmac burgundy: disabled by MacOS :-(\n"); in snd_pmac_burgundy_init()
656 if (chip->hp_stat_mask == 0) { in snd_pmac_burgundy_init()
657 /* set headphone-jack detection bit */ in snd_pmac_burgundy_init()
659 chip->hp_stat_mask = BURGUNDY_HPDETECT_IMAC_UPPER in snd_pmac_burgundy_init()
663 chip->hp_stat_mask = BURGUNDY_HPDETECT_PMAC_BACK; in snd_pmac_burgundy_init()
668 strcpy(chip->card->mixername, "PowerMac Burgundy"); in snd_pmac_burgundy_init()
671 err = snd_ctl_add(chip->card, in snd_pmac_burgundy_init()
678 err = snd_ctl_add(chip->card, in snd_pmac_burgundy_init()
684 chip->master_sw_ctl = snd_ctl_new1(imac in snd_pmac_burgundy_init()
687 err = snd_ctl_add(chip->card, chip->master_sw_ctl); in snd_pmac_burgundy_init()
690 chip->master_sw_ctl = snd_ctl_new1(imac in snd_pmac_burgundy_init()
693 err = snd_ctl_add(chip->card, chip->master_sw_ctl); in snd_pmac_burgundy_init()
697 chip->master_sw_ctl = snd_ctl_new1( in snd_pmac_burgundy_init()
699 err = snd_ctl_add(chip->card, chip->master_sw_ctl); in snd_pmac_burgundy_init()
703 chip->speaker_sw_ctl = snd_ctl_new1(imac in snd_pmac_burgundy_init()
706 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); in snd_pmac_burgundy_init()
714 chip->detect_headphone = snd_pmac_burgundy_detect_headphone; in snd_pmac_burgundy_init()
715 chip->update_automute = snd_pmac_burgundy_update_automute; in snd_pmac_burgundy_init()