Lines Matching refs:chip

20 snd_pmac_burgundy_busy_wait(struct snd_pmac *chip)  in snd_pmac_burgundy_busy_wait()  argument
23 while ((in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) && timeout--) in snd_pmac_burgundy_busy_wait()
30 snd_pmac_burgundy_extend_wait(struct snd_pmac *chip) in snd_pmac_burgundy_extend_wait() argument
34 while (!(in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--) in snd_pmac_burgundy_extend_wait()
39 while ((in_le32(&chip->awacs->codec_stat) & MASK_EXTEND) && timeout--) in snd_pmac_burgundy_extend_wait()
46 snd_pmac_burgundy_wcw(struct snd_pmac *chip, unsigned addr, unsigned val) in snd_pmac_burgundy_wcw() argument
48 out_le32(&chip->awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff)); in snd_pmac_burgundy_wcw()
49 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
50 out_le32(&chip->awacs->codec_ctrl, addr + 0x200d00 +((val>>8) & 0xff)); in snd_pmac_burgundy_wcw()
51 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
52 out_le32(&chip->awacs->codec_ctrl, addr + 0x200e00 +((val>>16) & 0xff)); in snd_pmac_burgundy_wcw()
53 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
54 out_le32(&chip->awacs->codec_ctrl, addr + 0x200f00 +((val>>24) & 0xff)); in snd_pmac_burgundy_wcw()
55 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcw()
59 snd_pmac_burgundy_rcw(struct snd_pmac *chip, unsigned addr) in snd_pmac_burgundy_rcw() argument
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()
67 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
68 snd_pmac_burgundy_extend_wait(chip); 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()
72 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
73 snd_pmac_burgundy_extend_wait(chip); 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()
77 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
78 snd_pmac_burgundy_extend_wait(chip); 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()
82 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcw()
83 snd_pmac_burgundy_extend_wait(chip); 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()
92 snd_pmac_burgundy_wcb(struct snd_pmac *chip, unsigned int addr, in snd_pmac_burgundy_wcb() argument
95 out_le32(&chip->awacs->codec_ctrl, addr + 0x300000 + (val & 0xff)); in snd_pmac_burgundy_wcb()
96 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_wcb()
100 snd_pmac_burgundy_rcb(struct snd_pmac *chip, unsigned int addr) in snd_pmac_burgundy_rcb() argument
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()
108 snd_pmac_burgundy_busy_wait(chip); in snd_pmac_burgundy_rcb()
109 snd_pmac_burgundy_extend_wait(chip); 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()
124 snd_pmac_burgundy_write_volume(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_write_volume() argument
139 snd_pmac_burgundy_wcw(chip, address, hardvolume); in snd_pmac_burgundy_write_volume()
143 snd_pmac_burgundy_read_volume(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_read_volume() argument
148 wvolume = snd_pmac_burgundy_rcw(chip, address); in snd_pmac_burgundy_read_volume()
175 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_volume() local
178 snd_pmac_burgundy_read_volume(chip, addr, in snd_pmac_burgundy_get_volume()
186 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_volume() local
191 snd_pmac_burgundy_write_volume(chip, addr, in snd_pmac_burgundy_put_volume()
193 snd_pmac_burgundy_read_volume(chip, addr, nvoices, shift); in snd_pmac_burgundy_put_volume()
209 snd_pmac_burgundy_write_volume_2b(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_write_volume_2b() argument
218 snd_pmac_burgundy_wcb(chip, address + off, lvolume); in snd_pmac_burgundy_write_volume_2b()
219 snd_pmac_burgundy_wcb(chip, address + off + 0x500, rvolume); in snd_pmac_burgundy_write_volume_2b()
223 snd_pmac_burgundy_read_volume_2b(struct snd_pmac *chip, unsigned int address, in snd_pmac_burgundy_read_volume_2b() argument
226 volume[0] = snd_pmac_burgundy_rcb(chip, address + off); in snd_pmac_burgundy_read_volume_2b()
231 volume[1] = snd_pmac_burgundy_rcb(chip, address + off + 0x100); in snd_pmac_burgundy_read_volume_2b()
251 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_volume_2b() local
254 snd_pmac_burgundy_read_volume_2b(chip, addr, in snd_pmac_burgundy_get_volume_2b()
262 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_volume_2b() local
267 snd_pmac_burgundy_write_volume_2b(chip, addr, in snd_pmac_burgundy_put_volume_2b()
269 snd_pmac_burgundy_read_volume_2b(chip, addr, nvoices, off); in snd_pmac_burgundy_put_volume_2b()
298 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_gain() local
304 oval = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_get_gain()
316 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_gain() local
322 oval = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_put_gain()
332 snd_pmac_burgundy_wcb(chip, addr, val); in snd_pmac_burgundy_put_gain()
360 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_switch_w() local
365 int val = snd_pmac_burgundy_rcw(chip, addr); in snd_pmac_burgundy_get_switch_w()
375 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_switch_w() local
381 oval = snd_pmac_burgundy_rcw(chip, addr); in snd_pmac_burgundy_put_switch_w()
387 snd_pmac_burgundy_wcw(chip, addr, val); in snd_pmac_burgundy_put_switch_w()
416 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_get_switch_b() local
421 int val = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_get_switch_b()
431 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in snd_pmac_burgundy_put_switch_b() local
437 oval = snd_pmac_burgundy_rcb(chip, addr); in snd_pmac_burgundy_put_switch_b()
443 snd_pmac_burgundy_wcb(chip, addr, val); in snd_pmac_burgundy_put_switch_b()
564 static int snd_pmac_burgundy_detect_headphone(struct snd_pmac *chip) in snd_pmac_burgundy_detect_headphone() argument
566 return (in_le32(&chip->awacs->codec_stat) & chip->hp_stat_mask) ? 1 : 0; in snd_pmac_burgundy_detect_headphone()
569 static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_notify) in snd_pmac_burgundy_update_automute() argument
571 if (chip->auto_mute) { in snd_pmac_burgundy_update_automute()
574 reg = oreg = snd_pmac_burgundy_rcb(chip, in snd_pmac_burgundy_update_automute()
580 if (snd_pmac_burgundy_detect_headphone(chip)) in snd_pmac_burgundy_update_automute()
590 snd_pmac_burgundy_wcb(chip, 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()
608 int snd_pmac_burgundy_init(struct snd_pmac *chip) in snd_pmac_burgundy_init() argument
614 if ((in_le32(&chip->awacs->codec_ctrl) & MASK_ERRCODE) == 0xf0000) { in snd_pmac_burgundy_init()
619 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_OUTPUTENABLES, in snd_pmac_burgundy_init()
621 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, in snd_pmac_burgundy_init()
623 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_OUTPUTSELECTS, in snd_pmac_burgundy_init()
626 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_INPSEL21, in snd_pmac_burgundy_init()
628 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_INPSEL3, in snd_pmac_burgundy_init()
631 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINCD, in snd_pmac_burgundy_init()
633 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINLINE, in snd_pmac_burgundy_init()
635 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINMIC, in snd_pmac_burgundy_init()
637 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_GAINMODEM, in snd_pmac_burgundy_init()
640 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENSPEAKER, in snd_pmac_burgundy_init()
642 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENLINEOUT, in snd_pmac_burgundy_init()
644 snd_pmac_burgundy_wcb(chip, MASK_ADDR_BURGUNDY_ATTENHP, in snd_pmac_burgundy_init()
647 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_MASTER_VOLUME, in snd_pmac_burgundy_init()
649 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLCD, in snd_pmac_burgundy_init()
651 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLLINE, in snd_pmac_burgundy_init()
653 snd_pmac_burgundy_wcw(chip, MASK_ADDR_BURGUNDY_VOLMIC, in snd_pmac_burgundy_init()
656 if (chip->hp_stat_mask == 0) { 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()
672 snd_ctl_new1(&snd_pmac_burgundy_mixers[i], chip)); in snd_pmac_burgundy_init()
678 err = snd_ctl_add(chip->card, in snd_pmac_burgundy_init()
680 : &snd_pmac_burgundy_mixers_pmac[i], chip)); in snd_pmac_burgundy_init()
684 chip->master_sw_ctl = snd_ctl_new1(imac in snd_pmac_burgundy_init()
686 : &snd_pmac_burgundy_master_sw_pmac, chip); 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()
692 : &snd_pmac_burgundy_line_sw_pmac, chip); 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()
698 &snd_pmac_burgundy_hp_sw_imac, chip); 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()
705 : &snd_pmac_burgundy_speaker_sw_pmac, chip); in snd_pmac_burgundy_init()
706 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); in snd_pmac_burgundy_init()
710 err = snd_pmac_add_automute(chip); 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()
716 snd_pmac_burgundy_update_automute(chip, 0); /* update the status only */ in snd_pmac_burgundy_init()