aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/pcsp
diff options
context:
space:
mode:
Diffstat (limited to 'sound/drivers/pcsp')
-rw-r--r--sound/drivers/pcsp/pcsp.h6
-rw-r--r--sound/drivers/pcsp/pcsp_mixer.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/sound/drivers/pcsp/pcsp.h b/sound/drivers/pcsp/pcsp.h
index f07cc1ee1fe7..1d661f795e8c 100644
--- a/sound/drivers/pcsp/pcsp.h
+++ b/sound/drivers/pcsp/pcsp.h
@@ -24,7 +24,8 @@ static DEFINE_SPINLOCK(i8253_lock);
24/* default timer freq for PC-Speaker: 18643 Hz */ 24/* default timer freq for PC-Speaker: 18643 Hz */
25#define DIV_18KHZ 64 25#define DIV_18KHZ 64
26#define MAX_DIV DIV_18KHZ 26#define MAX_DIV DIV_18KHZ
27#define CUR_DIV() (MAX_DIV >> chip->treble) 27#define CALC_DIV(d) (MAX_DIV >> (d))
28#define CUR_DIV() CALC_DIV(chip->treble)
28#define PCSP_MAX_TREBLE 1 29#define PCSP_MAX_TREBLE 1
29 30
30/* unfortunately, with hrtimers 37KHz does not work very well :( */ 31/* unfortunately, with hrtimers 37KHz does not work very well :( */
@@ -36,7 +37,8 @@ static DEFINE_SPINLOCK(i8253_lock);
36#define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1) 37#define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1)
37#define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PCSP_DEFAULT_SDIV) 38#define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PCSP_DEFAULT_SDIV)
38#define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBLE - chip->treble)) 39#define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBLE - chip->treble))
39#define PCSP_RATE() (PIT_TICK_RATE / CUR_DIV()) 40#define PCSP_CALC_RATE(i) (PIT_TICK_RATE / CALC_DIV(i))
41#define PCSP_RATE() PCSP_CALC_RATE(chip->treble)
40#define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE 42#define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE
41#define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE 43#define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE
42#define PCSP_MAX_PERIOD_NS (1000000000ULL * PCSP_MIN_RATE__1) 44#define PCSP_MAX_PERIOD_NS (1000000000ULL * PCSP_MIN_RATE__1)
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c
index 64a695fef74e..caeb0f57fcca 100644
--- a/sound/drivers/pcsp/pcsp_mixer.c
+++ b/sound/drivers/pcsp/pcsp_mixer.c
@@ -50,7 +50,8 @@ static int pcsp_treble_info(struct snd_kcontrol *kcontrol,
50 uinfo->value.enumerated.items = chip->max_treble + 1; 50 uinfo->value.enumerated.items = chip->max_treble + 1;
51 if (uinfo->value.enumerated.item > chip->max_treble) 51 if (uinfo->value.enumerated.item > chip->max_treble)
52 uinfo->value.enumerated.item = chip->max_treble; 52 uinfo->value.enumerated.item = chip->max_treble;
53 sprintf(uinfo->value.enumerated.name, "%d", PCSP_RATE()); 53 sprintf(uinfo->value.enumerated.name, "%d",
54 PCSP_CALC_RATE(uinfo->value.enumerated.item));
54 return 0; 55 return 0;
55} 56}
56 57