aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/es18xx.c
diff options
context:
space:
mode:
authorMark Salazar <markTheCoder@justmyself.net>2006-01-16 05:29:09 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:23:52 -0500
commitc1f6d41593d3ef1f778fd6892cc4b916050c7cb9 (patch)
tree573794c432dea568a81ad500b80390001838e0ae /sound/isa/es18xx.c
parent415b09e4559b0c95666af3cebe918386212aef98 (diff)
[ALSA] #1/4 for Zoom Video - resolve common vs chipset specific mixer controls
Modules: ES18xx driver First of 4 es18xx.c patches culminating in Zoom Video support. While adding support for Zoom Video to the es18xx driver I found some of the mixer controls were wrong. Since you guys went to the trouble of supplying the datasheets for the supported chipsets I did a review of all of them and tried to get es18xx.c to accurately reflect the proper mixer controls for each chipset. If the datasheets are wrong then so are my patches. This first patch moves some controls from the common-to-all-chipsets array 'snd_es18xx_base_controls' to a chipset-specific array and adds code to manage that new array. Also while testing on my ES1878 test machine I discovered it needed a couple of udelays in the identify function so those are in this patch as well. Testing: This work was initially done on the source from the Debian Sarge ALSA package, then tested on an ES1879 and an ES1878 machine. Patches were created against the Sarge code and then edited to apply correctly to the ALSA cvs code. Lastly the patched ALSA cvs code was test for successful compilation. No additional testing was done on the ALSA cvs version. Signed-off-by: Mark Salazar <markTheCoder@justmyself.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/es18xx.c')
-rw-r--r--sound/isa/es18xx.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 08f032b51107..bde9860327fe 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1191,19 +1191,22 @@ static int snd_es18xx_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1191 return change; 1191 return change;
1192} 1192}
1193 1193
1194/* Mixer controls
1195 * These arrays contain setup data for mixer controls.
1196 *
1197 * The controls that are universal to all chipsets are fully initialized
1198 * here.
1199 */
1194static struct snd_kcontrol_new snd_es18xx_base_controls[] = { 1200static struct snd_kcontrol_new snd_es18xx_base_controls[] = {
1195ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), 1201ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0),
1196ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), 1202ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1),
1197ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0), 1203ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0),
1198ES18XX_DOUBLE("CD Playback Volume", 0, 0x38, 0x38, 4, 0, 15, 0), 1204ES18XX_DOUBLE("CD Playback Volume", 0, 0x38, 0x38, 4, 0, 15, 0),
1199ES18XX_DOUBLE("FM Playback Volume", 0, 0x36, 0x36, 4, 0, 15, 0), 1205ES18XX_DOUBLE("FM Playback Volume", 0, 0x36, 0x36, 4, 0, 15, 0),
1200ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0),
1201ES18XX_DOUBLE("Mic Playback Volume", 0, 0x1a, 0x1a, 4, 0, 15, 0), 1206ES18XX_DOUBLE("Mic Playback Volume", 0, 0x1a, 0x1a, 4, 0, 15, 0),
1202ES18XX_DOUBLE("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0), 1207ES18XX_DOUBLE("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0),
1203ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0),
1204ES18XX_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0), 1208ES18XX_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0),
1205ES18XX_DOUBLE("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0), 1209ES18XX_DOUBLE("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0),
1206ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),
1207{ 1210{
1208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1209 .name = "Capture Source", 1212 .name = "Capture Source",
@@ -1213,19 +1216,27 @@ ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),
1213} 1216}
1214}; 1217};
1215 1218
1216static struct snd_kcontrol_new snd_es18xx_mono_in_control =
1217ES18XX_DOUBLE("Mono Input Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0);
1218
1219static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { 1219static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = {
1220ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0), 1220ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0),
1221ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0), 1221ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0),
1222ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0), 1222ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0),
1223ES18XX_DOUBLE("FM Capture Volume", 0, 0x6b, 0x6b, 4, 0, 15, 0), 1223ES18XX_DOUBLE("FM Capture Volume", 0, 0x6b, 0x6b, 4, 0, 15, 0),
1224ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0),
1225ES18XX_DOUBLE("CD Capture Volume", 0, 0x6a, 0x6a, 4, 0, 15, 0), 1224ES18XX_DOUBLE("CD Capture Volume", 0, 0x6a, 0x6a, 4, 0, 15, 0),
1226ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0) 1225ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0)
1227}; 1226};
1228 1227
1228/*
1229 * The chipset specific mixer controls
1230 */
1231static struct snd_kcontrol_new snd_es18xx_opt_speaker =
1232 ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0);
1233
1234static struct snd_kcontrol_new snd_es18xx_opt_1869[] = {
1235ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),
1236ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0),
1237ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0)
1238};
1239
1229static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { 1240static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = {
1230ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), 1241ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0),
1231}; 1242};
@@ -1476,11 +1487,14 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip)
1476 } 1487 }
1477 1488
1478 outb(0x40, chip->port + 0x04); 1489 outb(0x40, chip->port + 0x04);
1490 udelay(10);
1479 hi = inb(chip->port + 0x05); 1491 hi = inb(chip->port + 0x05);
1492 udelay(10);
1480 lo = inb(chip->port + 0x05); 1493 lo = inb(chip->port + 0x05);
1481 if (hi != lo) { 1494 if (hi != lo) {
1482 chip->version = hi << 8 | lo; 1495 chip->version = hi << 8 | lo;
1483 chip->ctrl_port = inb(chip->port + 0x05) << 8; 1496 chip->ctrl_port = inb(chip->port + 0x05) << 8;
1497 udelay(10);
1484 chip->ctrl_port += inb(chip->port + 0x05); 1498 chip->ctrl_port += inb(chip->port + 0x05);
1485 1499
1486 if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) { 1500 if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) {
@@ -1778,10 +1792,6 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip)
1778 } 1792 }
1779 } 1793 }
1780 1794
1781 if (chip->caps & ES18XX_MONO) {
1782 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_mono_in_control, chip))) < 0)
1783 return err;
1784 }
1785 if (chip->caps & ES18XX_RECMIX) { 1795 if (chip->caps & ES18XX_RECMIX) {
1786 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) { 1796 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) {
1787 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0) 1797 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0)
@@ -1819,6 +1829,23 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip)
1819 1829
1820 } 1830 }
1821 } 1831 }
1832 /* finish initializing other chipset specific controls
1833 */
1834 if (chip->version != 0x1868) {
1835 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_speaker,
1836 chip));
1837 if (err < 0)
1838 return err;
1839 }
1840 if (chip->version == 0x1869) {
1841 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1869); idx++) {
1842 err = snd_ctl_add(card,
1843 snd_ctl_new1(&snd_es18xx_opt_1869[idx],
1844 chip));
1845 if (err < 0)
1846 return err;
1847 }
1848 }
1822 return 0; 1849 return 0;
1823} 1850}
1824 1851