]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[ALSA] snd-pcsp - fix pcsp_treble_info() to honour an item number
authorStas Sergeev <stsp@aknet.ru>
Sat, 24 May 2008 16:05:47 +0000 (18:05 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sun, 25 May 2008 16:21:10 +0000 (18:21 +0200)
This solves the problem with mixers wrongly displaying the PWM freq.

Signed-off-by: Stas Sergeev <stsp@aknet.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/drivers/pcsp/pcsp.h
sound/drivers/pcsp/pcsp_mixer.c

index f07cc1ee1fe7a4ca33eef4df1ce5739a369d9f0f..1d661f795e8c15f13342ffeb221901d922e8b10d 100644 (file)
@@ -24,7 +24,8 @@ static DEFINE_SPINLOCK(i8253_lock);
 /* 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 @@ static DEFINE_SPINLOCK(i8253_lock);
 #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)
index 64a695fef74e2417ed8e24ef683f5cbb24b7ccd9..caeb0f57fccaf1cfeb6f295dc9b871cd00171ade 100644 (file)
@@ -50,7 +50,8 @@ static int pcsp_treble_info(struct snd_kcontrol *kcontrol,
        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;
 }