]>
Commit | Line | Data |
---|---|---|
95777e06 GKH |
1 | From f97a0944a72b26a2bece72516294e112a890f98a Mon Sep 17 00:00:00 2001 |
2 | From: Takashi Sakamoto <o-takashi@sakamocchi.jp> | |
3 | Date: Tue, 26 Feb 2019 13:38:37 +0900 | |
4 | Subject: ALSA: firewire-motu: fix construction of PCM frame for capture direction | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | From: Takashi Sakamoto <o-takashi@sakamocchi.jp> | |
10 | ||
11 | commit f97a0944a72b26a2bece72516294e112a890f98a upstream. | |
12 | ||
13 | In data blocks of common isochronous packet for MOTU devices, PCM | |
14 | frames are multiplexed in a shape of '24 bit * 4 Audio Pack', described | |
15 | in IEC 61883-6. The frames are not aligned to quadlet. | |
16 | ||
17 | For capture PCM substream, ALSA firewire-motu driver constructs PCM | |
18 | frames by reading data blocks byte-by-byte. However this operation | |
19 | includes bug for lower byte of the PCM sample. This brings invalid | |
20 | content of the PCM samples. | |
21 | ||
22 | This commit fixes the bug. | |
23 | ||
24 | Reported-by: Peter Sjöberg <autopeter@gmail.com> | |
25 | Cc: <stable@vger.kernel.org> # v4.12+ | |
26 | Fixes: 4641c9394010 ("ALSA: firewire-motu: add MOTU specific protocol layer") | |
27 | Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> | |
28 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
29 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
30 | ||
31 | --- | |
32 | sound/firewire/motu/amdtp-motu.c | 4 +++- | |
33 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
34 | ||
35 | --- a/sound/firewire/motu/amdtp-motu.c | |
36 | +++ b/sound/firewire/motu/amdtp-motu.c | |
37 | @@ -136,7 +136,9 @@ static void read_pcm_s32(struct amdtp_st | |
38 | byte = (u8 *)buffer + p->pcm_byte_offset; | |
39 | ||
40 | for (c = 0; c < channels; ++c) { | |
41 | - *dst = (byte[0] << 24) | (byte[1] << 16) | byte[2]; | |
42 | + *dst = (byte[0] << 24) | | |
43 | + (byte[1] << 16) | | |
44 | + (byte[2] << 8); | |
45 | byte += 3; | |
46 | dst++; | |
47 | } |