Commit 6f2f7e21 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] saa7134 driver update

This updates the saa7134 driver.  It adds support for a few more cards
and includes adaptions to the video-buf.c changes sent earlier.
parent f26843fa
...@@ -288,6 +288,81 @@ struct saa7134_board saa7134_boards[] = { ...@@ -288,6 +288,81 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2, .amux = LINE2,
}, },
}, },
[SAA7134_BOARD_KWORLD] = {
.name = "Kworld/KuroutoShikou SAA7130-TVPCI",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_NTSC_M,
.inputs = {{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
},{
.name = name_tv,
.vmux = 1,
.amux = TV,
.tv = 1,
}},
},
[SAA7134_BOARD_CINERGY600] = {
.name = "Terratec Cinergy 600 TV",
.audio_clock = 0x00200000,
.tuner_type = TUNER_PHILIPS_PAL,
.inputs = {{
.name = name_tv,
.vmux = 1,
.amux = TV,
.tv = 1,
},{
.name = name_comp1,
.vmux = 4,
.amux = LINE1,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
},{
.name = name_comp2, // CVideo over SVideo Connector
.vmux = 0,
.amux = LINE1,
}},
.radio = {
.name = name_radio,
.amux = LINE2,
},
},
[SAA7134_BOARD_MD7134] = {
.name = "Medion 7134",
.audio_clock = 0x00200000,
.tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
.need_tda9887 = 1,
.inputs = {{
.name = name_tv,
.vmux = 1,
.amux = LINE2,
.tv = 1,
},{
.name = name_comp1,
.vmux = 0,
.amux = LINE2,
},{
.name = name_comp2,
.vmux = 3,
.amux = LINE2,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE2,
}},
.radio = {
.name = name_radio,
.amux = LINE2,
},
},
}; };
const int saa7134_bcount = (sizeof(saa7134_boards)/sizeof(struct saa7134_board)); const int saa7134_bcount = (sizeof(saa7134_boards)/sizeof(struct saa7134_board));
...@@ -320,7 +395,25 @@ struct pci_device_id __devinitdata saa7134_pci_tbl[] = { ...@@ -320,7 +395,25 @@ struct pci_device_id __devinitdata saa7134_pci_tbl[] = {
.subdevice = 0x1142, .subdevice = 0x1142,
.driver_data = SAA7134_BOARD_CINERGY400, .driver_data = SAA7134_BOARD_CINERGY400,
},{ },{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
.subvendor = 0x153B,
.subdevice = 0x1143,
.driver_data = SAA7134_BOARD_CINERGY600,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
.subvendor = 0x5168,
.subdevice = 0x0138,
.driver_data = SAA7134_BOARD_FLYVIDEO3000,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
.subvendor = 0x16be,
.subdevice = 0x0003,
.driver_data = SAA7134_BOARD_MD7134,
},{
/* --- boards without eeprom + subsystem ID --- */ /* --- boards without eeprom + subsystem ID --- */
.vendor = PCI_VENDOR_ID_PHILIPS, .vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134, .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
......
...@@ -318,6 +318,7 @@ static u32 functionality(struct i2c_adapter *adap) ...@@ -318,6 +318,7 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL; return I2C_FUNC_SMBUS_EMUL;
} }
static int attach_inform(struct i2c_client *client) static int attach_inform(struct i2c_client *client)
{ {
struct saa7134_dev *dev = client->adapter->algo_data; struct saa7134_dev *dev = client->adapter->algo_data;
......
...@@ -102,11 +102,13 @@ static int dsp_rec_start(struct saa7134_dev *dev) ...@@ -102,11 +102,13 @@ static int dsp_rec_start(struct saa7134_dev *dev)
/* prepare buffer */ /* prepare buffer */
if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma))) if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->oss.dma)))
return err; return err;
if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->oss.pt)))
goto fail1;
if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt, if (0 != (err = saa7134_pgtable_build(dev->pci,&dev->oss.pt,
dev->oss.dma.sglist, dev->oss.dma.sglist,
dev->oss.dma.sglen, dev->oss.dma.sglen,
0))) 0)))
goto fail1; goto fail2;
/* sample format */ /* sample format */
switch (dev->oss.afmt) { switch (dev->oss.afmt) {
......
...@@ -52,21 +52,24 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -52,21 +52,24 @@ static int buffer_activate(struct saa7134_dev *dev,
struct saa7134_buf *buf, struct saa7134_buf *buf,
struct saa7134_buf *next) struct saa7134_buf *next)
{ {
unsigned long control,status; u32 control;
dprintk("buffer_activate [%p]\n",buf); dprintk("buffer_activate [%p]\n",buf);
buf->vb.state = STATE_ACTIVE; buf->vb.state = STATE_ACTIVE;
/* dma: setup channel 5 (= TS) */ /* dma: setup channel 5 (= TS) */
control = SAA7134_RS_CONTROL_BURST_16 | control = SAA7134_RS_CONTROL_BURST_16 |
SAA7134_RS_CONTROL_ME | SAA7134_RS_CONTROL_ME |
(buf->pt->dma >> 12); (buf->pt->dma >> 12);
status = saa_readl(SAA7134_IRQ_STATUS); if (NULL == next)
if (0 == (status & 0x100000)) { next = buf;
if (V4L2_FIELD_TOP == buf->vb.field) {
dprintk("[top] buf=%p next=%p",buf,next);
saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(buf)); saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(buf));
saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(next)); saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(next));
} else { } else {
dprintk("[bottom] buf=%p next=%p",buf,next);
saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next)); saa_writel(SAA7134_RS_BA1(5),saa7134_buffer_base(next));
saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf)); saa_writel(SAA7134_RS_BA2(5),saa7134_buffer_base(buf));
} }
...@@ -80,7 +83,8 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -80,7 +83,8 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0; return 0;
} }
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb) static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
enum v4l2_field field)
{ {
struct saa7134_dev *dev = file->private_data; struct saa7134_dev *dev = file->private_data;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
...@@ -116,7 +120,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb) ...@@ -116,7 +120,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb)
buf->vb.state = STATE_PREPARED; buf->vb.state = STATE_PREPARED;
buf->top_seen = 0; buf->top_seen = 0;
buf->activate = buffer_activate; buf->activate = buffer_activate;
buf->vb.field = V4L2_FIELD_SEQ_TB; buf->vb.field = field;
return 0; return 0;
oops: oops:
...@@ -408,11 +412,13 @@ int saa7134_ts_init(struct saa7134_dev *dev) ...@@ -408,11 +412,13 @@ int saa7134_ts_init(struct saa7134_dev *dev)
tsbufs = VIDEO_MAX_FRAME; tsbufs = VIDEO_MAX_FRAME;
INIT_LIST_HEAD(&dev->ts_q.queue); INIT_LIST_HEAD(&dev->ts_q.queue);
init_timer(&dev->ts_q.timeout);
dev->ts_q.timeout.function = saa7134_buffer_timeout; dev->ts_q.timeout.function = saa7134_buffer_timeout;
dev->ts_q.timeout.data = (unsigned long)(&dev->ts_q); dev->ts_q.timeout.data = (unsigned long)(&dev->ts_q);
dev->ts_q.dev = dev; dev->ts_q.dev = dev;
videobuf_queue_init(&dev->ts.ts, &ts_qops, dev->pci, &dev->slock, videobuf_queue_init(&dev->ts.ts, &ts_qops, dev->pci, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_ALTERNATE,
sizeof(struct saa7134_buf)); sizeof(struct saa7134_buf));
saa7134_pgtable_alloc(dev->pci,&dev->ts.pt_ts); saa7134_pgtable_alloc(dev->pci,&dev->ts.pt_ts);
...@@ -437,11 +443,23 @@ int saa7134_ts_fini(struct saa7134_dev *dev) ...@@ -437,11 +443,23 @@ int saa7134_ts_fini(struct saa7134_dev *dev)
void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status) void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status)
{ {
enum v4l2_field field;
spin_lock(&dev->slock); spin_lock(&dev->slock);
if (dev->ts_q.curr) { if (dev->ts_q.curr) {
field = dev->video_q.curr->vb.field;
if (field == V4L2_FIELD_TOP) {
if ((status & 0x100000) != 0x100000)
goto done;
} else {
if ((status & 0x100000) != 0x000000)
goto done;
}
saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE); saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE);
} }
saa7134_buffer_next(dev,&dev->ts_q); saa7134_buffer_next(dev,&dev->ts_q);
done:
spin_unlock(&dev->slock); spin_unlock(&dev->slock);
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <asm/div64.h> #include <asm/div64.h>
...@@ -119,6 +120,10 @@ static void tvaudio_init(struct saa7134_dev *dev) ...@@ -119,6 +120,10 @@ static void tvaudio_init(struct saa7134_dev *dev)
/* init all audio registers */ /* init all audio registers */
saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00); saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00);
if (need_resched())
schedule();
else
udelay(10);
saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff);
saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff);
...@@ -357,6 +362,7 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, int carrier) ...@@ -357,6 +362,7 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, int carrier)
return value; return value;
} }
#if 0
static void sifdebug_dump_regs(struct saa7134_dev *dev) static void sifdebug_dump_regs(struct saa7134_dev *dev)
{ {
print_regb(AUDIO_STATUS); print_regb(AUDIO_STATUS);
...@@ -372,6 +378,7 @@ static void sifdebug_dump_regs(struct saa7134_dev *dev) ...@@ -372,6 +378,7 @@ static void sifdebug_dump_regs(struct saa7134_dev *dev)
print_regb(SIF_SAMPLE_FREQ); print_regb(SIF_SAMPLE_FREQ);
print_regb(ANALOG_IO_SELECT); print_regb(ANALOG_IO_SELECT);
} }
#endif
static int tvaudio_thread(void *data) static int tvaudio_thread(void *data)
{ {
...@@ -440,9 +447,8 @@ static int tvaudio_thread(void *data) ...@@ -440,9 +447,8 @@ static int tvaudio_thread(void *data)
} }
if (0 == carrier) { if (0 == carrier) {
/* Oops: autoscan didn't work for some reason :-/ */ /* Oops: autoscan didn't work for some reason :-/ */
printk("%s/audio: oops: audio carrier scan failed\n", printk(KERN_WARNING "%s/audio: oops: audio carrier "
dev->name); "scan failed\n", dev->name);
sifdebug_dump_regs(dev);
} else { } else {
dprintk("found %s main sound carrier @ %d.%03d MHz\n", dprintk("found %s main sound carrier @ %d.%03d MHz\n",
dev->tvnorm->name, dev->tvnorm->name,
......
...@@ -114,7 +114,8 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -114,7 +114,8 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0; return 0;
} }
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb) static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
enum v4l2_field field)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = file->private_data;
struct saa7134_dev *dev = fh->dev; struct saa7134_dev *dev = fh->dev;
...@@ -158,7 +159,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb) ...@@ -158,7 +159,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb)
buf->vb.state = STATE_PREPARED; buf->vb.state = STATE_PREPARED;
buf->top_seen = 0; buf->top_seen = 0;
buf->activate = buffer_activate; buf->activate = buffer_activate;
buf->vb.field = V4L2_FIELD_SEQ_TB; buf->vb.field = field;
return 0; return 0;
oops: oops:
...@@ -218,6 +219,7 @@ struct videobuf_queue_ops saa7134_vbi_qops = { ...@@ -218,6 +219,7 @@ struct videobuf_queue_ops saa7134_vbi_qops = {
int saa7134_vbi_init(struct saa7134_dev *dev) int saa7134_vbi_init(struct saa7134_dev *dev)
{ {
INIT_LIST_HEAD(&dev->vbi_q.queue); INIT_LIST_HEAD(&dev->vbi_q.queue);
init_timer(&dev->vbi_q.timeout);
dev->vbi_q.timeout.function = saa7134_buffer_timeout; dev->vbi_q.timeout.function = saa7134_buffer_timeout;
dev->vbi_q.timeout.data = (unsigned long)(&dev->vbi_q); dev->vbi_q.timeout.data = (unsigned long)(&dev->vbi_q);
dev->vbi_q.dev = dev; dev->vbi_q.dev = dev;
......
This diff is collapsed.
...@@ -117,6 +117,9 @@ struct saa7134_format { ...@@ -117,6 +117,9 @@ struct saa7134_format {
#define SAA7134_BOARD_TVSTATION_RDS 7 #define SAA7134_BOARD_TVSTATION_RDS 7
#define SAA7134_BOARD_CINERGY400 8 #define SAA7134_BOARD_CINERGY400 8
#define SAA7134_BOARD_MD5044 9 #define SAA7134_BOARD_MD5044 9
#define SAA7134_BOARD_KWORLD 10
#define SAA7134_BOARD_CINERGY600 11
#define SAA7134_BOARD_MD7134 12
#define SAA7134_INPUT_MAX 8 #define SAA7134_INPUT_MAX 8
...@@ -159,7 +162,7 @@ struct saa7134_board { ...@@ -159,7 +162,7 @@ struct saa7134_board {
#define RESOURCE_OVERLAY 1 #define RESOURCE_OVERLAY 1
#define RESOURCE_VIDEO 2 #define RESOURCE_VIDEO 2
#define RESOURCE_VBI 3 #define RESOURCE_VBI 4
#define INTERLACE_AUTO 0 #define INTERLACE_AUTO 0
#define INTERLACE_ON 1 #define INTERLACE_ON 1
...@@ -224,7 +227,6 @@ struct saa7134_fh { ...@@ -224,7 +227,6 @@ struct saa7134_fh {
/* video capture */ /* video capture */
struct saa7134_format *fmt; struct saa7134_format *fmt;
int width,height; int width,height;
enum v4l2_field field;
struct videobuf_queue cap; struct videobuf_queue cap;
struct saa7134_pgtable pt_cap; struct saa7134_pgtable pt_cap;
......
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