/* * load the firmware binaries */ static int vx_boot(const char *devname) { snd_hwdep_t *hw; const char *id; int err, is_pcmcia; unsigned int idx, dsps, loaded; snd_hwdep_dsp_status_t *stat; if ((err = snd_hwdep_open(&hw, devname, O_RDWR)) < 0) { error("cannot open hwdep %s\n", devname); return err; } if (check_hwinfo(hw, "VX Loader") < 0) { error("invalid hwdep %s\n", devname); snd_hwdep_close(hw); return -ENODEV; } snd_hwdep_dsp_status_alloca(&stat); /* get the current status */ if ((err = snd_hwdep_dsp_status(hw, stat)) < 0) { error("cannot get version for %s\n", devname); snd_hwdep_close(hw); return err; } if (snd_hwdep_dsp_status_get_chip_ready(stat)) return 0; /* already loaded */ id = snd_hwdep_dsp_status_get_id(stat); if (strcmp(id, "vxpocket") == 0 || strcmp(id, "vxp440") == 0) is_pcmcia = 1; else is_pcmcia = 0; dsps = snd_hwdep_dsp_status_get_num_dsps(stat); loaded = snd_hwdep_dsp_status_get_dsp_loaded(stat); for (idx = 0; idx < dsps; idx++) { if (loaded & (1 << idx)) continue; if ((err = load_firmware(hw, id, idx, is_pcmcia)) < 0) { snd_hwdep_close(hw); return err; } } snd_hwdep_close(hw); return 0; }
static long snd_hwdep_ioctl(struct file * file, unsigned int cmd, unsigned long arg) { snd_hwdep_t *hw = file->private_data; void __user *argp = (void __user *)arg; switch (cmd) { case SNDRV_HWDEP_IOCTL_PVERSION: return put_user(SNDRV_HWDEP_VERSION, (int __user *)argp); case SNDRV_HWDEP_IOCTL_INFO: return snd_hwdep_info(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_STATUS: return snd_hwdep_dsp_status(hw, argp); case SNDRV_HWDEP_IOCTL_DSP_LOAD: return snd_hwdep_dsp_load(hw, argp); } if (hw->ops.ioctl) return hw->ops.ioctl(hw, file, cmd, arg); return -ENOTTY; }