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