Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series

For Focusrite Saffire Pro i/o, the lowest 8 bits of register represents
configured source of sampling clock. The next lowest 8 bits represents
whether the configured source is actually detected or not just after
the register is changed for the source.

Current implementation evaluates whole the register to detect configured
source. This results in failure due to the next lowest 8 bits when the
source is connected in advance.

This commit fixes the bug.

Fixes: 25784ec2d034 ("ALSA: bebob: Add support for Focusrite Saffire/SaffirePro series")
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191102150920.20367-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Takashi Sakamoto and committed by
Takashi Iwai
706ad674 a3933186

+3
+3
sound/firewire/bebob/bebob_focusrite.c
··· 27 27 #define SAFFIRE_CLOCK_SOURCE_SPDIF 1 28 28 29 29 /* clock sources as returned from register of Saffire Pro 10 and 26 */ 30 + #define SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK 0x000000ff 31 + #define SAFFIREPRO_CLOCK_SOURCE_DETECT_MASK 0x0000ff00 30 32 #define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 0 31 33 #define SAFFIREPRO_CLOCK_SOURCE_SKIP 1 /* never used on hardware */ 32 34 #define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2 ··· 191 189 map = saffirepro_clk_maps[1]; 192 190 193 191 /* In a case that this driver cannot handle the value of register. */ 192 + value &= SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK; 194 193 if (value >= SAFFIREPRO_CLOCK_SOURCE_COUNT || map[value] < 0) { 195 194 err = -EIO; 196 195 goto end;