Skip to contentSkip to conversation

sis7019: support the SiS 7019 Audio Accelerator

PATCH In review Dave Dillow 2 participants 6 messages Nov 28, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sis7019: support the SiS 7019 Audio Accelerator

Basic audio support for the SiS 7019 Audio Accelerator as found in the SiS 55x SoC. There is currently no synth support at the moment, but audio playback and capture with two periods per buffer has seen extensive use. Arbitrary period and buffer sizes (with multiple periods per buffer) have seen light testing, but are believed to be production ready.

---
This is against the alsa-kernel hg repo.

Changes since last posting:
* Removed unnecessary locking
* Added power management support
* Reworked capture period timing to use dedicated silence buffer
* Changed header location
* Fixed muting of left stereo channel
* Fixed XRUNs with non-integral periods per buffer
* Better enforcement of hardware limits

 pci/sis7019.c   | 1466 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 pci/sis7019.h   |  342 +++++++++++++
 pci/Kconfig     |   10 
 pci/Makefile    |    2 
 4 files changed, 1820 insertions(+)
pci/Kconfig +10 -0
diff -r 17223a4918b4 pci/Kconfig
@@ -802,6 +802,16 @@ config SND_RME9652
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-rme9652.
 
+config SND_SIS7019
+	tristate "SiS 7019 Audio Accelerator"
+	depends on SND
+	select SND_AC97_CODEC
+	help
+	  Say Y here to include support for the SiS 7019 Audio Accelerator.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called snd-sis7019.
+
 config SND_SONICVIBES
 	tristate "S3 SonicVibes"
 	depends on SND
pci/Makefile +2 -0
diff -r 17223a4918b4 pci/Makefile
@@ -23,6 +23,7 @@ snd-maestro3-objs := maestro3.o
 snd-maestro3-objs := maestro3.o
 snd-rme32-objs := rme32.o
 snd-rme96-objs := rme96.o
+snd-sis7019-objs := sis7019.o
 snd-sonicvibes-objs := sonicvibes.o
 snd-via82xx-objs := via82xx.o
 snd-via82xx-modem-objs := via82xx_modem.o
@@ -48,6 +49,7 @@ obj-$(CONFIG_SND_MAESTRO3) += snd-maestr
 obj-$(CONFIG_SND_MAESTRO3) += snd-maestro3.o
 obj-$(CONFIG_SND_RME32) += snd-rme32.o
 obj-$(CONFIG_SND_RME96) += snd-rme96.o
+obj-$(CONFIG_SND_SIS7019) += snd-sis7019.o
 obj-$(CONFIG_SND_SONICVIBES) += snd-sonicvibes.o
 obj-$(CONFIG_SND_VIA82XX) += snd-via82xx.o
 obj-$(CONFIG_SND_VIA82XX_MODEM) += snd-via82xx-modem.o
pci/sis7019.c new file +1466 -0

1,466 lines not on this page · raw message

pci/sis7019.h new file +342 -0

342 lines not on this page · raw message

#1 lore raw

At Wed, 28 Nov 2007 02:19:03 -0500,

pci/sis7019.c line 43

Quoted 3 lines · Dave Dillow
pci/sis7019.c new file +3 -0
+static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
+static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
+static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */

Can there be multiple SIS7019 devices? If there can only a single device, let's avoid array.

pci/sis7019.c line 50

Quoted 6 lines
pci/sis7019.c new file +6 -0
+module_param_array(index, int, NULL, 0444);
+MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator.");
+module_param_array(id, charp, NULL, 0444);
+MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator.");
+module_param_array(enable, bool, NULL, 0444);
+MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator.");

Ditto.

pci/sis7019.c line 161

Quoted 7 lines
pci/sis7019.c new file +7 -0
+static struct snd_pcm_hardware sis_playback_hw_info = {
+	.info = (SNDRV_PCM_INFO_MMAP |
+		 SNDRV_PCM_INFO_MMAP_VALID |
+		 SNDRV_PCM_INFO_INTERLEAVED |
+		 SNDRV_PCM_INFO_BLOCK_TRANSFER |
+		 SNDRV_PCM_INFO_SYNC_START |
+		 SNDRV_PCM_INFO_RESUME),

SNDRV_PCM_INFO_SYNC_START seems invalid here. It's not implemented in the driver.

Quoted 1 line

+static void __sis_map_silence(struct sis7019 *sis)

Any reason to use __ prefix?

Thanks,

Takashi

#2 lore raw
Quoted 8 lines · Takashi Iwai

At Wed, 28 Nov 2007 02:19:03 -0500,

pci/sis7019.c line 43

Quoted 3 lines · Dave Dillow
pci/sis7019.c new file +3 -0
+static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
+static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
+static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */

Can there be multiple SIS7019 devices? If there can only a single device, let's avoid array.

Ok, can do.

Quoted 10 lines

pci/sis7019.c line 161

Quoted 7 lines
pci/sis7019.c new file +7 -0
+static struct snd_pcm_hardware sis_playback_hw_info = {
+	.info = (SNDRV_PCM_INFO_MMAP |
+		 SNDRV_PCM_INFO_MMAP_VALID |
+		 SNDRV_PCM_INFO_INTERLEAVED |
+		 SNDRV_PCM_INFO_BLOCK_TRANSFER |
+		 SNDRV_PCM_INFO_SYNC_START |
+		 SNDRV_PCM_INFO_RESUME),

SNDRV_PCM_INFO_SYNC_START seems invalid here. It's not implemented in the driver.

Perhaps I'm misunderstanding what SYNC_START is for -- I can start multiple playback/capture substreams at once in ->trigger(). If it means something else, can you point to a driver that does implement it properly so that I can see if can be implemented?

Quoted 3 lines
Quoted 1 line

+static void __sis_map_silence(struct sis7019 *sis)

Any reason to use __ prefix?

It requires locks to be held when it is called, making it an internal helper function. I'd prefer to keep the prefix, but it could go away, or be merged into the one call-site.

Thanks,
Dave

#3 lore raw

At Wed, 28 Nov 2007 08:03:35 -0500,

Quoted 12 lines · Dave Dillow
Quoted 11 lines

pci/sis7019.c line 161

Quoted 8 lines
pci/sis7019.c new file +7 -0
+static struct snd_pcm_hardware sis_playback_hw_info = {
+	.info = (SNDRV_PCM_INFO_MMAP |
+		 SNDRV_PCM_INFO_MMAP_VALID |
+		 SNDRV_PCM_INFO_INTERLEAVED |
+		 SNDRV_PCM_INFO_BLOCK_TRANSFER |
+		 SNDRV_PCM_INFO_SYNC_START |
+		 SNDRV_PCM_INFO_RESUME),

SNDRV_PCM_INFO_SYNC_START seems invalid here. It's not implemented in the driver.

Quoted 4 lines

Perhaps I'm misunderstanding what SYNC_START is for -- I can start multiple playback/capture substreams at once in ->trigger(). If it means something else, can you point to a driver that does implement it properly so that I can see if can be implemented?

Sorry, looks like I typo'ed when I searched strngs (due to a damn keyboard scan bug in the recent xorg...)
Please disregard my previous comment.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+static void __sis_map_silence(struct sis7019 *sis)

Any reason to use __ prefix?

It requires locks to be held when it is called, making it an internal helper function. I'd prefer to keep the prefix, but it could go away, or be merged into the one call-site.

OK, then it's fine. But add a proper comment. Otherwise no one else would understand the difference.

Thanks,

Takashi

#4 lore raw
Quoted 2 lines · Takashi Iwai

OK, then it's fine. But add a proper comment. Otherwise no one else would understand the difference.

I presume the comment /* Must hold the voice_lock on entry */ present in all of the __ functions is insufficient, or we wouldn't be having this coversation? :)

#5 lore raw

At Wed, 28 Nov 2007 08:22:25 -0500,

Quoted 8 lines · Dave Dillow
Quoted 2 lines · Takashi Iwai

OK, then it's fine. But add a proper comment. Otherwise no one else would understand the difference.

I presume the comment /* Must hold the voice_lock on entry */ present in all of the __ functions is insufficient, or we wouldn't be having this coversation? :)

Yeah, that comment should suffice. Let's save other one's precious time in advance ;)

thanks,

Takashi