aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/es18xx.c
diff options
context:
space:
mode:
authorMark Salazar <markTheCoder@justmyself.net>2006-01-16 05:35:40 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:24:17 -0500
commit95b712965f0a50365cc0128dacc27acf562f2ff1 (patch)
tree19e4f44751862c4f89c2e7465735e726a3965ac1 /sound/isa/es18xx.c
parent14086771c04acecc81e3985ca3118b330324194d (diff)
[ALSA] #4/4 for Zoom Video - add Zoom Video support
Modules: ES18xx driver Forth of 4 es18xx.c patches culminating in Zoom Video support. This patch adds Zoom Video support for those chipsets that support it. Testing: This work was initially done on the source from the Debian Sarge ALSA package, then tested on an ES1879. I could not test the Zoom Video function for an ES1878 or ES1869. 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. One quirk (noted in my comments below) is that apparently the datasheet is wrong for one of the ES1879 Zoom Video 'enable' bits, because 1) if you set this bit it messes up PCM playback (speaker_test play a lower frequency) 2) even if you don't set this bit Zoom Video still works. I added a control to toggle the bit on just in case there might be a version of the ES1879 that requires it, but I expect noone will need it. 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.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 93335000c51e..79785808dd60 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -49,6 +49,10 @@
49 * - contrarily to some pages in DS_1869.PDF the rates can be set 49 * - contrarily to some pages in DS_1869.PDF the rates can be set
50 * independently. 50 * independently.
51 * 51 *
52 * - Zoom Video is implemented by sharing the FM DAC, thus the user can
53 * have either FM playback or Video playback but not both simultaneously.
54 * The Video Playback Switch mixer control toggles this choice.
55 *
52 * BUGS: 56 * BUGS:
53 * 57 *
54 * - There is a major trouble I noted: 58 * - There is a major trouble I noted:
@@ -63,7 +67,16 @@
63 * 67 *
64 */ 68 */
65 69
66 70/*
71 * ES1879 NOTES:
72 * - When Zoom Video is enabled (reg 0x71 bit 6 toggled on) the PCM playback
73 * seems to be effected (speaker_test plays a lower frequency). Can't find
74 * anything in the datasheet to account for this, so a Video Playback Switch
75 * control has been included to allow ZV to be enabled only when necessary.
76 * Then again on at least one test system the 0x71 bit 6 enable bit is not
77 * needed for ZV, so maybe the datasheet is entirely wrong here.
78 */
79
67#include <sound/driver.h> 80#include <sound/driver.h>
68#include <linux/init.h> 81#include <linux/init.h>
69#include <linux/err.h> 82#include <linux/err.h>
@@ -1317,10 +1330,20 @@ static struct snd_kcontrol_new snd_es18xx_opt_speaker =
1317 1330
1318static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { 1331static struct snd_kcontrol_new snd_es18xx_opt_1869[] = {
1319ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), 1332ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),
1333ES18XX_SINGLE("Video Playback Switch", 0, 0x7f, 0, 1, 0),
1320ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), 1334ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0),
1321ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) 1335ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0)
1322}; 1336};
1323 1337
1338static struct snd_kcontrol_new snd_es18xx_opt_1878 =
1339 ES18XX_DOUBLE("Video Playback Volume", 0, 0x68, 0x68, 4, 0, 15, 0);
1340
1341static struct snd_kcontrol_new snd_es18xx_opt_1879[] = {
1342ES18XX_SINGLE("Video Playback Switch", 0, 0x71, 6, 1, 0),
1343ES18XX_DOUBLE("Video Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0),
1344ES18XX_DOUBLE("Video Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0)
1345};
1346
1324static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { 1347static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = {
1325ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), 1348ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0),
1326}; 1349};
@@ -1365,7 +1388,6 @@ static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = {
1365ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), 1388ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0),
1366}; 1389};
1367 1390
1368#if 0
1369static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) 1391static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg)
1370{ 1392{
1371 int data; 1393 int data;
@@ -1376,7 +1398,6 @@ static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned ch
1376 spin_unlock_irqrestore(&chip->ctrl_lock, flags); 1398 spin_unlock_irqrestore(&chip->ctrl_lock, flags);
1377 return data; 1399 return data;
1378} 1400}
1379#endif
1380 1401
1381static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip, 1402static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip,
1382 unsigned char reg, unsigned char data) 1403 unsigned char reg, unsigned char data)
@@ -1522,6 +1543,17 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip)
1522 snd_es18xx_mixer_write(chip, 0x58, 0x94); 1543 snd_es18xx_mixer_write(chip, 0x58, 0x94);
1523 snd_es18xx_mixer_write(chip, 0x5a, 0x80); 1544 snd_es18xx_mixer_write(chip, 0x5a, 0x80);
1524 } 1545 }
1546 /* Flip the "enable I2S" bits for those chipsets that need it */
1547 switch (chip->version) {
1548 case 0x1879:
1549 //Leaving I2S enabled on the 1879 screws up the PCM playback (rate effected somehow)
1550 //so a Switch control has been added to toggle this 0x71 bit on/off:
1551 //snd_es18xx_mixer_bits(chip, 0x71, 0x40, 0x40);
1552 /* Note: we fall through on purpose here. */
1553 case 0x1878:
1554 snd_es18xx_config_write(chip, 0x29, snd_es18xx_config_read(chip, 0x29) | 0x40);
1555 break;
1556 }
1525 /* Mute input source */ 1557 /* Mute input source */
1526 if (chip->caps & ES18XX_MUTEREC) 1558 if (chip->caps & ES18XX_MUTEREC)
1527 mask = 0x10; 1559 mask = 0x10;
@@ -1929,6 +1961,19 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip)
1929 if (err < 0) 1961 if (err < 0)
1930 return err; 1962 return err;
1931 } 1963 }
1964 } else if (chip->version == 0x1878) {
1965 err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_1878,
1966 chip));
1967 if (err < 0)
1968 return err;
1969 } else if (chip->version == 0x1879) {
1970 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1879); idx++) {
1971 err = snd_ctl_add(card,
1972 snd_ctl_new1(&snd_es18xx_opt_1879[idx],
1973 chip));
1974 if (err < 0)
1975 return err;
1976 }
1932 } 1977 }
1933 return 0; 1978 return 0;
1934} 1979}