rpms/kernel/F-9 linux-2.6-alsa-backport-beep-switch.patch, NONE, 1.1 linux-2.6-defaults-alsa-hda-beep-off.patch, NONE, 1.1 config-generic, 1.132, 1.133 kernel.spec, 1.889, 1.890

Chuck Ebbert cebbert at fedoraproject.org
Thu Dec 18 22:29:00 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16201

Modified Files:
	config-generic kernel.spec 
Added Files:
	linux-2.6-alsa-backport-beep-switch.patch 
	linux-2.6-defaults-alsa-hda-beep-off.patch 
Log Message:
Re-enable input beep code, but disable it by default (from F10.)
  Added:
   linux-2.6-alsa-backport-beep-switch.patch
   linux-2.6-defaults-alsa-hda-beep-off.patch

linux-2.6-alsa-backport-beep-switch.patch:

--- NEW FILE linux-2.6-alsa-backport-beep-switch.patch ---
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 9b77b3e..3ecd7e7 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -37,6 +37,9 @@ static void snd_hda_generate_beep(struct work_struct *work)
 		container_of(work, struct hda_beep, beep_work);
 	struct hda_codec *codec = beep->codec;
 
+	if (!beep->enabled)
+		return;
+
 	/* generate tone */
 	snd_hda_codec_write_cache(codec, beep->nid, 0,
 			AC_VERB_SET_BEEP_CONTROL, beep->tone);
@@ -85,6 +88,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
 	snprintf(beep->phys, sizeof(beep->phys),
 		"card%d/codec#%d/beep0", codec->bus->card->number, codec->addr);
 	input_dev = input_allocate_device();
+	if (!input_dev) {
+		kfree(beep);
+		return -ENOMEM;
+	}
 
 	/* setup digital beep device */
 	input_dev->name = "HDA Digital PCBeep";
@@ -115,6 +122,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
 	beep->nid = nid;
 	beep->dev = input_dev;
 	beep->codec = codec;
+	beep->enabled = 1;
 	codec->beep = beep;
 
 	INIT_WORK(&beep->beep_work, &snd_hda_generate_beep);
diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h
index de4036e..b9679f0 100644
--- a/sound/pci/hda/hda_beep.h
+++ b/sound/pci/hda/hda_beep.h
@@ -31,6 +31,7 @@ struct hda_beep {
 	char phys[32];
 	int tone;
 	int nid;
+	int enabled;
 	struct work_struct beep_work; /* scheduled task for beep event */
 };
 
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 12c88c4..d81b4b6 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2609,8 +2609,10 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = {
 };
 
 /* add dynamic controls */
-static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type,
-		int idx, const char *name, unsigned long val)
+static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
+				     struct snd_kcontrol_new *ktemp,
+				     int idx, const char *name,
+				     unsigned long val)
 {
 	struct snd_kcontrol_new *knew;
 
@@ -2618,19 +2620,28 @@ static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type,
 	knew = snd_array_new(&spec->kctls);
 	if (!knew)
 		return -ENOMEM;
-	*knew = stac92xx_control_templates[type];
+	*knew = *ktemp;
 	knew->index = idx;
 	knew->name = kstrdup(name, GFP_KERNEL);
-	if (! knew->name)
+	if (!knew->name)
 		return -ENOMEM;
 	knew->private_value = val;
 	return 0;
 }
 
+static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,
+					   int type, int idx, const char *name,
+					   unsigned long val)
+{
+	return stac92xx_add_control_temp(spec,
+					 &stac92xx_control_templates[type],
+					 idx, name, val);
+}
+
 
 /* add dynamic controls */
-static int stac92xx_add_control(struct sigmatel_spec *spec, int type,
-		const char *name, unsigned long val)
+static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type,
+				       const char *name, unsigned long val)
 {
 	return stac92xx_add_control_idx(spec, type, 0, name, val);
 }
@@ -3071,6 +3082,43 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec,
 	return 0;
 }
 
+#ifdef CONFIG_SND_HDA_INPUT_BEEP
+#define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info
+
+static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
+					struct snd_ctl_elem_value *ucontrol)
+{
+	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+	ucontrol->value.integer.value[0] = codec->beep->enabled;
+	return 0;
+}
+
+static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
+					struct snd_ctl_elem_value *ucontrol)
+{
+	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+	int enabled = !!ucontrol->value.integer.value[0];
+	if (codec->beep->enabled != enabled) {
+		codec->beep->enabled = enabled;
+		return 1;
+	}
+	return 0;
+}
+
+static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
+	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+	.info = stac92xx_dig_beep_switch_info,
+	.get = stac92xx_dig_beep_switch_get,
+	.put = stac92xx_dig_beep_switch_put,
+};
+
+static int stac92xx_beep_switch_ctl(struct hda_codec *codec)
+{
+	return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,
+					 0, "PC Beep Playback Switch", 0);
+}
+#endif
+
 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec)
 {
 	struct sigmatel_spec *spec = codec->spec;
@@ -3377,6 +3425,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
 #ifdef CONFIG_SND_HDA_INPUT_BEEP
 	if (spec->digbeep_nid > 0) {
 		hda_nid_t nid = spec->digbeep_nid;
+		unsigned int caps;
 
 		err = stac92xx_auto_create_beep_ctls(codec, nid);
 		if (err < 0)
@@ -3384,6 +3433,14 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
 		err = snd_hda_attach_beep_device(codec, nid);
 		if (err < 0)
 			return err;
+		/* if no beep switch is available, make its own one */
+		caps = query_amp_caps(codec, nid, HDA_OUTPUT);
+		if (codec->beep &&
+		    !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {
+			err = stac92xx_beep_switch_ctl(codec);
+			if (err < 0)
+				return err;
+		}
 	}
 #endif
 

linux-2.6-defaults-alsa-hda-beep-off.patch:

--- NEW FILE linux-2.6-defaults-alsa-hda-beep-off.patch ---
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 3ecd7e7..2762b40 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -122,7 +122,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
 	beep->nid = nid;
 	beep->dev = input_dev;
 	beep->codec = codec;
-	beep->enabled = 1;
+	beep->enabled = 0;
 	codec->beep = beep;
 
 	INIT_WORK(&beep->beep_work, &snd_hda_generate_beep);


Index: config-generic
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/config-generic,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- config-generic	18 Dec 2008 21:53:28 -0000	1.132
+++ config-generic	18 Dec 2008 22:28:29 -0000	1.133
@@ -2538,7 +2538,7 @@
 CONFIG_SND_FM801_TEA575X_BOOL=y
 CONFIG_SND_HDA_INTEL=m
 CONFIG_SND_HDA_HWDEP=y
-# CONFIG_SND_HDA_INPUT_BEEP is not set
+CONFIG_SND_HDA_INPUT_BEEP=y
 CONFIG_SND_HDA_CODEC_NVHDMI=y
 CONFIG_SND_HDA_CODEC_INTELHDMI=y
 CONFIG_SND_HDA_CODEC_REALTEK=y


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.889
retrieving revision 1.890
diff -u -r1.889 -r1.890
--- kernel.spec	18 Dec 2008 22:04:28 -0000	1.889
+++ kernel.spec	18 Dec 2008 22:28:29 -0000	1.890
@@ -649,6 +649,8 @@
 Patch412: linux-2.6.27.9-alsa-hda-add-a-quirk-for-dell-studio-15.patch
 Patch413: linux-2.6.27.9-alsa-hda-no-headphone-as-line-out-swich-without-line-outs.patch
 Patch414: linux-2.6.27.9-alsa-hda-mark-dell-studio-1535-quirk.patch
+Patch415: linux-2.6-alsa-backport-beep-switch.patch
+Patch416: linux-2.6-defaults-alsa-hda-beep-off.patch
 
 # filesystem patches
 Patch421: linux-2.6-squashfs.patch
@@ -1206,6 +1208,8 @@
 ApplyPatch linux-2.6.27.9-alsa-hda-add-a-quirk-for-dell-studio-15.patch
 ApplyPatch linux-2.6.27.9-alsa-hda-no-headphone-as-line-out-swich-without-line-outs.patch
 ApplyPatch linux-2.6.27.9-alsa-hda-mark-dell-studio-1535-quirk.patch
+ApplyPatch linux-2.6-alsa-backport-beep-switch.patch
+ApplyPatch linux-2.6-defaults-alsa-hda-beep-off.patch
 
 # block/bio
 #
@@ -1920,6 +1924,12 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Fri Dec 19 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.27.10-77
+- Re-enable input beep code, but disable it by default (from F10.)
+  Added:
+   linux-2.6-alsa-backport-beep-switch.patch
+   linux-2.6-defaults-alsa-hda-beep-off.patch
+
 * Fri Dec 19 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.27.10-76
 - Linux 2.6.27.10
   Dropped patches:




More information about the fedora-extras-commits mailing list