Commit bd15eba3 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Linus Torvalds

[PATCH] v4l: 720: alsa support for saa7134 that should work wonderful

- Alsa support for saa7134 that should work.
Signed-off-by: default avatarRicardo Cerqueira <v4l@cerqueira.org>
Signed-off-by: default avatarNickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2f8d4f51
This diff is collapsed.
......@@ -57,6 +57,10 @@ static unsigned int oss = 0;
module_param(oss, int, 0444);
MODULE_PARM_DESC(oss,"register oss devices (default: no)");
static unsigned int alsa = 0;
module_param(alsa, int, 0444);
MODULE_PARM_DESC(alsa,"register alsa devices (default: no)");
static unsigned int latency = UNSET;
module_param(latency, int, 0444);
MODULE_PARM_DESC(latency,"pci latency timer");
......@@ -591,13 +595,19 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
card_has_mpeg(dev))
saa7134_irq_ts_done(dev,status);
if ((report & SAA7134_IRQ_REPORT_DONE_RA3))
saa7134_irq_oss_done(dev,status);
if ((report & SAA7134_IRQ_REPORT_DONE_RA3)) {
if (oss) {
saa7134_irq_oss_done(dev,status);
} else if (alsa) {
saa7134_irq_alsa_done(dev,status);
}
}
if ((report & (SAA7134_IRQ_REPORT_GPIO16 |
SAA7134_IRQ_REPORT_GPIO18)) &&
dev->remote)
saa7134_input_irq(dev);
}
if (10 == loop) {
......@@ -1016,6 +1026,10 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
goto fail5;
printk(KERN_INFO "%s: registered device mixer%d\n",
dev->name,dev->oss.minor_mixer >> 4);
} else if (alsa) {
alsa_card_saa7134_create(dev);
printk(KERN_INFO "%s: registered ALSA devices\n",
dev->name);
}
break;
}
......@@ -1043,6 +1057,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
case PCI_DEVICE_ID_PHILIPS_SAA7135:
if (oss)
unregister_sound_dsp(dev->oss.minor_dsp);
else if (alsa)
alsa_card_saa7134_exit();
break;
}
fail4:
......@@ -1102,7 +1118,8 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
if (oss) {
unregister_sound_mixer(dev->oss.minor_mixer);
unregister_sound_dsp(dev->oss.minor_dsp);
}
} else if (alsa)
alsa_card_saa7134_exit();
break;
}
saa7134_unregister_video(dev);
......
......@@ -44,6 +44,7 @@ MODULE_PARM_DESC(oss_rate,"sample rate (valid are: 32000,48000)");
#define dprintk(fmt, arg...) if (oss_debug) \
printk(KERN_DEBUG "%s/oss: " fmt, dev->name , ## arg)
/* ------------------------------------------------------------------ */
static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks)
......@@ -173,8 +174,8 @@ static int dsp_rec_start(struct saa7134_dev *dev)
fmt |= (2 << 4);
if (!sign)
fmt |= 0x04;
saa_writel(0x588 >> 2, dev->oss.blksize -4);
saa_writel(0x58c >> 2, 0x543210 | (fmt << 24));
saa_writel(SAA7133_NUM_SAMPLES, dev->oss.blksize -4);
saa_writel(SAA7133_AUDIO_CHANNEL, 0x543210 | (fmt << 24));
break;
}
dprintk("rec_start: afmt=%d ch=%d => fmt=0x%x swap=%c\n",
......
......@@ -43,6 +43,14 @@
#define SAA7134_FIFO_SIZE (0x2a0 >> 2)
#define SAA7134_THRESHOULD (0x2a4 >> 2)
#define SAA7133_NUM_SAMPLES (0x588 >> 2)
#define SAA7133_AUDIO_CHANNEL (0x58c >> 2)
#define SAA7133_AUDIO_FORMAT (0x58f >> 2)
#define SAA7133_DIGITAL_OUTPUT_SEL1 (0x46c >> 2)
#define SAA7133_DIGITAL_OUTPUT_SEL2 (0x470 >> 2)
#define SAA7133_DIGITAL_INPUT_XBAR1 (0x464 >> 2)
#define SAA7133_ANALOG_IO_SELECT (0x594 >> 2)
/* main control */
#define SAA7134_MAIN_CTRL (0x2a8 >> 2)
#define SAA7134_MAIN_CTRL_VPLLE (1 << 15)
......
......@@ -45,6 +45,10 @@
#endif
#define UNSET (-1U)
#include <sound/driver.h>
#include <sound/core.h>
#include <sound/pcm.h>
/* ----------------------------------------------------------- */
/* enums */
......@@ -364,6 +368,7 @@ struct saa7134_oss {
unsigned int dma_blk;
unsigned int read_offset;
unsigned int read_count;
snd_pcm_substream_t *substream;
};
/* IR input */
......@@ -644,6 +649,11 @@ int saa7134_input_init1(struct saa7134_dev *dev);
void saa7134_input_fini(struct saa7134_dev *dev);
void saa7134_input_irq(struct saa7134_dev *dev);
int alsa_card_saa7134_create(struct saa7134_dev *saadev);
void alsa_card_saa7134_exit(void);
void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status);
/*
* Local variables:
* c-basic-offset: 8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment