Lines Matching refs:dev

118        if ((dev->debug & (cond)) == (cond)) { \
260 wavefront_status (snd_wavefront_t *dev) in wavefront_status() argument
263 return inb (dev->status_port); in wavefront_status()
276 wavefront_wait (snd_wavefront_t *dev, int mask) in wavefront_wait() argument
286 if (wavefront_status (dev) & mask) { in wavefront_wait()
294 if (wavefront_status (dev) & mask) { in wavefront_wait()
307 wavefront_read (snd_wavefront_t *dev) in wavefront_read() argument
310 if (wavefront_wait (dev, STAT_CAN_READ)) in wavefront_read()
311 return inb (dev->data_port); in wavefront_read()
319 wavefront_write (snd_wavefront_t *dev, unsigned char data) in wavefront_write() argument
322 if (wavefront_wait (dev, STAT_CAN_WRITE)) { in wavefront_write()
323 outb (data, dev->data_port); in wavefront_write()
333 snd_wavefront_cmd (snd_wavefront_t *dev, in snd_wavefront_cmd() argument
344 dev_err(dev->card->dev, "command 0x%x not supported.\n", in snd_wavefront_cmd()
363 if (wavefront_write (dev, cmd)) { in snd_wavefront_cmd()
376 if (wavefront_write (dev, wbuf[i])) { in snd_wavefront_cmd()
395 c = wavefront_read(dev); in snd_wavefront_cmd()
406 c = wavefront_read(dev); in snd_wavefront_cmd()
465 ack = wavefront_read(dev); in snd_wavefront_cmd()
481 err = wavefront_read(dev); in snd_wavefront_cmd()
599 wavefront_delete_sample (snd_wavefront_t *dev, int sample_num) in wavefront_delete_sample() argument
608 x = snd_wavefront_cmd(dev, WFC_DELETE_SAMPLE, NULL, wbuf); in wavefront_delete_sample()
610 dev->sample_status[sample_num] = WF_ST_EMPTY; in wavefront_delete_sample()
616 wavefront_get_sample_status (snd_wavefront_t *dev, int assume_rom) in wavefront_get_sample_status() argument
625 if (snd_wavefront_cmd (dev, WFC_GET_NSAMPLES, rbuf, wbuf)) { in wavefront_get_sample_status()
626 dev_err(dev->card->dev, "cannot request sample count.\n"); in wavefront_get_sample_status()
630 sc_real = sc_alias = sc_multi = dev->samples_used = 0; in wavefront_get_sample_status()
637 if (snd_wavefront_cmd (dev, WFC_IDENTIFY_SAMPLE_TYPE, rbuf, wbuf)) { in wavefront_get_sample_status()
638 dev_warn(dev->card->dev, in wavefront_get_sample_status()
640 dev->sample_status[i] = WF_ST_EMPTY; in wavefront_get_sample_status()
644 dev->sample_status[i] = (WF_SLOT_FILLED|rbuf[0]); in wavefront_get_sample_status()
647 dev->sample_status[i] |= WF_SLOT_ROM; in wavefront_get_sample_status()
664 dev_err(dev->card->dev, in wavefront_get_sample_status()
670 dev->samples_used++; in wavefront_get_sample_status()
674 dev_info(dev->card->dev, in wavefront_get_sample_status()
676 dev->samples_used, sc_real, sc_alias, sc_multi, in wavefront_get_sample_status()
677 WF_MAX_SAMPLE - dev->samples_used); in wavefront_get_sample_status()
685 wavefront_get_patch_status (snd_wavefront_t *dev) in wavefront_get_patch_status() argument
697 x = snd_wavefront_cmd(dev, WFC_UPLOAD_PATCH, patchbuf, in wavefront_get_patch_status()
701 dev->patch_status[i] |= WF_SLOT_FILLED; in wavefront_get_patch_status()
703 dev->sample_status in wavefront_get_patch_status()
708 dev->patch_status[i] = 0; in wavefront_get_patch_status()
710 dev_err(dev->card->dev, in wavefront_get_patch_status()
712 dev->patch_status[i] = 0; in wavefront_get_patch_status()
720 if (dev->patch_status[i] & WF_SLOT_FILLED) { in wavefront_get_patch_status()
723 if (dev->patch_status[i] & WF_SLOT_USED) { in wavefront_get_patch_status()
728 dev_info(dev->card->dev, "%d patch slots filled, %d in use\n", in wavefront_get_patch_status()
735 wavefront_get_program_status (snd_wavefront_t *dev) in wavefront_get_program_status() argument
746 x = snd_wavefront_cmd(dev, WFC_UPLOAD_PROGRAM, progbuf, in wavefront_get_program_status()
750 dev->prog_status[i] |= WF_SLOT_USED; in wavefront_get_program_status()
757 dev->patch_status in wavefront_get_program_status()
763 dev->prog_status[i] = 0; in wavefront_get_program_status()
765 dev_err(dev->card->dev, in wavefront_get_program_status()
767 dev->prog_status[i] = 0; in wavefront_get_program_status()
772 if (dev->prog_status[i]) { in wavefront_get_program_status()
777 dev_info(dev->card->dev, "%d programs slots in use\n", cnt); in wavefront_get_program_status()
783 wavefront_send_patch (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_patch() argument
792 if (header->number >= ARRAY_SIZE(dev->patch_status)) in wavefront_send_patch()
795 dev->patch_status[header->number] |= WF_SLOT_FILLED; in wavefront_send_patch()
800 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PATCH, NULL, buf)) { in wavefront_send_patch()
801 dev_err(dev->card->dev, "download patch failed\n"); in wavefront_send_patch()
809 wavefront_send_program (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_program() argument
818 if (header->number >= ARRAY_SIZE(dev->prog_status)) in wavefront_send_program()
821 dev->prog_status[header->number] = WF_SLOT_USED; in wavefront_send_program()
829 dev->patch_status[header->hdr.pr.layer[i].patch_number] |= in wavefront_send_program()
841 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PROGRAM, NULL, buf)) { in wavefront_send_program()
842 dev_err(dev->card->dev, "download patch failed\n"); in wavefront_send_program()
850 wavefront_freemem (snd_wavefront_t *dev) in wavefront_freemem() argument
855 if (snd_wavefront_cmd (dev, WFC_REPORT_FREE_MEMORY, rbuf, NULL)) { in wavefront_freemem()
856 dev_err(dev->card->dev, "can't get memory stats.\n"); in wavefront_freemem()
864 wavefront_send_sample (snd_wavefront_t *dev, in wavefront_send_sample() argument
903 x = wavefront_find_free_sample(dev); in wavefront_send_sample()
906 dev_info(dev->card->dev, "unspecified sample => %d\n", x); in wavefront_send_sample()
938 if (dev->rom_samples_rdonly) { in wavefront_send_sample()
939 if (dev->sample_status[header->number] & WF_SLOT_ROM) { in wavefront_send_sample()
940 dev_err(dev->card->dev, in wavefront_send_sample()
947 wavefront_delete_sample (dev, header->number); in wavefront_send_sample()
951 dev->freemem = wavefront_freemem (dev); in wavefront_send_sample()
953 if (dev->freemem < (int)header->size) { in wavefront_send_sample()
954 dev_err(dev->card->dev, in wavefront_send_sample()
965 dev_err(dev->card->dev, in wavefront_send_sample()
1058 if (snd_wavefront_cmd (dev, in wavefront_send_sample()
1062 dev_err(dev->card->dev, "sample %sdownload refused.\n", in wavefront_send_sample()
1087 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) { in wavefront_send_sample()
1088 dev_err(dev->card->dev, in wavefront_send_sample()
1137 outw (sample_short, dev->block_port); in wavefront_send_sample()
1139 outw (sample_short, dev->last_block_port); in wavefront_send_sample()
1147 dma_ack = wavefront_read(dev); in wavefront_send_sample()
1150 dev_err(dev->card->dev, in wavefront_send_sample()
1154 dev_err(dev->card->dev, in wavefront_send_sample()
1162 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_SAMPLE); in wavefront_send_sample()
1173 wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_alias() argument
1199 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) { in wavefront_send_alias()
1200 dev_err(dev->card->dev, "download alias failed.\n"); in wavefront_send_alias()
1204 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_ALIAS); in wavefront_send_alias()
1210 wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_multisample() argument
1250 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_MULTISAMPLE, in wavefront_send_multisample()
1253 dev_err(dev->card->dev, "download of multisample failed.\n"); in wavefront_send_multisample()
1258 dev->sample_status[header->number] = (WF_SLOT_FILLED|WF_ST_MULTISAMPLE); in wavefront_send_multisample()
1265 wavefront_fetch_multisample (snd_wavefront_t *dev, in wavefront_fetch_multisample() argument
1275 if (snd_wavefront_cmd (dev, WFC_UPLOAD_MULTISAMPLE, log_ns, number)) { in wavefront_fetch_multisample()
1276 dev_err(dev->card->dev, "upload multisample failed.\n"); in wavefront_fetch_multisample()
1293 val = wavefront_read(dev); in wavefront_fetch_multisample()
1295 dev_err(dev->card->dev, in wavefront_fetch_multisample()
1301 val = wavefront_read(dev); in wavefront_fetch_multisample()
1303 dev_err(dev->card->dev, in wavefront_fetch_multisample()
1321 wavefront_send_drum (snd_wavefront_t *dev, wavefront_patch_info *header) in wavefront_send_drum() argument
1338 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) { in wavefront_send_drum()
1339 dev_err(dev->card->dev, "download drum failed.\n"); in wavefront_send_drum()
1347 wavefront_find_free_sample (snd_wavefront_t *dev) in wavefront_find_free_sample() argument
1353 if (!(dev->sample_status[i] & WF_SLOT_FILLED)) { in wavefront_find_free_sample()
1357 dev_err(dev->card->dev, "no free sample slots!\n"); in wavefront_find_free_sample()
1363 wavefront_find_free_patch (snd_wavefront_t *dev)
1369 if (!(dev->patch_status[i] & WF_SLOT_FILLED)) {
1373 dev_err(dev->card->dev, "no free patch slots!\n");
1379 wavefront_load_patch (snd_wavefront_t *dev, const char __user *addr) in wavefront_load_patch() argument
1390 dev_err(dev->card->dev, "bad address for load patch.\n"); in wavefront_load_patch()
1412 err = wavefront_send_sample (dev, header, header->dataptr, 0); in wavefront_load_patch()
1423 err = wavefront_send_multisample (dev, header); in wavefront_load_patch()
1434 err = wavefront_send_alias (dev, header); in wavefront_load_patch()
1444 err = wavefront_send_drum (dev, header); in wavefront_load_patch()
1454 err = wavefront_send_patch (dev, header); in wavefront_load_patch()
1464 err = wavefront_send_program (dev, header); in wavefront_load_patch()
1468 dev_err(dev->card->dev, "unknown patch type %d.\n", in wavefront_load_patch()
1520 snd_wavefront_t *dev = &acard->wavefront; in wavefront_synth_control() local
1532 dev_dbg(dev->card->dev, "interrupts disabled.\n"); in wavefront_synth_control()
1533 outb (0x80|0x20, dev->control_port); in wavefront_synth_control()
1534 dev->interrupts_are_midi = 1; in wavefront_synth_control()
1538 dev_dbg(dev->card->dev, "interrupts enabled.\n"); in wavefront_synth_control()
1539 outb (0x80|0x40|0x20, dev->control_port); in wavefront_synth_control()
1540 dev->interrupts_are_midi = 1; in wavefront_synth_control()
1544 wc->rbuf[0] = dev->interrupts_are_midi; in wavefront_synth_control()
1548 dev->rom_samples_rdonly = wc->wbuf[0]; in wavefront_synth_control()
1555 dev_err(dev->card->dev, "invalid slot ID %d\n", in wavefront_synth_control()
1560 wc->rbuf[0] = dev->sample_status[i]; in wavefront_synth_control()
1565 dev->debug = wc->wbuf[0]; in wavefront_synth_control()
1566 dev_dbg(dev->card->dev, "debug = 0x%x\n", dev->debug); in wavefront_synth_control()
1579 (dev, (wavefront_patch_info *) wc->rbuf); in wavefront_synth_control()
1583 dev_err(dev->card->dev, in wavefront_synth_control()
1589 wc->status = snd_wavefront_cmd (dev, wc->cmd, wc->rbuf, wc->wbuf); in wavefront_synth_control()
1605 dev->freemem = demunge_int32 (wc->rbuf, 4); in wavefront_synth_control()
1625 dev_err(dev->card->dev, in wavefront_synth_control()
1666 snd_wavefront_t *dev; in snd_wavefront_synth_ioctl() local
1680 dev = &acard->wavefront; in snd_wavefront_synth_ioctl()
1684 if (wavefront_load_patch (dev, argp) != 0) { in snd_wavefront_synth_ioctl()
1718 snd_wavefront_t *dev = &card->wavefront; in snd_wavefront_internal_interrupt() local
1740 if ((wavefront_status(dev) & (STAT_INTR_READ|STAT_INTR_WRITE)) == 0) { in snd_wavefront_internal_interrupt()
1744 spin_lock(&dev->irq_lock); in snd_wavefront_internal_interrupt()
1745 dev->irq_ok = 1; in snd_wavefront_internal_interrupt()
1746 dev->irq_cnt++; in snd_wavefront_internal_interrupt()
1747 spin_unlock(&dev->irq_lock); in snd_wavefront_internal_interrupt()
1748 wake_up(&dev->interrupt_sleeper); in snd_wavefront_internal_interrupt()
1764 snd_wavefront_interrupt_bits(snd_wavefront_t *dev, int irq) in snd_wavefront_interrupt_bits() argument
1784 dev_err(dev->card->dev, "invalid IRQ %d\n", irq); in snd_wavefront_interrupt_bits()
1792 wavefront_should_cause_interrupt (snd_wavefront_t *dev, in wavefront_should_cause_interrupt() argument
1799 spin_lock_irq(&dev->irq_lock); in wavefront_should_cause_interrupt()
1800 add_wait_queue(&dev->interrupt_sleeper, &wait); in wavefront_should_cause_interrupt()
1801 dev->irq_ok = 0; in wavefront_should_cause_interrupt()
1803 spin_unlock_irq(&dev->irq_lock); in wavefront_should_cause_interrupt()
1804 while (!dev->irq_ok && time_before(jiffies, timeout)) { in wavefront_should_cause_interrupt()
1811 wavefront_reset_to_cleanliness (snd_wavefront_t *dev) in wavefront_reset_to_cleanliness() argument
1819 bits = snd_wavefront_interrupt_bits(dev, dev->irq); in wavefront_reset_to_cleanliness()
1823 outb (0x0, dev->control_port); in wavefront_reset_to_cleanliness()
1861 outb (0x80 | 0x40 | bits, dev->data_port); in wavefront_reset_to_cleanliness()
1880 wavefront_should_cause_interrupt(dev, 0x80|0x40|0x10|0x1, in wavefront_reset_to_cleanliness()
1881 dev->control_port, in wavefront_reset_to_cleanliness()
1888 if (!dev->irq_ok) { in wavefront_reset_to_cleanliness()
1889 dev_err(dev->card->dev, "intr not received after h/w un-reset.\n"); in wavefront_reset_to_cleanliness()
1909 wavefront_should_cause_interrupt(dev, WFC_HARDWARE_VERSION, in wavefront_reset_to_cleanliness()
1910 dev->data_port, ramcheck_time*HZ); in wavefront_reset_to_cleanliness()
1912 if (!dev->irq_ok) { in wavefront_reset_to_cleanliness()
1913 dev_err(dev->card->dev, "post-RAM-check interrupt not received.\n"); in wavefront_reset_to_cleanliness()
1917 if (!wavefront_wait (dev, STAT_CAN_READ)) { in wavefront_reset_to_cleanliness()
1918 dev_err(dev->card->dev, "no response to HW version cmd.\n"); in wavefront_reset_to_cleanliness()
1922 hwv[0] = wavefront_read(dev); in wavefront_reset_to_cleanliness()
1924 dev_err(dev->card->dev, "board not responding correctly.\n"); in wavefront_reset_to_cleanliness()
1934 hwv[0] = wavefront_read(dev); in wavefront_reset_to_cleanliness()
1936 dev_err(dev->card->dev, in wavefront_reset_to_cleanliness()
1939 dev_err(dev->card->dev, in wavefront_reset_to_cleanliness()
1948 hwv[1] = wavefront_read(dev); in wavefront_reset_to_cleanliness()
1950 dev_err(dev->card->dev, "incorrect h/w response.\n"); in wavefront_reset_to_cleanliness()
1954 dev_info(dev->card->dev, "hardware version %d.%d\n", in wavefront_reset_to_cleanliness()
1965 wavefront_download_firmware (snd_wavefront_t *dev, char *path) in wavefront_download_firmware() argument
1973 err = request_firmware(&firmware, path, dev->card->dev); in wavefront_download_firmware()
1975 dev_err(dev->card->dev, "firmware (%s) download failed!!!\n", path); in wavefront_download_firmware()
1986 dev_err(dev->card->dev, in wavefront_download_firmware()
1995 dev_err(dev->card->dev, "firmware section read error.\n"); in wavefront_download_firmware()
2000 if (wavefront_write(dev, WFC_DOWNLOAD_OS)) in wavefront_download_firmware()
2004 if (wavefront_write(dev, *buf)) in wavefront_download_firmware()
2011 if (!wavefront_wait(dev, STAT_CAN_READ)) { in wavefront_download_firmware()
2012 dev_err(dev->card->dev, "time out for firmware ACK.\n"); in wavefront_download_firmware()
2015 err = inb(dev->data_port); in wavefront_download_firmware()
2017 dev_err(dev->card->dev, in wavefront_download_firmware()
2031 dev_err(dev->card->dev, "firmware download failed!!!\n"); in wavefront_download_firmware()
2037 wavefront_do_reset (snd_wavefront_t *dev) in wavefront_do_reset() argument
2042 if (wavefront_reset_to_cleanliness (dev)) { in wavefront_do_reset()
2043 dev_err(dev->card->dev, "hw reset failed.\n"); in wavefront_do_reset()
2047 if (dev->israw) { in wavefront_do_reset()
2048 if (wavefront_download_firmware (dev, ospath)) { in wavefront_do_reset()
2052 dev->israw = 0; in wavefront_do_reset()
2062 wavefront_should_cause_interrupt (dev, WFC_NOOP, in wavefront_do_reset()
2063 dev->data_port, in wavefront_do_reset()
2066 if (!dev->irq_ok) { in wavefront_do_reset()
2067 dev_err(dev->card->dev, "no post-OS interrupt.\n"); in wavefront_do_reset()
2073 wavefront_should_cause_interrupt (dev, WFC_NOOP, in wavefront_do_reset()
2074 dev->data_port, (10*HZ)); in wavefront_do_reset()
2076 if (!dev->irq_ok) { in wavefront_do_reset()
2077 dev_err(dev->card->dev, "no post-OS interrupt(2).\n"); in wavefront_do_reset()
2085 outb (0x80|0x40, dev->control_port); in wavefront_do_reset()
2093 dev->freemem = wavefront_freemem(dev); in wavefront_do_reset()
2094 if (dev->freemem < 0) in wavefront_do_reset()
2097 dev_info(dev->card->dev, "available DRAM %dk\n", dev->freemem / 1024); in wavefront_do_reset()
2099 if (wavefront_write (dev, 0xf0) || in wavefront_do_reset()
2100 wavefront_write (dev, 1) || in wavefront_do_reset()
2101 (wavefront_read (dev) < 0)) { in wavefront_do_reset()
2102 dev->debug = 0; in wavefront_do_reset()
2103 dev_err(dev->card->dev, "MPU emulation mode not set.\n"); in wavefront_do_reset()
2109 if (snd_wavefront_cmd (dev, WFC_SET_NVOICES, NULL, voices)) { in wavefront_do_reset()
2110 dev_err(dev->card->dev, "cannot set number of voices to 32.\n"); in wavefront_do_reset()
2120 outb (0x0, dev->control_port); in wavefront_do_reset()
2121 dev->interrupts_are_midi = 0; in wavefront_do_reset()
2126 snd_wavefront_start (snd_wavefront_t *dev) in snd_wavefront_start() argument
2135 if (dev->israw) { in snd_wavefront_start()
2142 if (dev->israw || fx_raw) { in snd_wavefront_start()
2143 if (wavefront_do_reset (dev)) { in snd_wavefront_start()
2149 dev->has_fx = (snd_wavefront_fx_detect (dev) == 0); in snd_wavefront_start()
2151 if (dev->has_fx && fx_raw) { in snd_wavefront_start()
2152 snd_wavefront_fx_start (dev); in snd_wavefront_start()
2155 wavefront_get_sample_status (dev, samples_are_from_rom); in snd_wavefront_start()
2156 wavefront_get_program_status (dev); in snd_wavefront_start()
2157 wavefront_get_patch_status (dev); in snd_wavefront_start()
2162 outb (0x80|0x40|0x20, dev->control_port); in snd_wavefront_start()
2172 snd_wavefront_t *dev = &card->wavefront; in snd_wavefront_detect() local
2178 dev->israw = 0; in snd_wavefront_detect()
2179 dev->has_fx = 0; in snd_wavefront_detect()
2180 dev->debug = debug_default; in snd_wavefront_detect()
2181 dev->interrupts_are_midi = 0; in snd_wavefront_detect()
2182 dev->irq_cnt = 0; in snd_wavefront_detect()
2183 dev->rom_samples_rdonly = 1; in snd_wavefront_detect()
2185 if (snd_wavefront_cmd (dev, WFC_FIRMWARE_VERSION, rbuf, wbuf) == 0) { in snd_wavefront_detect()
2187 dev->fw_version[0] = rbuf[0]; in snd_wavefront_detect()
2188 dev->fw_version[1] = rbuf[1]; in snd_wavefront_detect()
2190 dev_info(dev->card->dev, "firmware %d.%d already loaded.\n", in snd_wavefront_detect()
2195 if (snd_wavefront_cmd (dev, WFC_HARDWARE_VERSION, in snd_wavefront_detect()
2197 dev->hw_version[0] = rbuf[0]; in snd_wavefront_detect()
2198 dev->hw_version[1] = rbuf[1]; in snd_wavefront_detect()
2200 dev_err(dev->card->dev, in snd_wavefront_detect()
2208 dev_info(dev->card->dev, in snd_wavefront_detect()
2210 dev->israw = 1; in snd_wavefront_detect()
2215 dev->israw = 1; in snd_wavefront_detect()
2216 dev_info(dev->card->dev, in snd_wavefront_detect()