* YMFPCI: IEC958 volume does not work anymore (2.6.18->2.6.21)
@ 2007-07-20 7:22 Jan Zuchhold
2007-07-23 15:56 ` Clemens Ladisch
0 siblings, 1 reply; 3+ messages in thread
From: Jan Zuchhold @ 2007-07-20 7:22 UTC (permalink / raw)
To: ALSA development
[-- Attachment #1.1: Type: text/plain, Size: 458 bytes --]
Hello,
i'm using a Hoontech Soundtrack Digital-XG (YMF744) and after i've upgraded to
kernel 2.6.21, i can't control the IEC958 volume (using "Wave volume") any
longer. It seems to be always at maximum volume. The volume control of the
analog output port works fine.
This is working in 2.6.18, that i've used before. Something must have changed
in between.
Is there anything I can do to help to get this working again?
Thanks alot,
Jan
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: YMFPCI: IEC958 volume does not work anymore (2.6.18->2.6.21)
2007-07-20 7:22 YMFPCI: IEC958 volume does not work anymore (2.6.18->2.6.21) Jan Zuchhold
@ 2007-07-23 15:56 ` Clemens Ladisch
2007-07-24 18:41 ` Jan Zuchhold
0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2007-07-23 15:56 UTC (permalink / raw)
To: Jan Zuchhold, ALSA development
[-- Attachment #1: Type: text/plain, Size: 279 bytes --]
Jan Zuchhold wrote:
> Hello,
>
> i'm using a Hoontech Soundtrack Digital-XG (YMF744) and after i've upgraded to
> kernel 2.6.21, i can't control the IEC958 volume (using "Wave volume") any
> longer.
This happens only for 44.1 kHz data.
Try the attached patch.
HTH
Clemens
[-- Attachment #2: ymf-441-vol.diff --]
[-- Type: application/octet-stream, Size: 6848 bytes --]
ymfpci: fix volume handling of the 44.1 kHz slot
The existing code for handling the 44.1 slot's volume has two problems:
the volume is not affected by the "Wave Playback Volume" mixer control,
and the BUF441OUTVOL register, which is used to control the per-
substream volume for this slot, uses a different scale than the gain
fields of the other slots.
This patch makes the BUF441OUTVOL register a shadow of the
NATIVEDACOUTVOL register so that the Wave volume is consistent for all
substreams.
As a consequence of this, the per-substream PCM volume control gets no
longer activated for the substream using this slot. The code for
(de)activating the mixer control is moved from the open/close to the
prepare/trigger_stop callbacks so that it is able to determine the
substream's slot.
Index: alsa/alsa-kernel/pci/ymfpci/ymfpci_main.c
===================================================================
--- alsa.orig/alsa-kernel/pci/ymfpci/ymfpci_main.c 2007-07-21 11:19:27.000000000 +0200
+++ alsa/alsa-kernel/pci/ymfpci/ymfpci_main.c 2007-07-22 19:54:57.000000000 +0200
@@ -171,17 +171,6 @@ static u32 snd_ymfpci_calc_lpfQ(u32 rate
return val[0];
}
-static void snd_ymfpci_pcm_441_volume_set(struct snd_ymfpci_pcm *ypcm)
-{
- unsigned int value;
- struct snd_ymfpci_pcm_mixer *mixer;
-
- mixer = &ypcm->chip->pcm_mixer[ypcm->substream->number];
- value = min_t(unsigned int, mixer->left, 0x7fff) >> 1;
- value |= (min_t(unsigned int, mixer->right, 0x7fff) >> 1) << 16;
- snd_ymfpci_writel(ypcm->chip, YDSXGR_BUF441OUTVOL, value);
-}
-
/*
* Hardware start management
*/
@@ -389,6 +378,7 @@ static int snd_ymfpci_playback_trigger(s
{
struct snd_ymfpci *chip = snd_pcm_substream_chip(substream);
struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data;
+ struct snd_kcontrol *kctl = NULL;
int result = 0;
spin_lock(&chip->reg_lock);
@@ -406,6 +396,11 @@ static int snd_ymfpci_playback_trigger(s
ypcm->running = 1;
break;
case SNDRV_PCM_TRIGGER_STOP:
+ if (substream->pcm == chip->pcm && !ypcm->use_441_slot) {
+ kctl = chip->pcm_mixer[substream->number].ctl;
+ kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+ }
+ /* fall through */
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
chip->ctrl_playback[ypcm->voices[0]->number + 1] = 0;
@@ -419,6 +414,8 @@ static int snd_ymfpci_playback_trigger(s
}
__unlock:
spin_unlock(&chip->reg_lock);
+ if (kctl)
+ snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
return result;
}
static int snd_ymfpci_capture_trigger(struct snd_pcm_substream *substream,
@@ -526,7 +523,6 @@ static void snd_ymfpci_pcm_init_voice(st
ypcm->chip->src441_used = voice->number;
ypcm->use_441_slot = 1;
format |= 0x10000000;
- snd_ymfpci_pcm_441_volume_set(ypcm);
}
if (ypcm->chip->src441_used == voice->number &&
(format & 0x10000000) == 0) {
@@ -667,6 +663,7 @@ static int snd_ymfpci_playback_prepare(s
struct snd_ymfpci *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm = runtime->private_data;
+ struct snd_kcontrol *kctl;
unsigned int nvoice;
ypcm->period_size = runtime->period_size;
@@ -676,6 +673,12 @@ static int snd_ymfpci_playback_prepare(s
for (nvoice = 0; nvoice < runtime->channels; nvoice++)
snd_ymfpci_pcm_init_voice(ypcm, nvoice, runtime,
substream->pcm == chip->pcm);
+
+ if (substream->pcm == chip->pcm && !ypcm->use_441_slot) {
+ kctl = chip->pcm_mixer[substream->number].ctl;
+ kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
+ snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
+ }
return 0;
}
@@ -926,7 +929,6 @@ static int snd_ymfpci_playback_open(stru
struct snd_ymfpci *chip = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ymfpci_pcm *ypcm;
- struct snd_kcontrol *kctl;
int err;
if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
@@ -941,10 +943,6 @@ static int snd_ymfpci_playback_open(stru
chip->rear_opened++;
}
spin_unlock_irq(&chip->reg_lock);
-
- kctl = chip->pcm_mixer[substream->number].ctl;
- kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
- snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
return 0;
}
@@ -1039,7 +1037,6 @@ static int snd_ymfpci_playback_close(str
{
struct snd_ymfpci *chip = snd_pcm_substream_chip(substream);
struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data;
- struct snd_kcontrol *kctl;
spin_lock_irq(&chip->reg_lock);
if (ypcm->output_rear && chip->rear_opened > 0) {
@@ -1047,9 +1044,6 @@ static int snd_ymfpci_playback_close(str
ymfpci_close_extension(chip);
}
spin_unlock_irq(&chip->reg_lock);
- kctl = chip->pcm_mixer[substream->number].ctl;
- kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
- snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
return snd_ymfpci_playback_close_1(substream);
}
@@ -1567,6 +1561,26 @@ static int snd_ymfpci_put_double(struct
return change;
}
+static int snd_ymfpci_put_nativedacvol(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_ymfpci *chip = snd_kcontrol_chip(kcontrol);
+ unsigned int reg = YDSXGR_NATIVEDACOUTVOL;
+ unsigned int reg2 = YDSXGR_BUF441OUTVOL;
+ int change;
+ unsigned int value, oval;
+
+ value = ucontrol->value.integer.value[0] & 0x3fff;
+ value |= (ucontrol->value.integer.value[1] & 0x3fff) << 16;
+ spin_lock_irq(&chip->reg_lock);
+ oval = snd_ymfpci_readl(chip, reg);
+ change = value != oval;
+ snd_ymfpci_writel(chip, reg, value);
+ snd_ymfpci_writel(chip, reg2, value);
+ spin_unlock_irq(&chip->reg_lock);
+ return change;
+}
+
/*
* 4ch duplication
*/
@@ -1598,7 +1612,17 @@ static int snd_ymfpci_put_dup4ch(struct
static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = {
-YMFPCI_DOUBLE("Wave Playback Volume", 0, YDSXGR_NATIVEDACOUTVOL),
+{
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Wave Playback Volume",
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READ,
+ .info = snd_ymfpci_info_double,
+ .get = snd_ymfpci_get_double,
+ .put = snd_ymfpci_put_nativedacvol,
+ .private_value = YDSXGR_NATIVEDACOUTVOL,
+ .tlv = { .p = db_scale_native },
+},
YMFPCI_DOUBLE("Wave Capture Volume", 0, YDSXGR_NATIVEDACLOOPVOL),
YMFPCI_DOUBLE("Digital Capture Volume", 0, YDSXGR_NATIVEDACINVOL),
YMFPCI_DOUBLE("Digital Capture Volume", 1, YDSXGR_NATIVEADCINVOL),
@@ -1748,8 +1772,6 @@ static int snd_ymfpci_pcm_vol_put(struct
struct snd_ymfpci_pcm *ypcm = substream->runtime->private_data;
if (!ypcm->use_441_slot)
ypcm->update_pcm_vol = 2;
- else
- snd_ymfpci_pcm_441_volume_set(ypcm);
}
spin_unlock_irqrestore(&chip->voice_lock, flags);
return 1;
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: YMFPCI: IEC958 volume does not work anymore (2.6.18->2.6.21)
2007-07-23 15:56 ` Clemens Ladisch
@ 2007-07-24 18:41 ` Jan Zuchhold
0 siblings, 0 replies; 3+ messages in thread
From: Jan Zuchhold @ 2007-07-24 18:41 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 393 bytes --]
Hello,
> > i'm using a Hoontech Soundtrack Digital-XG (YMF744) and after i've
> > upgraded to kernel 2.6.21, i can't control the IEC958 volume (using "Wave
> > volume") any longer.
>
> This happens only for 44.1 kHz data.
>
> Try the attached patch.
great, it's working!
Could you please mail me a way to reward you (Paypal account? Amazon wishlist
etc?)?
Thank you,
Jan
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-24 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-20 7:22 YMFPCI: IEC958 volume does not work anymore (2.6.18->2.6.21) Jan Zuchhold
2007-07-23 15:56 ` Clemens Ladisch
2007-07-24 18:41 ` Jan Zuchhold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.