static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) { struct snd_card *card; struct soundscape *sscape; int ret; card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct soundscape)); if (!card) return -ENOMEM; sscape = get_card_soundscape(card); sscape->type = SSCAPE; dma[dev] &= 0x03; ret = create_sscape(dev, card); if (ret < 0) goto _release_card; snd_card_set_dev(card, pdev); if ((ret = snd_card_register(card)) < 0) { printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; } dev_set_drvdata(pdev, card); return 0; _release_card: snd_card_free(card); return ret; }
static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) { struct snd_card *card; int ret; dma[dev] &= 0x03; ret = create_sscape(dev, &card); if (ret < 0) return ret; snd_card_set_dev(card, pdev); if ((ret = snd_card_register(card)) < 0) { printk(KERN_ERR "sscape: Failed to register sound card\n"); return ret; } dev_set_drvdata(pdev, card); return 0; }
static int __init snd_sscape_probe(struct platform_device *pdev) { int dev = pdev->id; struct snd_card *card; int ret; dma[dev] &= 0x03; ret = create_sscape(dev, &card); if (ret < 0) return ret; snd_card_set_dev(card, &pdev->dev); if ((ret = snd_card_register(card)) < 0) { printk(KERN_ERR "sscape: Failed to register sound card\n"); return ret; } platform_set_drvdata(pdev, card); return 0; }
static int __init sscape_manual_probe(struct params *params) { int ret; unsigned i; snd_card_t *card; for (i = 0; i < SNDRV_CARDS; ++i) { /* * We do NOT probe for ports. * If we're not given a port number for this * card then we completely ignore this line * of parameters. */ if (port[i] == SNDRV_AUTO_PORT) continue; /* * Make sure we were given ALL of the other parameters. */ if ( (irq[i] == SNDRV_AUTO_IRQ) || (mpu_irq[i] == SNDRV_AUTO_IRQ) || (dma[i] == SNDRV_AUTO_DMA) ) { printk(KERN_INFO "sscape: insufficient parameters, need IO, IRQ, MPU-IRQ and DMA\n"); return -ENXIO; } /* * This cards looks OK ... */ init_params(params, index[i], id[i], port[i], irq[i], mpu_irq[i], dma[i]); ret = create_sscape(params, &card); if (ret < 0) return ret; sscape_card[sscape_cards] = card; params++; sscape_cards++; } /* for */ return 0; }
static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { static int idx = 0; struct pnp_dev *dev; struct snd_card *card; int ret; /* * Allow this function to fail *quietly* if all the ISA PnP * devices were configured using module parameters instead. */ if ((idx = get_next_autoindex(idx)) >= SNDRV_CARDS) return -ENOSPC; /* * We have found a candidate ISA PnP card. Now we * have to check that it has the devices that we * expect it to have. * * We will NOT try and autoconfigure all of the resources * needed and then activate the card as we are assuming that * has already been done at boot-time using /proc/isapnp. * We shall simply try to give each active card the resources * that it wants. This is a sensible strategy for a modular * system where unused modules are unloaded regularly. * * This strategy is utterly useless if we compile the driver * into the kernel, of course. */ // printk(KERN_INFO "sscape: %s\n", card->name); /* * Check that we still have room for another sound card ... */ dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); if (! dev) return -ENODEV; if (!pnp_is_active(dev)) { if (pnp_activate_dev(dev) < 0) { printk(KERN_INFO "sscape: device is inactive\n"); return -EBUSY; } } /* * Read the correct parameters off the ISA PnP bus ... */ port[idx] = pnp_port_start(dev, 0); irq[idx] = pnp_irq(dev, 0); mpu_irq[idx] = pnp_irq(dev, 1); dma[idx] = pnp_dma(dev, 0) & 0x03; ret = create_sscape(idx, &card); if (ret < 0) return ret; snd_card_set_dev(card, &pcard->card->dev); if ((ret = snd_card_register(card)) < 0) { printk(KERN_ERR "sscape: Failed to register sound card\n"); snd_card_free(card); return ret; } pnp_set_card_drvdata(pcard, card); ++idx; return ret; }
static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { static int idx = 0; struct pnp_dev *dev; struct snd_card *card; struct soundscape *sscape; int ret; /* * Allow this function to fail *quietly* if all the ISA PnP * devices were configured using module parameters instead. */ if ((idx = get_next_autoindex(idx)) >= SNDRV_CARDS) return -ENOSPC; /* * We have found a candidate ISA PnP card. Now we * have to check that it has the devices that we * expect it to have. * * We will NOT try and autoconfigure all of the resources * needed and then activate the card as we are assuming that * has already been done at boot-time using /proc/isapnp. * We shall simply try to give each active card the resources * that it wants. This is a sensible strategy for a modular * system where unused modules are unloaded regularly. * * This strategy is utterly useless if we compile the driver * into the kernel, of course. */ // printk(KERN_INFO "sscape: %s\n", card->name); /* * Check that we still have room for another sound card ... */ dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL); if (! dev) return -ENODEV; if (!pnp_is_active(dev)) { if (pnp_activate_dev(dev) < 0) { printk(KERN_INFO "sscape: device is inactive\n"); return -EBUSY; } } /* * Create a new ALSA sound card entry, in anticipation * of detecting our hardware ... */ card = snd_card_new(index[idx], id[idx], THIS_MODULE, sizeof(struct soundscape)); if (!card) return -ENOMEM; sscape = get_card_soundscape(card); /* * Identify card model ... */ if (!strncmp("ENS4081", pid->id, 7)) sscape->type = SSCAPE_VIVO; else sscape->type = SSCAPE_PNP; /* * Read the correct parameters off the ISA PnP bus ... */ port[idx] = pnp_port_start(dev, 0); irq[idx] = pnp_irq(dev, 0); mpu_irq[idx] = pnp_irq(dev, 1); dma[idx] = pnp_dma(dev, 0) & 0x03; if (sscape->type == SSCAPE_PNP) { dma2[idx] = dma[idx]; wss_port[idx] = CODEC_IO(port[idx]); } else { wss_port[idx] = pnp_port_start(dev, 1); dma2[idx] = pnp_dma(dev, 1); } ret = create_sscape(idx, card); if (ret < 0) goto _release_card; snd_card_set_dev(card, &pcard->card->dev); if ((ret = snd_card_register(card)) < 0) { printk(KERN_ERR "sscape: Failed to register sound card\n"); goto _release_card; } pnp_set_card_drvdata(pcard, card); ++idx; return 0; _release_card: snd_card_free(card); return ret; }