Skip to contentSkip to conversation

Add back beep support to snd-powermac

PATCH In review Julien BLACHE 2 participants 2 messages Aug 21, 2004 – Aug 22, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add back beep support to snd-powermac

Hi,

The attached patch adds back the beep support to sound/ppc/pmac.c, aka snd-powermac, and adds a dependency on INPUT in sound/ppc/Kconfig (for obvious reason, read on :).

The patch is based on the code that used to be present in that file, and got removed in early april last year. I ported it to the input event interface based on the code used in dmasound_awacs.c.

Attached patch against Linux 2.6.8.1 vanilla. This patch was already posted to debian-powerpc and to the sound maintainer roughly 2 months ago, and has been tested extensively without any problem reported.

Please apply,

JB.

Signature · 5 lines
Julien BLACHE                                   <http://www.jblache.org> 
<[email protected]>                                  GPG KeyID 0xF5D65169


Signed-off-by: Julien BLACHE <[email protected]>
sound/ppc/Kconfig +1 -1
diff -u linux-2.6.8.1/sound/ppc/Kconfig linux-2.6.8.1-BEEP/sound/ppc/Kconfig
@@ -8,7 +8,7 @@
 
 config SND_POWERMAC
 	tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)"
-	depends on SND && I2C
+	depends on SND && I2C && INPUT
 	select SND_PCM
 
 endmenu
sound/ppc/pmac.c +238 -1

275 lines not on this page · raw message

sound/ppc/pmac.h +17 -7
diff -u linux-2.6.8.1/sound/ppc/pmac.h linux-2.6.8.1-BEEP/sound/ppc/pmac.h
@@ -36,7 +36,7 @@
 #endif
 #include <linux/nvram.h>
 #include <linux/tty.h>
-#include <linux/vt_kern.h>
+#include <linux/input.h>
 #include <asm/dbdma.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
@@ -90,6 +90,21 @@
 
 
 /*
+ * beep using pcm
+ */
+struct snd_pmac_beep {
+	int volume;	/* mixer volume: 0-100 */
+	int volume_play;	/* currently playing volume */
+	int hz;
+	int nsamples;
+	short *buf;		/* allocated wave buffer */
+	unsigned long addr;	/* physical address of buffer */
+	snd_kcontrol_t *control;	/* mixer element */
+	struct input_dev indev;         /* input device used for beeping */
+};
+
+
+/*
  */
 
 enum snd_pmac_model {
@@ -146,7 +161,7 @@
 
 	snd_pcm_t *pcm;
 
-	pmac_beep_t *beep;
+	pmac_beep_t beep;
 
 	unsigned int control_mask;	/* control mask */
 
@@ -206,9 +221,4 @@
 	schedule_timeout(((msec) * HZ + 999) / 1000);\
 } while (0)
 
-#ifndef PMAC_SUPPORT_PCM_BEEP
-#define snd_pmac_attach_beep(chip) 0
-#define snd_pmac_beep_stop(chip)  /**/
-#endif
-
 #endif /* __PMAC_H */
sound/ppc/powermac.c +1 -6
diff -u linux-2.6.8.1/sound/ppc/powermac.c linux-2.6.8.1-BEEP/sound/ppc/powermac.c
@@ -37,9 +37,7 @@
 static int index = SNDRV_DEFAULT_IDX1;		/* Index 0-MAX */
 static char *id = SNDRV_DEFAULT_STR1;		/* ID for this card */
 /* static int enable = 1; */
-#ifdef PMAC_SUPPORT_PCM_BEEP
 static int enable_beep = 1;
-#endif
 
 module_param(index, int, 0444);
 MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip.");
@@ -50,11 +48,9 @@
 /* module_param(enable, bool, 0444);
    MODULE_PARM_DESC(enable, "Enable this soundchip.");
    MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC); */
-#ifdef PMAC_SUPPORT_PCM_BEEP
 module_param(enable_beep, bool, 0444);
 MODULE_PARM_DESC(enable_beep, "Enable beep using PCM.");
 MODULE_PARM_SYNTAX(enable_beep, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
-#endif
 
 
 /*
@@ -133,10 +129,9 @@
 		goto __error;
 
 	chip->initialized = 1;
-#ifdef PMAC_SUPPORT_PCM_BEEP
+
 	if (enable_beep)
 		snd_pmac_attach_beep(chip);
-#endif
 
 	if ((err = snd_card_register(card)) < 0)
 		goto __error;
#1 lore raw
Quoted 5 lines · Julien BLACHE

Hi,

The attached patch adds back the beep support to sound/ppc/pmac.c, aka snd-powermac, and adds a dependency on INPUT in sound/ppc/Kconfig (for obvious reason, read on :).

A similar patch is already in our ALSA tree (thus in -mm kernels).

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs