aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-07-03 10:58:48 -0400
committerTakashi Iwai <tiwai@suse.de>2012-07-03 12:31:20 -0400
commit0920c9b4c4d896025a560e4510d473dfd41c3dcd (patch)
tree64c4ba13540f15d686e1175fba09ffc699382a71
parent6887a4131da3adaab011613776d865f4bcfb5678 (diff)
ALSA: hda - Remove beep_mode=2
The beep_mode=2 option was introduced to make the beep mixer controlling the beep input allocation/deallocation dynamically, so that a user can switch between HD-audio codec digital beep and the system beep only via mixer API. This was necessary because the keyboard driver took only the first input beep instance at that time. However, the recent keyboard driver already processes the multiple input instances, thus there is no point to keep this mode. Let's remove it. Acked-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt3
-rw-r--r--sound/pci/hda/Kconfig7
-rw-r--r--sound/pci/hda/hda_beep.c37
-rw-r--r--sound/pci/hda/hda_beep.h4
-rw-r--r--sound/pci/hda/hda_intel.c6
5 files changed, 8 insertions, 49 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 221b81016dba..4e4d0bc9816f 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -875,8 +875,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
875 setup before initializing the codecs. This option is 875 setup before initializing the codecs. This option is
876 available only when CONFIG_SND_HDA_PATCH_LOADER=y is set. 876 available only when CONFIG_SND_HDA_PATCH_LOADER=y is set.
877 See HD-Audio.txt for details. 877 See HD-Audio.txt for details.
878 beep_mode - Selects the beep registration mode (0=off, 1=on, 2= 878 beep_mode - Selects the beep registration mode (0=off, 1=on); default
879 dynamic registration via mute switch on/off); the default
880 value is set via CONFIG_SND_HDA_INPUT_BEEP_MODE kconfig. 879 value is set via CONFIG_SND_HDA_INPUT_BEEP_MODE kconfig.
881 880
882 [Single (global) options] 881 [Single (global) options]
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index d03079764189..194d625c1f83 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -53,15 +53,14 @@ config SND_HDA_INPUT_BEEP
53 driver. This interface is used to generate digital beeps. 53 driver. This interface is used to generate digital beeps.
54 54
55config SND_HDA_INPUT_BEEP_MODE 55config SND_HDA_INPUT_BEEP_MODE
56 int "Digital beep registration mode (0=off, 1=on, 2=mute sw on/off)" 56 int "Digital beep registration mode (0=off, 1=on)"
57 depends on SND_HDA_INPUT_BEEP=y 57 depends on SND_HDA_INPUT_BEEP=y
58 default "1" 58 default "1"
59 range 0 2 59 range 0 1
60 help 60 help
61 Set 0 to disable the digital beep interface for HD-audio by default. 61 Set 0 to disable the digital beep interface for HD-audio by default.
62 Set 1 to always enable the digital beep interface for HD-audio by 62 Set 1 to always enable the digital beep interface for HD-audio by
63 default. Set 2 to control the beep device registration to input 63 default.
64 layer using a "Beep Switch" in mixer applications.
65 64
66config SND_HDA_INPUT_JACK 65config SND_HDA_INPUT_JACK
67 bool "Support jack plugging notification via input layer" 66 bool "Support jack plugging notification via input layer"
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 60738e52b8f9..662de6e58b6f 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -162,28 +162,6 @@ static int snd_hda_do_attach(struct hda_beep *beep)
162 return 0; 162 return 0;
163} 163}
164 164
165static void snd_hda_do_register(struct work_struct *work)
166{
167 struct hda_beep *beep =
168 container_of(work, struct hda_beep, register_work);
169
170 mutex_lock(&beep->mutex);
171 if (beep->enabled && !beep->dev)
172 snd_hda_do_attach(beep);
173 mutex_unlock(&beep->mutex);
174}
175
176static void snd_hda_do_unregister(struct work_struct *work)
177{
178 struct hda_beep *beep =
179 container_of(work, struct hda_beep, unregister_work.work);
180
181 mutex_lock(&beep->mutex);
182 if (!beep->enabled && beep->dev)
183 snd_hda_do_detach(beep);
184 mutex_unlock(&beep->mutex);
185}
186
187int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) 165int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
188{ 166{
189 struct hda_beep *beep = codec->beep; 167 struct hda_beep *beep = codec->beep;
@@ -197,15 +175,6 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
197 snd_hda_codec_write(beep->codec, beep->nid, 0, 175 snd_hda_codec_write(beep->codec, beep->nid, 0,
198 AC_VERB_SET_BEEP_CONTROL, 0); 176 AC_VERB_SET_BEEP_CONTROL, 0);
199 } 177 }
200 if (beep->mode == HDA_BEEP_MODE_SWREG) {
201 if (enable) {
202 cancel_delayed_work(&beep->unregister_work);
203 schedule_work(&beep->register_work);
204 } else {
205 schedule_delayed_work(&beep->unregister_work,
206 HZ);
207 }
208 }
209 return 1; 178 return 1;
210 } 179 }
211 return 0; 180 return 0;
@@ -235,12 +204,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
235 beep->mode = codec->beep_mode; 204 beep->mode = codec->beep_mode;
236 codec->beep = beep; 205 codec->beep = beep;
237 206
238 INIT_WORK(&beep->register_work, &snd_hda_do_register);
239 INIT_DELAYED_WORK(&beep->unregister_work, &snd_hda_do_unregister);
240 INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); 207 INIT_WORK(&beep->beep_work, &snd_hda_generate_beep);
241 mutex_init(&beep->mutex); 208 mutex_init(&beep->mutex);
242 209
243 if (beep->mode == HDA_BEEP_MODE_ON) { 210 if (beep->mode) {
244 int err = snd_hda_do_attach(beep); 211 int err = snd_hda_do_attach(beep);
245 if (err < 0) { 212 if (err < 0) {
246 kfree(beep); 213 kfree(beep);
@@ -257,8 +224,6 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
257{ 224{
258 struct hda_beep *beep = codec->beep; 225 struct hda_beep *beep = codec->beep;
259 if (beep) { 226 if (beep) {
260 cancel_work_sync(&beep->register_work);
261 cancel_delayed_work(&beep->unregister_work);
262 if (beep->dev) 227 if (beep->dev)
263 snd_hda_do_detach(beep); 228 snd_hda_do_detach(beep);
264 codec->beep = NULL; 229 codec->beep = NULL;
diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h
index 55f0647458c7..30e79d16f9f8 100644
--- a/sound/pci/hda/hda_beep.h
+++ b/sound/pci/hda/hda_beep.h
@@ -26,7 +26,6 @@
26 26
27#define HDA_BEEP_MODE_OFF 0 27#define HDA_BEEP_MODE_OFF 0
28#define HDA_BEEP_MODE_ON 1 28#define HDA_BEEP_MODE_ON 1
29#define HDA_BEEP_MODE_SWREG 2
30 29
31/* beep information */ 30/* beep information */
32struct hda_beep { 31struct hda_beep {
@@ -37,10 +36,7 @@ struct hda_beep {
37 int tone; 36 int tone;
38 hda_nid_t nid; 37 hda_nid_t nid;
39 unsigned int enabled:1; 38 unsigned int enabled:1;
40 unsigned int request_enable:1;
41 unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */ 39 unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */
42 struct work_struct register_work; /* registration work */
43 struct delayed_work unregister_work; /* unregistration work */
44 struct work_struct beep_work; /* scheduled task for beep event */ 40 struct work_struct beep_work; /* scheduled task for beep event */
45 struct mutex mutex; 41 struct mutex mutex;
46}; 42};
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 7757536b9d5f..334c0ba7d04b 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -72,7 +72,7 @@ static int enable_msi = -1;
72static char *patch[SNDRV_CARDS]; 72static char *patch[SNDRV_CARDS];
73#endif 73#endif
74#ifdef CONFIG_SND_HDA_INPUT_BEEP 74#ifdef CONFIG_SND_HDA_INPUT_BEEP
75static int beep_mode[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 75static bool beep_mode[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] =
76 CONFIG_SND_HDA_INPUT_BEEP_MODE}; 76 CONFIG_SND_HDA_INPUT_BEEP_MODE};
77#endif 77#endif
78 78
@@ -103,9 +103,9 @@ module_param_array(patch, charp, NULL, 0444);
103MODULE_PARM_DESC(patch, "Patch file for Intel HD audio interface."); 103MODULE_PARM_DESC(patch, "Patch file for Intel HD audio interface.");
104#endif 104#endif
105#ifdef CONFIG_SND_HDA_INPUT_BEEP 105#ifdef CONFIG_SND_HDA_INPUT_BEEP
106module_param_array(beep_mode, int, NULL, 0444); 106module_param_array(beep_mode, bool, NULL, 0444);
107MODULE_PARM_DESC(beep_mode, "Select HDA Beep registration mode " 107MODULE_PARM_DESC(beep_mode, "Select HDA Beep registration mode "
108 "(0=off, 1=on, 2=mute switch on/off) (default=1)."); 108 "(0=off, 1=on) (default=1).");
109#endif 109#endif
110 110
111#ifdef CONFIG_SND_HDA_POWER_SAVE 111#ifdef CONFIG_SND_HDA_POWER_SAVE