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