Lines Matching refs:chip

64 static int snd_pmac_dbdma_alloc(struct snd_pmac *chip, struct pmac_dbdma *rec, int size)  in snd_pmac_dbdma_alloc()  argument
68 rec->space = dma_alloc_coherent(&chip->pdev->dev, rsize, in snd_pmac_dbdma_alloc()
80 static void snd_pmac_dbdma_free(struct snd_pmac *chip, struct pmac_dbdma *rec) in snd_pmac_dbdma_free() argument
85 dma_free_coherent(&chip->pdev->dev, rsize, rec->space, rec->dma_base); in snd_pmac_dbdma_free()
98 unsigned int snd_pmac_rate_index(struct snd_pmac *chip, struct pmac_stream *rec, unsigned int rate) in snd_pmac_rate_index() argument
103 if (rate > chip->freq_table[0]) in snd_pmac_rate_index()
106 for (i = 0; i < chip->num_freqs; i++, ok >>= 1) { in snd_pmac_rate_index()
109 if (rate >= chip->freq_table[i]) in snd_pmac_rate_index()
145 static struct pmac_stream *snd_pmac_get_stream(struct snd_pmac *chip, int stream) in snd_pmac_get_stream() argument
149 return &chip->playback; in snd_pmac_get_stream()
151 return &chip->capture; in snd_pmac_get_stream()
173 static void snd_pmac_pcm_set_format(struct snd_pmac *chip) in snd_pmac_pcm_set_format() argument
176 out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); in snd_pmac_pcm_set_format()
177 out_le32(&chip->awacs->byteswap, chip->format == SNDRV_PCM_FORMAT_S16_LE ? 1 : 0); in snd_pmac_pcm_set_format()
178 if (chip->set_format) in snd_pmac_pcm_set_format()
179 chip->set_format(chip); in snd_pmac_pcm_set_format()
211 static int snd_pmac_pcm_prepare(struct snd_pmac *chip, struct pmac_stream *rec, struct snd_pcm_subs… in snd_pmac_pcm_prepare() argument
224 rate_index = snd_pmac_rate_index(chip, rec, runtime->rate); in snd_pmac_pcm_prepare()
227 astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); in snd_pmac_pcm_prepare()
232 chip->rate_index = rate_index; in snd_pmac_pcm_prepare()
233 chip->format = runtime->format; in snd_pmac_pcm_prepare()
241 spin_lock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
243 chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP); in snd_pmac_pcm_prepare()
244 snd_pmac_dma_set_command(rec, &chip->extra_dma); in snd_pmac_pcm_prepare()
246 spin_unlock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
248 spin_lock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
266 spin_unlock_irq(&chip->reg_lock); in snd_pmac_pcm_prepare()
275 static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec, in snd_pmac_pcm_trigger() argument
288 spin_lock(&chip->reg_lock); in snd_pmac_pcm_trigger()
289 snd_pmac_beep_stop(chip); in snd_pmac_pcm_trigger()
290 snd_pmac_pcm_set_format(chip); in snd_pmac_pcm_trigger()
297 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_trigger()
302 spin_lock(&chip->reg_lock); in snd_pmac_pcm_trigger()
308 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_trigger()
322 static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip, in snd_pmac_pcm_pointer() argument
349 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_prepare() local
350 return snd_pmac_pcm_prepare(chip, &chip->playback, subs); in snd_pmac_playback_prepare()
356 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_trigger() local
357 return snd_pmac_pcm_trigger(chip, &chip->playback, subs, cmd); in snd_pmac_playback_trigger()
362 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_pointer() local
363 return snd_pmac_pcm_pointer(chip, &chip->playback, subs); in snd_pmac_playback_pointer()
373 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_prepare() local
374 return snd_pmac_pcm_prepare(chip, &chip->capture, subs); in snd_pmac_capture_prepare()
380 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_trigger() local
381 return snd_pmac_pcm_trigger(chip, &chip->capture, subs, cmd); in snd_pmac_capture_trigger()
386 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_pointer() local
387 return snd_pmac_pcm_pointer(chip, &chip->capture, subs); in snd_pmac_capture_pointer()
463 static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec) in snd_pmac_pcm_update() argument
469 spin_lock(&chip->reg_lock); in snd_pmac_pcm_update()
500 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_update()
502 spin_lock(&chip->reg_lock); in snd_pmac_pcm_update()
505 spin_unlock(&chip->reg_lock); in snd_pmac_pcm_update()
556 struct snd_pmac *chip = rule->private;
557 struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
563 for (i = chip->num_freqs - 1; i >= 0; i--) {
565 freq_table[num_freqs++] = chip->freq_table[i];
575 struct snd_pmac *chip = rule->private;
576 struct pmac_stream *rec = snd_pmac_get_stream(chip, rule->deps[0]);
585 static int snd_pmac_pcm_open(struct snd_pmac *chip, struct pmac_stream *rec, in snd_pmac_pcm_open() argument
593 for (i = 0; i < chip->num_freqs; i++) in snd_pmac_pcm_open()
594 if (chip->freqs_ok & (1 << i)) in snd_pmac_pcm_open()
596 snd_pcm_rate_to_rate_bit(chip->freq_table[i]); in snd_pmac_pcm_open()
599 for (i = 0; i < chip->num_freqs; i++) { in snd_pmac_pcm_open()
600 if (chip->freqs_ok & (1 << i)) { in snd_pmac_pcm_open()
601 runtime->hw.rate_max = chip->freq_table[i]; in snd_pmac_pcm_open()
605 for (i = chip->num_freqs - 1; i >= 0; i--) { in snd_pmac_pcm_open()
606 if (chip->freqs_ok & (1 << i)) { in snd_pmac_pcm_open()
607 runtime->hw.rate_min = chip->freq_table[i]; in snd_pmac_pcm_open()
611 runtime->hw.formats = chip->formats_ok; in snd_pmac_pcm_open()
612 if (chip->can_capture) { in snd_pmac_pcm_open()
613 if (! chip->can_duplex) in snd_pmac_pcm_open()
622 snd_pmac_hw_rule_rate, chip, rec->stream, -1); in snd_pmac_pcm_open()
624 snd_pmac_hw_rule_format, chip, rec->stream, -1); in snd_pmac_pcm_open()
634 static int snd_pmac_pcm_close(struct snd_pmac *chip, struct pmac_stream *rec, in snd_pmac_pcm_close() argument
641 astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); in snd_pmac_pcm_close()
646 astr->cur_freqs = chip->freqs_ok; in snd_pmac_pcm_close()
647 astr->cur_formats = chip->formats_ok; in snd_pmac_pcm_close()
654 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_open() local
657 return snd_pmac_pcm_open(chip, &chip->playback, subs); in snd_pmac_playback_open()
662 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_open() local
665 return snd_pmac_pcm_open(chip, &chip->capture, subs); in snd_pmac_capture_open()
670 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_playback_close() local
672 return snd_pmac_pcm_close(chip, &chip->playback, subs); in snd_pmac_playback_close()
677 struct snd_pmac *chip = snd_pcm_substream_chip(subs); in snd_pmac_capture_close() local
679 return snd_pmac_pcm_close(chip, &chip->capture, subs); in snd_pmac_capture_close()
707 int snd_pmac_pcm_new(struct snd_pmac *chip) in snd_pmac_pcm_new() argument
713 if (! chip->can_capture) in snd_pmac_pcm_new()
715 err = snd_pcm_new(chip->card, chip->card->driver, 0, 1, num_captures, &pcm); in snd_pmac_pcm_new()
720 if (chip->can_capture) in snd_pmac_pcm_new()
723 pcm->private_data = chip; in snd_pmac_pcm_new()
725 strcpy(pcm->name, chip->card->shortname); in snd_pmac_pcm_new()
726 chip->pcm = pcm; in snd_pmac_pcm_new()
728 chip->formats_ok = SNDRV_PCM_FMTBIT_S16_BE; in snd_pmac_pcm_new()
729 if (chip->can_byte_swap) in snd_pmac_pcm_new()
730 chip->formats_ok |= SNDRV_PCM_FMTBIT_S16_LE; in snd_pmac_pcm_new()
732 chip->playback.cur_formats = chip->formats_ok; in snd_pmac_pcm_new()
733 chip->capture.cur_formats = chip->formats_ok; in snd_pmac_pcm_new()
734 chip->playback.cur_freqs = chip->freqs_ok; in snd_pmac_pcm_new()
735 chip->capture.cur_freqs = chip->freqs_ok; in snd_pmac_pcm_new()
739 &chip->pdev->dev, in snd_pmac_pcm_new()
746 static void snd_pmac_dbdma_reset(struct snd_pmac *chip) in snd_pmac_dbdma_reset() argument
748 out_le32(&chip->playback.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); in snd_pmac_dbdma_reset()
749 snd_pmac_wait_ack(&chip->playback); in snd_pmac_dbdma_reset()
750 out_le32(&chip->capture.dma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16); in snd_pmac_dbdma_reset()
751 snd_pmac_wait_ack(&chip->capture); in snd_pmac_dbdma_reset()
758 void snd_pmac_beep_dma_start(struct snd_pmac *chip, int bytes, unsigned long addr, int speed) in snd_pmac_beep_dma_start() argument
760 struct pmac_stream *rec = &chip->playback; in snd_pmac_beep_dma_start()
763 chip->extra_dma.cmds->req_count = cpu_to_le16(bytes); in snd_pmac_beep_dma_start()
764 chip->extra_dma.cmds->xfer_status = cpu_to_le16(0); in snd_pmac_beep_dma_start()
765 chip->extra_dma.cmds->cmd_dep = cpu_to_le32(chip->extra_dma.addr); in snd_pmac_beep_dma_start()
766 chip->extra_dma.cmds->phy_addr = cpu_to_le32(addr); in snd_pmac_beep_dma_start()
767 chip->extra_dma.cmds->command = cpu_to_le16(OUTPUT_MORE + BR_ALWAYS); in snd_pmac_beep_dma_start()
768 out_le32(&chip->awacs->control, in snd_pmac_beep_dma_start()
769 (in_le32(&chip->awacs->control) & ~0x1f00) in snd_pmac_beep_dma_start()
771 out_le32(&chip->awacs->byteswap, 0); in snd_pmac_beep_dma_start()
772 snd_pmac_dma_set_command(rec, &chip->extra_dma); in snd_pmac_beep_dma_start()
776 void snd_pmac_beep_dma_stop(struct snd_pmac *chip) in snd_pmac_beep_dma_stop() argument
778 snd_pmac_dma_stop(&chip->playback); in snd_pmac_beep_dma_stop()
779 chip->extra_dma.cmds->command = cpu_to_le16(DBDMA_STOP); in snd_pmac_beep_dma_stop()
780 snd_pmac_pcm_set_format(chip); /* reset format */ in snd_pmac_beep_dma_stop()
790 struct snd_pmac *chip = devid; in snd_pmac_tx_intr() local
791 snd_pmac_pcm_update(chip, &chip->playback); in snd_pmac_tx_intr()
799 struct snd_pmac *chip = devid; in snd_pmac_rx_intr() local
800 snd_pmac_pcm_update(chip, &chip->capture); in snd_pmac_rx_intr()
808 struct snd_pmac *chip = devid; in snd_pmac_ctrl_intr() local
809 int ctrl = in_le32(&chip->awacs->control); in snd_pmac_ctrl_intr()
814 if (chip->update_automute) in snd_pmac_ctrl_intr()
815 chip->update_automute(chip, 1); in snd_pmac_ctrl_intr()
818 int err = (in_le32(&chip->awacs->codec_stat) & MASK_ERRCODE) >> 16; in snd_pmac_ctrl_intr()
819 if (err && chip->model <= PMAC_SCREAMER) in snd_pmac_ctrl_intr()
823 out_le32(&chip->awacs->control, ctrl); in snd_pmac_ctrl_intr()
831 static void snd_pmac_sound_feature(struct snd_pmac *chip, int enable) in snd_pmac_sound_feature() argument
834 ppc_md.feature_call(PMAC_FTR_SOUND_CHIP_ENABLE, chip->node, 0, enable); in snd_pmac_sound_feature()
841 static int snd_pmac_free(struct snd_pmac *chip) in snd_pmac_free() argument
844 if (chip->initialized) { in snd_pmac_free()
845 snd_pmac_dbdma_reset(chip); in snd_pmac_free()
847 out_le32(&chip->awacs->control, in_le32(&chip->awacs->control) & 0xfff); in snd_pmac_free()
850 if (chip->node) in snd_pmac_free()
851 snd_pmac_sound_feature(chip, 0); in snd_pmac_free()
854 if (chip->mixer_free) in snd_pmac_free()
855 chip->mixer_free(chip); in snd_pmac_free()
857 snd_pmac_detach_beep(chip); in snd_pmac_free()
860 if (chip->irq >= 0) in snd_pmac_free()
861 free_irq(chip->irq, (void*)chip); in snd_pmac_free()
862 if (chip->tx_irq >= 0) in snd_pmac_free()
863 free_irq(chip->tx_irq, (void*)chip); in snd_pmac_free()
864 if (chip->rx_irq >= 0) in snd_pmac_free()
865 free_irq(chip->rx_irq, (void*)chip); in snd_pmac_free()
866 snd_pmac_dbdma_free(chip, &chip->playback.cmd); in snd_pmac_free()
867 snd_pmac_dbdma_free(chip, &chip->capture.cmd); in snd_pmac_free()
868 snd_pmac_dbdma_free(chip, &chip->extra_dma); in snd_pmac_free()
869 snd_pmac_dbdma_free(chip, &emergency_dbdma); in snd_pmac_free()
870 iounmap(chip->macio_base); in snd_pmac_free()
871 iounmap(chip->latch_base); in snd_pmac_free()
872 iounmap(chip->awacs); in snd_pmac_free()
873 iounmap(chip->playback.dma); in snd_pmac_free()
874 iounmap(chip->capture.dma); in snd_pmac_free()
876 if (chip->node) { in snd_pmac_free()
879 if (chip->requested & (1 << i)) in snd_pmac_free()
880 release_mem_region(chip->rsrc[i].start, in snd_pmac_free()
881 resource_size(&chip->rsrc[i])); in snd_pmac_free()
885 pci_dev_put(chip->pdev); in snd_pmac_free()
886 of_node_put(chip->node); in snd_pmac_free()
887 kfree(chip); in snd_pmac_free()
897 struct snd_pmac *chip = device->device_data; in snd_pmac_dev_free() local
898 return snd_pmac_free(chip); in snd_pmac_dev_free()
906 static void detect_byte_swap(struct snd_pmac *chip) in detect_byte_swap() argument
911 for (mio = chip->node->parent; mio; mio = mio->parent) { in detect_byte_swap()
914 chip->can_byte_swap = 0; in detect_byte_swap()
922 chip->can_byte_swap = 0 ; in detect_byte_swap()
925 chip->can_duplex = 0; in detect_byte_swap()
932 static int snd_pmac_detect(struct snd_pmac *chip) in snd_pmac_detect() argument
943 chip->subframe = 0; in snd_pmac_detect()
944 chip->revision = 0; in snd_pmac_detect()
945 chip->freqs_ok = 0xff; /* all ok */ in snd_pmac_detect()
946 chip->model = PMAC_AWACS; in snd_pmac_detect()
947 chip->can_byte_swap = 1; in snd_pmac_detect()
948 chip->can_duplex = 1; in snd_pmac_detect()
949 chip->can_capture = 1; in snd_pmac_detect()
950 chip->num_freqs = ARRAY_SIZE(awacs_freqs); in snd_pmac_detect()
951 chip->freq_table = awacs_freqs; in snd_pmac_detect()
952 chip->pdev = NULL; in snd_pmac_detect()
954 chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */ in snd_pmac_detect()
959 chip->is_pbook_3400 = 1; in snd_pmac_detect()
962 chip->is_pbook_G3 = 1; in snd_pmac_detect()
963 chip->node = of_find_node_by_name(NULL, "awacs"); in snd_pmac_detect()
964 sound = of_node_get(chip->node); in snd_pmac_detect()
970 if (!chip->node) in snd_pmac_detect()
971 chip->node = of_find_node_by_name(NULL, "davbus"); in snd_pmac_detect()
976 if (! chip->node) { in snd_pmac_detect()
977 chip->node = of_find_node_by_name(NULL, "i2s-a"); in snd_pmac_detect()
978 if (chip->node && chip->node->parent && in snd_pmac_detect()
979 chip->node->parent->parent) { in snd_pmac_detect()
980 if (of_device_is_compatible(chip->node->parent->parent, in snd_pmac_detect()
982 chip->is_k2 = 1; in snd_pmac_detect()
985 if (! chip->node) in snd_pmac_detect()
990 if (sound->parent == chip->node) in snd_pmac_detect()
994 of_node_put(chip->node); in snd_pmac_detect()
995 chip->node = NULL; in snd_pmac_detect()
1000 chip->subframe = *prop; in snd_pmac_detect()
1009 of_node_put(chip->node); in snd_pmac_detect()
1010 chip->node = NULL; in snd_pmac_detect()
1015 chip->model = PMAC_SCREAMER; in snd_pmac_detect()
1019 chip->model = PMAC_BURGUNDY; in snd_pmac_detect()
1020 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
1023 chip->model = PMAC_DACA; in snd_pmac_detect()
1024 chip->can_capture = 0; /* no capture */ in snd_pmac_detect()
1025 chip->can_duplex = 0; in snd_pmac_detect()
1027 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
1030 chip->model = PMAC_TUMBLER; in snd_pmac_detect()
1031 chip->can_capture = of_machine_is_compatible("PowerMac4,2") in snd_pmac_detect()
1037 chip->can_duplex = 0; in snd_pmac_detect()
1039 chip->num_freqs = ARRAY_SIZE(tumbler_freqs); in snd_pmac_detect()
1040 chip->freq_table = tumbler_freqs; in snd_pmac_detect()
1041 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
1044 chip->model = PMAC_SNAPPER; in snd_pmac_detect()
1046 chip->num_freqs = ARRAY_SIZE(tumbler_freqs); in snd_pmac_detect()
1047 chip->freq_table = tumbler_freqs; in snd_pmac_detect()
1048 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ in snd_pmac_detect()
1052 chip->device_id = *prop; in snd_pmac_detect()
1054 chip->has_iic = (dn != NULL); in snd_pmac_detect()
1060 macio = macio_find(chip->node, macio_unknown); in snd_pmac_detect()
1069 chip->pdev = pdev; in snd_pmac_detect()
1074 if (chip->pdev == NULL) in snd_pmac_detect()
1078 detect_byte_swap(chip); in snd_pmac_detect()
1087 chip->freqs_ok = 0; in snd_pmac_detect()
1093 for (i = 0; i < chip->num_freqs; ++i) { in snd_pmac_detect()
1094 if (r == chip->freq_table[i]) { in snd_pmac_detect()
1095 chip->freqs_ok |= (1 << i); in snd_pmac_detect()
1102 chip->freqs_ok = 1; in snd_pmac_detect()
1116 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in pmac_auto_mute_get() local
1117 ucontrol->value.integer.value[0] = chip->auto_mute; in pmac_auto_mute_get()
1124 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in pmac_auto_mute_put() local
1125 if (ucontrol->value.integer.value[0] != chip->auto_mute) { in pmac_auto_mute_put()
1126 chip->auto_mute = !!ucontrol->value.integer.value[0]; in pmac_auto_mute_put()
1127 if (chip->update_automute) in pmac_auto_mute_put()
1128 chip->update_automute(chip, 1); in pmac_auto_mute_put()
1137 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); in pmac_hp_detect_get() local
1138 if (chip->detect_headphone) in pmac_hp_detect_get()
1139 ucontrol->value.integer.value[0] = chip->detect_headphone(chip); in pmac_hp_detect_get()
1160 int snd_pmac_add_automute(struct snd_pmac *chip) in snd_pmac_add_automute() argument
1163 chip->auto_mute = 1; in snd_pmac_add_automute()
1164 err = snd_ctl_add(chip->card, snd_ctl_new1(&auto_mute_controls[0], chip)); in snd_pmac_add_automute()
1169 chip->hp_detect_ctl = snd_ctl_new1(&auto_mute_controls[1], chip); in snd_pmac_add_automute()
1170 return snd_ctl_add(chip->card, chip->hp_detect_ctl); in snd_pmac_add_automute()
1179 struct snd_pmac *chip; in snd_pmac_new() local
1190 chip = kzalloc(sizeof(*chip), GFP_KERNEL); in snd_pmac_new()
1191 if (chip == NULL) in snd_pmac_new()
1193 chip->card = card; in snd_pmac_new()
1195 spin_lock_init(&chip->reg_lock); in snd_pmac_new()
1196 chip->irq = chip->tx_irq = chip->rx_irq = -1; in snd_pmac_new()
1198 chip->playback.stream = SNDRV_PCM_STREAM_PLAYBACK; in snd_pmac_new()
1199 chip->capture.stream = SNDRV_PCM_STREAM_CAPTURE; in snd_pmac_new()
1201 if ((err = snd_pmac_detect(chip)) < 0) in snd_pmac_new()
1204 if (snd_pmac_dbdma_alloc(chip, &chip->playback.cmd, PMAC_MAX_FRAGS + 1) < 0 || in snd_pmac_new()
1205 snd_pmac_dbdma_alloc(chip, &chip->capture.cmd, PMAC_MAX_FRAGS + 1) < 0 || in snd_pmac_new()
1206 snd_pmac_dbdma_alloc(chip, &chip->extra_dma, 2) < 0 || in snd_pmac_new()
1207 snd_pmac_dbdma_alloc(chip, &emergency_dbdma, 2) < 0) { in snd_pmac_new()
1212 np = chip->node; in snd_pmac_new()
1213 chip->requested = 0; in snd_pmac_new()
1214 if (chip->is_k2) { in snd_pmac_new()
1219 &chip->rsrc[i])) { in snd_pmac_new()
1225 if (request_mem_region(chip->rsrc[i].start, in snd_pmac_new()
1226 resource_size(&chip->rsrc[i]), in snd_pmac_new()
1230 i, rnames[i], &chip->rsrc[i]); in snd_pmac_new()
1234 chip->requested |= (1 << i); in snd_pmac_new()
1236 ctrl_addr = chip->rsrc[0].start; in snd_pmac_new()
1237 txdma_addr = chip->rsrc[1].start; in snd_pmac_new()
1244 &chip->rsrc[i])) { in snd_pmac_new()
1250 if (request_mem_region(chip->rsrc[i].start, in snd_pmac_new()
1251 resource_size(&chip->rsrc[i]), in snd_pmac_new()
1255 i, rnames[i], &chip->rsrc[i]); in snd_pmac_new()
1259 chip->requested |= (1 << i); in snd_pmac_new()
1261 ctrl_addr = chip->rsrc[0].start; in snd_pmac_new()
1262 txdma_addr = chip->rsrc[1].start; in snd_pmac_new()
1263 rxdma_addr = chip->rsrc[2].start; in snd_pmac_new()
1266 chip->awacs = ioremap(ctrl_addr, 0x1000); in snd_pmac_new()
1267 chip->playback.dma = ioremap(txdma_addr, 0x100); in snd_pmac_new()
1268 chip->capture.dma = ioremap(rxdma_addr, 0x100); in snd_pmac_new()
1269 if (chip->model <= PMAC_BURGUNDY) { in snd_pmac_new()
1272 "PMac", (void*)chip)) { in snd_pmac_new()
1278 chip->irq = irq; in snd_pmac_new()
1281 if (request_irq(irq, snd_pmac_tx_intr, 0, "PMac Output", (void*)chip)){ in snd_pmac_new()
1286 chip->tx_irq = irq; in snd_pmac_new()
1288 if (request_irq(irq, snd_pmac_rx_intr, 0, "PMac Input", (void*)chip)) { in snd_pmac_new()
1293 chip->rx_irq = irq; in snd_pmac_new()
1295 snd_pmac_sound_feature(chip, 1); in snd_pmac_new()
1298 if (chip->model <= PMAC_BURGUNDY) in snd_pmac_new()
1299 out_le32(&chip->awacs->control, chip->control_mask); in snd_pmac_new()
1304 if (chip->is_pbook_3400) { in snd_pmac_new()
1312 chip->latch_base = ioremap (0xf301a000, 0x1000); in snd_pmac_new()
1313 in_8(chip->latch_base + 0x190); in snd_pmac_new()
1314 } else if (chip->is_pbook_G3) { in snd_pmac_new()
1316 for (mio = chip->node->parent; mio; mio = mio->parent) { in snd_pmac_new()
1320 chip->macio_base = in snd_pmac_new()
1333 if (chip->macio_base) in snd_pmac_new()
1334 out_8(chip->macio_base + 0x37, 3); in snd_pmac_new()
1338 snd_pmac_dbdma_reset(chip); in snd_pmac_new()
1340 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) in snd_pmac_new()
1343 *chip_return = chip; in snd_pmac_new()
1347 snd_pmac_free(chip); in snd_pmac_new()
1362 void snd_pmac_suspend(struct snd_pmac *chip) in snd_pmac_suspend() argument
1366 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot); in snd_pmac_suspend()
1367 if (chip->suspend) in snd_pmac_suspend()
1368 chip->suspend(chip); in snd_pmac_suspend()
1369 snd_pcm_suspend_all(chip->pcm); in snd_pmac_suspend()
1370 spin_lock_irqsave(&chip->reg_lock, flags); in snd_pmac_suspend()
1371 snd_pmac_beep_stop(chip); in snd_pmac_suspend()
1372 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_pmac_suspend()
1373 if (chip->irq >= 0) in snd_pmac_suspend()
1374 disable_irq(chip->irq); in snd_pmac_suspend()
1375 if (chip->tx_irq >= 0) in snd_pmac_suspend()
1376 disable_irq(chip->tx_irq); in snd_pmac_suspend()
1377 if (chip->rx_irq >= 0) in snd_pmac_suspend()
1378 disable_irq(chip->rx_irq); in snd_pmac_suspend()
1379 snd_pmac_sound_feature(chip, 0); in snd_pmac_suspend()
1382 void snd_pmac_resume(struct snd_pmac *chip) in snd_pmac_resume() argument
1384 snd_pmac_sound_feature(chip, 1); in snd_pmac_resume()
1385 if (chip->resume) in snd_pmac_resume()
1386 chip->resume(chip); in snd_pmac_resume()
1388 if (chip->macio_base && chip->is_pbook_G3) in snd_pmac_resume()
1389 out_8(chip->macio_base + 0x37, 3); in snd_pmac_resume()
1390 else if (chip->is_pbook_3400) in snd_pmac_resume()
1391 in_8(chip->latch_base + 0x190); in snd_pmac_resume()
1393 snd_pmac_pcm_set_format(chip); in snd_pmac_resume()
1395 if (chip->irq >= 0) in snd_pmac_resume()
1396 enable_irq(chip->irq); in snd_pmac_resume()
1397 if (chip->tx_irq >= 0) in snd_pmac_resume()
1398 enable_irq(chip->tx_irq); in snd_pmac_resume()
1399 if (chip->rx_irq >= 0) in snd_pmac_resume()
1400 enable_irq(chip->rx_irq); in snd_pmac_resume()
1402 snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0); in snd_pmac_resume()