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

Message ID 20191102150920.20367-1-o-takashi@sakamocchi.jp
State New
Headers show
Series
  • ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series
Related show

Commit Message

Takashi Sakamoto Nov. 2, 2019, 3:09 p.m. UTC
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>
---
 sound/firewire/bebob/bebob_focusrite.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Takashi Iwai Nov. 4, 2019, 8:03 a.m. UTC | #1
On Sat, 02 Nov 2019 16:09:20 +0100,
Takashi Sakamoto wrote:
> 
> 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>

Applied now.  Thanks.


Takashi

Patch
diff mbox series

diff --git a/sound/firewire/bebob/bebob_focusrite.c b/sound/firewire/bebob/bebob_focusrite.c
index 32b864bee25f..06d6a37cd853 100644
--- a/sound/firewire/bebob/bebob_focusrite.c
+++ b/sound/firewire/bebob/bebob_focusrite.c
@@ -27,6 +27,8 @@ 
 #define SAFFIRE_CLOCK_SOURCE_SPDIF		1
 
 /* clock sources as returned from register of Saffire Pro 10 and 26 */
+#define SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK	0x000000ff
+#define SAFFIREPRO_CLOCK_SOURCE_DETECT_MASK	0x0000ff00
 #define SAFFIREPRO_CLOCK_SOURCE_INTERNAL	0
 #define SAFFIREPRO_CLOCK_SOURCE_SKIP		1 /* never used on hardware */
 #define SAFFIREPRO_CLOCK_SOURCE_SPDIF		2
@@ -189,6 +191,7 @@  saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
 		map = saffirepro_clk_maps[1];
 
 	/* In a case that this driver cannot handle the value of register. */
+	value &= SAFFIREPRO_CLOCK_SOURCE_SELECT_MASK;
 	if (value >= SAFFIREPRO_CLOCK_SOURCE_COUNT || map[value] < 0) {
 		err = -EIO;
 		goto end;