Lines Matching refs:chip

50 static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, int size)  in snd_pmac_dbdma_alloc()  argument
54 rec->space = dma_alloc_coherent(&chip->pdev->dev, rsize, in snd_pmac_dbdma_alloc()
66 static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) in snd_pmac_dbdma_free() argument
71 dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base); in snd_pmac_dbdma_free()
84 unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate) in snd_pmac_rate_index() argument
89 if (rate > chip->freq_table[0]) in snd_pmac_rate_index()
92 for (i = 0; i < chip->num_freqs; i++, ok >>= 1) { in snd_pmac_rate_index()
95 if (rate >= chip->freq_table[i]) in snd_pmac_rate_index()
113 static struct pmac_stream *snd_pmac_get_stream(struct snd_pmac *chip, int stream) in snd_pmac_get_stream() argument
117 return &chip->playback; in snd_pmac_get_stream()
119 return &chip->capture; in snd_pmac_get_stream()
141 static void snd_pmac_pcm_set_format(struct snd_pmac *chip) in snd_pmac_pcm_set_format() argument
144 out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); in snd_pmac_pcm_set_format()
145 out_le32(&chip->awacs->byteswap, chip->format == SNDRV_PCM_FORMAT_S16_LE ? 1 : 0); in snd_pmac_pcm_set_format()
146 if (chip->set_format) in snd_pmac_pcm_set_format()
147 chip->set_format(chip); in snd_pmac_pcm_set_format()
179 static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, struct snd_pcm_subs… in snd_pmac_pcm_prepare() argument
192 rate_index = snd_pmac_rate_index(chip, rec, runtime->rate); in snd_pmac_pcm_prepare()
195 astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); in snd_pmac_pcm_prepare()
200 chip->rate_index = rate_index; in snd_pmac_pcm_prepare()
201 chip->format = runtime->format; in snd_pmac_pcm_prepare()
209 spin_lock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
211 chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP); in snd_pmac_pcm_prepare()
212 snd_pmac_dma_set_command(rec, &chip->extra_dma); in snd_pmac_pcm_prepare()
214 spin_unlock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
216 spin_lock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
234 spin_unlock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
243 static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec, in snd_pmac_pcm_trigger() argument
256 spin_lock(&chip->reg_lock); in snd_pmac_pcm_trigger()
257 snd_pmac_beep_stop(chip); in snd_pmac_pcm_trigger()
258 snd_pmac_pcm_set_format(chip); in snd_pmac_pcm_trigger()
265 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_trigger()
270 spin_lock(&chip->reg_lock); in snd_pmac_pcm_trigger()
276 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_trigger()
290 static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip, in snd_pmac_pcm_pointer() argument
317 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_prepare() local
318 return snd_pmac_pcm_prepare(chip, &chip->playback, subs); in snd_pmac_playback_prepare()
324 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_trigger() local
325 return snd_pmac_pcm_trigger(chip, &chip->playback, subs, cmd); in snd_pmac_playback_trigger()
330 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_pointer() local
331 return snd_pmac_pcm_pointer(chip, &chip->playback, subs); in snd_pmac_playback_pointer()
341 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_prepare() local
342 return snd_pmac_pcm_prepare(chip, &chip->capture, subs); in snd_pmac_capture_prepare()
348 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_trigger() local
349 return snd_pmac_pcm_trigger(chip, &chip->capture, subs, cmd); in snd_pmac_capture_trigger()
354 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_pointer() local
355 return snd_pmac_pcm_pointer(chip, &chip->capture, subs); in snd_pmac_capture_pointer()
431 static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec) in snd_pmac_pcm_update() argument
437 spin_lock(&chip->reg_lock); in snd_pmac_pcm_update()
468 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_update()
470 spin_lock(&chip->reg_lock); in snd_pmac_pcm_update()
473 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_update()
524 struct snd_pmac *chip = rule->private;
525 struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
531 for (i = chip->num_freqs - 1; i >= 0; i--) {
533 freq_table[num_freqs++] = chip->freq_table[i];
543 struct snd_pmac *chip = rule->private;
544 struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
553 static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec, in snd_pmac_pcm_open() argument
561 for (i = 0; i < chip->num_freqs; i++) in snd_pmac_pcm_open()
562 if (chip->freqs_ok & (1 << i)) in snd_pmac_pcm_open()
564 snd_pcm_rate_to_rate_bit(chip->freq_table[i]); in snd_pmac_pcm_open()
567 for (i = 0; i < chip->num_freqs; i++) { in snd_pmac_pcm_open()
568 if (chip->freqs_ok & (1 << i)) { in snd_pmac_pcm_open()
569 runtime->hw.rate_max = chip->freq_table[i]; in snd_pmac_pcm_open()
573 for (i = chip->num_freqs - 1; i >= 0; i--) { in snd_pmac_pcm_open()
574 if (chip->freqs_ok & (1 << i)) { in snd_pmac_pcm_open()
575 runtime->hw.rate_min = chip->freq_table[i]; in snd_pmac_pcm_open()
579 runtime->hw.formats = chip->formats_ok; in snd_pmac_pcm_open()
580 if (chip->can_capture) { in snd_pmac_pcm_open()
581 if (! chip->can_duplex) in snd_pmac_pcm_open()
590 snd_pmac_hw_rule_rate, chip, rec->stream, -1); in snd_pmac_pcm_open()
592 snd_pmac_hw_rule_format, chip, rec->stream, -1); in snd_pmac_pcm_open()
602 static int snd_pmac_pcm_close(struct snd_pmac *chip, struct pmac_stream *rec, in snd_pmac_pcm_close() argument
609 astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); in snd_pmac_pcm_close()
614 astr->cur_freqs = chip->freqs_ok; in snd_pmac_pcm_close()
615 astr->cur_formats = chip->formats_ok; in snd_pmac_pcm_close()
622 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_open() local
625 return snd_pmac_pcm_open(chip, &chip->playback, subs); in snd_pmac_playback_open()
630 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_open() local
633 return snd_pmac_pcm_open(chip, &chip->capture, subs); in snd_pmac_capture_open()
638 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_close() local
640 return snd_pmac_pcm_close(chip, &chip->playback, subs); in snd_pmac_playback_close()
645 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_close() local
647 return snd_pmac_pcm_close(chip, &chip->capture, subs); in snd_pmac_capture_close()
669 int snd_pmac_pcm_new(struct snd_pmac *chip) in snd_pmac_pcm_new() argument
675 if (! chip->can_capture) in snd_pmac_pcm_new()
677 err = snd_pcm_new(chip->card, chip->card->driver, 0, 1, num_captures, &pcm); in snd_pmac_pcm_new()
682 if (chip->can_capture) in snd_pmac_pcm_new()
685 pcm->private_data = chip; in snd_pmac_pcm_new()
687 strcpy(pcm->name, chip->card->shortname); in snd_pmac_pcm_new()
688 chip->pcm = pcm; in snd_pmac_pcm_new()
690 chip->formats_ok = SNDRV_PCM_FMTBIT_S16_BE; in snd_pmac_pcm_new()
691 if (chip->can_byte_swap) in snd_pmac_pcm_new()
692 chip->formats_ok |= SNDRV_PCM_FMTBIT_S16_LE; in snd_pmac_pcm_new()
694 chip->playback.cur_formats = chip->formats_ok; in snd_pmac_pcm_new()
695 chip->capture.cur_formats = chip->formats_ok; in snd_pmac_pcm_new()
696 chip->playback.cur_freqs = chip->freqs_ok; in snd_pmac_pcm_new()
697 chip->capture.cur_freqs = chip->freqs_ok; in snd_pmac_pcm_new()
701 &chip->pdev->dev, in snd_pmac_pcm_new()
708 static void snd_pmac_dbdma_reset(struct snd_pmac *chip) in snd_pmac_dbdma_reset() argument
710 out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); in snd_pmac_dbdma_reset()
711 snd_pmac_wait_ack(&chip->playback); in snd_pmac_dbdma_reset()
712 out_le32(&chip->capture.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); in snd_pmac_dbdma_reset()
713 snd_pmac_wait_ack(&chip->capture); in snd_pmac_dbdma_reset()
720 void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed) in snd_pmac_beep_dma_start() argument
722 struct pmac_stream *rec = &chip->playback; in snd_pmac_beep_dma_start()
725 chip->extra_dma.cmds->req_count = cpu_to_le16(bytes); in snd_pmac_beep_dma_start()
726 chip->extra_dma.cmds->xfer_status = cpu_to_le16(0); in snd_pmac_beep_dma_start()
727 chip->extra_dma.cmds->cmd_dep = cpu_to_le32(chip->extra_dma.addr); in snd_pmac_beep_dma_start()
728 chip->extra_dma.cmds->phy_addr = cpu_to_le32(addr); in snd_pmac_beep_dma_start()
729 chip->extra_dma.cmds->command = cpu_to_le16(OUTPUT_MORE | BR_ALWAYS); in snd_pmac_beep_dma_start()
730 out_le32(&chip->awacs->control, in snd_pmac_beep_dma_start()
731 (in_le32(&chip->awacs->control) & ~0x1f00) in snd_pmac_beep_dma_start()
733 out_le32(&chip->awacs->byteswap, 0); in snd_pmac_beep_dma_start()
734 snd_pmac_dma_set_command(rec, &chip->extra_dma); in snd_pmac_beep_dma_start()
738 void snd_pmac_beep_dma_stop(struct snd_pmac *chip) in snd_pmac_beep_dma_stop() argument
740 snd_pmac_dma_stop(&chip->playback); in snd_pmac_beep_dma_stop()
741 chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP); in snd_pmac_beep_dma_stop()
742 snd_pmac_pcm_set_format(chip); /* reset format */ in snd_pmac_beep_dma_stop()
752 struct snd_pmac *chip = devid; in snd_pmac_tx_intr() local
753 snd_pmac_pcm_update(chip, &chip->playback); in snd_pmac_tx_intr()
761 struct snd_pmac *chip = devid; in snd_pmac_rx_intr() local
762 snd_pmac_pcm_update(chip, &chip->capture); in snd_pmac_rx_intr()
770 struct snd_pmac *chip = devid; in snd_pmac_ctrl_intr() local
771 int ctrl = in_le32(&chip->awacs->control); in snd_pmac_ctrl_intr()
776 if (chip->update_automute) in snd_pmac_ctrl_intr()
777 chip->update_automute(chip, 1); in snd_pmac_ctrl_intr()
780 int err = (in_le32(&chip->awacs->codec_stat) & MASK_ERRCODE) >> 16; in snd_pmac_ctrl_intr()
781 if (err && chip->model <= PMAC_SCREAMER) in snd_pmac_ctrl_intr()
785 out_le32(&chip->awacs->control, ctrl); in snd_pmac_ctrl_intr()
793 static void snd_pmac_sound_feature(struct snd_pmac *chip, int enable) in snd_pmac_sound_feature() argument
796 ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); in snd_pmac_sound_feature()
803 static int snd_pmac_free(struct snd_pmac *chip) in snd_pmac_free() argument
806 if (chip->initialized) { in snd_pmac_free()
807 snd_pmac_dbdma_reset(chip); in snd_pmac_free()
809 out_le32(&chip->awacs->control, in_le32(&chip->awacs->control) & 0xfff); in snd_pmac_free()
812 if (chip->node) in snd_pmac_free()
813 snd_pmac_sound_feature(chip, 0); in snd_pmac_free()
816 if (chip->mixer_free) in snd_pmac_free()
817 chip->mixer_free(chip); in snd_pmac_free()
819 snd_pmac_detach_beep(chip); in snd_pmac_free()
822 if (chip->irq >= 0) in snd_pmac_free()
823 free_irq(chip->irq, (void*)chip); in snd_pmac_free()
824 if (chip->tx_irq >= 0) in snd_pmac_free()
825 free_irq(chip->tx_irq, (void*)chip); in snd_pmac_free()
826 if (chip->rx_irq >= 0) in snd_pmac_free()
827 free_irq(chip->rx_irq, (void*)chip); in snd_pmac_free()
828 snd_pmac_dbdma_free(chip, &chip->playback.cmd); in snd_pmac_free()
829 snd_pmac_dbdma_free(chip, &chip->capture.cmd); in snd_pmac_free()
830 snd_pmac_dbdma_free(chip, &chip->extra_dma); in snd_pmac_free()
831 snd_pmac_dbdma_free(chip, &emergency_dbdma); in snd_pmac_free()
832 iounmap(chip->macio_base); in snd_pmac_free()
833 iounmap(chip->latch_base); in snd_pmac_free()
834 iounmap(chip->awacs); in snd_pmac_free()
835 iounmap(chip->playback.dma); in snd_pmac_free()
836 iounmap(chip->capture.dma); in snd_pmac_free()
838 if (chip->node) { in snd_pmac_free()
841 if (chip->requested & (1 << i)) in snd_pmac_free()
842 release_mem_region(chip->rsrc[i].start, in snd_pmac_free()
843 resource_size(&chip->rsrc[i])); in snd_pmac_free()
847 pci_dev_put(chip->pdev); in snd_pmac_free()
848 of_node_put(chip->node); in snd_pmac_free()
849 kfree(chip); in snd_pmac_free()
859 struct snd_pmac *chip = device->device_data; in snd_pmac_dev_free() local
860 return snd_pmac_free(chip); in snd_pmac_dev_free()
868 static void detect_byte_swap(struct snd_pmac *chip) in detect_byte_swap() argument
873 for (mio = chip->node->parent; mio; mio = mio->parent) { in detect_byte_swap()
876 chip->can_byte_swap = 0; in detect_byte_swap()
884 chip->can_byte_swap = 0 ; in detect_byte_swap()
887 chip->can_duplex = 0; in detect_byte_swap()
894 static int snd_pmac_detect(struct snd_pmac *chip) in snd_pmac_detect() argument
905 chip->subframe = 0; in snd_pmac_detect()
906 chip->revision = 0; in snd_pmac_detect()
907 chip->freqs_ok = 0xff; /* all ok */ in snd_pmac_detect()
908 chip->model = PMAC_AWACS; in snd_pmac_detect()
909 chip->can_byte_swap = 1; in snd_pmac_detect()
910 chip->can_duplex = 1; in snd_pmac_detect()
911 chip->can_capture = 1; in snd_pmac_detect()
912 chip->num_freqs = ARRAY_SIZE(awacs_freqs); in snd_pmac_detect()
913 chip->freq_table = awacs_freqs; in snd_pmac_detect()
914 chip->pdev = NULL; in snd_pmac_detect()
916 chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ in snd_pmac_detect()
921 chip->is_pbook_3400 = 1; in snd_pmac_detect()
924 chip->is_pbook_G3 = 1; in snd_pmac_detect()
925 chip->node = of_find_node_by_name(NULL, "awacs"); in snd_pmac_detect()
926 sound = of_node_get(chip->node); in snd_pmac_detect()
932 if (!chip->node) in snd_pmac_detect()
933 chip->node = of_find_node_by_name(NULL, "davbus"); in snd_pmac_detect()
938 if (! chip->node) { in snd_pmac_detect()
939 chip->node = of_find_node_by_name(NULL, "i2s-a"); in snd_pmac_detect()
940 if (chip->node && chip->node->parent && in snd_pmac_detect()
941 chip->node->parent->parent) { in snd_pmac_detect()
942 if (of_device_is_compatible(chip->node->parent->parent, in snd_pmac_detect()
944 chip->is_k2 = 1; in snd_pmac_detect()
947 if (! chip->node) in snd_pmac_detect()
952 if (sound->parent == chip->node) in snd_pmac_detect()
956 of_node_put(chip->node); in snd_pmac_detect()
957 chip->node = NULL; in snd_pmac_detect()
962 chip->subframe = *prop; in snd_pmac_detect()
971 of_node_put(chip->node); in snd_pmac_detect()
972 chip->node = NULL; in snd_pmac_detect()
977 chip->model = PMAC_SCREAMER; in snd_pmac_detect()
981 chip->model = PMAC_BURGUNDY; in snd_pmac_detect()
982 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
985 chip->model = PMAC_DACA; in snd_pmac_detect()
986 chip->can_capture = 0; /* no capture */ in snd_pmac_detect()
987 chip->can_duplex = 0; in snd_pmac_detect()
989 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
992 chip->model = PMAC_TUMBLER; in snd_pmac_detect()
993 chip->can_capture = of_machine_is_compatible("PowerMac4,2") in snd_pmac_detect()
999 chip->can_duplex = 0; in snd_pmac_detect()
1001 chip->num_freqs = ARRAY_SIZE(tumbler_freqs); in snd_pmac_detect()
1002 chip->freq_table = tumbler_freqs; in snd_pmac_detect()
1003 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
1006 chip->model = PMAC_SNAPPER; in snd_pmac_detect()
1008 chip->num_freqs = ARRAY_SIZE(tumbler_freqs); in snd_pmac_detect()
1009 chip->freq_table = tumbler_freqs; in snd_pmac_detect()
1010 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
1014 chip->device_id = *prop; in snd_pmac_detect()
1016 chip->has_iic = (dn != NULL); in snd_pmac_detect()
1022 macio = macio_find(chip->node, macio_unknown); in snd_pmac_detect()
1031 chip->pdev = pdev; in snd_pmac_detect()
1036 if (chip->pdev == NULL) in snd_pmac_detect()
1040 detect_byte_swap(chip); in snd_pmac_detect()
1049 chip->freqs_ok = 0; in snd_pmac_detect()
1055 for (i = 0; i < chip->num_freqs; ++i) { in snd_pmac_detect()
1056 if (r == chip->freq_table[i]) { in snd_pmac_detect()
1057 chip->freqs_ok |= (1 << i); in snd_pmac_detect()
1064 chip->freqs_ok = 1; in snd_pmac_detect()
1078 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in pmac_auto_mute_get() local
1079 ucontrol->value.integer.value[0] = chip->auto_mute; in pmac_auto_mute_get()
1086 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in pmac_auto_mute_put() local
1087 if (ucontrol->value.integer.value[0] != chip->auto_mute) { in pmac_auto_mute_put()
1088 chip->auto_mute = !!ucontrol->value.integer.value[0]; in pmac_auto_mute_put()
1089 if (chip->update_automute) in pmac_auto_mute_put()
1090 chip->update_automute(chip, 1); in pmac_auto_mute_put()
1099 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in pmac_hp_detect_get() local
1100 if (chip->detect_headphone) in pmac_hp_detect_get()
1101 ucontrol->value.integer.value[0] = chip->detect_headphone(chip); in pmac_hp_detect_get()
1122 int snd_pmac_add_automute(struct snd_pmac *chip) in snd_pmac_add_automute() argument
1125 chip->auto_mute = 1; in snd_pmac_add_automute()
1126 err = snd_ctl_add(chip->card, snd_ctl_new1(&auto_mute_controls[0], chip)); in snd_pmac_add_automute()
1131 chip->hp_detect_ctl = snd_ctl_new1(&auto_mute_controls[1], chip); in snd_pmac_add_automute()
1132 return snd_ctl_add(chip->card, chip->hp_detect_ctl); in snd_pmac_add_automute()
1141 struct snd_pmac *chip; in snd_pmac_new() local
1152 chip = kzalloc(sizeof(*chip), GFP_KERNEL); in snd_pmac_new()
1153 if (chip == NULL) in snd_pmac_new()
1155 chip->card = card; in snd_pmac_new()
1157 spin_lock_init(&chip->reg_lock); in snd_pmac_new()
1158 chip->irq = chip->tx_irq = chip->rx_irq = -1; in snd_pmac_new()
1160 chip->playback.stream = SNDRV_PCM_STREAM_PLAYBACK; in snd_pmac_new()
1161 chip->capture.stream = SNDRV_PCM_STREAM_CAPTURE; in snd_pmac_new()
1163 err = snd_pmac_detect(chip); in snd_pmac_new()
1167 if (snd_pmac_dbdma_alloc(chip, &chip->playback.cmd, PMAC_MAX_FRAGS + 1) < 0 || in snd_pmac_new()
1168 snd_pmac_dbdma_alloc(chip, &chip->capture.cmd, PMAC_MAX_FRAGS + 1) < 0 || in snd_pmac_new()
1169 snd_pmac_dbdma_alloc(chip, &chip->extra_dma, 2) < 0 || in snd_pmac_new()
1170 snd_pmac_dbdma_alloc(chip, &emergency_dbdma, 2) < 0) { in snd_pmac_new()
1175 np = chip->node; in snd_pmac_new()
1176 chip->requested = 0; in snd_pmac_new()
1177 if (chip->is_k2) { in snd_pmac_new()
1182 &chip->rsrc[i])) { in snd_pmac_new()
1188 if (request_mem_region(chip->rsrc[i].start, in snd_pmac_new()
1189 resource_size(&chip->rsrc[i]), in snd_pmac_new()
1193 i, rnames[i], &chip->rsrc[i]); in snd_pmac_new()
1197 chip->requested |= (1 << i); in snd_pmac_new()
1199 ctrl_addr = chip->rsrc[0].start; in snd_pmac_new()
1200 txdma_addr = chip->rsrc[1].start; in snd_pmac_new()
1207 &chip->rsrc[i])) { in snd_pmac_new()
1213 if (request_mem_region(chip->rsrc[i].start, in snd_pmac_new()
1214 resource_size(&chip->rsrc[i]), in snd_pmac_new()
1218 i, rnames[i], &chip->rsrc[i]); in snd_pmac_new()
1222 chip->requested |= (1 << i); in snd_pmac_new()
1224 ctrl_addr = chip->rsrc[0].start; in snd_pmac_new()
1225 txdma_addr = chip->rsrc[1].start; in snd_pmac_new()
1226 rxdma_addr = chip->rsrc[2].start; in snd_pmac_new()
1229 chip->awacs = ioremap(ctrl_addr, 0x1000); in snd_pmac_new()
1230 chip->playback.dma = ioremap(txdma_addr, 0x100); in snd_pmac_new()
1231 chip->capture.dma = ioremap(rxdma_addr, 0x100); in snd_pmac_new()
1232 if (chip->model <= PMAC_BURGUNDY) { in snd_pmac_new()
1235 "PMac", (void*)chip)) { in snd_pmac_new()
1241 chip->irq = irq; in snd_pmac_new()
1244 if (request_irq(irq, snd_pmac_tx_intr, 0, "PMac Output", (void*)chip)){ in snd_pmac_new()
1249 chip->tx_irq = irq; in snd_pmac_new()
1251 if (request_irq(irq, snd_pmac_rx_intr, 0, "PMac Input", (void*)chip)) { in snd_pmac_new()
1256 chip->rx_irq = irq; in snd_pmac_new()
1258 snd_pmac_sound_feature(chip, 1); in snd_pmac_new()
1261 if (chip->model <= PMAC_BURGUNDY) in snd_pmac_new()
1262 out_le32(&chip->awacs->control, chip->control_mask); in snd_pmac_new()
1267 if (chip->is_pbook_3400) { in snd_pmac_new()
1275 chip->latch_base = ioremap (0xf301a000, 0x1000); in snd_pmac_new()
1276 in_8(chip->latch_base + 0x190); in snd_pmac_new()
1277 } else if (chip->is_pbook_G3) { in snd_pmac_new()
1279 for (mio = chip->node->parent; mio; mio = mio->parent) { in snd_pmac_new()
1283 chip->macio_base = in snd_pmac_new()
1296 if (chip->macio_base) in snd_pmac_new()
1297 out_8(chip->macio_base + 0x37, 3); in snd_pmac_new()
1301 snd_pmac_dbdma_reset(chip); in snd_pmac_new()
1303 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); in snd_pmac_new()
1307 *chip_return = chip; in snd_pmac_new()
1311 snd_pmac_free(chip); in snd_pmac_new()
1326 void snd_pmac_suspend(struct snd_pmac *chip) in snd_pmac_suspend() argument
1330 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); in snd_pmac_suspend()
1331 if (chip->suspend) in snd_pmac_suspend()
1332 chip->suspend(chip); in snd_pmac_suspend()
1333 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_suspend()
1334 snd_pmac_beep_stop(chip); in snd_pmac_suspend()
1335 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_suspend()
1336 if (chip->irq >= 0) in snd_pmac_suspend()
1337 disable_irq(chip->irq); in snd_pmac_suspend()
1338 if (chip->tx_irq >= 0) in snd_pmac_suspend()
1339 disable_irq(chip->tx_irq); in snd_pmac_suspend()
1340 if (chip->rx_irq >= 0) in snd_pmac_suspend()
1341 disable_irq(chip->rx_irq); in snd_pmac_suspend()
1342 snd_pmac_sound_feature(chip, 0); in snd_pmac_suspend()
1345 void snd_pmac_resume(struct snd_pmac *chip) in snd_pmac_resume() argument
1347 snd_pmac_sound_feature(chip, 1); in snd_pmac_resume()
1348 if (chip->resume) in snd_pmac_resume()
1349 chip->resume(chip); in snd_pmac_resume()
1351 if (chip->macio_base && chip->is_pbook_G3) in snd_pmac_resume()
1352 out_8(chip->macio_base + 0x37, 3); in snd_pmac_resume()
1353 else if (chip->is_pbook_3400) in snd_pmac_resume()
1354 in_8(chip->latch_base + 0x190); in snd_pmac_resume()
1356 snd_pmac_pcm_set_format(chip); in snd_pmac_resume()
1358 if (chip->irq >= 0) in snd_pmac_resume()
1359 enable_irq(chip->irq); in snd_pmac_resume()
1360 if (chip->tx_irq >= 0) in snd_pmac_resume()
1361 enable_irq(chip->tx_irq); in snd_pmac_resume()
1362 if (chip->rx_irq >= 0) in snd_pmac_resume()
1363 enable_irq(chip->rx_irq); in snd_pmac_resume()
1365 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); in snd_pmac_resume()