blob: 5572dc4d265d7db69db07022947d6cf030302fc6 [file] [log] [blame]
Simon Glass6a27e542019-02-16 20:24:59 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018 Google LLC
4 */
5
6#include <common.h>
7#include <dm.h>
8#include <sound.h>
9#include <asm/i8254.h>
10
11int i8254_start_beep(struct udevice *dev, int frequency_hz)
12{
13 return i8254_enable_beep(frequency_hz);
14}
15
16int i8254_stop_beep(struct udevice *dev)
17{
18 i8254_disable_beep();
19
20 return 0;
21}
22
23static const struct sound_ops i8254_ops = {
24 .start_beep = i8254_start_beep,
25 .stop_beep = i8254_stop_beep,
26};
27
28static const struct udevice_id i8254_ids[] = {
29 { .compatible = "i8254,beeper" },
30 { }
31};
32
33U_BOOT_DRIVER(i8254_drv) = {
34 .name = "i8254_drv",
35 .id = UCLASS_SOUND,
36 .of_match = i8254_ids,
37 .ops = &i8254_ops,
38};