sound: Add a driver for the i8254 beep
Add a sound driver which can output simple beeps using this legacy timer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
79a5be820d
commit
6a27e540de
@ -40,6 +40,18 @@ config I2S_SAMSUNG
|
|||||||
option provides an implementation for sound_init() and
|
option provides an implementation for sound_init() and
|
||||||
sound_play().
|
sound_play().
|
||||||
|
|
||||||
|
config SOUND_I8254
|
||||||
|
bool "Intel i8254 timer / beeper"
|
||||||
|
depends on SOUND
|
||||||
|
help
|
||||||
|
This enables support for a beeper that uses the i8254 timer chip.
|
||||||
|
This can emit beeps at a fixed frequency. It is possible to control
|
||||||
|
the length of the beeps, by turning a beep on, waiting for a period
|
||||||
|
of time, then turning it off.
|
||||||
|
|
||||||
|
This is quite an old feature, called PIT (Programmable Interval
|
||||||
|
Timer), but is nonetheless still available on modern x86 machines.
|
||||||
|
|
||||||
config SOUND_INTEL_HDA
|
config SOUND_INTEL_HDA
|
||||||
bool "Intel HDA audio codec"
|
bool "Intel HDA audio codec"
|
||||||
depends on SOUND
|
depends on SOUND
|
||||||
|
@ -16,4 +16,5 @@ obj-$(CONFIG_SOUND_MAX98088) += max98088.o maxim_codec.o
|
|||||||
obj-$(CONFIG_SOUND_MAX98090) += max98090.o maxim_codec.o
|
obj-$(CONFIG_SOUND_MAX98090) += max98090.o maxim_codec.o
|
||||||
obj-$(CONFIG_SOUND_MAX98095) += max98095.o maxim_codec.o
|
obj-$(CONFIG_SOUND_MAX98095) += max98095.o maxim_codec.o
|
||||||
obj-$(CONFIG_SOUND_INTEL_HDA) += hda_codec.o
|
obj-$(CONFIG_SOUND_INTEL_HDA) += hda_codec.o
|
||||||
|
obj-$(CONFIG_SOUND_I8254) += i8254_beep.o
|
||||||
obj-$(CONFIG_SOUND_IVYBRIDGE) += ivybridge_sound.o
|
obj-$(CONFIG_SOUND_IVYBRIDGE) += ivybridge_sound.o
|
||||||
|
38
drivers/sound/i8254_beep.c
Normal file
38
drivers/sound/i8254_beep.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/*
|
||||||
|
* Copyright 2018 Google LLC
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <dm.h>
|
||||||
|
#include <sound.h>
|
||||||
|
#include <asm/i8254.h>
|
||||||
|
|
||||||
|
int i8254_start_beep(struct udevice *dev, int frequency_hz)
|
||||||
|
{
|
||||||
|
return i8254_enable_beep(frequency_hz);
|
||||||
|
}
|
||||||
|
|
||||||
|
int i8254_stop_beep(struct udevice *dev)
|
||||||
|
{
|
||||||
|
i8254_disable_beep();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct sound_ops i8254_ops = {
|
||||||
|
.start_beep = i8254_start_beep,
|
||||||
|
.stop_beep = i8254_stop_beep,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct udevice_id i8254_ids[] = {
|
||||||
|
{ .compatible = "i8254,beeper" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
U_BOOT_DRIVER(i8254_drv) = {
|
||||||
|
.name = "i8254_drv",
|
||||||
|
.id = UCLASS_SOUND,
|
||||||
|
.of_match = i8254_ids,
|
||||||
|
.ops = &i8254_ops,
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user