22 #include <linux/input.h>
23 #include <linux/pci.h>
24 #include <linux/slab.h>
26 #include <linux/export.h>
58 static int beep_linear_tone(
struct hda_beep *
beep,
int hz)
82 static int beep_standard_tone(
struct hda_beep *beep,
int hz)
94 static int snd_hda_beep_event(
struct input_dev *
dev,
unsigned int type,
95 unsigned int code,
int hz)
97 struct hda_beep *beep = input_get_drvdata(dev);
105 beep->
tone = beep_linear_tone(beep, hz);
107 beep->
tone = beep_standard_tone(beep, hz);
118 static void snd_hda_do_detach(
struct hda_beep *beep)
120 input_unregister_device(beep->
dev);
128 static int snd_hda_do_attach(
struct hda_beep *beep)
130 struct input_dev *input_dev;
134 input_dev = input_allocate_device();
141 input_dev->name =
"HDA Digital PCBeep";
142 input_dev->phys = beep->
phys;
143 input_dev->id.bustype =
BUS_PCI;
145 input_dev->id.vendor = codec->
vendor_id >> 16;
146 input_dev->id.product = codec->
vendor_id & 0xffff;
147 input_dev->id.version = 0x01;
151 input_dev->event = snd_hda_beep_event;
152 input_dev->dev.parent = &codec->
bus->pci->dev;
153 input_set_drvdata(input_dev, beep);
155 err = input_register_device(input_dev);
157 input_free_device(input_dev);
161 beep->
dev = input_dev;
190 if (!snd_hda_get_bool_hint(codec,
"beep"))
199 "card%d/codec#%d/beep0", codec->
bus->card->number, codec->
addr);
211 err = snd_hda_do_attach(beep);
227 snd_hda_do_detach(beep);
247 if (beep && (!beep->
enabled || !ctl_has_mute(kcontrol))) {
248 ucontrol->
value.integer.value[0] =
264 long *valp = ucontrol->
value.integer.value;
273 if (!ctl_has_mute(kcontrol))