xref: /openbmc/linux/sound/pci/hda/hda_beep.h (revision 928ac9fc)
1248a380aSMatt Ranostay /* SPDX-License-Identifier: GPL-2.0+ */
21cd2224cSMatthew Ranostay /*
31cd2224cSMatthew Ranostay  * Digital Beep Input Interface for HD-audio codec
41cd2224cSMatthew Ranostay  *
5248a380aSMatt Ranostay  * Author: Matt Ranostay <matt.ranostay@konsulko.com>
61cd2224cSMatthew Ranostay  * Copyright (c) 2008 Embedded Alley Solutions Inc
71cd2224cSMatthew Ranostay  */
81cd2224cSMatthew Ranostay 
91cd2224cSMatthew Ranostay #ifndef __SOUND_HDA_BEEP_H
101cd2224cSMatthew Ranostay #define __SOUND_HDA_BEEP_H
111cd2224cSMatthew Ranostay 
12be57bfffSPierre-Louis Bossart #include <sound/hda_codec.h>
131cd2224cSMatthew Ranostay 
149bb1fe39STakashi Iwai #define HDA_BEEP_MODE_OFF	0
159bb1fe39STakashi Iwai #define HDA_BEEP_MODE_ON	1
162dca0bbaSJaroslav Kysela 
171cd2224cSMatthew Ranostay /* beep information */
181cd2224cSMatthew Ranostay struct hda_beep {
191cd2224cSMatthew Ranostay 	struct input_dev *dev;
201cd2224cSMatthew Ranostay 	struct hda_codec *codec;
211cd2224cSMatthew Ranostay 	char phys[32];
221cd2224cSMatthew Ranostay 	int tone;
23fa797966STakashi Iwai 	hda_nid_t nid;
24d604b399STakashi Iwai 	unsigned int registered:1;
25fa797966STakashi Iwai 	unsigned int enabled:1;
26fa797966STakashi Iwai 	unsigned int linear_tone:1;	/* linear tone for IDT/STAC codec */
27e914b25eSTakashi Iwai 	unsigned int playing:1;
28*928ac9fcSTakashi Iwai 	unsigned int keep_power_at_enable:1;	/* set by driver */
291cd2224cSMatthew Ranostay 	struct work_struct beep_work; /* scheduled task for beep event */
30123c07aeSJaroslav Kysela 	struct mutex mutex;
315ccf835cSTakashi Iwai 	void (*power_hook)(struct hda_beep *beep, bool on);
321cd2224cSMatthew Ranostay };
331cd2224cSMatthew Ranostay 
341cd2224cSMatthew Ranostay #ifdef CONFIG_SND_HDA_INPUT_BEEP
35123c07aeSJaroslav Kysela int snd_hda_enable_beep_device(struct hda_codec *codec, int enable);
361cd2224cSMatthew Ranostay int snd_hda_attach_beep_device(struct hda_codec *codec, int nid);
371cd2224cSMatthew Ranostay void snd_hda_detach_beep_device(struct hda_codec *codec);
381cd2224cSMatthew Ranostay #else
snd_hda_attach_beep_device(struct hda_codec * codec,int nid)392308f4adSJoe Perches static inline int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
402308f4adSJoe Perches {
412308f4adSJoe Perches 	return 0;
422308f4adSJoe Perches }
snd_hda_detach_beep_device(struct hda_codec * codec)43ca2585afSTakashi Iwai static inline void snd_hda_detach_beep_device(struct hda_codec *codec)
442308f4adSJoe Perches {
452308f4adSJoe Perches }
461cd2224cSMatthew Ranostay #endif
471cd2224cSMatthew Ranostay #endif
48