Skip to contentSkip to conversation

ALSA driver for SGI O2 audio board

PATCH New Thomas Bogendoerfer 1 participant 1 message Jul 11, 2008 Sound

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ALSA driver for SGI O2 audio board

This patch adds a new ALSA driver for the audio device found inside most of the SGI O2 workstation. The hardware uses a SGI custom chip, which feeds a AD codec chip.

---

Please apply for 2.6.27

Changes in v3:

- removed IRQF_SHARED from request_irq, because they can't be shared

Changes in v2:

- removed unused volume field
- spreaded some statics
- switch over to use C99 field inits
- use msleep_interuptible instead of long udelay
- use schedule_timeout_interruptible instead of simple schedule

 include/sound/ad1843.h  |   46 +++
 sound/mips/Kconfig      |    6 +
 sound/mips/Makefile     |    2 +
 sound/mips/ad1843.c     |  561 ++++++++++++++++++++++++++
 sound/mips/sgio2audio.c | 1006 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 1621 insertions(+), 0 deletions(-)
include/sound/ad1843.h new file +46 -0
new file mode 100644
index 0000000..b236a9d
@@ -0,0 +1,46 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright 2003 Vivien Chappelier <[email protected]>
+ * Copyright 2008 Thomas Bogendoerfer <[email protected]>
+ */
+
+#ifndef __SOUND_AD1843_H
+#define __SOUND_AD1843_H
+
+struct snd_ad1843 {
+	void *chip;
+	int (*read)(void *chip, int reg);
+	int (*write)(void *chip, int reg, int val);
+};
+
+#define AD1843_GAIN_RECLEV 0
+#define AD1843_GAIN_LINE   1
+#define AD1843_GAIN_LINE_2 2
+#define AD1843_GAIN_MIC    3
+#define AD1843_GAIN_PCM_0  4
+#define AD1843_GAIN_PCM_1  5
+#define AD1843_GAIN_SIZE   (AD1843_GAIN_PCM_1+1)
+
+int ad1843_get_gain_max(struct snd_ad1843 *ad1843, int id);
+int ad1843_get_gain(struct snd_ad1843 *ad1843, int id);
+int ad1843_set_gain(struct snd_ad1843 *ad1843, int id, int newval);
+int ad1843_get_recsrc(struct snd_ad1843 *ad1843);
+int ad1843_set_recsrc(struct snd_ad1843 *ad1843, int newsrc);
+void ad1843_setup_dac(struct snd_ad1843 *ad1843,
+		      unsigned int id,
+		      unsigned int framerate,
+		      snd_pcm_format_t fmt,
+		      unsigned int channels);
+void ad1843_shutdown_dac(struct snd_ad1843 *ad1843,
+			 unsigned int id);
+void ad1843_setup_adc(struct snd_ad1843 *ad1843,
+		      unsigned int framerate,
+		      snd_pcm_format_t fmt,
+		      unsigned int channels);
+void ad1843_shutdown_adc(struct snd_ad1843 *ad1843);
+int ad1843_init(struct snd_ad1843 *ad1843);
+
+#endif /* __SOUND_AD1843_H */
sound/mips/Kconfig +6 -0
index 531f8ba..3ce743b 100644
@@ -11,5 +11,11 @@ config SND_AU1X00
 	help
 	  ALSA Sound driver for the Au1x00's AC97 port.
 
+config SND_SGI_O2
+	tristate "SGI O2 Audio"
+	depends on SGI_IP32
+        help
+                Sound support for the SGI O2 Workstation. 
+
 endmenu
 
sound/mips/Makefile +2 -0
index 47afed9..55624d8 100644
@@ -2,7 +2,9 @@
 # Makefile for ALSA
 #
 
+snd-sgi-o2-objs := sgio2audio.o ad1843.o
 snd-au1x00-objs := au1x00.o
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_AU1X00) += snd-au1x00.o
+obj-$(CONFIG_SND_SGI_O2) += snd-sgi-o2.o
sound/mips/ad1843.c new file +561 -0

561 lines not on this page · raw message

sound/mips/sgio2audio.c new file +1006 -0

1,006 lines not on this page · raw message

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel