blob: a25358a4807abfbc581e352b8ce63811da4f172b [file] [log] [blame]
Matt Ranostay248a3802018-02-16 21:53:15 -08001/* SPDX-License-Identifier: GPL-2.0+ */
Matthew Ranostay1cd22242008-07-18 18:20:52 +02002/*
3 * Digital Beep Input Interface for HD-audio codec
4 *
Matt Ranostay248a3802018-02-16 21:53:15 -08005 * Author: Matt Ranostay <matt.ranostay@konsulko.com>
Matthew Ranostay1cd22242008-07-18 18:20:52 +02006 * Copyright (c) 2008 Embedded Alley Solutions Inc
Matthew Ranostay1cd22242008-07-18 18:20:52 +02007 */
8
9#ifndef __SOUND_HDA_BEEP_H
10#define __SOUND_HDA_BEEP_H
11
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050012#include <sound/hda_codec.h>
Matthew Ranostay1cd22242008-07-18 18:20:52 +020013
Takashi Iwai9bb1fe32009-11-16 15:33:49 +010014#define HDA_BEEP_MODE_OFF 0
15#define HDA_BEEP_MODE_ON 1
Jaroslav Kysela2dca0bb2009-11-13 18:41:52 +010016
Matthew Ranostay1cd22242008-07-18 18:20:52 +020017/* beep information */
18struct hda_beep {
19 struct input_dev *dev;
20 struct hda_codec *codec;
21 char phys[32];
22 int tone;
Takashi Iwaifa797962009-05-19 12:50:04 +020023 hda_nid_t nid;
Takashi Iwaid604b392014-02-28 13:42:09 +010024 unsigned int registered:1;
Takashi Iwaifa797962009-05-19 12:50:04 +020025 unsigned int enabled:1;
26 unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */
Takashi Iwaie914b252013-03-18 11:29:56 +010027 unsigned int playing:1;
Matthew Ranostay1cd22242008-07-18 18:20:52 +020028 struct work_struct beep_work; /* scheduled task for beep event */
Jaroslav Kysela123c07a2009-10-21 14:48:23 +020029 struct mutex mutex;
Takashi Iwai5ccf8352015-03-18 09:23:10 +010030 void (*power_hook)(struct hda_beep *beep, bool on);
Matthew Ranostay1cd22242008-07-18 18:20:52 +020031};
32
33#ifdef CONFIG_SND_HDA_INPUT_BEEP
Jaroslav Kysela123c07a2009-10-21 14:48:23 +020034int snd_hda_enable_beep_device(struct hda_codec *codec, int enable);
Matthew Ranostay1cd22242008-07-18 18:20:52 +020035int snd_hda_attach_beep_device(struct hda_codec *codec, int nid);
36void snd_hda_detach_beep_device(struct hda_codec *codec);
37#else
Joe Perches2308f4a2011-06-12 13:02:43 -070038static inline int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
39{
40 return 0;
41}
Takashi Iwaica2585a2011-06-14 08:14:32 +020042static inline void snd_hda_detach_beep_device(struct hda_codec *codec)
Joe Perches2308f4a2011-06-12 13:02:43 -070043{
44}
Matthew Ranostay1cd22242008-07-18 18:20:52 +020045#endif
46#endif