i8254_beep.c 665 B

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