Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219384
b: refs/heads/master
c: e8ce2f2
h: refs/heads/master
v: v3
  • Loading branch information
Steven Toth authored and Mauro Carvalho Chehab committed Oct 21, 2010
1 parent 4c2f555 commit 4be9eb5
Show file tree
Hide file tree
Showing 8 changed files with 327 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 11bd27b2e7ab8125b0f8d763b8b61d07a5a38acf
refs/heads/master: e8ce2f21665442a29a2b2d1b25197b05405a7216
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/saa7164/Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
111 changes: 106 additions & 5 deletions trunk/drivers/media/video/saa7164/saa7164-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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'
Expand All @@ -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();

Expand All @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions trunk/drivers/media/video/saa7164/saa7164-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 4be9eb5

Please sign in to comment.