Add AES67
This commit is contained in:
parent
a38297e3fb
commit
33dc918c7a
|
@ -43,7 +43,7 @@ menuconfig SND_DRIVERS
|
|||
default y
|
||||
help
|
||||
Support for generic sound devices.
|
||||
|
||||
|
||||
if SND_DRIVERS
|
||||
|
||||
config SND_PCSP
|
||||
|
@ -89,6 +89,12 @@ config SND_DUMMY
|
|||
To compile this driver as a module, choose M here: the module
|
||||
will be called snd-dummy.
|
||||
|
||||
config SND_AES67
|
||||
tristate "AES67 Network Soundcard"
|
||||
select SND_PCM
|
||||
help
|
||||
Y for AES67 Goodness
|
||||
|
||||
config SND_ALOOP
|
||||
tristate "Generic loopback driver (PCM)"
|
||||
select SND_PCM
|
||||
|
@ -160,12 +166,12 @@ config SND_MTS64
|
|||
depends on PARPORT
|
||||
select SND_RAWMIDI
|
||||
help
|
||||
The ESI Miditerminal 4140 is a 4 In 4 Out MIDI Interface with
|
||||
The ESI Miditerminal 4140 is a 4 In 4 Out MIDI Interface with
|
||||
additional SMPTE Timecode capabilities for the parallel port.
|
||||
|
||||
Say 'Y' to include support for this device.
|
||||
|
||||
To compile this driver as a module, chose 'M' here: the module
|
||||
To compile this driver as a module, chose 'M' here: the module
|
||||
will be called snd-mts64.
|
||||
|
||||
config SND_SERIAL_U16550
|
||||
|
|
|
@ -4,18 +4,20 @@
|
|||
# Copyright (c) 2001 by Jaroslav Kysela <perex@perex.cz>
|
||||
#
|
||||
|
||||
snd-dummy-objs := dummy.o
|
||||
snd-aloop-objs := aloop.o
|
||||
snd-mtpav-objs := mtpav.o
|
||||
snd-mts64-objs := mts64.o
|
||||
snd-pcmtest-objs := pcmtest.o
|
||||
snd-portman2x4-objs := portman2x4.o
|
||||
snd-serial-u16550-objs := serial-u16550.o
|
||||
snd-serial-generic-objs := serial-generic.o
|
||||
snd-virmidi-objs := virmidi.o
|
||||
snd-dummy-y := dummy.o
|
||||
snd-aes67-y := aes67.o
|
||||
snd-aloop-y := aloop.o
|
||||
snd-mtpav-y := mtpav.o
|
||||
snd-mts64-y := mts64.o
|
||||
snd-pcmtest-y := pcmtest.o
|
||||
snd-portman2x4-y := portman2x4.o
|
||||
snd-serial-u16550-y := serial-u16550.o
|
||||
snd-serial-generic-y := serial-generic.o
|
||||
snd-virmidi-y := virmidi.o
|
||||
|
||||
# Toplevel Module Dependency
|
||||
obj-$(CONFIG_SND_DUMMY) += snd-dummy.o
|
||||
obj-$(CONFIG_SND_AES67) += snd-aes67.o
|
||||
obj-$(CONFIG_SND_ALOOP) += snd-aloop.o
|
||||
obj-$(CONFIG_SND_VIRMIDI) += snd-virmidi.o
|
||||
obj-$(CONFIG_SND_PCMTEST) += snd-pcmtest.o
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* AES67 soundcard
|
||||
*
|
||||
* */
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/core.h>
|
||||
|
||||
MODULE_AUTHOR("Preston Baxter <preston@preston-baxter.xom>");
|
||||
MODULE_DESCRIPTION("AES67 Virtual Soundcard");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
/* Definistion of AES67 Virtual SoundCard */
|
||||
struct aes67 {
|
||||
struct snd_card *card;
|
||||
};
|
||||
|
||||
/* Destructor */
|
||||
static int snd_aes67_free(struct aes67 *virtcard)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Component Free */
|
||||
static int snd_aes67_dev_free(struct snd_device *device)
|
||||
{
|
||||
return snd_aes67_free(device->device_data);
|
||||
}
|
||||
|
||||
/* Constructor */
|
||||
|
||||
static int snd_aes67_create(struct snd_card *card, struct aes67 **rvirtcard)
|
||||
{
|
||||
struct aes67 *virtcard;
|
||||
int err;
|
||||
static const struct snd_device_ops ops = {
|
||||
.dev_free = snd_aes67_dev_free,
|
||||
};
|
||||
|
||||
*rvirtcard = NULL;
|
||||
|
||||
/* Setup Connection Handlers */
|
||||
|
||||
/* allocate memory for virt card */
|
||||
virtcard = kzalloc(sizeof(*virtcard), GFP_KERNEL);
|
||||
if (virtcard == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
virtcard->card = card;
|
||||
|
||||
/* COnnect to things */
|
||||
|
||||
/* Build Sound Device */
|
||||
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, virtcard, &ops);
|
||||
if (err < 0) {
|
||||
snd_aes67_free(virtcard);
|
||||
return err;
|
||||
}
|
||||
|
||||
*rvirtcard = virtcard;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Probe method */
|
||||
static int aes67_probe(struct platform_device *devptr)
|
||||
{
|
||||
static int deviceNumber;
|
||||
struct snd_card *card;
|
||||
struct aes67 *virtcard;
|
||||
int err;
|
||||
|
||||
//Incredibly temporary
|
||||
if (deviceNumber > 1) {
|
||||
return -ENODEV;
|
||||
}
|
||||
deviceNumber++;
|
||||
|
||||
snd_printk(KERN_INFO "Attempting to create Soundcard for AES67\n");
|
||||
err = snd_devm_card_new(&devptr->dev, 0, "xid", THIS_MODULE,
|
||||
sizeof(struct aes67), &card);
|
||||
if (err < 0)
|
||||
snd_printk(KERN_ERR "Unable to create AES67 Soundcard\n");
|
||||
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)
|
||||
snd_printk(KERN_ERR "Unable to create AES67rtual Soundcard\n");
|
||||
goto error;
|
||||
|
||||
/* Setup Names */
|
||||
strcpy(card->driver, "AES67 VSC");
|
||||
strcpy(card->shortname, "AES67 Virtual Soundcard");
|
||||
strcpy(card->longname, "AES67 Virtual Soundcard - 8x8");
|
||||
|
||||
snd_printk(KERN_INFO
|
||||
"Attempting to Register AES67 Virtual Soundcard\n");
|
||||
err = snd_card_register(card);
|
||||
if (err < 0)
|
||||
snd_printk(KERN_ERR
|
||||
"Unable to Register AES67 Virtual Soundcard\n");
|
||||
goto error;
|
||||
|
||||
error:
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Power Methods */
|
||||
static int snd_aes67_suspend(struct device *pdev)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(pdev);
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_aes67_resume(struct device *pdev)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(pdev);
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
return 0;
|
||||
}
|
||||
/* Power management operations. Most definitely need to revisit this */
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(snd_aes67_pm, snd_aes67_suspend,
|
||||
snd_aes67_resume);
|
||||
|
||||
#define SND_AES67_DRIVER "snd_aes67"
|
||||
|
||||
static struct platform_driver snd_aes67_driver = {
|
||||
.probe = aes67_probe,
|
||||
.driver = {
|
||||
.name = SND_AES67_DRIVER,
|
||||
.pm = &snd_aes67_pm,
|
||||
},
|
||||
};
|
||||
|
||||
/* Module init and exit functions */
|
||||
static int __init alsa_card_aes67_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = platform_driver_register(&snd_aes67_driver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit alsa_card_aes67_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&snd_aes67_driver);
|
||||
}
|
||||
|
||||
module_init(alsa_card_aes67_init) module_exit(alsa_card_aes67_exit)
|
Loading…
Reference in New Issue