From 3463d8fa14ba2e00ede9894efdaa65189eb04b36 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Thu, 28 Feb 2008 11:53:41 +0100 Subject: [ALSA] sound: es1968.c fox shadowed variable warning id is used when initializing the mixer elements, use elem_id here instead. sound/pci/es1968.c:1963:25: warning: symbol 'id' shadows an earlier one sound/pci/es1968.c:129:13: originally declared here Signed-off-by: Harvey Harrison Signed-off-by: Takashi Iwai --- sound/pci/es1968.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'sound/pci/es1968.c') diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 7d911a18c08..67f03264f87 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -1972,7 +1972,7 @@ snd_es1968_mixer(struct es1968 *chip) { struct snd_ac97_bus *pbus; struct snd_ac97_template ac97; - struct snd_ctl_elem_id id; + struct snd_ctl_elem_id elem_id; int err; static struct snd_ac97_bus_ops ops = { .write = snd_es1968_ac97_write, @@ -1989,14 +1989,14 @@ snd_es1968_mixer(struct es1968 *chip) return err; /* attach master switch / volumes for h/w volume control */ - memset(&id, 0, sizeof(id)); - id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(id.name, "Master Playback Switch"); - chip->master_switch = snd_ctl_find_id(chip->card, &id); - memset(&id, 0, sizeof(id)); - id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strcpy(id.name, "Master Playback Volume"); - chip->master_volume = snd_ctl_find_id(chip->card, &id); + memset(&elem_id, 0, sizeof(elem_id)); + elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; + strcpy(elem_id.name, "Master Playback Switch"); + chip->master_switch = snd_ctl_find_id(chip->card, &elem_id); + memset(&elem_id, 0, sizeof(elem_id)); + elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; + strcpy(elem_id.name, "Master Playback Volume"); + chip->master_volume = snd_ctl_find_id(chip->card, &elem_id); return 0; } -- cgit v1.2.3 From f24bfa53dab478e1bde2d7fd39d3c1a69dc518f1 Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Mon, 14 Apr 2008 13:08:05 +0200 Subject: [ALSA] es1968: fix jitter on some maestro cards This patch suppresses jitter on several Maestro cards in stereo mode (ALSA of course). The patch is also incorporated in the *BSD drivers where I "ported" it from. Without this patch most of the stereo audio gets out of sync and really distorted (oss-emulation with mplayer at 48000khz worked somehow). Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/es1968.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'sound/pci/es1968.c') diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 67f03264f87..f8f3bb662d1 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -1827,6 +1827,23 @@ snd_es1968_pcm(struct es1968 *chip, int device) return 0; } +/* + * suppress jitter on some maestros when playing stereo + */ +static void snd_es1968_suppress_jitter(struct es1968 *chip, struct esschan *es) +{ + unsigned int cp1; + unsigned int cp2; + unsigned int diff; + + cp1 = __apu_get_register(chip, 0, 5); + cp2 = __apu_get_register(chip, 1, 5); + diff = (cp1 > cp2 ? cp1 - cp2 : cp2 - cp1); + + if (diff > 1) { + __maestro_write(chip, IDR0_DATA_PORT, cp1); + } +} /* * update pointer @@ -1948,8 +1965,11 @@ static irqreturn_t snd_es1968_interrupt(int irq, void *dev_id) struct esschan *es; spin_lock(&chip->substream_lock); list_for_each_entry(es, &chip->substream_list, list) { - if (es->running) + if (es->running) { snd_es1968_update_pcm(chip, es); + if (es->fmt & ESS_FMT_STEREO) + snd_es1968_suppress_jitter(chip, es); + } } spin_unlock(&chip->substream_lock); if (chip->in_measurement) { -- cgit v1.2.3 From 66c9aa6043798197e1760eaf4c5f510d6c69b95a Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 14 Apr 2008 13:09:33 +0200 Subject: [ALSA] es1968 - fix coding style in the last patch WARNING: braces {} are not necessary for single statement blocks #40: FILE: sound/pci/es1968.c:1831: + if (diff > 1) { + __maestro_write(chip, IDR0_DATA_PORT, cp1); + } total: 0 errors, 1 warnings, 35 lines checked ./patches/es1968-fix-jitter-on-some-maestro-cards.patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches Cc: Andreas Mueller Tested-by: Rene Herman Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/pci/es1968.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sound/pci/es1968.c') diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index f8f3bb662d1..13837989606 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -1840,9 +1840,8 @@ static void snd_es1968_suppress_jitter(struct es1968 *chip, struct esschan *es) cp2 = __apu_get_register(chip, 1, 5); diff = (cp1 > cp2 ? cp1 - cp2 : cp2 - cp1); - if (diff > 1) { + if (diff > 1) __maestro_write(chip, IDR0_DATA_PORT, cp1); - } } /* -- cgit v1.2.3 From f000fd80937c0d94c67f9f3e7026f1fbc8ef8873 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Tue, 22 Apr 2008 13:50:34 +0200 Subject: [ALSA] Fix synchronize_irq() bugs, redundancies free_irq() calls synchronize_irq() for you, so there is no need for drivers to manually do the same thing (again). Thus, calls where sync-irq immediately precedes free-irq can be simplified. However, during this audit several bugs were noticed, where free-irq is preceded by a "irq >= 0" check... but the sync-irq call is not covered by the same check. So, where sync-irq could not be eliminated completely, the missing check was added. Signed-off-by: Jeff Garzik Signed-off-by: Takashi Iwai --- sound/pci/es1968.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound/pci/es1968.c') diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 13837989606..1bf298d214b 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -2475,7 +2475,8 @@ static inline void snd_es1968_free_gameport(struct es1968 *chip) { } static int snd_es1968_free(struct es1968 *chip) { if (chip->io_port) { - synchronize_irq(chip->irq); + if (chip->irq >= 0) + synchronize_irq(chip->irq); outw(1, chip->io_port + 0x04); /* clear WP interrupts */ outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */ } -- cgit v1.2.3