aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_beep.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-07-09 12:48:38 -0400
committerTakashi Iwai <tiwai@suse.de>2009-07-09 12:48:38 -0400
commit305355aad89f1b7eb27cb210fad2f9d3c67b2572 (patch)
treeb7510300fae4fd06a29b2d773fb841e4ca3c8956 /sound/pci/hda/hda_beep.c
parentb1e4422f96a9b4830ffd8119b05211abb830ef4a (diff)
parent005b10769c05fb16db70f7689ffb5ba17e3fc324 (diff)
Merge branch 'fix/hda' into topic/hda
Conflicts: sound/pci/hda/patch_realtek.c Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_beep.c')
-rw-r--r--sound/pci/hda/hda_beep.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 08fe6592ad44..3f51a981e604 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -51,19 +51,22 @@ static void snd_hda_generate_beep(struct work_struct *work)
51 * The tone frequency of beep generator on IDT/STAC codecs is 51 * The tone frequency of beep generator on IDT/STAC codecs is
52 * defined from the 8bit tone parameter, in Hz, 52 * defined from the 8bit tone parameter, in Hz,
53 * freq = 48000 * (257 - tone) / 1024 53 * freq = 48000 * (257 - tone) / 1024
54 * that is from 12kHz to 93.75kHz in step of 46.875 hz 54 * that is from 12kHz to 93.75Hz in steps of 46.875 Hz
55 */ 55 */
56static int beep_linear_tone(struct hda_beep *beep, int hz) 56static int beep_linear_tone(struct hda_beep *beep, int hz)
57{ 57{
58 if (hz <= 0)
59 return 0;
58 hz *= 1000; /* fixed point */ 60 hz *= 1000; /* fixed point */
59 hz = hz - DIGBEEP_HZ_MIN; 61 hz = hz - DIGBEEP_HZ_MIN
62 + DIGBEEP_HZ_STEP / 2; /* round to nearest step */
60 if (hz < 0) 63 if (hz < 0)
61 hz = 0; /* turn off PC beep*/ 64 hz = 0; /* turn off PC beep*/
62 else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) 65 else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN))
63 hz = 0xff; 66 hz = 1; /* max frequency */
64 else { 67 else {
65 hz /= DIGBEEP_HZ_STEP; 68 hz /= DIGBEEP_HZ_STEP;
66 hz++; 69 hz = 255 - hz;
67 } 70 }
68 return hz; 71 return hz;
69} 72}