* [bug report] ALSA: firewire-motu: add support for MOTU 828mk3 (FireWire/Hybrid) as a model with protocol version 3
@ 2017-03-31 12:50 Dan Carpenter
2017-03-31 13:29 ` Takashi Sakamoto
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-03-31 12:50 UTC (permalink / raw)
To: o-takashi; +Cc: alsa-devel
Hello Takashi Sakamoto,
The patch 5992e30034c4: "ALSA: firewire-motu: add support for MOTU
828mk3 (FireWire/Hybrid) as a model with protocol version 3" from Mar
22, 2017, leads to the following static checker warning:
sound/firewire/motu/motu-protocol-v3.c:104 v3_get_clock_source()
warn: mask and shift to zero
sound/firewire/motu/motu-protocol-v3.c
90 static int v3_get_clock_source(struct snd_motu *motu,
91 enum snd_motu_clock_source *src)
92 {
93 __be32 reg;
94 u32 data;
95 unsigned int val;
96 int err;
97
98 err = snd_motu_transaction_read(motu, V3_CLOCK_STATUS_OFFSET, ®,
99 sizeof(reg));
100 if (err < 0)
101 return err;
102 data = be32_to_cpu(reg);
103
104 val = (data & V3_CLOCK_SOURCE_MASK) >> V3_CLOCK_SOURCE_SHIFT;
0xff >> 8
val is always zero. These are the only places we use
V3_CLOCK_SOURCE_MASK and V3_CLOCK_SOURCE_SHIFT so I have no idea what
it should be.
105 if (val == 0x00) {
106 *src = SND_MOTU_CLOCK_SOURCE_INTERNAL;
107 } else if (val == 0x01) {
108 *src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC;
109 } else if (val == 0x10) {
110 *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX;
111 } else if (val == 0x18 || val == 0x19) {
112 err = snd_motu_transaction_read(motu, V3_OPT_IFACE_MODE_OFFSET,
113 ®, sizeof(reg));
114 if (err < 0)
115 return err;
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] ALSA: firewire-motu: add support for MOTU 828mk3 (FireWire/Hybrid) as a model with protocol version 3
2017-03-31 12:50 [bug report] ALSA: firewire-motu: add support for MOTU 828mk3 (FireWire/Hybrid) as a model with protocol version 3 Dan Carpenter
@ 2017-03-31 13:29 ` Takashi Sakamoto
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Sakamoto @ 2017-03-31 13:29 UTC (permalink / raw)
To: Dan Carpenter; +Cc: alsa-devel
Hi Dan,
On Mar 31 2017 21:50, Dan Carpenter wrote:
> Hello Takashi Sakamoto,
>
> The patch 5992e30034c4: "ALSA: firewire-motu: add support for MOTU
> 828mk3 (FireWire/Hybrid) as a model with protocol version 3" from Mar
> 22, 2017, leads to the following static checker warning:
>
> sound/firewire/motu/motu-protocol-v3.c:104 v3_get_clock_source()
> warn: mask and shift to zero
>
> sound/firewire/motu/motu-protocol-v3.c
> 90 static int v3_get_clock_source(struct snd_motu *motu,
> 91 enum snd_motu_clock_source *src)
> 92 {
> 93 __be32 reg;
> 94 u32 data;
> 95 unsigned int val;
> 96 int err;
> 97
> 98 err = snd_motu_transaction_read(motu, V3_CLOCK_STATUS_OFFSET, ®,
> 99 sizeof(reg));
> 100 if (err < 0)
> 101 return err;
> 102 data = be32_to_cpu(reg);
> 103
> 104 val = (data & V3_CLOCK_SOURCE_MASK) >> V3_CLOCK_SOURCE_SHIFT;
> 0xff >> 8
>
> val is always zero. These are the only places we use
> V3_CLOCK_SOURCE_MASK and V3_CLOCK_SOURCE_SHIFT so I have no idea what
> it should be.
>
> 105 if (val == 0x00) {
> 106 *src = SND_MOTU_CLOCK_SOURCE_INTERNAL;
> 107 } else if (val == 0x01) {
> 108 *src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC;
> 109 } else if (val == 0x10) {
> 110 *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX;
> 111 } else if (val == 0x18 || val == 0x19) {
> 112 err = snd_motu_transaction_read(motu, V3_OPT_IFACE_MODE_OFFSET,
> 113 ®, sizeof(reg));
> 114 if (err < 0)
> 115 return err;
Indeed. It's my mistake.
LSB of the register represents current source of clock, thus no need to
shift. I'll post fix this weekend.
Thanks
Takashi Sakamoto
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-31 13:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-31 12:50 [bug report] ALSA: firewire-motu: add support for MOTU 828mk3 (FireWire/Hybrid) as a model with protocol version 3 Dan Carpenter
2017-03-31 13:29 ` Takashi Sakamoto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.