Matt Ranostay | 248a380 | 2018-02-16 21:53:15 -0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Digital Beep Input Interface for HD-audio codec |
| 4 | * |
Matt Ranostay | 248a380 | 2018-02-16 21:53:15 -0800 | [diff] [blame] | 5 | * Author: Matt Ranostay <matt.ranostay@konsulko.com> |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 6 | * Copyright (c) 2008 Embedded Alley Solutions Inc |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <linux/input.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 10 | #include <linux/slab.h> |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 11 | #include <linux/workqueue.h> |
Paul Gortmaker | d81a6d7 | 2011-09-22 09:34:58 -0400 | [diff] [blame] | 12 | #include <linux/export.h> |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 13 | #include <sound/core.h> |
| 14 | #include "hda_beep.h" |
Takashi Iwai | b7b5114 | 2009-06-29 08:34:06 +0200 | [diff] [blame] | 15 | #include "hda_local.h" |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 16 | |
| 17 | enum { |
| 18 | DIGBEEP_HZ_STEP = 46875, /* 46.875 Hz */ |
| 19 | DIGBEEP_HZ_MIN = 93750, /* 93.750 Hz */ |
| 20 | DIGBEEP_HZ_MAX = 12000000, /* 12 KHz */ |
| 21 | }; |
| 22 | |
Takashi Iwai | 5ccf835 | 2015-03-18 09:23:10 +0100 | [diff] [blame] | 23 | /* generate or stop tone */ |
| 24 | static void generate_tone(struct hda_beep *beep, int tone) |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 25 | { |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 26 | struct hda_codec *codec = beep->codec; |
| 27 | |
Takashi Iwai | e914b25 | 2013-03-18 11:29:56 +0100 | [diff] [blame] | 28 | if (tone && !beep->playing) { |
| 29 | snd_hda_power_up(codec); |
Takashi Iwai | 5ccf835 | 2015-03-18 09:23:10 +0100 | [diff] [blame] | 30 | if (beep->power_hook) |
| 31 | beep->power_hook(beep, true); |
Takashi Iwai | e914b25 | 2013-03-18 11:29:56 +0100 | [diff] [blame] | 32 | beep->playing = 1; |
| 33 | } |
Takashi Iwai | 411fe85 | 2009-12-27 10:25:58 +0100 | [diff] [blame] | 34 | snd_hda_codec_write(codec, beep->nid, 0, |
Takashi Iwai | e914b25 | 2013-03-18 11:29:56 +0100 | [diff] [blame] | 35 | AC_VERB_SET_BEEP_CONTROL, tone); |
| 36 | if (!tone && beep->playing) { |
| 37 | beep->playing = 0; |
Takashi Iwai | 5ccf835 | 2015-03-18 09:23:10 +0100 | [diff] [blame] | 38 | if (beep->power_hook) |
| 39 | beep->power_hook(beep, false); |
Takashi Iwai | e914b25 | 2013-03-18 11:29:56 +0100 | [diff] [blame] | 40 | snd_hda_power_down(codec); |
| 41 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 42 | } |
| 43 | |
Takashi Iwai | 5ccf835 | 2015-03-18 09:23:10 +0100 | [diff] [blame] | 44 | static void snd_hda_generate_beep(struct work_struct *work) |
| 45 | { |
| 46 | struct hda_beep *beep = |
| 47 | container_of(work, struct hda_beep, beep_work); |
| 48 | |
| 49 | if (beep->enabled) |
| 50 | generate_tone(beep, beep->tone); |
| 51 | } |
| 52 | |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 53 | /* (non-standard) Linear beep tone calculation for IDT/STAC codecs |
| 54 | * |
| 55 | * The tone frequency of beep generator on IDT/STAC codecs is |
| 56 | * defined from the 8bit tone parameter, in Hz, |
| 57 | * freq = 48000 * (257 - tone) / 1024 |
Paul Vojta | 369693d | 2009-07-08 23:57:46 -0700 | [diff] [blame] | 58 | * that is from 12kHz to 93.75Hz in steps of 46.875 Hz |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 59 | */ |
| 60 | static int beep_linear_tone(struct hda_beep *beep, int hz) |
| 61 | { |
Paul Vojta | 369693d | 2009-07-08 23:57:46 -0700 | [diff] [blame] | 62 | if (hz <= 0) |
| 63 | return 0; |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 64 | hz *= 1000; /* fixed point */ |
Paul Vojta | 369693d | 2009-07-08 23:57:46 -0700 | [diff] [blame] | 65 | hz = hz - DIGBEEP_HZ_MIN |
| 66 | + DIGBEEP_HZ_STEP / 2; /* round to nearest step */ |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 67 | if (hz < 0) |
| 68 | hz = 0; /* turn off PC beep*/ |
| 69 | else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) |
Paul Vojta | 369693d | 2009-07-08 23:57:46 -0700 | [diff] [blame] | 70 | hz = 1; /* max frequency */ |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 71 | else { |
| 72 | hz /= DIGBEEP_HZ_STEP; |
Paul Vojta | 369693d | 2009-07-08 23:57:46 -0700 | [diff] [blame] | 73 | hz = 255 - hz; |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 74 | } |
| 75 | return hz; |
| 76 | } |
| 77 | |
| 78 | /* HD-audio standard beep tone parameter calculation |
| 79 | * |
| 80 | * The tone frequency in Hz is calculated as |
| 81 | * freq = 48000 / (tone * 4) |
| 82 | * from 47Hz to 12kHz |
| 83 | */ |
| 84 | static int beep_standard_tone(struct hda_beep *beep, int hz) |
| 85 | { |
| 86 | if (hz <= 0) |
| 87 | return 0; /* disabled */ |
| 88 | hz = 12000 / hz; |
| 89 | if (hz > 0xff) |
| 90 | return 0xff; |
| 91 | if (hz <= 0) |
| 92 | return 1; |
| 93 | return hz; |
| 94 | } |
| 95 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 96 | static int snd_hda_beep_event(struct input_dev *dev, unsigned int type, |
| 97 | unsigned int code, int hz) |
| 98 | { |
| 99 | struct hda_beep *beep = input_get_drvdata(dev); |
| 100 | |
| 101 | switch (code) { |
| 102 | case SND_BELL: |
| 103 | if (hz) |
| 104 | hz = 1000; |
Gustavo A. R. Silva | c0dbbda | 2020-07-08 15:32:36 -0500 | [diff] [blame] | 105 | fallthrough; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 106 | case SND_TONE: |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 107 | if (beep->linear_tone) |
| 108 | beep->tone = beep_linear_tone(beep, hz); |
| 109 | else |
| 110 | beep->tone = beep_standard_tone(beep, hz); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 111 | break; |
| 112 | default: |
| 113 | return -1; |
| 114 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 115 | |
| 116 | /* schedule beep event */ |
| 117 | schedule_work(&beep->beep_work); |
| 118 | return 0; |
| 119 | } |
| 120 | |
Takashi Iwai | e914b25 | 2013-03-18 11:29:56 +0100 | [diff] [blame] | 121 | static void turn_off_beep(struct hda_beep *beep) |
| 122 | { |
| 123 | cancel_work_sync(&beep->beep_work); |
| 124 | if (beep->playing) { |
| 125 | /* turn off beep */ |
Takashi Iwai | 5ccf835 | 2015-03-18 09:23:10 +0100 | [diff] [blame] | 126 | generate_tone(beep, 0); |
Takashi Iwai | e914b25 | 2013-03-18 11:29:56 +0100 | [diff] [blame] | 127 | } |
| 128 | } |
| 129 | |
Takashi Iwai | 95a962c | 2014-10-29 16:03:58 +0100 | [diff] [blame] | 130 | /** |
| 131 | * snd_hda_enable_beep_device - Turn on/off beep sound |
| 132 | * @codec: the HDA codec |
| 133 | * @enable: flag to turn on/off |
| 134 | */ |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 135 | int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) |
| 136 | { |
| 137 | struct hda_beep *beep = codec->beep; |
Takashi Iwai | 3fd877d | 2012-07-03 17:36:35 +0200 | [diff] [blame] | 138 | if (!beep) |
Jaroslav Kysela | 13dab08 | 2009-11-03 14:29:50 +0100 | [diff] [blame] | 139 | return 0; |
Takashi Iwai | 3fd877d | 2012-07-03 17:36:35 +0200 | [diff] [blame] | 140 | enable = !!enable; |
Jaroslav Kysela | 13dab08 | 2009-11-03 14:29:50 +0100 | [diff] [blame] | 141 | if (beep->enabled != enable) { |
| 142 | beep->enabled = enable; |
Takashi Iwai | e914b25 | 2013-03-18 11:29:56 +0100 | [diff] [blame] | 143 | if (!enable) |
| 144 | turn_off_beep(beep); |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 145 | return 1; |
| 146 | } |
| 147 | return 0; |
| 148 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 149 | EXPORT_SYMBOL_GPL(snd_hda_enable_beep_device); |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 150 | |
Takashi Iwai | 45571bb | 2019-01-24 09:45:36 +0100 | [diff] [blame] | 151 | static int beep_dev_register(struct snd_device *device) |
| 152 | { |
| 153 | struct hda_beep *beep = device->device_data; |
| 154 | int err; |
| 155 | |
| 156 | err = input_register_device(beep->dev); |
| 157 | if (!err) |
| 158 | beep->registered = true; |
| 159 | return err; |
| 160 | } |
| 161 | |
| 162 | static int beep_dev_disconnect(struct snd_device *device) |
| 163 | { |
| 164 | struct hda_beep *beep = device->device_data; |
| 165 | |
| 166 | if (beep->registered) |
| 167 | input_unregister_device(beep->dev); |
| 168 | else |
| 169 | input_free_device(beep->dev); |
| 170 | turn_off_beep(beep); |
| 171 | return 0; |
| 172 | } |
| 173 | |
| 174 | static int beep_dev_free(struct snd_device *device) |
| 175 | { |
| 176 | struct hda_beep *beep = device->device_data; |
| 177 | |
| 178 | beep->codec->beep = NULL; |
| 179 | kfree(beep); |
| 180 | return 0; |
| 181 | } |
| 182 | |
Takashi Iwai | 95a962c | 2014-10-29 16:03:58 +0100 | [diff] [blame] | 183 | /** |
| 184 | * snd_hda_attach_beep_device - Attach a beep input device |
| 185 | * @codec: the HDA codec |
| 186 | * @nid: beep NID |
| 187 | * |
| 188 | * Attach a beep object to the given widget. If beep hint is turned off |
| 189 | * explicitly or beep_mode of the codec is turned off, this doesn't nothing. |
| 190 | * |
Takashi Iwai | 95a962c | 2014-10-29 16:03:58 +0100 | [diff] [blame] | 191 | * Currently, only one beep device is allowed to each codec. |
| 192 | */ |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 193 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) |
| 194 | { |
Takashi Iwai | 41f394a | 2020-01-03 09:16:24 +0100 | [diff] [blame] | 195 | static const struct snd_device_ops ops = { |
Takashi Iwai | 45571bb | 2019-01-24 09:45:36 +0100 | [diff] [blame] | 196 | .dev_register = beep_dev_register, |
| 197 | .dev_disconnect = beep_dev_disconnect, |
| 198 | .dev_free = beep_dev_free, |
| 199 | }; |
| 200 | struct input_dev *input_dev; |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 201 | struct hda_beep *beep; |
Takashi Iwai | 257dfb4 | 2012-07-03 17:35:05 +0200 | [diff] [blame] | 202 | int err; |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 203 | |
| 204 | if (!snd_hda_get_bool_hint(codec, "beep")) |
Takashi Iwai | 9bb1fe3 | 2009-11-16 15:33:49 +0100 | [diff] [blame] | 205 | return 0; /* disabled explicitly by hints */ |
| 206 | if (codec->beep_mode == HDA_BEEP_MODE_OFF) |
| 207 | return 0; /* disabled by module option */ |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 208 | |
| 209 | beep = kzalloc(sizeof(*beep), GFP_KERNEL); |
| 210 | if (beep == NULL) |
| 211 | return -ENOMEM; |
| 212 | snprintf(beep->phys, sizeof(beep->phys), |
Takashi Iwai | 6efdd85 | 2015-02-27 16:09:22 +0100 | [diff] [blame] | 213 | "card%d/codec#%d/beep0", codec->card->number, codec->addr); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 214 | /* enable linear scale */ |
Takashi Iwai | 8bc0a84 | 2013-03-18 11:34:45 +0100 | [diff] [blame] | 215 | snd_hda_codec_write_cache(codec, nid, 0, |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 216 | AC_VERB_SET_DIGI_CONVERT_2, 0x01); |
| 217 | |
| 218 | beep->nid = nid; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 219 | beep->codec = codec; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 220 | codec->beep = beep; |
| 221 | |
| 222 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 223 | mutex_init(&beep->mutex); |
| 224 | |
Takashi Iwai | 45571bb | 2019-01-24 09:45:36 +0100 | [diff] [blame] | 225 | input_dev = input_allocate_device(); |
| 226 | if (!input_dev) { |
| 227 | err = -ENOMEM; |
| 228 | goto err_free; |
Jaroslav Kysela | 2dca0bb | 2009-11-13 18:41:52 +0100 | [diff] [blame] | 229 | } |
| 230 | |
Takashi Iwai | 45571bb | 2019-01-24 09:45:36 +0100 | [diff] [blame] | 231 | /* setup digital beep device */ |
| 232 | input_dev->name = "HDA Digital PCBeep"; |
| 233 | input_dev->phys = beep->phys; |
| 234 | input_dev->id.bustype = BUS_PCI; |
| 235 | input_dev->dev.parent = &codec->card->card_dev; |
| 236 | |
| 237 | input_dev->id.vendor = codec->core.vendor_id >> 16; |
| 238 | input_dev->id.product = codec->core.vendor_id & 0xffff; |
| 239 | input_dev->id.version = 0x01; |
| 240 | |
| 241 | input_dev->evbit[0] = BIT_MASK(EV_SND); |
| 242 | input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); |
| 243 | input_dev->event = snd_hda_beep_event; |
| 244 | input_set_drvdata(input_dev, beep); |
| 245 | |
| 246 | beep->dev = input_dev; |
| 247 | |
| 248 | err = snd_device_new(codec->card, SNDRV_DEV_JACK, beep, &ops); |
| 249 | if (err < 0) |
| 250 | goto err_input; |
| 251 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 252 | return 0; |
Takashi Iwai | 45571bb | 2019-01-24 09:45:36 +0100 | [diff] [blame] | 253 | |
| 254 | err_input: |
| 255 | input_free_device(beep->dev); |
| 256 | err_free: |
| 257 | kfree(beep); |
| 258 | codec->beep = NULL; |
| 259 | return err; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 260 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 261 | EXPORT_SYMBOL_GPL(snd_hda_attach_beep_device); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 262 | |
Takashi Iwai | 95a962c | 2014-10-29 16:03:58 +0100 | [diff] [blame] | 263 | /** |
| 264 | * snd_hda_detach_beep_device - Detach the beep device |
| 265 | * @codec: the HDA codec |
| 266 | */ |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 267 | void snd_hda_detach_beep_device(struct hda_codec *codec) |
| 268 | { |
Takashi Iwai | 45571bb | 2019-01-24 09:45:36 +0100 | [diff] [blame] | 269 | if (!codec->bus->shutdown && codec->beep) |
| 270 | snd_device_free(codec->card, codec->beep); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 271 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 272 | EXPORT_SYMBOL_GPL(snd_hda_detach_beep_device); |
Takashi Iwai | 0401e85 | 2012-07-03 17:27:57 +0200 | [diff] [blame] | 273 | |
David Henningsson | 265d931 | 2012-08-13 17:10:46 +0200 | [diff] [blame] | 274 | static bool ctl_has_mute(struct snd_kcontrol *kcontrol) |
| 275 | { |
| 276 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 277 | return query_amp_caps(codec, get_amp_nid(kcontrol), |
| 278 | get_amp_direction(kcontrol)) & AC_AMPCAP_MUTE; |
| 279 | } |
| 280 | |
Takashi Iwai | 0401e85 | 2012-07-03 17:27:57 +0200 | [diff] [blame] | 281 | /* get/put callbacks for beep mute mixer switches */ |
Takashi Iwai | 95a962c | 2014-10-29 16:03:58 +0100 | [diff] [blame] | 282 | |
| 283 | /** |
| 284 | * snd_hda_mixer_amp_switch_get_beep - Get callback for beep controls |
| 285 | * @kcontrol: ctl element |
| 286 | * @ucontrol: pointer to get/store the data |
| 287 | */ |
Takashi Iwai | 0401e85 | 2012-07-03 17:27:57 +0200 | [diff] [blame] | 288 | int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol, |
| 289 | struct snd_ctl_elem_value *ucontrol) |
| 290 | { |
| 291 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 292 | struct hda_beep *beep = codec->beep; |
Takashi Iwai | 0ad3f0b | 2020-04-07 10:44:01 +0200 | [diff] [blame] | 293 | int chs = get_amp_channels(kcontrol); |
| 294 | |
David Henningsson | 265d931 | 2012-08-13 17:10:46 +0200 | [diff] [blame] | 295 | if (beep && (!beep->enabled || !ctl_has_mute(kcontrol))) { |
Takashi Iwai | 0ad3f0b | 2020-04-07 10:44:01 +0200 | [diff] [blame] | 296 | if (chs & 1) |
| 297 | ucontrol->value.integer.value[0] = beep->enabled; |
| 298 | if (chs & 2) |
David Henningsson | 265d931 | 2012-08-13 17:10:46 +0200 | [diff] [blame] | 299 | ucontrol->value.integer.value[1] = beep->enabled; |
Takashi Iwai | 0401e85 | 2012-07-03 17:27:57 +0200 | [diff] [blame] | 300 | return 0; |
| 301 | } |
| 302 | return snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); |
| 303 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 304 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get_beep); |
Takashi Iwai | 0401e85 | 2012-07-03 17:27:57 +0200 | [diff] [blame] | 305 | |
Takashi Iwai | 95a962c | 2014-10-29 16:03:58 +0100 | [diff] [blame] | 306 | /** |
| 307 | * snd_hda_mixer_amp_switch_put_beep - Put callback for beep controls |
| 308 | * @kcontrol: ctl element |
| 309 | * @ucontrol: pointer to get/store the data |
| 310 | */ |
Takashi Iwai | 0401e85 | 2012-07-03 17:27:57 +0200 | [diff] [blame] | 311 | int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol, |
| 312 | struct snd_ctl_elem_value *ucontrol) |
| 313 | { |
| 314 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 315 | struct hda_beep *beep = codec->beep; |
David Henningsson | 14bc9c6 | 2012-08-10 13:29:32 +0200 | [diff] [blame] | 316 | if (beep) { |
| 317 | u8 chs = get_amp_channels(kcontrol); |
| 318 | int enable = 0; |
| 319 | long *valp = ucontrol->value.integer.value; |
| 320 | if (chs & 1) { |
| 321 | enable |= *valp; |
| 322 | valp++; |
| 323 | } |
| 324 | if (chs & 2) |
| 325 | enable |= *valp; |
| 326 | snd_hda_enable_beep_device(codec, enable); |
| 327 | } |
David Henningsson | 265d931 | 2012-08-13 17:10:46 +0200 | [diff] [blame] | 328 | if (!ctl_has_mute(kcontrol)) |
| 329 | return 0; |
Takashi Iwai | 0401e85 | 2012-07-03 17:27:57 +0200 | [diff] [blame] | 330 | return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); |
| 331 | } |
Takashi Iwai | 2698ea9 | 2013-12-18 07:45:52 +0100 | [diff] [blame] | 332 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_put_beep); |