[media] saa7164: add NTSC VBI support

IRQ handlers, firmware messages, deferred queue handlers, V4L api's
etc.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Steven Toth 2010-07-31 16:06:06 -03:00 committed by Mauro Carvalho Chehab
parent 11bd27b2e7
commit e8ce2f2166
7 changed files with 326 additions and 17 deletions

View File

@ -1,6 +1,6 @@
saa7164-objs := saa7164-cards.o saa7164-core.o saa7164-i2c.o saa7164-dvb.o \
saa7164-fw.o saa7164-bus.o saa7164-cmd.o saa7164-api.o \
saa7164-buffer.o saa7164-encoder.o
saa7164-buffer.o saa7164-encoder.o saa7164-vbi.o
obj-$(CONFIG_VIDEO_SAA7164) += saa7164.o

View File

@ -24,6 +24,62 @@
#include "saa7164.h"
int saa7164_api_set_vbi_format(struct saa7164_port *port)
{
struct saa7164_dev *dev = port->dev;
tmComResProbeCommit_t fmt, rsp;
int ret;
dprintk(DBGLVL_API, "%s(nr=%d)\n", __func__, port->nr);
fmt.bmHint = 0;
fmt.bFormatIndex = 1;
fmt.bFrameIndex = 1;
/* Probe, see if it can support this format */
ret = saa7164_cmd_send(port->dev, port->hwcfg.unitid,
SET_CUR, SAA_PROBE_CONTROL, sizeof(fmt), &fmt);
if (ret != SAA_OK)
printk(KERN_ERR "%s() set error, ret = 0x%x\n", __func__, ret);
/* See of the format change was successful */
ret = saa7164_cmd_send(port->dev, port->hwcfg.unitid,
GET_CUR, SAA_PROBE_CONTROL, sizeof(rsp), &rsp);
if (ret != SAA_OK) {
printk(KERN_ERR "%s() get error, ret = 0x%x\n", __func__, ret);
} else {
/* Compare requested vs received, should be same */
if (memcmp(&fmt, &rsp, sizeof(rsp)) == 0) {
/* Ask the device to select the negotiated format */
ret = saa7164_cmd_send(port->dev, port->hwcfg.unitid,
SET_CUR, SAA_COMMIT_CONTROL, sizeof(fmt), &fmt);
if (ret != SAA_OK)
printk(KERN_ERR "%s() commit error, ret = 0x%x\n",
__func__, ret);
ret = saa7164_cmd_send(port->dev, port->hwcfg.unitid,
GET_CUR, SAA_COMMIT_CONTROL, sizeof(rsp), &rsp);
if (ret != SAA_OK)
printk(KERN_ERR "%s() GET commit error, ret = 0x%x\n",
__func__, ret);
if (memcmp(&fmt, &rsp, sizeof(rsp)) != 0)
printk(KERN_ERR "%s() memcmp error, ret = 0x%x\n",
__func__, ret);
dprintk(DBGLVL_API, "rsp.bmHint = 0x%x\n", rsp.bmHint);
dprintk(DBGLVL_API, "rsp.bFormatIndex = 0x%x\n", rsp.bFormatIndex);
dprintk(DBGLVL_API, "rsp.bFrameIndex = 0x%x\n", rsp.bFrameIndex);
} else
printk(KERN_ERR "%s() compare failed\n", __func__);
}
if (ret == SAA_OK)
dprintk(DBGLVL_API, "%s(nr=%d) Success\n", __func__, port->nr);
return ret;
}
int saa7164_api_set_gop_size(struct saa7164_port *port)
{
struct saa7164_dev *dev = port->dev;
@ -463,7 +519,8 @@ int saa7164_api_set_dif(struct saa7164_port *port, u8 reg, u8 val)
int ret;
u8 mas;
dprintk(DBGLVL_API, "%s()\n", __func__);
dprintk(DBGLVL_API, "%s(nr=%d type=%d val=%x)\n", __func__,
port->nr, port->type, val);
if (port->nr == 0)
mas = 0xd0;
@ -516,7 +573,7 @@ int saa7164_api_configure_dif(struct saa7164_port *port, u32 std)
int ret = 0;
u8 agc_disable;
dprintk(DBGLVL_API, "%s(%p, 0x%x)\n", __func__, port, std);
dprintk(DBGLVL_API, "%s(nr=%d, 0x%x)\n", __func__, port->nr, std);
if (std & V4L2_STD_NTSC) {
dprintk(DBGLVL_API, " NTSC\n");
@ -580,6 +637,9 @@ int saa7164_api_initialize_dif(struct saa7164_port *port)
int ret = -EINVAL;
u32 std = 0;
dprintk(DBGLVL_API, "%s(nr=%d type=%d)\n", __func__,
port->nr, port->type);
if (port->type == SAA7164_MPEG_ENCODER) {
/* Pick any analog standard to init the diff.
* we'll come back during encoder_init'
@ -592,6 +652,13 @@ int saa7164_api_initialize_dif(struct saa7164_port *port)
p = &dev->ports[ SAA7164_PORT_ENC1 ];
else
p = &dev->ports[ SAA7164_PORT_ENC2 ];
} else
if (port->type == SAA7164_MPEG_VBI) {
std = V4L2_STD_NTSC;
if (port->nr == SAA7164_PORT_VBI1)
p = &dev->ports[ SAA7164_PORT_ENC1 ];
else
p = &dev->ports[ SAA7164_PORT_ENC2 ];
} else
BUG();
@ -603,12 +670,18 @@ int saa7164_api_initialize_dif(struct saa7164_port *port)
int saa7164_api_transition_port(struct saa7164_port *port, u8 mode)
{
struct saa7164_dev *dev = port->dev;
int ret;
dprintk(DBGLVL_API, "%s(nr=%d unitid=0x%x,%d)\n",
__func__, port->nr, port->hwcfg.unitid, mode);
ret = saa7164_cmd_send(port->dev, port->hwcfg.unitid, SET_CUR,
SAA_STATE_CONTROL, sizeof(mode), &mode);
if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
printk(KERN_ERR "%s(portnr %d unitid 0x%x) error, ret = 0x%x\n",
__func__, port->nr, port->hwcfg.unitid, ret);
return ret;
}
@ -639,6 +712,23 @@ int saa7164_api_read_eeprom(struct saa7164_dev *dev, u8 *buf, int buflen)
}
int saa7164_api_configure_port_vbi(struct saa7164_dev *dev,
struct saa7164_port *port)
{
tmComResVBIFormatDescrHeader_t *fmt = &port->vbi_fmt_ntsc;
dprintk(DBGLVL_API, " bFormatIndex = 0x%x\n", fmt->bFormatIndex);
dprintk(DBGLVL_API, " VideoStandard = 0x%x\n", fmt->VideoStandard);
dprintk(DBGLVL_API, " StartLine = %d\n", fmt->StartLine);
dprintk(DBGLVL_API, " EndLine = %d\n", fmt->EndLine);
dprintk(DBGLVL_API, " FieldRate = %d\n", fmt->FieldRate);
dprintk(DBGLVL_API, " bNumLines = %d\n", fmt->bNumLines);
dprintk(DBGLVL_API, " = VS_FORMAT_VBI (becomes dev->en[%d])\n",
port->nr);
return 0;
}
int saa7164_api_configure_port_mpeg2ts(struct saa7164_dev *dev,
struct saa7164_port *port,
tmComResTSFormatDescrHeader_t *tsfmt)
@ -710,6 +800,7 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
{
struct saa7164_port *tsport = 0;
struct saa7164_port *encport = 0;
struct saa7164_port *vbiport = 0;
u32 idx, next_offset;
int i;
tmComResDescrHeader_t *hdr, *t;
@ -724,6 +815,7 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
tmComResProcDescrHeader_t *pdh;
tmComResAFeatureDescrHeader_t *afd;
tmComResEncoderDescrHeader_t *edh;
tmComResVBIFormatDescrHeader_t *vbifmt;
u32 currpath = 0;
dprintk(DBGLVL_API,
@ -881,8 +973,17 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
encport, psfmt);
break;
case VS_FORMAT_VBI:
dprintk(DBGLVL_API,
" = VS_FORMAT_VBI\n");
vbifmt =
(tmComResVBIFormatDescrHeader_t *)t;
if (currpath == 1)
vbiport = &dev->ports[ SAA7164_PORT_VBI1 ];
else
vbiport = &dev->ports[ SAA7164_PORT_VBI2 ];
memcpy(&vbiport->hwcfg, vcoutputtermhdr,
sizeof(*vcoutputtermhdr));
memcpy(&vbiport->vbi_fmt_ntsc, vbifmt, sizeof(*vbifmt));
saa7164_api_configure_port_vbi(dev,
vbiport);
break;
case VS_FORMAT_RDS:
dprintk(DBGLVL_API,

View File

@ -57,6 +57,8 @@ struct saa7164_board saa7164_boards[] = {
.portb = SAA7164_MPEG_DVB,
.portc = SAA7164_MPEG_ENCODER,
.portd = SAA7164_MPEG_ENCODER,
.porte = SAA7164_MPEG_VBI,
.portf = SAA7164_MPEG_VBI,
.chiprev = SAA7164_CHIP_REV3,
.unit = {{
.id = 0x1d,
@ -101,6 +103,8 @@ struct saa7164_board saa7164_boards[] = {
.portb = SAA7164_MPEG_DVB,
.portc = SAA7164_MPEG_ENCODER,
.portd = SAA7164_MPEG_ENCODER,
.porte = SAA7164_MPEG_VBI,
.portf = SAA7164_MPEG_VBI,
.chiprev = SAA7164_CHIP_REV2,
.unit = {{
.id = 0x06,
@ -145,6 +149,8 @@ struct saa7164_board saa7164_boards[] = {
.portb = SAA7164_MPEG_DVB,
.portc = SAA7164_MPEG_ENCODER,
.portd = SAA7164_MPEG_ENCODER,
.porte = SAA7164_MPEG_VBI,
.portf = SAA7164_MPEG_VBI,
.chiprev = SAA7164_CHIP_REV2,
.unit = {{
.id = 0x1d,
@ -205,6 +211,8 @@ struct saa7164_board saa7164_boards[] = {
.portd = SAA7164_MPEG_ENCODER,
.portc = SAA7164_MPEG_ENCODER,
.portd = SAA7164_MPEG_ENCODER,
.porte = SAA7164_MPEG_VBI,
.portf = SAA7164_MPEG_VBI,
.chiprev = SAA7164_CHIP_REV3,
.unit = {{
.id = 0x22,
@ -263,6 +271,10 @@ struct saa7164_board saa7164_boards[] = {
.portb = SAA7164_MPEG_DVB,
.portc = SAA7164_MPEG_ENCODER,
.portd = SAA7164_MPEG_ENCODER,
.porte = SAA7164_MPEG_VBI,
.portf = SAA7164_MPEG_VBI,
.porte = SAA7164_MPEG_VBI,
.portf = SAA7164_MPEG_VBI,
.chiprev = SAA7164_CHIP_REV3,
.unit = {{
.id = 0x28,
@ -321,6 +333,8 @@ struct saa7164_board saa7164_boards[] = {
.portb = SAA7164_MPEG_DVB,
.portc = SAA7164_MPEG_ENCODER,
.portd = SAA7164_MPEG_ENCODER,
.porte = SAA7164_MPEG_VBI,
.portf = SAA7164_MPEG_VBI,
.chiprev = SAA7164_CHIP_REV3,
.unit = {{
.id = 0x26,

View File

@ -53,6 +53,10 @@ unsigned int encoder_buffers = SAA7164_MAX_ENCODER_BUFFERS;
module_param(encoder_buffers, int, 0644);
MODULE_PARM_DESC(encoder_buffers, "Total buffers in read queue 16-512 def:64");
unsigned int vbi_buffers = SAA7164_MAX_VBI_BUFFERS;
module_param(vbi_buffers, int, 0644);
MODULE_PARM_DESC(vbi_buffers, "Total buffers in read queue 16-512 def:64");
unsigned int waitsecs = 10;
module_param(waitsecs, int, 0644);
MODULE_PARM_DESC(waitsecs, "timeout on firmware messages");
@ -440,6 +444,61 @@ static void saa7164_work_enchandler(struct work_struct *w)
}
}
static void saa7164_work_vbihandler(struct work_struct *w)
{
struct saa7164_port *port =
container_of(w, struct saa7164_port, workenc);
struct saa7164_dev *dev = port->dev;
u32 wp, mcb, rp, cnt = 0;
port->last_svc_msecs_diff = port->last_svc_msecs;
port->last_svc_msecs = jiffies_to_msecs(jiffies);
port->last_svc_msecs_diff = port->last_svc_msecs -
port->last_svc_msecs_diff;
saa7164_histogram_update(&port->svc_interval,
port->last_svc_msecs_diff);
port->last_irq_svc_msecs_diff = port->last_svc_msecs -
port->last_irq_msecs;
saa7164_histogram_update(&port->irq_svc_interval,
port->last_irq_svc_msecs_diff);
dprintk(DBGLVL_IRQ,
"%s() %Ldms elapsed irq->deferred %Ldms wp: %d rp: %d\n",
__func__,
port->last_svc_msecs_diff,
port->last_irq_svc_msecs_diff,
port->last_svc_wp,
port->last_svc_rp
);
/* Current write position */
wp = saa7164_readl(port->bufcounter);
if (wp > (port->hwcfg.buffercount - 1)) {
printk(KERN_ERR "%s() illegal buf count %d\n", __func__, wp);
return;
}
/* Most current complete buffer */
if (wp == 0)
mcb = (port->hwcfg.buffercount - 1);
else
mcb = wp - 1;
/* TODO: Convert this into a /proc/saa7164 style readable file */
if (print_histogram == port->nr) {
saa7164_histogram_print(port, &port->irq_interval);
saa7164_histogram_print(port, &port->svc_interval);
saa7164_histogram_print(port, &port->irq_svc_interval);
saa7164_histogram_print(port, &port->read_interval);
saa7164_histogram_print(port, &port->poll_interval);
/* TODO: fix this to preserve any previous state */
print_histogram = 64 + port->nr;
}
}
static void saa7164_work_cmdhandler(struct work_struct *w)
{
struct saa7164_dev *dev = container_of(w, struct saa7164_dev, workcmd);
@ -458,6 +517,31 @@ static void saa7164_buffer_deliver(struct saa7164_buffer *buf)
}
static irqreturn_t saa7164_irq_vbi(struct saa7164_port *port)
{
struct saa7164_dev *dev = port->dev;
/* Store old time */
port->last_irq_msecs_diff = port->last_irq_msecs;
/* Collect new stats */
port->last_irq_msecs = jiffies_to_msecs(jiffies);
/* Calculate stats */
port->last_irq_msecs_diff = port->last_irq_msecs -
port->last_irq_msecs_diff;
saa7164_histogram_update(&port->irq_interval,
port->last_irq_msecs_diff);
dprintk(DBGLVL_IRQ, "%s() %Ldms elapsed\n", __func__,
port->last_irq_msecs_diff);
/* Tis calls the vbi irq handler */
schedule_work(&port->workenc);
return 0;
}
static irqreturn_t saa7164_irq_encoder(struct saa7164_port *port)
{
struct saa7164_dev *dev = port->dev;
@ -527,6 +611,8 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id)
struct saa7164_port *portb = &dev->ports[ SAA7164_PORT_TS2 ];
struct saa7164_port *portc = &dev->ports[ SAA7164_PORT_ENC1 ];
struct saa7164_port *portd = &dev->ports[ SAA7164_PORT_ENC2 ];
struct saa7164_port *porte = &dev->ports[ SAA7164_PORT_VBI1 ];
struct saa7164_port *portf = &dev->ports[ SAA7164_PORT_VBI2 ];
u32 intid, intstat[INT_SIZE/4];
int i, handled = 0, bit;
@ -590,9 +676,19 @@ static irqreturn_t saa7164_irq(int irq, void *dev_id)
} else if (intid == portd->hwcfg.interruptid) {
/* Encoder path 1 */
/* Encoder path 2 */
saa7164_irq_encoder(portd);
} else if (intid == porte->hwcfg.interruptid) {
/* VBI path 1 */
saa7164_irq_vbi(porte);
} else if (intid == portf->hwcfg.interruptid) {
/* VBI path 2 */
saa7164_irq_vbi(portf);
} else {
/* Find the function */
dprintk(DBGLVL_IRQ,
@ -830,9 +926,19 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
if ((portnr == SAA7164_PORT_TS1) || (portnr == SAA7164_PORT_TS2))
port->type = SAA7164_MPEG_DVB;
else
if ((portnr == SAA7164_PORT_ENC1) || (portnr == SAA7164_PORT_ENC2))
if ((portnr == SAA7164_PORT_ENC1) || (portnr == SAA7164_PORT_ENC2)) {
port->type = SAA7164_MPEG_ENCODER;
/* We need a deferred interrupt handler for cmd handling */
INIT_WORK(&port->workenc, saa7164_work_enchandler);
}
else
if ((portnr == SAA7164_PORT_VBI1) || (portnr == SAA7164_PORT_VBI2)) {
port->type = SAA7164_MPEG_VBI;
/* We need a deferred interrupt handler for cmd handling */
INIT_WORK(&port->workenc, saa7164_work_vbihandler);
} else
BUG();
/* Init all the critical resources */
@ -844,17 +950,15 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
INIT_LIST_HEAD(&port->list_buf_free.list);
init_waitqueue_head(&port->wait_read);
/* We need a deferred interrupt handler for cmd handling */
INIT_WORK(&port->workenc, saa7164_work_enchandler);
saa7164_histogram_reset(&port->irq_interval, "irq intervals");
saa7164_histogram_reset(&port->svc_interval, "deferred intervals");
saa7164_histogram_reset(&port->irq_svc_interval,
"irq to deferred intervals");
saa7164_histogram_reset(&port->read_interval,
"encoder read() intervals");
"encoder/vbi read() intervals");
saa7164_histogram_reset(&port->poll_interval,
"encoder poll() intervals");
"encoder/vbi poll() intervals");
return 0;
}
@ -905,6 +1009,8 @@ static int saa7164_dev_setup(struct saa7164_dev *dev)
saa7164_port_init(dev, SAA7164_PORT_TS2);
saa7164_port_init(dev, SAA7164_PORT_ENC1);
saa7164_port_init(dev, SAA7164_PORT_ENC2);
saa7164_port_init(dev, SAA7164_PORT_VBI1);
saa7164_port_init(dev, SAA7164_PORT_VBI2);
if (get_resources(dev) < 0) {
printk(KERN_ERR "CORE %s No more PCIe resources for "
@ -1107,6 +1213,21 @@ static int __devinit saa7164_initdev(struct pci_dev *pci_dev,
}
}
if (saa7164_boards[dev->board].porte == SAA7164_MPEG_VBI) {
if (saa7164_vbi_register(&dev->ports[ SAA7164_PORT_VBI1 ]) < 0) {
printk(KERN_ERR"%s() Failed to register "
"vbi device\n", __func__);
}
}
if (saa7164_boards[dev->board].portf == SAA7164_MPEG_VBI) {
if (saa7164_vbi_register(&dev->ports[ SAA7164_PORT_VBI2 ]) < 0) {
printk(KERN_ERR"%s() Failed to register "
"vbi device\n", __func__);
}
}
} /* != BOARD_UNKNOWN */
else
printk(KERN_ERR "%s() Unsupported board detected, "
@ -1144,6 +1265,10 @@ static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
&dev->ports[ SAA7164_PORT_ENC1 ].read_interval);
saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
&dev->ports[ SAA7164_PORT_ENC1 ].poll_interval);
saa7164_histogram_print(&dev->ports[ SAA7164_PORT_VBI1 ],
&dev->ports[ SAA7164_PORT_VBI1 ].read_interval);
saa7164_histogram_print(&dev->ports[ SAA7164_PORT_VBI2 ],
&dev->ports[ SAA7164_PORT_VBI2 ].poll_interval);
saa7164_shutdown(dev);
@ -1159,6 +1284,12 @@ static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
if (saa7164_boards[dev->board].portd == SAA7164_MPEG_ENCODER)
saa7164_encoder_unregister(&dev->ports[ SAA7164_PORT_ENC2 ]);
if (saa7164_boards[dev->board].porte == SAA7164_MPEG_VBI)
saa7164_vbi_unregister(&dev->ports[ SAA7164_PORT_VBI1 ]);
if (saa7164_boards[dev->board].portf == SAA7164_MPEG_VBI)
saa7164_vbi_unregister(&dev->ports[ SAA7164_PORT_VBI2 ]);
saa7164_i2c_unregister(&dev->i2c_bus[0]);
saa7164_i2c_unregister(&dev->i2c_bus[1]);
saa7164_i2c_unregister(&dev->i2c_bus[2]);

View File

@ -156,6 +156,8 @@
#define EXU_INTERRUPT_CONTROL 0x03
/* State Transition and args */
#define SAA_PROBE_CONTROL 0x01
#define SAA_COMMIT_CONTROL 0x02
#define SAA_STATE_CONTROL 0x03
#define SAA_DMASTATE_STOP 0x00
#define SAA_DMASTATE_ACQUIRE 0x01

View File

@ -414,3 +414,23 @@ typedef struct
u8 bPackDataType;
} __attribute__((packed)) tmComResPSFormatDescrHeader_t;
/* VBI control structure */
typedef struct
{
u8 len;
u8 type;
u8 subtype; /* VS_FORMAT_VBI */
u8 bFormatIndex;
u32 VideoStandard; /* See KS_AnalogVideoStandard, NTSC = 1 */
u8 StartLine; /* NTSC Start = 10 */
u8 EndLine; /* NTSC = 21 */
u8 FieldRate; /* 60 for NTSC */
u8 bNumLines; /* Unsed - scheduled for removal */
} __attribute__((packed)) tmComResVBIFormatDescrHeader_t;
typedef struct
{
u16 bmHint;
u8 bFormatIndex;
u8 bFrameIndex;
} __attribute__((packed)) tmComResProbeCommit_t;

View File

@ -88,13 +88,16 @@
#define SAA7164_PS_NUMBER_OF_LINES 256
#define SAA7164_PT_ENTRIES 16 /* (312 * 188) / 4096 */
#define SAA7164_MAX_ENCODER_BUFFERS 64 /* max 5secs of latency at 6Mbps */
#define SAA7164_MAX_VBI_BUFFERS 64
/* Port related defines */
#define SAA7164_PORT_TS1 (0)
#define SAA7164_PORT_TS2 (SAA7164_PORT_TS1 + 1)
#define SAA7164_PORT_ENC1 (SAA7164_PORT_TS2 + 1)
#define SAA7164_PORT_ENC2 (SAA7164_PORT_ENC1 + 1)
#define SAA7164_MAX_PORTS (SAA7164_PORT_ENC2 + 1)
#define SAA7164_PORT_VBI1 (SAA7164_PORT_ENC2 + 1)
#define SAA7164_PORT_VBI2 (SAA7164_PORT_VBI1 + 1)
#define SAA7164_MAX_PORTS (SAA7164_PORT_VBI2 + 1)
#define DBGLVL_FW 4
#define DBGLVL_DVB 8
@ -105,6 +108,7 @@
#define DBGLVL_IRQ 256
#define DBGLVL_BUF 512
#define DBGLVL_ENC 1024
#define DBGLVL_VBI 2048
#define SAA7164_NORMS ( V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443 )
@ -112,6 +116,7 @@ enum port_t {
SAA7164_MPEG_UNDEFINED = 0,
SAA7164_MPEG_DVB,
SAA7164_MPEG_ENCODER,
SAA7164_MPEG_VBI,
};
enum saa7164_i2c_bus_nr {
@ -156,7 +161,8 @@ struct saa7164_unit {
struct saa7164_board {
char *name;
enum port_t porta, portb, portc, portd;
enum port_t porta, portb, portc,
portd, porte, portf;
enum {
SAA7164_CHIP_UNDEFINED = 0,
SAA7164_CHIP_REV2,
@ -173,8 +179,15 @@ struct saa7164_subid {
struct saa7164_encoder_fh {
struct saa7164_port *port;
u32 freq;
u32 tuner_type;
// u32 freq;
// u32 tuner_type;
atomic_t v4l_reading;
};
struct saa7164_vbi_fh {
struct saa7164_port *port;
// u32 freq;
// u32 tuner_type;
atomic_t v4l_reading;
};
@ -270,6 +283,23 @@ struct saa7164_encoder_params {
u32 gop_size;
};
struct saa7164_vbi_params {
struct saa7164_tvnorm encodernorm;
u32 height;
u32 width;
u32 is_50hz;
u32 bitrate; /* bps */
u32 bitrate_peak; /* bps */
u32 bitrate_mode;
u32 stream_type; /* V4L2_MPEG_STREAM_TYPE_MPEG2_TS */
u32 audio_sampling_freq;
u32 ctl_mute;
u32 ctl_aspect;
u32 refdist;
u32 gop_size;
};
struct saa7164_port;
struct saa7164_buffer {
@ -374,7 +404,7 @@ struct saa7164_port {
struct work_struct workenc;
/* V4L */
/* V4L Encoder Video */
struct saa7164_encoder_params encoder_params;
struct video_device *v4l_device;
atomic_t v4l_reader_count;
@ -383,6 +413,10 @@ struct saa7164_port {
struct saa7164_buffer list_buf_free;
wait_queue_head_t wait_read;
/* V4L VBI */
tmComResVBIFormatDescrHeader_t vbi_fmt_ntsc;
struct saa7164_vbi_params vbi_params;
/* Debug */
u32 sync_errors;
u32 v_cc_errors;
@ -442,6 +476,7 @@ struct saa7164_dev {
extern struct list_head saa7164_devlist;
extern unsigned int waitsecs;
extern unsigned int encoder_buffers;
extern unsigned int vbi_buffers;
/* ----------------------------------------------------------- */
/* saa7164-core.c */
@ -505,6 +540,7 @@ int saa7164_api_set_audio_volume(struct saa7164_port *port, s8 level);
int saa7164_api_set_audio_std(struct saa7164_port *port);
int saa7164_api_set_audio_detection(struct saa7164_port *port, int autodetect);
int saa7164_api_get_videomux(struct saa7164_port *port);
int saa7164_api_set_vbi_format(struct saa7164_port *port);
/* ----------------------------------------------------------- */
/* saa7164-cards.c */
@ -545,6 +581,11 @@ extern int saa7164_buffer_zero_offsets(struct saa7164_port *port, int i);
int saa7164_encoder_register(struct saa7164_port *port);
void saa7164_encoder_unregister(struct saa7164_port *port);
/* ----------------------------------------------------------- */
/* saa7164-vbi.c */
int saa7164_vbi_register(struct saa7164_port *port);
void saa7164_vbi_unregister(struct saa7164_port *port);
/* ----------------------------------------------------------- */
extern unsigned int crc_checking;