From 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 Mon Sep 17 00:00:00 2001 From: Yunhong Jiang Date: Tue, 4 Aug 2015 12:17:53 -0700 Subject: Add the rt linux 4.1.3-rt3 as base Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang --- kernel/sound/isa/adlib.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 kernel/sound/isa/adlib.c (limited to 'kernel/sound/isa/adlib.c') diff --git a/kernel/sound/isa/adlib.c b/kernel/sound/isa/adlib.c new file mode 100644 index 000000000..120c524bb --- /dev/null +++ b/kernel/sound/isa/adlib.c @@ -0,0 +1,126 @@ +/* + * AdLib FM card driver. + */ + +#include +#include +#include +#include +#include +#include + +#define CRD_NAME "AdLib FM" +#define DEV_NAME "adlib" + +MODULE_DESCRIPTION(CRD_NAME); +MODULE_AUTHOR("Rene Herman"); +MODULE_LICENSE("GPL"); + +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; +static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; + +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); +module_param_array(id, charp, NULL, 0444); +MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); +module_param_array(enable, bool, NULL, 0444); +MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); +module_param_array(port, long, NULL, 0444); +MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); + +static int snd_adlib_match(struct device *dev, unsigned int n) +{ + if (!enable[n]) + return 0; + + if (port[n] == SNDRV_AUTO_PORT) { + dev_err(dev, "please specify port\n"); + return 0; + } + return 1; +} + +static void snd_adlib_free(struct snd_card *card) +{ + release_and_free_resource(card->private_data); +} + +static int snd_adlib_probe(struct device *dev, unsigned int n) +{ + struct snd_card *card; + struct snd_opl3 *opl3; + int error; + + error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card); + if (error < 0) { + dev_err(dev, "could not create card\n"); + return error; + } + + card->private_data = request_region(port[n], 4, CRD_NAME); + if (!card->private_data) { + dev_err(dev, "could not grab ports\n"); + error = -EBUSY; + goto out; + } + card->private_free = snd_adlib_free; + + strcpy(card->driver, DEV_NAME); + strcpy(card->shortname, CRD_NAME); + sprintf(card->longname, CRD_NAME " at %#lx", port[n]); + + error = snd_opl3_create(card, port[n], port[n] + 2, OPL3_HW_AUTO, 1, &opl3); + if (error < 0) { + dev_err(dev, "could not create OPL\n"); + goto out; + } + + error = snd_opl3_hwdep_new(opl3, 0, 0, NULL); + if (error < 0) { + dev_err(dev, "could not create FM\n"); + goto out; + } + + error = snd_card_register(card); + if (error < 0) { + dev_err(dev, "could not register card\n"); + goto out; + } + + dev_set_drvdata(dev, card); + return 0; + +out: snd_card_free(card); + return error; +} + +static int snd_adlib_remove(struct device *dev, unsigned int n) +{ + snd_card_free(dev_get_drvdata(dev)); + return 0; +} + +static struct isa_driver snd_adlib_driver = { + .match = snd_adlib_match, + .probe = snd_adlib_probe, + .remove = snd_adlib_remove, + + .driver = { + .name = DEV_NAME + } +}; + +static int __init alsa_card_adlib_init(void) +{ + return isa_register_driver(&snd_adlib_driver, SNDRV_CARDS); +} + +static void __exit alsa_card_adlib_exit(void) +{ + isa_unregister_driver(&snd_adlib_driver); +} + +module_init(alsa_card_adlib_init); +module_exit(alsa_card_adlib_exit); -- cgit 1.2.3-korg