Lines Matching refs:chip
30 int snd_sbdsp_command(struct snd_sb *chip, unsigned char val)
37 if ((inb(SBP(chip, STATUS)) & 0x80) == 0) {
38 outb(val, SBP(chip, COMMAND));
41 snd_printd("%s [0x%lx]: timeout (0x%x)\n", __func__, chip->port, val);
45 int snd_sbdsp_get_byte(struct snd_sb *chip)
50 if (inb(SBP(chip, DATA_AVAIL)) & 0x80) {
51 val = inb(SBP(chip, READ));
58 snd_printd("%s [0x%lx]: timeout\n", __func__, chip->port);
62 int snd_sbdsp_reset(struct snd_sb *chip)
66 outb(1, SBP(chip, RESET));
68 outb(0, SBP(chip, RESET));
71 if (inb(SBP(chip, DATA_AVAIL)) & 0x80) {
72 if (inb(SBP(chip, READ)) == 0xaa)
77 snd_printdd("%s [0x%lx] failed...\n", __func__, chip->port);
81 static int snd_sbdsp_version(struct snd_sb * chip)
85 snd_sbdsp_command(chip, SB_DSP_GET_VERSION);
86 result = (short) snd_sbdsp_get_byte(chip) << 8;
87 result |= (short) snd_sbdsp_get_byte(chip);
91 static int snd_sbdsp_probe(struct snd_sb * chip)
102 spin_lock_irqsave(&chip->reg_lock, flags);
103 if (snd_sbdsp_reset(chip) < 0) {
104 spin_unlock_irqrestore(&chip->reg_lock, flags);
107 version = snd_sbdsp_version(chip);
109 spin_unlock_irqrestore(&chip->reg_lock, flags);
112 spin_unlock_irqrestore(&chip->reg_lock, flags);
115 snd_printdd("SB [0x%lx]: DSP chip found, version = %i.%i\n",
116 chip->port, major, minor);
118 switch (chip->hardware) {
122 chip->hardware = SB_HW_10;
127 chip->hardware = SB_HW_201;
130 chip->hardware = SB_HW_20;
135 chip->hardware = SB_HW_PRO;
139 chip->hardware = SB_HW_16;
143 snd_printk(KERN_INFO "SB [0x%lx]: unknown DSP chip version %i.%i\n",
144 chip->port, major, minor);
166 sprintf(chip->name, "Sound Blaster %s", str);
167 chip->version = (major << 8) | minor;
180 struct snd_sb *chip;
186 chip = devm_kzalloc(card->dev, sizeof(*chip), GFP_KERNEL);
187 if (!chip)
189 spin_lock_init(&chip->reg_lock);
190 spin_lock_init(&chip->open_lock);
191 spin_lock_init(&chip->midi_input_lock);
192 spin_lock_init(&chip->mixer_lock);
193 chip->irq = -1;
194 chip->dma8 = -1;
195 chip->dma16 = -1;
196 chip->port = port;
202 "SoundBlaster", (void *) chip)) {
206 chip->irq = irq;
207 card->sync_irq = chip->irq;
212 chip->res_port = devm_request_region(card->dev, port, 16,
214 if (!chip->res_port) {
225 chip->dma8 = dma8;
236 chip->dma16 = dma16;
240 chip->card = card;
241 chip->hardware = hardware;
242 err = snd_sbdsp_probe(chip);
245 *r_chip = chip;