cregit-Linux how code gets into the kernel

Release 4.8 sound/isa/opl3sa2.c

Directory: sound/isa
/*
 *  Driver for Yamaha OPL3-SA[2,3] soundcards
 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
 *
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */

#include <linux/init.h>
#include <linux/err.h>
#include <linux/isa.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/pnp.h>
#include <linux/module.h>
#include <linux/io.h>
#include <sound/core.h>
#include <sound/wss.h>
#include <sound/mpu401.h>
#include <sound/opl3.h>
#include <sound/initval.h>
#include <sound/tlv.h>

MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
MODULE_DESCRIPTION("Yamaha OPL3SA2+");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF719E-S},"
		"{Genius,Sound Maker 3DX},"
		"{Yamaha,OPL3SA3},"
		"{Intel,AL440LX sound},"
	        "{NeoMagic,MagicWave 3DX}}");


static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	
/* Index 0-MAX */

static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	
/* ID for this card */

static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 
/* Enable this card */
#ifdef CONFIG_PNP

static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
#endif

static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;	
/* 0xf86,0x370,0x100 */

static long sb_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;	
/* 0x220,0x240,0x260 */

static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
/* 0x530,0xe80,0xf40,0x604 */

static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;	
/* 0x388 */

static long midi_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
/* 0x330,0x300 */

static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;	
/* 0,1,3,5,9,11,12,15 */

static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	
/* 1,3,5,6,7 */

static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;	
/* 1,3,5,6,7 */

static int opl3sa3_ymode[SNDRV_CARDS];   
/* 0,1,2,3 */ 
/*SL Added*/

module_param_array(index, int, NULL, 0444);
MODULE_PARM_DESC(index, "Index value for OPL3-SA soundcard.");
module_param_array(id, charp, NULL, 0444);
MODULE_PARM_DESC(id, "ID string for OPL3-SA soundcard.");
module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable OPL3-SA soundcard.");
#ifdef CONFIG_PNP
module_param_array(isapnp, bool, NULL, 0444);
MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard.");
#endif
module_param_array(port, long, NULL, 0444);
MODULE_PARM_DESC(port, "Port # for OPL3-SA driver.");
module_param_array(sb_port, long, NULL, 0444);
MODULE_PARM_DESC(sb_port, "SB port # for OPL3-SA driver.");
module_param_array(wss_port, long, NULL, 0444);
MODULE_PARM_DESC(wss_port, "WSS port # for OPL3-SA driver.");
module_param_array(fm_port, long, NULL, 0444);
MODULE_PARM_DESC(fm_port, "FM port # for OPL3-SA driver.");
module_param_array(midi_port, long, NULL, 0444);
MODULE_PARM_DESC(midi_port, "MIDI port # for OPL3-SA driver.");
module_param_array(irq, int, NULL, 0444);
MODULE_PARM_DESC(irq, "IRQ # for OPL3-SA driver.");
module_param_array(dma1, int, NULL, 0444);
MODULE_PARM_DESC(dma1, "DMA1 # for OPL3-SA driver.");
module_param_array(dma2, int, NULL, 0444);
MODULE_PARM_DESC(dma2, "DMA2 # for OPL3-SA driver.");
module_param_array(opl3sa3_ymode, int, NULL, 0444);
MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi.");

#ifdef CONFIG_PNP

static int isa_registered;

static int pnp_registered;

static int pnpc_registered;
#endif

/* control ports */

#define OPL3SA2_PM_CTRL		0x01

#define OPL3SA2_SYS_CTRL		0x02

#define OPL3SA2_IRQ_CONFIG	0x03

#define OPL3SA2_IRQ_STATUS	0x04

#define OPL3SA2_DMA_CONFIG	0x06

#define OPL3SA2_MASTER_LEFT	0x07

#define OPL3SA2_MASTER_RIGHT	0x08

#define OPL3SA2_MIC		0x09

#define OPL3SA2_MISC		0x0A

/* opl3sa3 only */

#define OPL3SA3_DGTL_DOWN	0x12

#define OPL3SA3_ANLG_DOWN	0x13

#define OPL3SA3_WIDE		0x14

#define OPL3SA3_BASS		0x15

#define OPL3SA3_TREBLE		0x16

/* power management bits */

#define OPL3SA2_PM_ADOWN		0x20

#define OPL3SA2_PM_PSV		0x04		

#define OPL3SA2_PM_PDN		0x02

#define OPL3SA2_PM_PDX		0x01


#define OPL3SA2_PM_D0	0x00

#define OPL3SA2_PM_D3	(OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX)


struct snd_opl3sa2 {
	
int version;		/* 2 or 3 */
	
unsigned long port;	/* control port */
	
struct resource *res_port; /* control port resource */
	
int irq;
	
int single_dma;
	
spinlock_t reg_lock;
	
struct snd_hwdep *synth;
	
struct snd_rawmidi *rmidi;
	
struct snd_wss *wss;
	
unsigned char ctlregs[0x20];
	
int ymode;		/* SL added */
	
struct snd_kcontrol *master_switch;
	
struct snd_kcontrol *master_volume;
};


#define PFX	"opl3sa2: "

#ifdef CONFIG_PNP


static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
	{ .id = "YMH0021" },
	{ .id = "NMX2210" },	/* Gateway Solo 2500 */
	{ .id = "" }		/* end */
};

MODULE_DEVICE_TABLE(pnp, snd_opl3sa2_pnpbiosids);


static struct pnp_card_device_id snd_opl3sa2_pnpids[] = {
	/* Yamaha YMF719E-S (Genius Sound Maker 3DX) */
	{ .id = "YMH0020", .devs = { { "YMH0021" } } },
	/* Yamaha OPL3-SA3 (integrated on Intel's Pentium II AL440LX motherboard) */
	{ .id = "YMH0030", .devs = { { "YMH0021" } } },
	/* Yamaha OPL3-SA2 */
	{ .id = "YMH0800", .devs = { { "YMH0021" } } },
	/* Yamaha OPL3-SA2 */
	{ .id = "YMH0801", .devs = { { "YMH0021" } } },
	/* NeoMagic MagicWave 3DX */
	{ .id = "NMX2200", .devs = { { "YMH2210" } } },
	/* NeoMagic MagicWave 3D */
	{ .id = "NMX2200", .devs = { { "NMX2210" } } },
	/* --- */
	{ .id = "" }	/* end */
};

MODULE_DEVICE_TABLE(pnp_card, snd_opl3sa2_pnpids);

#endif /* CONFIG_PNP */


/* read control port (w/o spinlock) */

static unsigned char __snd_opl3sa2_read(struct snd_opl3sa2 *chip, unsigned char reg) { unsigned char result; #if 0 outb(0x1d, port); /* password */ printk(KERN_DEBUG "read [0x%lx] = 0x%x\n", port, inb(port)); #endif outb(reg, chip->port); /* register */ result = inb(chip->port + 1); #if 0 printk(KERN_DEBUG "read [0x%lx] = 0x%x [0x%x]\n", port, result, inb(port)); #endif return result; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela5493.10%133.33%
takashi iwaitakashi iwai46.90%266.67%
Total58100.00%3100.00%

/* read control port (with spinlock) */
static unsigned char snd_opl3sa2_read(struct snd_opl3sa2 *chip, unsigned char reg) { unsigned long flags; unsigned char result; spin_lock_irqsave(&chip->reg_lock, flags); result = __snd_opl3sa2_read(chip, reg); spin_unlock_irqrestore(&chip->reg_lock, flags); return result; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela5496.43%150.00%
takashi iwaitakashi iwai23.57%150.00%
Total56100.00%2100.00%

/* write control port (w/o spinlock) */
static void __snd_opl3sa2_write(struct snd_opl3sa2 *chip, unsigned char reg, unsigned char value) { #if 0 outb(0x1d, port); /* password */ #endif outb(reg, chip->port); /* register */ outb(value, chip->port + 1); chip->ctlregs[reg] = value; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela5496.43%150.00%
takashi iwaitakashi iwai23.57%150.00%
Total56100.00%2100.00%

/* write control port (with spinlock) */
static void snd_opl3sa2_write(struct snd_opl3sa2 *chip, unsigned char reg, unsigned char value) { unsigned long flags; spin_lock_irqsave(&chip->reg_lock, flags); __snd_opl3sa2_write(chip, reg, value); spin_unlock_irqrestore(&chip->reg_lock, flags); }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela5096.15%150.00%
takashi iwaitakashi iwai23.85%150.00%
Total52100.00%2100.00%


static int snd_opl3sa2_detect(struct snd_card *card) { struct snd_opl3sa2 *chip = card->private_data; unsigned long port; unsigned char tmp, tmp1; char str[2]; port = chip->port; if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port); return -EBUSY; } /* snd_printk(KERN_DEBUG "REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); */ chip->version = 0; tmp = snd_opl3sa2_read(chip, OPL3SA2_MISC); if (tmp == 0xff) { snd_printd("OPL3-SA [0x%lx] detect = 0x%x\n", port, tmp); return -ENODEV; } switch (tmp & 0x07) { case 0x01: chip->version = 2; /* YMF711 */ break; default: chip->version = 3; /* 0x02 - standard */ /* 0x03 - YM715B */ /* 0x04 - YM719 - OPL-SA4? */ /* 0x05 - OPL3-SA3 - Libretto 100 */ /* 0x07 - unknown - Neomagic MagicWave 3D */ break; } str[0] = chip->version + '0'; str[1] = 0; strcat(card->shortname, str); snd_opl3sa2_write(chip, OPL3SA2_MISC, tmp ^ 7); if ((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MISC)) != tmp) { snd_printd("OPL3-SA [0x%lx] detect (1) = 0x%x (0x%x)\n", port, tmp, tmp1); return -ENODEV; } /* try if the MIC register is accessible */ tmp = snd_opl3sa2_read(chip, OPL3SA2_MIC); snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x8a); if (((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MIC)) & 0x9f) != 0x8a) { snd_printd("OPL3-SA [0x%lx] detect (2) = 0x%x (0x%x)\n", port, tmp, tmp1); return -ENODEV; } snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x9f); /* initialization */ /* Power Management - full on */ snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0); if (chip->version > 2) { /* ymode is bits 4&5 (of 0 to 7) on all but opl3sa2 versions */ snd_opl3sa2_write(chip, OPL3SA2_SYS_CTRL, (chip->ymode << 4)); } else { /* default for opl3sa2 versions */ snd_opl3sa2_write(chip, OPL3SA2_SYS_CTRL, 0x00); } snd_opl3sa2_write(chip, OPL3SA2_IRQ_CONFIG, 0x0d); /* Interrupt Channel Configuration - IRQ A = OPL3 + MPU + WSS */ if (chip->single_dma) { snd_opl3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x03); /* DMA Configuration - DMA A = WSS-R + WSS-P */ } else { snd_opl3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x21); /* DMA Configuration - DMA B = WSS-R, DMA A = WSS-P */ } snd_opl3sa2_write(chip, OPL3SA2_MISC, 0x80 | (tmp & 7)); /* Miscellaneous - default */ if (chip->version > 2) { snd_opl3sa2_write(chip, OPL3SA3_DGTL_DOWN, 0x00); /* Digital Block Partial Power Down - default */ snd_opl3sa2_write(chip, OPL3SA3_ANLG_DOWN, 0x00); /* Analog Block Partial Power Down - default */ } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela40296.17%225.00%
krzysztof heltkrzysztof helt71.67%112.50%
takashi iwaitakashi iwai71.67%337.50%
uwe kleine-koeniguwe kleine-koenig10.24%112.50%
paul vojtapaul vojta10.24%112.50%
Total418100.00%8100.00%


static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id) { unsigned short status; struct snd_card *card = dev_id; struct snd_opl3sa2 *chip; int handled = 0; if (card == NULL) return IRQ_NONE; chip = card->private_data; status = snd_opl3sa2_read(chip, OPL3SA2_IRQ_STATUS); if (status & 0x20) { handled = 1; snd_opl3_interrupt(chip->synth); } if ((status & 0x10) && chip->rmidi != NULL) { handled = 1; snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data); } if (status & 0x07) { /* TI,CI,PI */ handled = 1; snd_wss_interrupt(irq, chip->wss); } if (status & 0x40) { /* hardware volume change */ handled = 1; /* reading from Master Lch register at 0x07 clears this bit */ snd_opl3sa2_read(chip, OPL3SA2_MASTER_RIGHT); snd_opl3sa2_read(chip, OPL3SA2_MASTER_LEFT); if (chip->master_switch && chip->master_volume) { snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); } } return IRQ_RETVAL(handled); }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela15073.53%233.33%
andrew mortonandrew morton3718.14%116.67%
krzysztof heltkrzysztof helt167.84%233.33%
takashi iwaitakashi iwai10.49%116.67%
Total204100.00%6100.00%

#define OPL3SA2_SINGLE(xname, xindex, reg, shift, mask, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ .info = snd_wss_info_single, \ .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } #define OPL3SA2_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ .name = xname, .index = xindex, \ .info = snd_wss_info_single, \ .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \ .tlv = { .p = (xtlv) } }
static int snd_opl3sa2_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff; int mask = (kcontrol->private_value >> 16) & 0xff; int invert = (kcontrol->private_value >> 24) & 0xff; spin_lock_irqsave(&chip->reg_lock, flags); ucontrol->value.integer.value[0] = (chip->ctlregs[reg] >> shift) & mask; spin_unlock_irqrestore(&chip->reg_lock, flags); if (invert) ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela14796.08%266.67%
takashi iwaitakashi iwai63.92%133.33%
Total153100.00%3100.00%


static int snd_opl3sa2_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff; int mask = (kcontrol->private_value >> 16) & 0xff; int invert = (kcontrol->private_value >> 24) & 0xff; int change; unsigned short val, oval; val = (ucontrol->value.integer.value[0] & mask); if (invert) val = mask - val; val <<= shift; spin_lock_irqsave(&chip->reg_lock, flags); oval = chip->ctlregs[reg]; val = (oval & ~(mask << shift)) | val; change = val != oval; __snd_opl3sa2_write(chip, reg, val); spin_unlock_irqrestore(&chip->reg_lock, flags); return change; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela17496.67%266.67%
takashi iwaitakashi iwai63.33%133.33%
Total180100.00%3100.00%

#define OPL3SA2_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ .info = snd_wss_info_double, \ .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } #define OPL3SA2_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \ .name = xname, .index = xindex, \ .info = snd_wss_info_double, \ .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22), \ .tlv = { .p = (xtlv) } }
static int snd_opl3sa2_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int left_reg = kcontrol->private_value & 0xff; int right_reg = (kcontrol->private_value >> 8) & 0xff; int shift_left = (kcontrol->private_value >> 16) & 0x07; int shift_right = (kcontrol->private_value >> 19) & 0x07; int mask = (kcontrol->private_value >> 24) & 0xff; int invert = (kcontrol->private_value >> 22) & 1; spin_lock_irqsave(&chip->reg_lock, flags); ucontrol->value.integer.value[0] = (chip->ctlregs[left_reg] >> shift_left) & mask; ucontrol->value.integer.value[1] = (chip->ctlregs[right_reg] >> shift_right) & mask; spin_unlock_irqrestore(&chip->reg_lock, flags); if (invert) { ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1]; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela22397.38%266.67%
takashi iwaitakashi iwai62.62%133.33%
Total229100.00%3100.00%


static int snd_opl3sa2_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int left_reg = kcontrol->private_value & 0xff; int right_reg = (kcontrol->private_value >> 8) & 0xff; int shift_left = (kcontrol->private_value >> 16) & 0x07; int shift_right = (kcontrol->private_value >> 19) & 0x07; int mask = (kcontrol->private_value >> 24) & 0xff; int invert = (kcontrol->private_value >> 22) & 1; int change; unsigned short val1, val2, oval1, oval2; val1 = ucontrol->value.integer.value[0] & mask; val2 = ucontrol->value.integer.value[1] & mask; if (invert) { val1 = mask - val1; val2 = mask - val2; } val1 <<= shift_left; val2 <<= shift_right; spin_lock_irqsave(&chip->reg_lock, flags); if (left_reg != right_reg) { oval1 = chip->ctlregs[left_reg]; oval2 = chip->ctlregs[right_reg]; val1 = (oval1 & ~(mask << shift_left)) | val1; val2 = (oval2 & ~(mask << shift_right)) | val2; change = val1 != oval1 || val2 != oval2; __snd_opl3sa2_write(chip, left_reg, val1); __snd_opl3sa2_write(chip, right_reg, val2); } else { oval1 = chip->ctlregs[left_reg]; val1 = (oval1 & ~((mask << shift_left) | (mask << shift_right))) | val1 | val2; change = val1 != oval1; __snd_opl3sa2_write(chip, left_reg, val1); } spin_unlock_irqrestore(&chip->reg_lock, flags); return change; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela32698.19%266.67%
takashi iwaitakashi iwai61.81%133.33%
Total332100.00%3100.00%

static const DECLARE_TLV_DB_SCALE(db_scale_master, -3000, 200, 0); static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); static struct snd_kcontrol_new snd_opl3sa2_controls[] = { OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), OPL3SA2_DOUBLE_TLV("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1, db_scale_master), OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1), OPL3SA2_SINGLE_TLV("Mic Playback Volume", 0, 0x09, 0, 31, 1, db_scale_5bit_12db_max), OPL3SA2_SINGLE("ZV Port Switch", 0, 0x02, 0, 1, 0), }; static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0), OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0), OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0) };
static void snd_opl3sa2_master_free(struct snd_kcontrol *kcontrol) { struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol); chip->master_switch = NULL; chip->master_volume = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
jaroslav kyselajaroslav kysela2987.88%266.67%
takashi iwaitakashi iwai412.12%133.33%
Total33100.00%3100.00%


static int snd_opl3sa2_mixer(struct snd_card *card) { struct snd_opl3sa2 *chip = card->private_data; struct snd_ctl_elem_id id1, id2; struct snd_kcontrol *kctl; unsigned int idx; int err; memset(&id1, 0, sizeof(id1)); memset(&id2, 0, sizeof(id2)); id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER; /* reassign AUX0 to CD */ strcpy(id1.name, "Aux Playback Switch"); strcpy(id2.name, "CD Playback Switch"); if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { snd_printk(KERN_ERR "Cannot rename opl3sa2 control\n"); return err; } strcpy(id1.name, "Aux Playback Volume"); strcpy(id2.name, "CD Playback Volume"); if ((err = snd_ctl_rename_id(card, &id1, &