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