1 From 51db452df07bb4c5754b73789253ba21681d9dc2 Mon Sep 17 00:00:00 2001
2 From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
3 Date: Tue, 26 Sep 2017 09:11:49 +0900
4 Subject: Revert "ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members"
6 From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
8 commit 51db452df07bb4c5754b73789253ba21681d9dc2 upstream.
10 This reverts commit 275353bb684e to fix a regression which can abort
11 'alsactl' program in alsa-utils due to assertion in alsa-lib.
13 alsactl: control.c:2513: snd_ctl_elem_value_get_integer: Assertion `idx < sizeof(obj->value.integer.value) / sizeof(obj->value.integer.value[0])' failed.
15 alsactl: control.c:2976: snd_ctl_elem_value_get_integer: Assertion `idx < ARRAY_SIZE(obj->value.integer.value)' failed.
17 This commit is a band-aid. In a point of usage of ALSA control interface,
18 the drivers still bring an issue that they prevent userspace applications
19 to have a consistent way to parse each levels of the dimension information
20 via ALSA control interface.
22 Let me investigate this issue. Current implementation of the drivers
23 have three control element sets with dimension information:
24 * 'Monitor Mixer Volume' (type: integer)
25 * 'VMixer Volume' (type: integer)
26 * 'VU-meters' (type: boolean)
28 Although the number of elements named as 'Monitor Mixer Volume' differs
29 depending on drivers in this group, it can be calculated by macros
30 defined by each driver (= (BX_NUM - BX_ANALOG_IN) * BX_ANALOG_IN). Each
31 of the elements has one member for value and has dimension information
32 with 2 levels (= BX_ANALOG_IN * (BX_NUM - BX_ANALOG_IN)). For these
33 elements, userspace applications are expected to handle the dimension
34 information so that all of the elements construct a matrix where the
35 number of rows and columns are represented by the dimension information.
37 The same way is applied to elements named as 'VMixer Volume'. The number
38 of these elements can also be calculated by macros defined by each
39 drivers (= PX_ANALOG_IN * BX_ANALOG_IN). Each of the element has one
40 member for value and has dimension information with 2 levels
41 (= BX_ANALOG_IN * PX_ANALOG_IN). All of the elements construct a matrix
42 with the dimension information.
44 An element named as 'VU-meters' gets a different way in a point of
45 dimension information. The element includes 96 members for value. The
46 element has dimension information with 3 levels (= 3 or 2 * 16 * 2). For
47 this element, userspace applications are expected to handle the dimension
48 information so that all of the members for value construct a matrix
49 where the number of rows and columns are represented by the dimension
50 information. This is different from the way for the former.
52 As a summary, the drivers were not designed to produce a consistent way to
53 parse the dimension information. This makes it hard for general userspace
54 applications such as amixer to parse the information by a consistent way,
55 and actually no userspace applications except for 'echomixer' utilize the
56 dimension information. Additionally, no drivers excluding this group use
59 The reverted commit was written based on the latter way. A commit
60 860c1994a70a ('ALSA: control: add dimension validator for userspace
61 elements') is written based on the latter way, too. The patch should be
62 reconsider too in the same time to re-define a consistent way to parse the
63 dimension information.
65 Reported-by: Mark Hills <mark@xwax.org>
66 Reported-by: S. Christian Collins <s.chriscollins@gmail.com>
67 Fixes: 275353bb684e ('ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members')
68 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
69 Signed-off-by: Takashi Iwai <tiwai@suse.de>
70 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
73 sound/pci/echoaudio/echoaudio.c | 6 +++---
74 1 file changed, 3 insertions(+), 3 deletions(-)
76 --- a/sound/pci/echoaudio/echoaudio.c
77 +++ b/sound/pci/echoaudio/echoaudio.c
78 @@ -1272,11 +1272,11 @@ static int snd_echo_mixer_info(struct sn
80 chip = snd_kcontrol_chip(kcontrol);
81 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
83 uinfo->value.integer.min = ECHOGAIN_MINOUT;
84 uinfo->value.integer.max = ECHOGAIN_MAXOUT;
85 uinfo->dimen.d[0] = num_busses_out(chip);
86 uinfo->dimen.d[1] = num_busses_in(chip);
87 - uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1];
91 @@ -1344,11 +1344,11 @@ static int snd_echo_vmixer_info(struct s
93 chip = snd_kcontrol_chip(kcontrol);
94 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
96 uinfo->value.integer.min = ECHOGAIN_MINOUT;
97 uinfo->value.integer.max = ECHOGAIN_MAXOUT;
98 uinfo->dimen.d[0] = num_busses_out(chip);
99 uinfo->dimen.d[1] = num_pipes_out(chip);
100 - uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1];
104 @@ -1728,6 +1728,7 @@ static int snd_echo_vumeters_info(struct
105 struct snd_ctl_elem_info *uinfo)
107 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
109 uinfo->value.integer.min = ECHOGAIN_MINOUT;
110 uinfo->value.integer.max = 0;
111 #ifdef ECHOCARD_HAS_VMIXER
112 @@ -1737,7 +1738,6 @@ static int snd_echo_vumeters_info(struct
114 uinfo->dimen.d[1] = 16; /* 16 channels */
115 uinfo->dimen.d[2] = 2; /* 0=level, 1=peak */
116 - uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1] * uinfo->dimen.d[2];