1 // 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 11 int i8254_start_beep(struct udevice *dev, int frequency_hz) 12 { 13 return i8254_enable_beep(frequency_hz); 14 } 15 16 int i8254_stop_beep(struct udevice *dev) 17 { 18 i8254_disable_beep(); 19 20 return 0; 21 } 22 23 static const struct sound_ops i8254_ops = { 24 .start_beep = i8254_start_beep, 25 .stop_beep = i8254_stop_beep, 26 }; 27 28 static const struct udevice_id i8254_ids[] = { 29 { .compatible = "i8254,beeper" }, 30 { } 31 }; 32 33 U_BOOT_DRIVER(i8254_drv) = { 34 .name = "i8254_drv", 35 .id = UCLASS_SOUND, 36 .of_match = i8254_ids, 37 .ops = &i8254_ops, 38 }; 39