[alsa-devel] [RFC] ALSA: usb-audio: Add custom mixer status quirks for RME CC devices
Takashi Iwai
tiwai at suse.de
Fri Sep 21 09:01:26 CEST 2018
On Fri, 21 Sep 2018 00:07:19 +0200,
Jussi Laako wrote:
>
> This patch accessing vendor specific registers of RME Class Compliant
> devices works otherwise fine, but there is still one small problem. It is
> supposed to be a polled from the hardware, since the values indicate
> device status and are subject to change at all times. Behavior is correct
> if I keep running "amixer" all the time to retrieve values - sampling rate
> changes are visible and values get updated. However, when I poll the
> values from an application without reopening the mixer, they are being
> cached somewhere and the changes are not reflected. This problem doesn't
> exist for example with PCIe based RME HDSPe AIO and application gets
> updated values, but in this USB based device case they don't get updated.
> I have flagged all the mixer controls as read-only and volatile, but the
> volatile flag is not honored in this (assuming I've understood it correctly).
>
> Any guidance on how to fix the caching problem is welcome!
The caching is currently enabled for all elements, but changing it
should be trivial. The patch below adds is_volatile flag to the
element, and you can set it to true in the quirk somehow for uncached
controls.
thanks,
Takashi
---
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -449,8 +449,10 @@ int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval,
cval->control, channel, err);
return err;
}
- cval->cached |= 1 << channel;
- cval->cache_val[index] = *value;
+ if (!cval->is_volatile) {
+ cval->cached |= 1 << channel;
+ cval->cache_val[index] = *value;
+ }
return 0;
}
@@ -540,8 +542,10 @@ int snd_usb_set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel,
value);
if (err < 0)
return err;
- cval->cached |= 1 << channel;
- cval->cache_val[index] = value;
+ if (!cval->is_volatile) {
+ cval->cached |= 1 << channel;
+ cval->cache_val[index] = value;
+ }
return 0;
}
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 3d12af8bf191..cfbc274ce89f 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -70,6 +70,7 @@ struct usb_mixer_elem_info {
int val_type;
int min, max, res;
int dBmin, dBmax;
+ bool is_volatile;
int cached;
int cache_val[MAX_CHANNELS];
u8 initialized;
More information about the Alsa-devel
mailing list