Skip to contentSkip to conversation

snd-pcsp: fix pcsp_treble_info() to honour the item number

PATCH In review Stas Sergeev 2 participants 2 messages May 23, 2008 – May 26, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 snd-pcsp: fix pcsp_treble_info() to honour the item number

Hello.

The attached patch fixes the problem
with mixers not properly displaying
the PWM freq. The bug was that the
pcsp_treble_info() didn't take the
item number into an account.

Takashi, could you please apply?

# HG changeset patch
# User Stas Sergeev <[email protected]>
# Date 1211572692 -14400
# Node ID 15efd0d72bdec6b30cad2ea225c0d9d2be07e150
# Parent 2278b9a6058f5b45081f8227902df585474a81a6
snd-pcsp: fix pcsp_treble_info() to honour an item number. This solves the problem with mixers wrongly displaying the PWM freq.

drivers/pcsp/pcsp.h +4 -2
diff -r 2278b9a6058f -r 15efd0d72bde drivers/pcsp/pcsp.h
@@ -24,7 +24,8 @@
 /* default timer freq for PC-Speaker: 18643 Hz */
 #define DIV_18KHZ 64
 #define MAX_DIV DIV_18KHZ
-#define CUR_DIV() (MAX_DIV >> chip->treble)
+#define CALC_DIV(d) (MAX_DIV >> (d))
+#define CUR_DIV() CALC_DIV(chip->treble)
 #define PCSP_MAX_TREBLE 1
 
 /* unfortunately, with hrtimers 37KHz does not work very well :( */
@@ -36,7 +37,8 @@
 #define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1)
 #define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PCSP_DEFAULT_SDIV)
 #define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBLE - chip->treble))
-#define PCSP_RATE() (PIT_TICK_RATE / CUR_DIV())
+#define PCSP_CALC_RATE(i) (PIT_TICK_RATE / CALC_DIV(i))
+#define PCSP_RATE() PCSP_CALC_RATE(chip->treble)
 #define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE
 #define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE
 #define PCSP_MAX_PERIOD_NS (1000000000ULL * PCSP_MIN_RATE__1)
drivers/pcsp/pcsp_mixer.c +2 -1
diff -r 2278b9a6058f -r 15efd0d72bde drivers/pcsp/pcsp_mixer.c
@@ -50,7 +50,8 @@
 	uinfo->value.enumerated.items = chip->max_treble + 1;
 	if (uinfo->value.enumerated.item > chip->max_treble)
 		uinfo->value.enumerated.item = chip->max_treble;
-	sprintf(uinfo->value.enumerated.name, "%d", PCSP_RATE());
+	sprintf(uinfo->value.enumerated.name, "%d",
+			PCSP_CALC_RATE(uinfo->value.enumerated.item));
 	return 0;
 }
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw

At Sat, 24 May 2008 00:04:33 +0400,

Quoted 19 lines · Stas Sergeev

Hello.

The attached patch fixes the problem
with mixers not properly displaying
the PWM freq. The bug was that the
pcsp_treble_info() didn't take the
item number into an account.

Takashi, could you please apply?
[2 pcsp_tre.diff <text/x-patch (7bit)>]
# HG changeset patch
# User Stas Sergeev <[email protected]>
# Date 1211572692 -14400
# Node ID 15efd0d72bdec6b30cad2ea225c0d9d2be07e150
# Parent 2278b9a6058f5b45081f8227902df585474a81a6
snd-pcsp: fix pcsp_treble_info() to honour an item number. This solves the problem with mixers wrongly displaying the PWM freq.

Quoted 2 lines

Thanks, it was merged to Linus git tree.

Takashi