Lines Matching refs:chip
32 snd_pmac_burgundy_busy_wait(struct snd_pmac *chip) in snd_pmac_burgundy_busy_wait() argument
35 while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) in snd_pmac_burgundy_busy_wait()
42 snd_pmac_burgundy_extend_wait(struct snd_pmac *chip) in snd_pmac_burgundy_extend_wait() argument
46 while (!(in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--) in snd_pmac_burgundy_extend_wait()
51 while ((in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--) in snd_pmac_burgundy_extend_wait()
58 snd_pmac_burgundy_wcw(struct snd_pmac *chip, unsigned addr, unsigned val) in snd_pmac_burgundy_wcw() argument
60 out_le32(&chip->awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff)); in snd_pmac_burgundy_wcw()
61 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
62 out_le32(&chip->awacs->codec_ctrl, addr + 0x200d00 +((val>>8) & 0xff)); in snd_pmac_burgundy_wcw()
63 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
64 out_le32(&chip->awacs->codec_ctrl, addr + 0x200e00 +((val>>16) & 0xff)); in snd_pmac_burgundy_wcw()
65 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
66 out_le32(&chip->awacs->codec_ctrl, addr + 0x200f00 +((val>>24) & 0xff)); in snd_pmac_burgundy_wcw()
67 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
71 snd_pmac_burgundy_rcw(struct snd_pmac *chip, unsigned addr) in snd_pmac_burgundy_rcw() argument
76 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_burgundy_rcw()
78 out_le32(&chip->awacs->codec_ctrl, addr + 0x100000); in snd_pmac_burgundy_rcw()
79 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
80 snd_pmac_burgundy_extend_wait(chip); in snd_pmac_burgundy_rcw()
81 val += (in_le32(&chip->awacs->codec_stat) >> 4) & 0xff; in snd_pmac_burgundy_rcw()
83 out_le32(&chip->awacs->codec_ctrl, addr + 0x100100); in snd_pmac_burgundy_rcw()
84 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
85 snd_pmac_burgundy_extend_wait(chip); in snd_pmac_burgundy_rcw()
86 val += ((in_le32(&chip->awacs->codec_stat)>>4) & 0xff) <<8; in snd_pmac_burgundy_rcw()
88 out_le32(&chip->awacs->codec_ctrl, addr + 0x100200); in snd_pmac_burgundy_rcw()
89 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
90 snd_pmac_burgundy_extend_wait(chip); in snd_pmac_burgundy_rcw()
91 val += ((in_le32(&chip->awacs->codec_stat)>>4) & 0xff) <<16; in snd_pmac_burgundy_rcw()
93 out_le32(&chip->awacs->codec_ctrl, addr + 0x100300); in snd_pmac_burgundy_rcw()
94 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
95 snd_pmac_burgundy_extend_wait(chip); in snd_pmac_burgundy_rcw()
96 val += ((in_le32(&chip->awacs->codec_stat)>>4) & 0xff) <<24; in snd_pmac_burgundy_rcw()
98 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_burgundy_rcw()
104 snd_pmac_burgundy_wcb(struct snd_pmac *chip, unsigned int addr, in snd_pmac_burgundy_wcb() argument
107 out_le32(&chip->awacs->codec_ctrl, addr + 0x300000 + (val & 0xff)); in snd_pmac_burgundy_wcb()
108 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcb()
112 snd_pmac_burgundy_rcb(struct snd_pmac *chip, unsigned int addr) in snd_pmac_burgundy_rcb() argument
117 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_burgundy_rcb()
119 out_le32(&chip->awacs->codec_ctrl, addr + 0x100000); in snd_pmac_burgundy_rcb()
120 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcb()
121 snd_pmac_burgundy_extend_wait(chip); in snd_pmac_burgundy_rcb()
122 val += (in_le32(&chip->awacs->codec_stat) >> 4) & 0xff; in snd_pmac_burgundy_rcb()
124 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_burgundy_rcb()
136 snd_pmac_burgundy_write_volume(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_write_volume() argument
151 snd_pmac_burgundy_wcw(chip, address, hardvolume); in snd_pmac_burgundy_write_volume()
155 snd_pmac_burgundy_read_volume(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_read_volume() argument
160 wvolume = snd_pmac_burgundy_rcw(chip, address); in snd_pmac_burgundy_read_volume()
187 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_volume() local
190 snd_pmac_burgundy_read_volume(chip, addr, in snd_pmac_burgundy_get_volume()
198 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_volume() local
203 snd_pmac_burgundy_write_volume(chip, addr, in snd_pmac_burgundy_put_volume()
205 snd_pmac_burgundy_read_volume(chip, addr, nvoices, shift); in snd_pmac_burgundy_put_volume()
221 snd_pmac_burgundy_write_volume_2b(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_write_volume_2b() argument
230 snd_pmac_burgundy_wcb(chip, address + off, lvolume); in snd_pmac_burgundy_write_volume_2b()
231 snd_pmac_burgundy_wcb(chip, address + off + 0x500, rvolume); in snd_pmac_burgundy_write_volume_2b()
235 snd_pmac_burgundy_read_volume_2b(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_read_volume_2b() argument
238 volume[0] = snd_pmac_burgundy_rcb(chip, address + off); in snd_pmac_burgundy_read_volume_2b()
243 volume[1] = snd_pmac_burgundy_rcb(chip, address + off + 0x100); in snd_pmac_burgundy_read_volume_2b()
263 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_volume_2b() local
266 snd_pmac_burgundy_read_volume_2b(chip, addr, in snd_pmac_burgundy_get_volume_2b()
274 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_volume_2b() local
279 snd_pmac_burgundy_write_volume_2b(chip, addr, in snd_pmac_burgundy_put_volume_2b()
281 snd_pmac_burgundy_read_volume_2b(chip, addr, nvoices, off); in snd_pmac_burgundy_put_volume_2b()
310 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_gain() local
316 oval = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_get_gain()
328 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_gain() local
334 oval = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_put_gain()
344 snd_pmac_burgundy_wcb(chip, addr, val); in snd_pmac_burgundy_put_gain()
372 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_switch_w() local
377 int val = snd_pmac_burgundy_rcw(chip, addr); in snd_pmac_burgundy_get_switch_w()
387 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_switch_w() local
393 oval = snd_pmac_burgundy_rcw(chip, addr); in snd_pmac_burgundy_put_switch_w()
399 snd_pmac_burgundy_wcw(chip, addr, val); in snd_pmac_burgundy_put_switch_w()
428 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_switch_b() local
433 int val = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_get_switch_b()
443 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_switch_b() local
449 oval = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_put_switch_b()
455 snd_pmac_burgundy_wcb(chip, addr, val); in snd_pmac_burgundy_put_switch_b()
576 static int snd_pmac_burgundy_detect_headphone(struct snd_pmac *chip) in snd_pmac_burgundy_detect_headphone() argument
578 return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; in snd_pmac_burgundy_detect_headphone()
581 static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_notify) in snd_pmac_burgundy_update_automute() argument
583 if (chip->auto_mute) { in snd_pmac_burgundy_update_automute()
586 reg = oreg = snd_pmac_burgundy_rcb(chip, in snd_pmac_burgundy_update_automute()
592 if (snd_pmac_burgundy_detect_headphone(chip)) in snd_pmac_burgundy_update_automute()
602 snd_pmac_burgundy_wcb(chip, in snd_pmac_burgundy_update_automute()
605 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_pmac_burgundy_update_automute()
606 &chip->master_sw_ctl->id); in snd_pmac_burgundy_update_automute()
607 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_pmac_burgundy_update_automute()
608 &chip->speaker_sw_ctl->id); in snd_pmac_burgundy_update_automute()
609 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in snd_pmac_burgundy_update_automute()
610 &chip->hp_detect_ctl->id); in snd_pmac_burgundy_update_automute()
620 int snd_pmac_burgundy_init(struct snd_pmac *chip) in snd_pmac_burgundy_init() argument
626 if ((in_le32(&chip->awacs->codec_ctrl) & MASK_ERRCODE) == 0xf0000) { in snd_pmac_burgundy_init()
631 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_OUTPUTENABLES, in snd_pmac_burgundy_init()
633 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, in snd_pmac_burgundy_init()
635 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_OUTPUTSELECTS, in snd_pmac_burgundy_init()
638 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_INPSEL21, in snd_pmac_burgundy_init()
640 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_INPSEL3, in snd_pmac_burgundy_init()
643 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINCD, in snd_pmac_burgundy_init()
645 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINLINE, in snd_pmac_burgundy_init()
647 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINMIC, in snd_pmac_burgundy_init()
649 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINMODEM, in snd_pmac_burgundy_init()
652 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENSPEAKER, in snd_pmac_burgundy_init()
654 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENLINEOUT, in snd_pmac_burgundy_init()
656 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENHP, in snd_pmac_burgundy_init()
659 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_MASTER_VOLUME, in snd_pmac_burgundy_init()
661 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLCD, in snd_pmac_burgundy_init()
663 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLLINE, in snd_pmac_burgundy_init()
665 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLMIC, in snd_pmac_burgundy_init()
668 if (chip->hp_stat_mask == 0) { in snd_pmac_burgundy_init()
671 chip->hp_stat_mask = BURGUNDY_HPDETECT_IMAC_UPPER in snd_pmac_burgundy_init()
675 chip->hp_stat_mask = BURGUNDY_HPDETECT_PMAC_BACK; in snd_pmac_burgundy_init()
680 strcpy(chip->card->mixername, "PowerMac Burgundy"); in snd_pmac_burgundy_init()
683 err = snd_ctl_add(chip->card, in snd_pmac_burgundy_init()
684 snd_ctl_new1(&snd_pmac_burgundy_mixers[i], chip)); in snd_pmac_burgundy_init()
690 err = snd_ctl_add(chip->card, in snd_pmac_burgundy_init()
692 : &snd_pmac_burgundy_mixers_pmac[i], chip)); in snd_pmac_burgundy_init()
696 chip->master_sw_ctl = snd_ctl_new1(imac in snd_pmac_burgundy_init()
698 : &snd_pmac_burgundy_master_sw_pmac, chip); in snd_pmac_burgundy_init()
699 err = snd_ctl_add(chip->card, chip->master_sw_ctl); in snd_pmac_burgundy_init()
702 chip->master_sw_ctl = snd_ctl_new1(imac in snd_pmac_burgundy_init()
704 : &snd_pmac_burgundy_line_sw_pmac, chip); in snd_pmac_burgundy_init()
705 err = snd_ctl_add(chip->card, chip->master_sw_ctl); in snd_pmac_burgundy_init()
709 chip->master_sw_ctl = snd_ctl_new1( in snd_pmac_burgundy_init()
710 &snd_pmac_burgundy_hp_sw_imac, chip); in snd_pmac_burgundy_init()
711 err = snd_ctl_add(chip->card, chip->master_sw_ctl); in snd_pmac_burgundy_init()
715 chip->speaker_sw_ctl = snd_ctl_new1(imac in snd_pmac_burgundy_init()
717 : &snd_pmac_burgundy_speaker_sw_pmac, chip); in snd_pmac_burgundy_init()
718 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); in snd_pmac_burgundy_init()
722 err = snd_pmac_add_automute(chip); in snd_pmac_burgundy_init()
726 chip->detect_headphone = snd_pmac_burgundy_detect_headphone; in snd_pmac_burgundy_init()
727 chip->update_automute = snd_pmac_burgundy_update_automute; in snd_pmac_burgundy_init()
728 snd_pmac_burgundy_update_automute(chip, 0); /* update the status only */ in snd_pmac_burgundy_init()