Re: Patch for ymfpci in 2.5.x

Pete Zaitcev (zaitcev@redhat.com)
Tue, 22 Jan 2002 00:11:25 -0500


> Date: Fri, 11 Jan 2002 10:36:30 -0800 (PST)
> From: Linus Torvalds <torvalds@transmeta.com>

> It would have been even saner to give that bit some sane name, and have
> something like
>
> #define YMFPCI_XXXBIT (__constant_cpu_to_le32(0x40000000))
>
> instead of creating a totally nonsensical random number.

I think something like this would be better than one more
totally nonsesical random #define:

--- linux-2.5.2/drivers/sound/ymfpci.c Fri Jan 11 10:34:43 2002
+++ linux-2.5.2-p3/drivers/sound/ymfpci.c Mon Jan 21 21:06:48 2002
@@ -832,6 +832,13 @@
u32 lpfK = ymfpci_calc_lpfK(rate);
ymfpci_playback_bank_t *bank;
int nbank;
+
+ /*
+ * The gain is a floating point number. According to the manual,
+ * bit 31 indicates a sign bit, bit 30 indicates an integer part,
+ * and bits [29:15] indicate a decimal fraction part. Thus,
+ * for a gain of 1.0 the constant of 0x40000000 is loaded.
+ */
unsigned le_0x40000000 = cpu_to_le32(0x40000000);

format = (stereo ? 0x00010000 : 0) | (w_16 ? 0 : 0x80000000);

-- Pete
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/