Skip to contentSkip to conversation

Driver for Emagic Audiowerk 2

PATCH In review Cédric Brégardis 2 participants 7 messages Feb 15, 2008 – Feb 20, 2008 1 message not in the archive Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Driver for Emagic Audiowerk 2

Hi,

We managed to write ALSA driver for Emagic Audiowerk 2 PCI sound card (based on Philips SAA7146 chip). You can find more information on
https://gna.org/projects/aw2-alsa/.

We think it's time to integrate the sources into the alsa/kernel tree. So, here is the patch for this driver. We hope this patch is usable.

Regards,

Jean-Christian Hassler and Cedric Bregardis

---
 sound/pci/Kconfig           |   15 +
 sound/pci/Makefile          |    1 +
 sound/pci/aw2/Makefile      |    3 +
 sound/pci/aw2/SAA7146.h     |  168 ++++++++++
 sound/pci/aw2/aw2-alsa.c    |  753 +++++++++++++++++++++++++++++++++++++++++++
 sound/pci/aw2/aw2-saa7146.c |  613 +++++++++++++++++++++++++++++++++++
 sound/pci/aw2/aw2-saa7146.h |  125 +++++++
 sound/pci/aw2/aw2_tsl.h     |  116 +++++++
 8 files changed, 1794 insertions(+), 0 deletions(-)
 create mode 100644 sound/pci/aw2/Makefile
 create mode 100644 sound/pci/aw2/SAA7146.h
 create mode 100644 sound/pci/aw2/aw2-alsa.c
 create mode 100644 sound/pci/aw2/aw2-saa7146.c
 create mode 100644 sound/pci/aw2/aw2-saa7146.h
 create mode 100644 sound/pci/aw2/aw2_tsl.h
sound/pci/Kconfig +15 -0
index 812085d..194394b 100644
@@ -122,6 +122,21 @@ config SND_AU8830
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-au8830.
 
+config SND_AW2
+	tristate "Emagic Audiowerk 2"
+	depends on SND
+	help
+	  Say Y here to include support for Emagic Audiowerk 2 soundcards.
+
+	  Supported features: Analog and SPDIF output. Analog or SPDIF input.
+	  Note: Switch between analog and digital input does not always work.
+	  It can produce continuous noise. The workaround is to switch again
+	  (and again) between digital and analog input until it works.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called snd-aw2.
+
+
 config SND_AZT3328
 	tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)"
 	depends on SND && EXPERIMENTAL
sound/pci/Makefile +1 -0
index 2d42fd2..85ef14b 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_SND) += \
 	ac97/ \
 	ali5451/ \
 	au88x0/ \
+	aw2/ \
 	ca0106/ \
 	cs46xx/ \
 	cs5535audio/ \
sound/pci/aw2/Makefile new file +3 -0
new file mode 100644
index 0000000..842335d
@@ -0,0 +1,3 @@
+snd-aw2-objs := aw2-alsa.o aw2-saa7146.o
+
+obj-$(CONFIG_SND_AW2) += snd-aw2.o
sound/pci/aw2/SAA7146.h new file +168 -0

168 lines not on this page · raw message

sound/pci/aw2/aw2-alsa.c new file +753 -0

753 lines not on this page · raw message

sound/pci/aw2/aw2-saa7146.c new file +613 -0

613 lines not on this page · raw message

sound/pci/aw2/aw2-saa7146.h new file +125 -0

125 lines not on this page · raw message

sound/pci/aw2/aw2_tsl.h new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
1.5.2.5
#1 lore raw

At Sat, 16 Feb 2008 00:30:55 +0100,

Quoted 10 lines · Cédric Brégardis

Hi,

We managed to write ALSA driver for Emagic Audiowerk 2 PCI sound card (based on Philips SAA7146 chip). You can find more information on
https://gna.org/projects/aw2-alsa/.

We think it's time to integrate the sources into the alsa/kernel tree. So, here is the patch for this driver. We hope this patch is usable.

Quoted 7 lines

Regards,

Jean-Christian Hassler and Cedric Bregardis

Thanks for the patch.

First of all, could you fix the issues reported by checkpatch.pl?

Below is a quick review.

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +0 -0

(snip)

Quoted 1 line

+#include <sound/driver.h>

sound/driver.h is deprecated now. Simply remove this line.

Quoted 1 line

+struct aw2_pcm_device_t {

Usually *_t is used for typedef'ed types. Use names without _t for structs, i.e. "struct aw2_pcm_device".

Quoted 1 line

+/* module parameters (see "Module Parameters") */

The comment (see "Module Parameters") isn't needed for the real codes. It's a comment that is valid only in my tutorial.

sound/pci/aw2/aw2-alsa.c line 161

Quoted 3 lines
sound/pci/aw2/aw2-alsa.c new file +3 -0
+/* pci_driver definition */
+static struct pci_driver driver = {
+	.name = "My Own Chip",

Choose a better name :)

Quoted 3 lines

+/* component-destructor
+ * (see "Management of Cards and Components")
+ */

Ditto about the comment.

Quoted 3 lines

+/* chip-specific constructor
+ * (see "Management of Cards and Components")
+ */

Ditto.

Quoted 3 lines
sound/pci/aw2/aw2-alsa.c new file +3 -0
+static int __devinit snd_aw2_create(struct snd_card *card,
+				    struct pci_dev *pci, struct aw2_t **rchip)
+{

(snip)

sound/pci/aw2/aw2-alsa.c line 259

Quoted 1 line
sound/pci/aw2/aw2-alsa.c new file +1 -0
+	chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);

Use kzalloc.

sound/pci/aw2/aw2-alsa.c line 279

Quoted 10 lines
sound/pci/aw2/aw2-alsa.c new file +10 -0
+	/* (1) PCI resource allocation */
+	err = pci_request_regions(pci, "Audiowerk2");
+	if (err < 0) {
+		kfree(chip);
+		return err;
+	}
+	chip->saa7146.iobase_phys = pci_resource_start(pci, 0);
+	chip->saa7146.iobase_virt =
+	    ioremap_nocache(chip->saa7146.iobase_phys,
+			    pci_resource_len(pci, 0));

Better to check whether ioremap succeeded or not.

Quoted 1 line

+/* constructor -- see "Constructor" sub-section */

Fix the comment.

Quoted 1 line

+/* destructor -- see "Destructor" sub-section */

Dtto.

sound/pci/aw2/aw2-alsa.c line 382

Quoted 6 lines
sound/pci/aw2/aw2-alsa.c new file +6 -0
+/* open callback */
+static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	printk(KERN_DEBUG "Playback_open \n");

Avoid unconditionally compiled debug messages. If you really want to keep such debug messages, use snd_printdd() or whatever that won't be compiled unless explicitly specified.

Quoted 4 lines
sound/pci/aw2/aw2-alsa.c new file +4 -0
+/* create a pcm device */
+static int __devinit snd_aw2_new_pcm(struct aw2_t *chip)
+{
+	struct snd_pcm *pcm_playback_ana;

sound/pci/aw2/aw2-alsa.c line 585

Quoted 10 lines
sound/pci/aw2/aw2-alsa.c new file +10 -0
+	struct snd_pcm *pcm_playback_num;
+	struct snd_pcm *pcm_capture;
+	int err = 0;
+
+	/* Create new Alsa PCM device */
+
+	err =
+	    snd_pcm_new(chip->card, "Audiowerk2 analog playback", 0, 1, 0,
+			&pcm_playback_ana);
+	if (err >= 0) {

It's easier to bail out when the error is returned.

sound/pci/aw2/aw2-alsa.c line 660

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +2 -0
+	err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1,
+			  &pcm_capture);

Any reason to make all PCM streams non-duplex?
Oh I see in the below...

Quoted 7 lines
sound/pci/aw2/aw2-alsa.c new file +7 -0
+static int snd_aw2_control_switch_capture_info(struct snd_kcontrol *kcontrol,
+					       struct snd_ctl_elem_info *uinfo)
+{
+	static char *texts[2] = {
+		"Analog", "Digital"
+	};
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;

sound/pci/aw2/aw2-alsa.c line 721

Quoted 10 lines
sound/pci/aw2/aw2-alsa.c new file +10 -0
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = 2;
+	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) {
+		uinfo->value.enumerated.item =
+		    uinfo->value.enumerated.items - 1;
+	}
+	strcpy(uinfo->value.enumerated.name,
+	       texts[uinfo->value.enumerated.item]);
+	return 0;
+}

So, you'd like to switch the input on the fly rather than selecting at open time? It's a question of the driver design...

Quoted 2 lines
sound/pci/aw2/aw2-saa7146.c new file +0 -0

(snip)

sound/pci/aw2/aw2-saa7146.c line 47

Quoted 2 lines
sound/pci/aw2/aw2-saa7146.c new file +2 -0
+#define WRITEREG(value, addr) do { writel((value), chip->iobase_virt + (addr));\
+				   mb(); } while (0)

Do you really need a barrier here?

sound/pci/aw2/aw2-saa7146.c line 66

Quoted 7 lines
sound/pci/aw2/aw2-saa7146.c new file +7 -0
+void snd_aw2_saa7146_dump_registers(struct snd_aw2_saa7146_t *chip)
+{
+	int i = 0;
+	for (i = 0; i <= 0x148; i += 4) {
+		printk(KERN_DEBUG "###DUMP 0x%03x: 0x%08x\n", i, READREG(i));
+	}
+}

Better to use proc interface than printk for such a purpose.

Quoted 16 lines
sound/pci/aw2/aw2-saa7146.c new file +16 -0
+/* chip-specific destructor
+ * (see "PCI Resource Managements")
+ */
+int snd_aw2_saa7146_free(struct snd_aw2_saa7146_t *chip)
+{
+	/* disable all irqs */
+	WRITEREG(0, IER);
+
+	/* reset saa7146 */
+	WRITEREG((MRST_N << 16), MC1);
+
+	/* release the irq */
+	if (chip->irq >= 0) {
+		free_irq(chip->irq, (void *)chip);
+	}
+	/* release the i/o ports & memory */

sound/pci/aw2/aw2-saa7146.c line 93

Quoted 10 lines
sound/pci/aw2/aw2-saa7146.c new file +10 -0
+	if (chip->iobase_virt) {
+		iounmap(chip->iobase_virt);
+	}
+	pci_release_regions(chip->pci);
+	/* disable the PCI entry */
+	pci_disable_device(chip->pci);
+	/* release the data */
+	kfree(chip);
+	return 0;
+}

Put the destructor in the same place as the constructor. Don't put in separate files.

Quoted 2 lines
sound/pci/aw2/aw2-saa7146.h new file +0 -0

(snip)

sound/pci/aw2/aw2-saa7146.h line 31

Quoted 5 lines
sound/pci/aw2/aw2-saa7146.h new file +5 -0
+#ifdef AW2_SAA7146_M
+#define PUBLIC
+#else
+#define PUBLIC extern
+#endif

Don't do this. It's too hackish.

thanks,

Takashi

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 9 lines · Takashi Iwai

At Tue, 19 Feb 2008 00:38:54 +0100,

Quoted 3 lines · Cédric Brégardis

Could you avoid HTML mail? I cannot get the patch properly. If embedding text is difficult, rather use an attachment.

Oh ! I am really sorry. I don't understand why my mailer has sent this mail in HTML... And as a side effect the mail has been refused by the list (too big).

So, this time you will find the patch in attachment, as suggested.

Regards,
Cedric.

Emagic Audiowerk 2 ALSA driver.

---
 sound/pci/Kconfig           |   15 +
 sound/pci/Makefile          |    1 +
 sound/pci/aw2/Makefile      |    3 +
 sound/pci/aw2/aw2-alsa.c    |  787 +++++++++++++++++++++++++++++++++++++++++++
 sound/pci/aw2/aw2-saa7146.c |  585 ++++++++++++++++++++++++++++++++
 sound/pci/aw2/aw2-saa7146.h |  112 ++++++
 sound/pci/aw2/aw2-tsl.h     |  116 +++++++
 sound/pci/aw2/saa7146.h     |  168 +++++++++
 8 files changed, 1787 insertions(+), 0 deletions(-)
 create mode 100644 sound/pci/aw2/Makefile
 create mode 100644 sound/pci/aw2/aw2-alsa.c
 create mode 100644 sound/pci/aw2/aw2-saa7146.c
 create mode 100644 sound/pci/aw2/aw2-saa7146.h
 create mode 100644 sound/pci/aw2/aw2-tsl.h
 create mode 100644 sound/pci/aw2/saa7146.h
sound/pci/Kconfig +15 -0
index 812085d..194394b 100644
@@ -122,6 +122,21 @@ config SND_AU8830
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-au8830.
 
+config SND_AW2
+	tristate "Emagic Audiowerk 2"
+	depends on SND
+	help
+	  Say Y here to include support for Emagic Audiowerk 2 soundcards.
+
+	  Supported features: Analog and SPDIF output. Analog or SPDIF input.
+	  Note: Switch between analog and digital input does not always work.
+	  It can produce continuous noise. The workaround is to switch again
+	  (and again) between digital and analog input until it works.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called snd-aw2.
+
+
 config SND_AZT3328
 	tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)"
 	depends on SND && EXPERIMENTAL
sound/pci/Makefile +1 -0
index 2d42fd2..85ef14b 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_SND) += \
 	ac97/ \
 	ali5451/ \
 	au88x0/ \
+	aw2/ \
 	ca0106/ \
 	cs46xx/ \
 	cs5535audio/ \
sound/pci/aw2/Makefile new file +3 -0
new file mode 100644
index 0000000..842335d
@@ -0,0 +1,3 @@
+snd-aw2-objs := aw2-alsa.o aw2-saa7146.o
+
+obj-$(CONFIG_SND_AW2) += snd-aw2.o
sound/pci/aw2/aw2-alsa.c new file +787 -0

787 lines not on this page · raw message

sound/pci/aw2/aw2-saa7146.c new file +585 -0

585 lines not on this page · raw message

sound/pci/aw2/aw2-saa7146.h new file +112 -0

112 lines not on this page · raw message

sound/pci/aw2/aw2-tsl.h new file +116 -0

116 lines not on this page · raw message

sound/pci/aw2/saa7146.h new file +168 -0

168 lines not on this page · raw message

Signature · 1 line
1.5.2.5

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

#5 lore raw

At Tue, 19 Feb 2008 18:11:45 +0100,

Quoted 9 lines · Cédric Brégardis
Quoted 7 lines · Takashi Iwai

At Tue, 19 Feb 2008 00:38:54 +0100,

Quoted 3 lines · Cédric Brégardis
Quoted 8 lines
Quoted 2 lines

Could you avoid HTML mail? I cannot get the patch properly. If embedding text is difficult, rather use an attachment.

Oh ! I am really sorry. I don't understand why my mailer has sent this mail in HTML... And as a side effect the mail has been refused by the list (too big).

So, this time you will find the patch in attachment, as suggested.

Thanks. I've checked again right now, and found some remaining issues.

sound/pci/aw2/aw2-alsa.c line 272

Quoted 4 lines
sound/pci/aw2/aw2-alsa.c new file +4 -0
+	/* check PCI availability (32bit DMA) */
+	if ((pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) ||
+	    (pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0)) {
+		printk(KERN_ERR "Impossible to set 32bit mask DMA\n");

The error message should have some prefix to indicate the driver name. Otherwise you'll have no idea who wrote it.

sound/pci/aw2/aw2-alsa.c line 300

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +2 -0
+	if (chip->saa7146.iobase_virt == NULL) {
+		printk(KERN_ERR "unable to remap memory region");

Ditto.

sound/pci/aw2/aw2-alsa.c line 309

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +2 -0
+	if (request_irq(pci->irq, snd_aw2_saa7146_interrupt,
+			IRQF_SHARED, "Audiowerk2", (void *)chip)) {

The cast to void* isn't needed.

sound/pci/aw2/aw2-alsa.c line 310

Quoted 1 line
sound/pci/aw2/aw2-alsa.c new file +1 -0
+		printk(KERN_ERR "Cannot grab irq %d\n", pci->irq);

Add prefix.

Quoted 3 lines
sound/pci/aw2/aw2-alsa.c new file +3 -0
+/* constructor */
+static int __devinit snd_aw2_probe(struct pci_dev *pci,
+				   const struct pci_device_id *pci_id)

(snip)

sound/pci/aw2/aw2-alsa.c line 371

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +2 -0
+	/* initialize semaphore */
+	init_MUTEX(&(chip->saa7146.sem));

Use struct mutex instead of semaphore. Also, the parenthesis around '&' isn't needed.

sound/pci/aw2/aw2-alsa.c line 373

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +2 -0
+	/* init spinlock */
+	spin_lock_init(&chip->saa7146.reg_lock);

The spinlock is actually local to aw2-alsa.c, isn't it? Then it should be outside saa7146.

sound/pci/aw2/aw2-alsa.c line 375

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +2 -0
+	/* initialize wait queue */
+	init_waitqueue_head(&chip->saa7146.wait_iic);

... and I'd suggest to the initializations of struct saa7146 to aw2-saa7146.c. mutex should be initialized there, too.

Quoted 2 lines
sound/pci/aw2/aw2-alsa.c new file +2 -0
+/* create a pcm device */
+static int __devinit snd_aw2_new_pcm(struct aw2 *chip)

(snip)

sound/pci/aw2/aw2-alsa.c line 649

Quoted 12 lines
sound/pci/aw2/aw2-alsa.c new file +12 -0
+	/* pre-allocation of buffers */
+	/* Preallocate continuous pages. */
+	err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana,
+						    SNDRV_DMA_TYPE_DEV,
+						    snd_dma_pci_data
+						    (chip->pci),
+						    64 * 1024, 64 * 1024);
+	if (err) {
+		printk(KERN_ERR "snd_pcm_lib_preallocate_pages_for_all error "
+		       "(0x%X)\n", err);
+		return err;
+	}

The error from preallocator isn't fatal. You can ignore it.

Quoted 2 lines
(quoted diff) +2 -0
+void snd_aw2_saa7146_pcm_trigger_start_playback(struct snd_aw2_saa7146 *chip,
+						int stream_number)

(snip)

sound/pci/aw2/aw2-saa7146.c line 308

Quoted 8 lines
sound/pci/aw2/aw2-saa7146.c new file +8 -0
+	} else if (stream_number == 1) {
+		WRITEREG((TR_E_A1_OUT << 16) | TR_E_A1_OUT, MC1);
+
+		/* WS1_CTRL, WS1_SYNC: output TSL1, I2S */
+		acon1 |= 1 * WS1_CTRL;
+		WRITEREG(acon1, ACON1);
+	} else {
+	}

Remove the empty block.

Quoted 2 lines
(quoted diff) +2 -0
+void snd_aw2_saa7146_pcm_trigger_stop_playback(struct snd_aw2_saa7146 *chip,
+					       int stream_number)

(snip)

sound/pci/aw2/aw2-saa7146.c line 330

Quoted 8 lines
sound/pci/aw2/aw2-saa7146.c new file +8 -0
+	} else if (stream_number == 1) {
+		/* WS1_CTRL, WS1_SYNC: output TSL1, I2S */
+		acon1 &= ~(3 * WS1_CTRL);
+		WRITEREG(acon1, ACON1);
+
+		WRITEREG((TR_E_A1_OUT << 16), MC1);
+	} else {
+	}

Ditto.

sound/pci/aw2/aw2-saa7146.c line 341

Quoted 9 lines
sound/pci/aw2/aw2-saa7146.c new file +9 -0
+void snd_aw2_saa7146_pcm_trigger_start_capture(struct snd_aw2_saa7146 *chip,
+					       int stream_number)
+{
+	/* In aw8 driver, dma transfert is always active. It is
+	   started and stopped in a larger "space" */
+	if (stream_number == 0) {
+		WRITEREG((TR_E_A1_IN << 16) | TR_E_A1_IN, MC1);
+	} else {
+	}

Ditto.

sound/pci/aw2/aw2-saa7146.c line 350

Quoted 7 lines
sound/pci/aw2/aw2-saa7146.c new file +7 -0
+void snd_aw2_saa7146_pcm_trigger_stop_capture(struct snd_aw2_saa7146 *chip,
+					      int stream_number)
+{
+	if (stream_number == 0) {
+		WRITEREG((TR_E_A1_IN << 16), MC1);
+	} else {
+	}

Ditto.

Quoted 8 lines
sound/pci/aw2/aw2-saa7146.c new file +8 -0
+irqreturn_t snd_aw2_saa7146_interrupt(int irq, void *dev_id)
+{
+	unsigned int isr;
+	unsigned int iicsta;
+	struct snd_aw2_saa7146 *chip = dev_id;
+
+	isr = READREG(ISR);
+	if (!isr)

sound/pci/aw2/aw2-saa7146.c line 371

Quoted 10 lines
sound/pci/aw2/aw2-saa7146.c new file +10 -0
+		return IRQ_NONE;
+
+	WRITEREG(isr, ISR);
+
+	if (isr & (IIC_S | IIC_E)) {
+		iicsta = READREG(IICSTA);
+		WRITEREG(0x100, IICSTA);
+		wake_up(&chip->wait_iic);
+	} else if (isr) {
+	}

Ditto.

Quoted 4 lines
sound/pci/aw2/aw2-saa7146.c new file +4 -0
+unsigned int snd_aw2_saa7146_get_hw_ptr_playback(struct snd_aw2_saa7146 *chip,
+						 int stream_number,
+						 unsigned char *start_addr,
+						 unsigned int buffer_size)

(snip)

sound/pci/aw2/aw2-saa7146.c line 420

Quoted 8 lines
sound/pci/aw2/aw2-saa7146.c new file +8 -0
+	if (stream_number == 1) {
+		pci_adp = READREG(PCI_ADP1);
+		ptr = pci_adp - (size_t) start_addr;
+
+		if (ptr == buffer_size)
+			ptr = 0;
+	} else {
+	}

Ditto.

sound/pci/aw2/aw2-saa7146.c line 497

Quoted 8 lines
sound/pci/aw2/aw2-saa7146.c new file +8 -0
+int snd_aw2_saa7146_is_using_digital_input(struct snd_aw2_saa7146 *chip)
+{
+	unsigned int reg_val = READREG(GPIO_CTRL);
+	if ((reg_val & 0xFF) == 0x40) {
+		return 1;
+	} else {
+		return 0;
+	}

Remove braces around the single if-statement.
Can be found in many other places.
(I thought this should be suggested by checkpatch.pl, but apparently
not perfectly detected...)

Takashi

#6 lore raw
Quoted 8 lines · Takashi Iwai

At Tue, 19 Feb 2008 18:11:45 +0100,

Cédric Brégardis wrote:
[...]

Quoted 1 line

So, this time you will find the patch in attachment, as suggested.

Thanks. I've checked again right now, and found some remaining issues.

Thanks. I have corrected the driver according to your review. By the same time I have removed some dead code. The new patch is in attachment.

Regards,
Cedric.

Emagic Audiowerk 2 ALSA driver.

---
 sound/pci/Kconfig           |   15 +
 sound/pci/Makefile          |    1 +
 sound/pci/aw2/Makefile      |    3 +
 sound/pci/aw2/aw2-alsa.c    |  787 +++++++++++++++++++++++++++++++++++++++++++
 sound/pci/aw2/aw2-saa7146.c |  464 +++++++++++++++++++++++++
 sound/pci/aw2/aw2-saa7146.h |  105 ++++++
 sound/pci/aw2/aw2-tsl.h     |  116 +++++++
 sound/pci/aw2/saa7146.h     |  168 +++++++++
 8 files changed, 1659 insertions(+), 0 deletions(-)
 create mode 100644 sound/pci/aw2/Makefile
 create mode 100644 sound/pci/aw2/aw2-alsa.c
 create mode 100644 sound/pci/aw2/aw2-saa7146.c
 create mode 100644 sound/pci/aw2/aw2-saa7146.h
 create mode 100644 sound/pci/aw2/aw2-tsl.h
 create mode 100644 sound/pci/aw2/saa7146.h
sound/pci/Kconfig +15 -0
index 812085d..194394b 100644
@@ -122,6 +122,21 @@ config SND_AU8830
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-au8830.
 
+config SND_AW2
+	tristate "Emagic Audiowerk 2"
+	depends on SND
+	help
+	  Say Y here to include support for Emagic Audiowerk 2 soundcards.
+
+	  Supported features: Analog and SPDIF output. Analog or SPDIF input.
+	  Note: Switch between analog and digital input does not always work.
+	  It can produce continuous noise. The workaround is to switch again
+	  (and again) between digital and analog input until it works.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called snd-aw2.
+
+
 config SND_AZT3328
 	tristate "Aztech AZF3328 / PCI168 (EXPERIMENTAL)"
 	depends on SND && EXPERIMENTAL
sound/pci/Makefile +1 -0
index 2d42fd2..85ef14b 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_SND) += \
 	ac97/ \
 	ali5451/ \
 	au88x0/ \
+	aw2/ \
 	ca0106/ \
 	cs46xx/ \
 	cs5535audio/ \
sound/pci/aw2/Makefile new file +3 -0
new file mode 100644
index 0000000..842335d
@@ -0,0 +1,3 @@
+snd-aw2-objs := aw2-alsa.o aw2-saa7146.o
+
+obj-$(CONFIG_SND_AW2) += snd-aw2.o
sound/pci/aw2/aw2-alsa.c new file +787 -0

787 lines not on this page · raw message

sound/pci/aw2/aw2-saa7146.c new file +464 -0

464 lines not on this page · raw message

sound/pci/aw2/aw2-saa7146.h new file +105 -0

105 lines not on this page · raw message

sound/pci/aw2/aw2-tsl.h new file +116 -0

116 lines not on this page · raw message

sound/pci/aw2/saa7146.h new file +168 -0

168 lines not on this page · raw message

--
1.5.2.5

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

#7 lore raw

At Tue, 19 Feb 2008 22:34:36 +0100,

Quoted 6 lines · Cédric Brégardis
Quoted 4 lines · Takashi Iwai

At Tue, 19 Feb 2008 18:11:45 +0100,

Cédric Brégardis wrote:
[...]

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

So, this time you will find the patch in attachment, as suggested.

Thanks. I've checked again right now, and found some remaining issues.

Thanks. I have corrected the driver according to your review. By the same time I have removed some dead code. The new patch is in attachment.

Thanks, now applied to HG tree.

.. and I found one more missing thing, the declaration of module parameters, after commitment. Fixed on HG tree now together with the addition of a very breif description of aw2 driver to ALSA-Configuration.txt.

Takashi