more debug. But got way farther

This commit is contained in:
Preston Baxter 2024-07-21 23:58:27 -05:00
parent ab000c22d7
commit fb4cd98286
1 changed files with 37 additions and 21 deletions

View File

@ -14,8 +14,10 @@
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8};
static int pcm_devs[SNDRV_CARDS] = { [0 ...(SNDRV_CARDS - 1)] = 1 };
static int pcm_substreams[SNDRV_CARDS] = { [0 ...(SNDRV_CARDS - 1)] = 8 };
static struct platform_device *devices[SNDRV_CARDS];
#define CARD_NAME "AES67 Virtual Soundcard"
@ -92,34 +94,26 @@ static int snd_aes67_create(struct snd_card *card, struct aes67 **rvirtcard)
/* Probe method */
static int aes67_probe(struct platform_device *devptr)
{
static int deviceNumber;
struct snd_card *card;
struct aes67 *virtcard;
int dev = devptr->id;
int err;
//Incredibly temporary
if (deviceNumber >= SNDRV_CARDS) {
return -ENODEV;
}
if (!enable[deviceNumber]) {
deviceNumber++;
return -ENODEV;
}
snd_printk(KERN_INFO "Attempting to create Soundcard for AES67\n");
err = snd_devm_card_new(&devptr->dev, index[deviceNumber],
id[deviceNumber], THIS_MODULE,
err = snd_devm_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
sizeof(struct aes67), &card);
if (err < 0)
if (err < 0) {
snd_printk(KERN_ERR "Unable to create AES67 Soundcard\n");
return err;
return err;
}
virtcard = card->private_data;
snd_printk(KERN_INFO "Attempting to create AES67 Virtual Soundcard\n");
err = snd_aes67_create(card, &virtcard);
if (err < 0)
if (err < 0) {
snd_printk(KERN_ERR "Unable to create AES67rtual Soundcard\n");
goto error;
goto error;
}
/* Setup Names */
strcpy(card->driver, "AES67 VSC");
@ -129,10 +123,13 @@ static int aes67_probe(struct platform_device *devptr)
snd_printk(KERN_INFO
"Attempting to Register AES67 Virtual Soundcard\n");
err = snd_card_register(card);
if (err < 0)
if (err < 0) {
snd_printk(KERN_ERR
"Unable to Register AES67 Virtual Soundcard\n");
goto error;
goto error;
}
platform_set_drvdata(devptr, card);
return 0;
error:
snd_card_free(card);
@ -340,14 +337,33 @@ static int __init alsa_card_aes67_init(void)
{
int err;
//Add driver to registry
snd_printk(KERN_INFO "Attempting to register driver for AES67\n");
err = platform_driver_register(&snd_aes67_driver);
if (err < 0)
if (err < 0) {
snd_printk(KERN_ERR "FAILED to register driver for AES67\n");
return err;
}
//register a card in the kernel
struct platform_device *device;
device = platform_device_register_simple(SND_AES67_DRIVER, 0, NULL, 0);
if (IS_ERR(device)) {
snd_printk(KERN_ERR "Failed to register AES67 Device\n");
return -ENODEV;
}
if (!platform_get_drvdata(device)) {
snd_printk(KERN_ERR "No device data for AES67\n");
platform_device_unregister(device);
return -ENODEV;
}
return 0;
}
static void __exit alsa_card_aes67_exit(void)
{
snd_printk(KERN_INFO "Attempting to unregistered driver for AES67\n");
platform_driver_unregister(&snd_aes67_driver);
}