hda_beep.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Digital Beep Input Interface for HD-audio codec
  4. *
  5. * Author: Matt Ranostay <matt.ranostay@konsulko.com>
  6. * Copyright (c) 2008 Embedded Alley Solutions Inc
  7. */
  8. #ifndef __SOUND_HDA_BEEP_H
  9. #define __SOUND_HDA_BEEP_H
  10. #include "hda_codec.h"
  11. #define HDA_BEEP_MODE_OFF 0
  12. #define HDA_BEEP_MODE_ON 1
  13. /* beep information */
  14. struct hda_beep {
  15. struct input_dev *dev;
  16. struct hda_codec *codec;
  17. char phys[32];
  18. int tone;
  19. hda_nid_t nid;
  20. unsigned int registered:1;
  21. unsigned int enabled:1;
  22. unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */
  23. unsigned int playing:1;
  24. struct work_struct beep_work; /* scheduled task for beep event */
  25. struct mutex mutex;
  26. void (*power_hook)(struct hda_beep *beep, bool on);
  27. };
  28. #ifdef CONFIG_SND_HDA_INPUT_BEEP
  29. int snd_hda_enable_beep_device(struct hda_codec *codec, int enable);
  30. int snd_hda_attach_beep_device(struct hda_codec *codec, int nid);
  31. void snd_hda_detach_beep_device(struct hda_codec *codec);
  32. int snd_hda_register_beep_device(struct hda_codec *codec);
  33. #else
  34. static inline int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
  35. {
  36. return 0;
  37. }
  38. static inline void snd_hda_detach_beep_device(struct hda_codec *codec)
  39. {
  40. }
  41. static inline int snd_hda_register_beep_device(struct hda_codec *codec)
  42. {
  43. return 0;
  44. }
  45. #endif
  46. #endif