Skip to content

Commit bbd6aac

Browse files
takaswietiwai
authored andcommitted
ALSA: fireface: fix configuration error for nominal sampling transfer frequency
128000 and 192000 are congruence modulo 32000, thus it's wrong to distinguish them as multiple of 32000 and 48000 by modulo 32000 at first. Additionally, used condition statement to detect quadruple speed can cause missing bit flag. Furthermore, counter to ensure the configuration is wrong and it causes false positive. This commit fixes the above three bugs. Cc: <stable@vger.kernel.org> Fixes: 60aec49 ("ALSA: fireface: support allocate_resources operation in latter protocol") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 69efd5c commit bbd6aac

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎sound/firewire/fireface/ff-protocol-latter.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,18 @@ static int latter_allocate_resources(struct snd_ff *ff, unsigned int rate)
107107
int err;
108108

109109
// Set the number of data blocks transferred in a second.
110-
if (rate % 32000 == 0)
111-
code = 0x00;
110+
if (rate % 48000 == 0)
111+
code = 0x04;
112112
else if (rate % 44100 == 0)
113113
code = 0x02;
114-
else if (rate % 48000 == 0)
115-
code = 0x04;
114+
else if (rate % 32000 == 0)
115+
code = 0x00;
116116
else
117117
return -EINVAL;
118118

119119
if (rate >= 64000 && rate < 128000)
120120
code |= 0x08;
121-
else if (rate >= 128000 && rate < 192000)
121+
else if (rate >= 128000)
122122
code |= 0x10;
123123

124124
reg = cpu_to_le32(code);
@@ -140,7 +140,7 @@ static int latter_allocate_resources(struct snd_ff *ff, unsigned int rate)
140140
if (curr_rate == rate)
141141
break;
142142
}
143-
if (count == 10)
143+
if (count > 10)
144144
return -ETIMEDOUT;
145145

146146
for (i = 0; i < ARRAY_SIZE(amdtp_rate_table); ++i) {

0 commit comments

Comments
 (0)