Commit bc250684 authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab

[media] saa7164: Checkpatch compliance cleanup

Checkpatch compliance cleanup across files in the saa7164 driver.
Signed-off-by: default avatarSteven Toth <stoth@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0e72cc8b
...@@ -40,9 +40,8 @@ int saa7164_api_get_load_info(struct saa7164_dev *dev, struct tmFwInfoStruct *i) ...@@ -40,9 +40,8 @@ int saa7164_api_get_load_info(struct saa7164_dev *dev, struct tmFwInfoStruct *i)
ret = saa7164_cmd_send(dev, 0, GET_CUR, ret = saa7164_cmd_send(dev, 0, GET_CUR,
GET_FW_STATUS_CONTROL, sizeof(struct tmFwInfoStruct), i); GET_FW_STATUS_CONTROL, sizeof(struct tmFwInfoStruct), i);
if (ret != SAA_OK) { if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
}
printk(KERN_INFO "saa7164[%d]-CPU: %d percent", dev->nr, i->CPULoad); printk(KERN_INFO "saa7164[%d]-CPU: %d percent", dev->nr, i->CPULoad);
...@@ -63,14 +62,15 @@ int saa7164_api_collect_debug(struct saa7164_dev *dev) ...@@ -63,14 +62,15 @@ int saa7164_api_collect_debug(struct saa7164_dev *dev)
ret = saa7164_cmd_send(dev, 0, GET_CUR, ret = saa7164_cmd_send(dev, 0, GET_CUR,
GET_DEBUG_DATA_CONTROL, sizeof(d), &d); GET_DEBUG_DATA_CONTROL, sizeof(d), &d);
if (ret != SAA_OK) { if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n",
} __func__, ret);
if (d.dwResult != SAA_OK) if (d.dwResult != SAA_OK)
break; break;
printk(KERN_INFO "saa7164[%d]-FWMSG: %s", dev->nr, d.ucDebugData); printk(KERN_INFO "saa7164[%d]-FWMSG: %s", dev->nr,
d.ucDebugData);
} }
return 0; return 0;
...@@ -86,9 +86,9 @@ int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level) ...@@ -86,9 +86,9 @@ int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level)
/* Retrieve current state */ /* Retrieve current state */
ret = saa7164_cmd_send(dev, 0, GET_CUR, ret = saa7164_cmd_send(dev, 0, GET_CUR,
SET_DEBUG_LEVEL_CONTROL, sizeof(lvl), &lvl); SET_DEBUG_LEVEL_CONTROL, sizeof(lvl), &lvl);
if (ret != SAA_OK) { if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
}
dprintk(DBGLVL_API, "%s() Was %d\n", __func__, lvl.dwDebugLevel); dprintk(DBGLVL_API, "%s() Was %d\n", __func__, lvl.dwDebugLevel);
lvl.dwDebugLevel = level; lvl.dwDebugLevel = level;
...@@ -96,9 +96,8 @@ int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level) ...@@ -96,9 +96,8 @@ int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level)
/* set new state */ /* set new state */
ret = saa7164_cmd_send(dev, 0, SET_CUR, ret = saa7164_cmd_send(dev, 0, SET_CUR,
SET_DEBUG_LEVEL_CONTROL, sizeof(lvl), &lvl); SET_DEBUG_LEVEL_CONTROL, sizeof(lvl), &lvl);
if (ret != SAA_OK) { if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
}
return ret; return ret;
} }
...@@ -152,8 +151,10 @@ int saa7164_api_set_vbi_format(struct saa7164_port *port) ...@@ -152,8 +151,10 @@ int saa7164_api_set_vbi_format(struct saa7164_port *port)
dprintk(DBGLVL_API, "SET/COMMIT Verified\n"); dprintk(DBGLVL_API, "SET/COMMIT Verified\n");
dprintk(DBGLVL_API, "rsp.bmHint = 0x%x\n", rsp.bmHint); dprintk(DBGLVL_API, "rsp.bmHint = 0x%x\n", rsp.bmHint);
dprintk(DBGLVL_API, "rsp.bFormatIndex = 0x%x\n", rsp.bFormatIndex); dprintk(DBGLVL_API, "rsp.bFormatIndex = 0x%x\n",
dprintk(DBGLVL_API, "rsp.bFrameIndex = 0x%x\n", rsp.bFrameIndex); rsp.bFormatIndex);
dprintk(DBGLVL_API, "rsp.bFrameIndex = 0x%x\n",
rsp.bFrameIndex);
} else } else
printk(KERN_ERR "%s() compare failed\n", __func__); printk(KERN_ERR "%s() compare failed\n", __func__);
} }
...@@ -210,14 +211,17 @@ int saa7164_api_set_encoder(struct saa7164_port *port) ...@@ -210,14 +211,17 @@ int saa7164_api_set_encoder(struct saa7164_port *port)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
/* Establish video bitrates */ /* Establish video bitrates */
if (port->encoder_params.bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) if (port->encoder_params.bitrate_mode ==
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR)
vb.ucVideoBitRateMode = EU_VIDEO_BIT_RATE_MODE_CONSTANT; vb.ucVideoBitRateMode = EU_VIDEO_BIT_RATE_MODE_CONSTANT;
else else
vb.ucVideoBitRateMode = EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK; vb.ucVideoBitRateMode = EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK;
vb.dwVideoBitRate = port->encoder_params.bitrate; vb.dwVideoBitRate = port->encoder_params.bitrate;
vb.dwVideoBitRatePeak = port->encoder_params.bitrate_peak; vb.dwVideoBitRatePeak = port->encoder_params.bitrate_peak;
ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR,
EU_VIDEO_BIT_RATE_CONTROL, sizeof(struct tmComResEncVideoBitRate), &vb); EU_VIDEO_BIT_RATE_CONTROL,
sizeof(struct tmComResEncVideoBitRate),
&vb);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
...@@ -226,9 +230,12 @@ int saa7164_api_set_encoder(struct saa7164_port *port) ...@@ -226,9 +230,12 @@ int saa7164_api_set_encoder(struct saa7164_port *port)
ab.dwAudioBitRate = 384000; ab.dwAudioBitRate = 384000;
ab.dwAudioBitRatePeak = ab.dwAudioBitRate; ab.dwAudioBitRatePeak = ab.dwAudioBitRate;
ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR,
EU_AUDIO_BIT_RATE_CONTROL, sizeof(struct tmComResEncAudioBitRate), &ab); EU_AUDIO_BIT_RATE_CONTROL,
sizeof(struct tmComResEncAudioBitRate),
&ab);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__,
ret);
saa7164_api_set_aspect_ratio(port); saa7164_api_set_aspect_ratio(port);
saa7164_api_set_gop_size(port); saa7164_api_set_gop_size(port);
...@@ -244,7 +251,8 @@ int saa7164_api_get_encoder(struct saa7164_port *port) ...@@ -244,7 +251,8 @@ int saa7164_api_get_encoder(struct saa7164_port *port)
struct tmComResEncVideoInputAspectRatio ar; struct tmComResEncVideoInputAspectRatio ar;
int ret; int ret;
dprintk(DBGLVL_ENC, "%s() unitid=0x%x\n", __func__, port->hwcfg.sourceid); dprintk(DBGLVL_ENC, "%s() unitid=0x%x\n", __func__,
port->hwcfg.sourceid);
port->encoder_profile = 0; port->encoder_profile = 0;
port->video_format = 0; port->video_format = 0;
...@@ -257,7 +265,8 @@ int saa7164_api_get_encoder(struct saa7164_port *port) ...@@ -257,7 +265,8 @@ int saa7164_api_get_encoder(struct saa7164_port *port)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, GET_CUR, ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, GET_CUR,
EU_VIDEO_RESOLUTION_CONTROL, sizeof(u8), &port->video_resolution); EU_VIDEO_RESOLUTION_CONTROL, sizeof(u8),
&port->video_resolution);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
...@@ -294,13 +303,20 @@ int saa7164_api_get_encoder(struct saa7164_port *port) ...@@ -294,13 +303,20 @@ int saa7164_api_get_encoder(struct saa7164_port *port)
dprintk(DBGLVL_ENC, "video_format = %d\n", port->video_format); dprintk(DBGLVL_ENC, "video_format = %d\n", port->video_format);
dprintk(DBGLVL_ENC, "audio_format = %d\n", port->audio_format); dprintk(DBGLVL_ENC, "audio_format = %d\n", port->audio_format);
dprintk(DBGLVL_ENC, "video_resolution= %d\n", port->video_resolution); dprintk(DBGLVL_ENC, "video_resolution= %d\n", port->video_resolution);
dprintk(DBGLVL_ENC, "v.ucVideoBitRateMode = %d\n", v.ucVideoBitRateMode); dprintk(DBGLVL_ENC, "v.ucVideoBitRateMode = %d\n",
dprintk(DBGLVL_ENC, "v.dwVideoBitRate = %d\n", v.dwVideoBitRate); v.ucVideoBitRateMode);
dprintk(DBGLVL_ENC, "v.dwVideoBitRatePeak = %d\n", v.dwVideoBitRatePeak); dprintk(DBGLVL_ENC, "v.dwVideoBitRate = %d\n",
dprintk(DBGLVL_ENC, "a.ucVideoBitRateMode = %d\n", a.ucAudioBitRateMode); v.dwVideoBitRate);
dprintk(DBGLVL_ENC, "a.dwVideoBitRate = %d\n", a.dwAudioBitRate); dprintk(DBGLVL_ENC, "v.dwVideoBitRatePeak = %d\n",
dprintk(DBGLVL_ENC, "a.dwVideoBitRatePeak = %d\n", a.dwAudioBitRatePeak); v.dwVideoBitRatePeak);
dprintk(DBGLVL_ENC, "aspect.width / height = %d:%d\n", ar.width, ar.height); dprintk(DBGLVL_ENC, "a.ucVideoBitRateMode = %d\n",
a.ucAudioBitRateMode);
dprintk(DBGLVL_ENC, "a.dwVideoBitRate = %d\n",
a.dwAudioBitRate);
dprintk(DBGLVL_ENC, "a.dwVideoBitRatePeak = %d\n",
a.dwAudioBitRatePeak);
dprintk(DBGLVL_ENC, "aspect.width / height = %d:%d\n",
ar.width, ar.height);
return ret; return ret;
} }
...@@ -439,7 +455,8 @@ int saa7164_api_set_videomux(struct saa7164_port *port) ...@@ -439,7 +455,8 @@ int saa7164_api_set_videomux(struct saa7164_port *port)
/* Audio Mux */ /* Audio Mux */
ret = saa7164_cmd_send(port->dev, port->audfeat.sourceid, SET_CUR, ret = saa7164_cmd_send(port->dev, port->audfeat.sourceid, SET_CUR,
SU_INPUT_SELECT_CONTROL, sizeof(u8), &inputs[port->mux_input - 1]); SU_INPUT_SELECT_CONTROL, sizeof(u8),
&inputs[port->mux_input - 1]);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
...@@ -492,7 +509,8 @@ int saa7164_api_set_audio_volume(struct saa7164_port *port, s8 level) ...@@ -492,7 +509,8 @@ int saa7164_api_set_audio_volume(struct saa7164_port *port, s8 level)
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
dprintk(DBGLVL_API, "%s(%d) min=%d max=%d cur=%d\n", __func__, level, min, max, v); dprintk(DBGLVL_API, "%s(%d) min=%d max=%d cur=%d\n", __func__,
level, min, max, v);
v = level; v = level;
if (v < min) if (v < min)
...@@ -517,7 +535,8 @@ int saa7164_api_set_audio_volume(struct saa7164_port *port, s8 level) ...@@ -517,7 +535,8 @@ int saa7164_api_set_audio_volume(struct saa7164_port *port, s8 level)
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
dprintk(DBGLVL_API, "%s(%d) min=%d max=%d cur=%d\n", __func__, level, min, max, v); dprintk(DBGLVL_API, "%s(%d) min=%d max=%d cur=%d\n", __func__,
level, min, max, v);
return ret; return ret;
} }
...@@ -539,7 +558,8 @@ int saa7164_api_set_audio_std(struct saa7164_port *port) ...@@ -539,7 +558,8 @@ int saa7164_api_set_audio_std(struct saa7164_port *port)
lvl.ucSAP_Level = TMHW_LEV_ADJ_SAPLEV_DEFAULT; lvl.ucSAP_Level = TMHW_LEV_ADJ_SAPLEV_DEFAULT;
lvl.ucADC_Level = TMHW_LEV_ADJ_ADCLEV_DEFAULT; lvl.ucADC_Level = TMHW_LEV_ADJ_ADCLEV_DEFAULT;
ret = saa7164_cmd_send(port->dev, port->audfeat.unitid, SET_CUR, ret = saa7164_cmd_send(port->dev, port->audfeat.unitid, SET_CUR,
AUDIO_DEFAULT_CONTROL, sizeof(struct tmComResAudioDefaults), &lvl); AUDIO_DEFAULT_CONTROL, sizeof(struct tmComResAudioDefaults),
&lvl);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
...@@ -555,7 +575,8 @@ int saa7164_api_set_audio_std(struct saa7164_port *port) ...@@ -555,7 +575,8 @@ int saa7164_api_set_audio_std(struct saa7164_port *port)
ret = saa7164_cmd_send(port->dev, port->tunerunit.unitid, SET_CUR, ret = saa7164_cmd_send(port->dev, port->tunerunit.unitid, SET_CUR,
TU_STANDARD_CONTROL, sizeof(tvaudio), &tvaudio); TU_STANDARD_CONTROL, sizeof(tvaudio), &tvaudio);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() TU_STANDARD_CONTROL error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() TU_STANDARD_CONTROL error, ret = 0x%x\n",
__func__, ret);
return ret; return ret;
} }
...@@ -575,7 +596,9 @@ int saa7164_api_set_audio_detection(struct saa7164_port *port, int autodetect) ...@@ -575,7 +596,9 @@ int saa7164_api_set_audio_detection(struct saa7164_port *port, int autodetect)
ret = saa7164_cmd_send(port->dev, port->tunerunit.unitid, SET_CUR, ret = saa7164_cmd_send(port->dev, port->tunerunit.unitid, SET_CUR,
TU_STANDARD_AUTO_CONTROL, sizeof(p), &p); TU_STANDARD_AUTO_CONTROL, sizeof(p), &p);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() TU_STANDARD_AUTO_CONTROL error, ret = 0x%x\n", __func__, ret); printk(KERN_ERR
"%s() TU_STANDARD_AUTO_CONTROL error, ret = 0x%x\n",
__func__, ret);
return ret; return ret;
} }
...@@ -646,9 +669,9 @@ int saa7164_api_set_dif(struct saa7164_port *port, u8 reg, u8 val) ...@@ -646,9 +669,9 @@ int saa7164_api_set_dif(struct saa7164_port *port, u8 reg, u8 val)
EXU_REGISTER_ACCESS_CONTROL, len, &buf); EXU_REGISTER_ACCESS_CONTROL, len, &buf);
if (ret != SAA_OK) if (ret != SAA_OK)
printk(KERN_ERR "%s() error, ret(2) = 0x%x\n", __func__, ret); printk(KERN_ERR "%s() error, ret(2) = 0x%x\n", __func__, ret);
#if 0
//saa7164_dumphex16(dev, buf, 16); saa7164_dumphex16(dev, buf, 16);
#endif
return ret == SAA_OK ? 0 : -EIO; return ret == SAA_OK ? 0 : -EIO;
} }
...@@ -696,7 +719,8 @@ int saa7164_api_configure_dif(struct saa7164_port *port, u32 std) ...@@ -696,7 +719,8 @@ int saa7164_api_configure_dif(struct saa7164_port *port, u32 std)
} else { } else {
/* Unknown standard, assume DTV */ /* Unknown standard, assume DTV */
dprintk(DBGLVL_API, " Unknown (assuming DTV)\n"); dprintk(DBGLVL_API, " Unknown (assuming DTV)\n");
saa7164_api_set_dif(port, 0x00, 0x80); /* Undefined Video Standard */ /* Undefinded Video Standard */
saa7164_api_set_dif(port, 0x00, 0x80);
agc_disable = 1; agc_disable = 1;
} }
...@@ -933,7 +957,7 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) ...@@ -933,7 +957,7 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
if (hdr->type != CS_INTERFACE) if (hdr->type != CS_INTERFACE)
return SAA_ERR_NOT_SUPPORTED; return SAA_ERR_NOT_SUPPORTED;
dprintk(DBGLVL_API, "@ 0x%x = \n", idx); dprintk(DBGLVL_API, "@ 0x%x =\n", idx);
switch (hdr->subtype) { switch (hdr->subtype) {
case GENERAL_REQUEST: case GENERAL_REQUEST:
dprintk(DBGLVL_API, " GENERAL_REQUEST\n"); dprintk(DBGLVL_API, " GENERAL_REQUEST\n");
...@@ -1085,7 +1109,8 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) ...@@ -1085,7 +1109,8 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
vbiport = &dev->ports[SAA7164_PORT_VBI2]; vbiport = &dev->ports[SAA7164_PORT_VBI2];
memcpy(&vbiport->hwcfg, vcoutputtermhdr, memcpy(&vbiport->hwcfg, vcoutputtermhdr,
sizeof(*vcoutputtermhdr)); sizeof(*vcoutputtermhdr));
memcpy(&vbiport->vbi_fmt_ntsc, vbifmt, sizeof(*vbifmt)); memcpy(&vbiport->vbi_fmt_ntsc, vbifmt,
sizeof(*vbifmt));
saa7164_api_configure_port_vbi(dev, saa7164_api_configure_port_vbi(dev,
vbiport); vbiport);
break; break;
...@@ -1134,7 +1159,9 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) ...@@ -1134,7 +1159,9 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
encport = &dev->ports[SAA7164_PORT_ENC2]; encport = &dev->ports[SAA7164_PORT_ENC2];
memcpy(&encport->tunerunit, tunerunithdr, memcpy(&encport->tunerunit, tunerunithdr,
sizeof(struct tmComResTunerDescrHeader)); sizeof(struct tmComResTunerDescrHeader));
dprintk(DBGLVL_API, " (becomes dev->enc[%d] tuner)\n", encport->nr); dprintk(DBGLVL_API,
" (becomes dev->enc[%d] tuner)\n",
encport->nr);
} }
break; break;
case VC_SELECTOR_UNIT: case VC_SELECTOR_UNIT:
...@@ -1163,7 +1190,8 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) ...@@ -1163,7 +1190,8 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
encport = &dev->ports[SAA7164_PORT_ENC2]; encport = &dev->ports[SAA7164_PORT_ENC2];
memcpy(&encport->vidproc, pdh, memcpy(&encport->vidproc, pdh,
sizeof(struct tmComResProcDescrHeader)); sizeof(struct tmComResProcDescrHeader));
dprintk(DBGLVL_API, " (becomes dev->enc[%d])\n", encport->nr); dprintk(DBGLVL_API, " (becomes dev->enc[%d])\n",
encport->nr);
} }
break; break;
case FEATURE_UNIT: case FEATURE_UNIT:
...@@ -1181,15 +1209,18 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) ...@@ -1181,15 +1209,18 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
encport = &dev->ports[SAA7164_PORT_ENC2]; encport = &dev->ports[SAA7164_PORT_ENC2];
memcpy(&encport->audfeat, afd, memcpy(&encport->audfeat, afd,
sizeof(struct tmComResAFeatureDescrHeader)); sizeof(struct tmComResAFeatureDescrHeader));
dprintk(DBGLVL_API, " (becomes dev->enc[%d])\n", encport->nr); dprintk(DBGLVL_API, " (becomes dev->enc[%d])\n",
encport->nr);
break; break;
case ENCODER_UNIT: case ENCODER_UNIT:
edh = (struct tmComResEncoderDescrHeader *)(buf + idx); edh = (struct tmComResEncoderDescrHeader *)(buf + idx);
dprintk(DBGLVL_API, " ENCODER_UNIT\n"); dprintk(DBGLVL_API, " ENCODER_UNIT\n");
dprintk(DBGLVL_API, " subtype = 0x%x\n", edh->subtype); dprintk(DBGLVL_API, " subtype = 0x%x\n", edh->subtype);
dprintk(DBGLVL_API, " unitid = 0x%x\n", edh->unitid); dprintk(DBGLVL_API, " unitid = 0x%x\n", edh->unitid);
dprintk(DBGLVL_API, " vsourceid = 0x%x\n", edh->vsourceid); dprintk(DBGLVL_API, " vsourceid = 0x%x\n",
dprintk(DBGLVL_API, " asourceid = 0x%x\n", edh->asourceid); edh->vsourceid);
dprintk(DBGLVL_API, " asourceid = 0x%x\n",
edh->asourceid);
dprintk(DBGLVL_API, " iunit = 0x%x\n", edh->iunit); dprintk(DBGLVL_API, " iunit = 0x%x\n", edh->iunit);
if (edh->iunit == edh->unitid) { if (edh->iunit == edh->unitid) {
if (currpath == 1) if (currpath == 1)
...@@ -1198,7 +1229,9 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) ...@@ -1198,7 +1229,9 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
encport = &dev->ports[SAA7164_PORT_ENC2]; encport = &dev->ports[SAA7164_PORT_ENC2];
memcpy(&encport->encunit, edh, memcpy(&encport->encunit, edh,
sizeof(struct tmComResEncoderDescrHeader)); sizeof(struct tmComResEncoderDescrHeader));
dprintk(DBGLVL_API, " (becomes dev->enc[%d])\n", encport->nr); dprintk(DBGLVL_API,
" (becomes dev->enc[%d])\n",
encport->nr);
} }
break; break;
case EXTENSION_UNIT: case EXTENSION_UNIT:
...@@ -1262,7 +1295,9 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len) ...@@ -1262,7 +1295,9 @@ int saa7164_api_dump_subdevs(struct saa7164_dev *dev, u8 *buf, int len)
encport = &dev->ports[SAA7164_PORT_ENC2]; encport = &dev->ports[SAA7164_PORT_ENC2];
memcpy(&encport->ifunit, exthdr, memcpy(&encport->ifunit, exthdr,
sizeof(struct tmComResExtDevDescrHeader)); sizeof(struct tmComResExtDevDescrHeader));
dprintk(DBGLVL_API, " (becomes dev->enc[%d])\n", encport->nr); dprintk(DBGLVL_API,
" (becomes dev->enc[%d])\n",
encport->nr);
} }
break; break;
case PVC_INFRARED_UNIT: case PVC_INFRARED_UNIT:
......
...@@ -24,46 +24,46 @@ ...@@ -24,46 +24,46 @@
#include "saa7164.h" #include "saa7164.h"
/* The PCI address space for buffer handling looks like this: /* The PCI address space for buffer handling looks like this:
*
+-u32 wide-------------+ * +-u32 wide-------------+
| + * | +
+-u64 wide------------------------------------+ * +-u64 wide------------------------------------+
+ + * + +
+----------------------+ * +----------------------+
| CurrentBufferPtr + Pointer to current PCI buffer >-+ * | CurrentBufferPtr + Pointer to current PCI buffer >-+
+----------------------+ | * +----------------------+ |
| Unused + | * | Unused + |
+----------------------+ | * +----------------------+ |
| Pitch + = 188 (bytes) | * | Pitch + = 188 (bytes) |
+----------------------+ | * +----------------------+ |
| PCI buffer size + = pitch * number of lines (312) | * | PCI buffer size + = pitch * number of lines (312) |
+----------------------+ | * +----------------------+ |
|0| Buf0 Write Offset + | * |0| Buf0 Write Offset + |
+----------------------+ v * +----------------------+ v
|1| Buf1 Write Offset + | * |1| Buf1 Write Offset + |
+----------------------+ | * +----------------------+ |
|2| Buf2 Write Offset + | * |2| Buf2 Write Offset + |
+----------------------+ | * +----------------------+ |
|3| Buf3 Write Offset + | * |3| Buf3 Write Offset + |
+----------------------+ | * +----------------------+ |
... More write offsets | * ... More write offsets |
+---------------------------------------------+ | * +---------------------------------------------+ |
+0| set of ptrs to PCI pagetables + | * +0| set of ptrs to PCI pagetables + |
+---------------------------------------------+ | * +---------------------------------------------+ |
+1| set of ptrs to PCI pagetables + <--------+ * +1| set of ptrs to PCI pagetables + <--------+
+---------------------------------------------+ * +---------------------------------------------+
+2| set of ptrs to PCI pagetables + * +2| set of ptrs to PCI pagetables +
+---------------------------------------------+ * +---------------------------------------------+
+3| set of ptrs to PCI pagetables + >--+ * +3| set of ptrs to PCI pagetables + >--+
+---------------------------------------------+ | * +---------------------------------------------+ |
... More buffer pointers | +----------------+ * ... More buffer pointers | +----------------+
+->| pt[0] TS data | * +->| pt[0] TS data |
| +----------------+ * | +----------------+
| * |
| +----------------+ * | +----------------+
+->| pt[1] TS data | * +->| pt[1] TS data |
| +----------------+ * | +----------------+
| etc * | etc
*/ */
void saa7164_buffer_display(struct saa7164_buffer *buf) void saa7164_buffer_display(struct saa7164_buffer *buf)
...@@ -283,7 +283,8 @@ int saa7164_buffer_cfg_port(struct saa7164_port *port) ...@@ -283,7 +283,8 @@ int saa7164_buffer_cfg_port(struct saa7164_port *port)
return 0; return 0;
} }
struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev, u32 len) struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev,
u32 len)
{ {
struct saa7164_user_buffer *buf; struct saa7164_user_buffer *buf;
...@@ -313,12 +314,9 @@ void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf) ...@@ -313,12 +314,9 @@ void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf)
if (!buf) if (!buf)
return; return;
if (buf->data) {
kfree(buf->data); kfree(buf->data);
buf->data = 0; buf->data = 0;
}
if (buf)
kfree(buf); kfree(buf);
} }
...@@ -43,7 +43,8 @@ int saa7164_bus_setup(struct saa7164_dev *dev) ...@@ -43,7 +43,8 @@ int saa7164_bus_setup(struct saa7164_dev *dev)
b->m_dwSizeGetRing = SAA_DEVICE_BUFFERBLOCKSIZE; b->m_dwSizeGetRing = SAA_DEVICE_BUFFERBLOCKSIZE;
b->m_dwSetWritePos = ((u32)dev->intfdesc.BARLocation) + (2 * sizeof(u64)); b->m_dwSetWritePos = ((u32)dev->intfdesc.BARLocation) +
(2 * sizeof(u64));
b->m_dwSetReadPos = b->m_dwSetWritePos + (1 * sizeof(u32)); b->m_dwSetReadPos = b->m_dwSetWritePos + (1 * sizeof(u32));
b->m_dwGetWritePos = b->m_dwSetWritePos + (2 * sizeof(u32)); b->m_dwGetWritePos = b->m_dwSetWritePos + (2 * sizeof(u32));
...@@ -105,7 +106,8 @@ void saa7164_bus_verify(struct saa7164_dev *dev) ...@@ -105,7 +106,8 @@ void saa7164_bus_verify(struct saa7164_dev *dev)
} }
} }
void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo* m, void *buf) void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo* m,
void *buf)
{ {
dprintk(DBGLVL_BUS, "Dumping msg structure:\n"); dprintk(DBGLVL_BUS, "Dumping msg structure:\n");
dprintk(DBGLVL_BUS, " .id = %d\n", m->id); dprintk(DBGLVL_BUS, " .id = %d\n", m->id);
...@@ -129,7 +131,8 @@ void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo* m, void * ...@@ -129,7 +131,8 @@ void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo* m, void *
* SAA_OK The function executed successfully. * SAA_OK The function executed successfully.
* < 0 One or more members are not initialized. * < 0 One or more members are not initialized.
*/ */
int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf) int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg,
void *buf)
{ {
struct tmComResBusInfo *bus = &dev->bus; struct tmComResBusInfo *bus = &dev->bus;
u32 bytes_to_write, free_write_space, timeout, curr_srp, curr_swp; u32 bytes_to_write, free_write_space, timeout, curr_srp, curr_swp;
...@@ -294,14 +297,15 @@ int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf ...@@ -294,14 +297,15 @@ int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf
/* /*
* Receive a command or a response from the bus. The implementation does not * Receive a command or a response from the bus. The implementation does not
* know if it is a command or a response it simply dequeues the data, * know if it is a command or a response it simply dequeues the data,
* depending on the bus information given in the struct tmComResBusInfo structure. * depending on the bus information given in the struct tmComResBusInfo
* structure.
* *
* Return Value: * Return Value:
* 0 The function executed successfully. * 0 The function executed successfully.
* < 0 One or more members are not initialized. * < 0 One or more members are not initialized.
*/ */
int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf, int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,
int peekonly) void *buf, int peekonly)
{ {
struct tmComResBusInfo *bus = &dev->bus; struct tmComResBusInfo *bus = &dev->bus;
u32 bytes_to_read, write_distance, curr_grp, curr_gwp, u32 bytes_to_read, write_distance, curr_grp, curr_gwp,
......
...@@ -482,7 +482,7 @@ void saa7164_gpio_setup(struct saa7164_dev *dev) ...@@ -482,7 +482,7 @@ void saa7164_gpio_setup(struct saa7164_dev *dev)
saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 2); saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 2);
saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 3); saa7164_api_clear_gpiobit(dev, PCIEBRIDGE_UNITID, 3);
msleep(10); msleep(20);
saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 2); saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 2);
saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 3); saa7164_api_set_gpiobit(dev, PCIEBRIDGE_UNITID, 3);
......
...@@ -122,8 +122,8 @@ int saa7164_irq_dequeue(struct saa7164_dev *dev) ...@@ -122,8 +122,8 @@ int saa7164_irq_dequeue(struct saa7164_dev *dev)
return ret; return ret;
} }
/* It's unlikely to have more than 4 or 5 pending messages, ensure we exit /* It's unlikely to have more than 4 or 5 pending messages,
* at some point regardles. * ensure we exit at some point regardless.
*/ */
} while (i++ < 32); } while (i++ < 32);
...@@ -186,7 +186,8 @@ int saa7164_cmd_dequeue(struct saa7164_dev *dev) ...@@ -186,7 +186,8 @@ int saa7164_cmd_dequeue(struct saa7164_dev *dev)
return SAA_OK; return SAA_OK;
} }
int saa7164_cmd_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf) int saa7164_cmd_set(struct saa7164_dev *dev, struct tmComResInfo *msg,
void *buf)
{ {
struct tmComResBusInfo *bus = &dev->bus; struct tmComResBusInfo *bus = &dev->bus;
u8 cmd_sent; u8 cmd_sent;
...@@ -292,7 +293,8 @@ int saa7164_cmd_wait(struct saa7164_dev *dev, u8 seqno) ...@@ -292,7 +293,8 @@ int saa7164_cmd_wait(struct saa7164_dev *dev, u8 seqno)
* We typically are signalled in < 50ms but it can * We typically are signalled in < 50ms but it can
* take MUCH longer. * take MUCH longer.
*/ */
wait_event_timeout(*q, dev->cmds[seqno].signalled, (HZ * waitsecs)); wait_event_timeout(*q, dev->cmds[seqno].signalled,
(HZ * waitsecs));
r = time_before(jiffies, stamp + (HZ * waitsecs)); r = time_before(jiffies, stamp + (HZ * waitsecs));
if (r) if (r)
ret = SAA_OK; ret = SAA_OK;
......
...@@ -40,12 +40,12 @@ MODULE_AUTHOR("Steven Toth <stoth@kernellabs.com>"); ...@@ -40,12 +40,12 @@ MODULE_AUTHOR("Steven Toth <stoth@kernellabs.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* /*
1 Basic * 1 Basic
2 * 2
4 i2c * 4 i2c
8 api * 8 api
16 cmd * 16 cmd
32 bus * 32 bus
*/ */
unsigned int saa_debug; unsigned int saa_debug;
...@@ -82,7 +82,8 @@ MODULE_PARM_DESC(crc_checking, "enable crc sanity checking on buffers"); ...@@ -82,7 +82,8 @@ MODULE_PARM_DESC(crc_checking, "enable crc sanity checking on buffers");
unsigned int guard_checking = 1; unsigned int guard_checking = 1;
module_param(guard_checking, int, 0644); module_param(guard_checking, int, 0644);
MODULE_PARM_DESC(guard_checking, "enable dma sanity checking for buffer overruns"); MODULE_PARM_DESC(guard_checking,
"enable dma sanity checking for buffer overruns");
static unsigned int saa7164_devcount; static unsigned int saa7164_devcount;
...@@ -123,7 +124,9 @@ static void saa7164_pack_verifier(struct saa7164_buffer *buf) ...@@ -123,7 +124,9 @@ static void saa7164_pack_verifier(struct saa7164_buffer *buf)
if ((*(p + i + 0) != 0x00) || (*(p + i + 1) != 0x00) || if ((*(p + i + 0) != 0x00) || (*(p + i + 1) != 0x00) ||
(*(p + i + 2) != 0x01) || (*(p + i + 3) != 0xBA)) { (*(p + i + 2) != 0x01) || (*(p + i + 3) != 0xBA)) {
printk(KERN_ERR "No pack at 0x%x\n", i); printk(KERN_ERR "No pack at 0x%x\n", i);
// saa7164_dumphex16FF(buf->port->dev, (p + i), 32); #if 0
saa7164_dumphex16FF(buf->port->dev, (p + i), 32);
#endif
} }
} }
} }
...@@ -199,19 +202,16 @@ static void saa7164_histogram_reset(struct saa7164_histogram *hg, char *name) ...@@ -199,19 +202,16 @@ static void saa7164_histogram_reset(struct saa7164_histogram *hg, char *name)
strcpy(hg->name, name); strcpy(hg->name, name);
/* First 30ms x 1ms */ /* First 30ms x 1ms */
for (i = 0; i < 30; i++) { for (i = 0; i < 30; i++)
hg->counter1[0 + i].val = i; hg->counter1[0 + i].val = i;
}
/* 30 - 200ms x 10ms */ /* 30 - 200ms x 10ms */
for (i = 0; i < 18; i++) { for (i = 0; i < 18; i++)
hg->counter1[30 + i].val = 30 + (i * 10); hg->counter1[30 + i].val = 30 + (i * 10);
}
/* 200 - 2000ms x 100ms */ /* 200 - 2000ms x 100ms */
for (i = 0; i < 15; i++) { for (i = 0; i < 15; i++)
hg->counter1[48 + i].val = 200 + (i * 200); hg->counter1[48 + i].val = 200 + (i * 200);
}
/* Catch all massive value (2secs) */ /* Catch all massive value (2secs) */
hg->counter1[55].val = 2000; hg->counter1[55].val = 2000;
...@@ -315,7 +315,9 @@ static void saa7164_work_enchandler_helper(struct saa7164_port *port, int bufnr) ...@@ -315,7 +315,9 @@ static void saa7164_work_enchandler_helper(struct saa7164_port *port, int bufnr)
(*(p + buf->actual_size + 0x13) != 0xff)) { (*(p + buf->actual_size + 0x13) != 0xff)) {
printk(KERN_ERR "%s() buf %p guard buffer breach\n", printk(KERN_ERR "%s() buf %p guard buffer breach\n",
__func__, buf); __func__, buf);
// saa7164_dumphex16FF(dev, (p + buf->actual_size) - 32 , 64); #if 0
saa7164_dumphex16FF(dev, (p + buf->actual_size) - 32 , 64);
#endif
} }
} }
...@@ -961,9 +963,7 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr) ...@@ -961,9 +963,7 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
/* We need a deferred interrupt handler for cmd handling */ /* We need a deferred interrupt handler for cmd handling */
INIT_WORK(&port->workenc, saa7164_work_enchandler); INIT_WORK(&port->workenc, saa7164_work_enchandler);
} } else if ((portnr == SAA7164_PORT_VBI1) || (portnr == SAA7164_PORT_VBI2)) {
else
if ((portnr == SAA7164_PORT_VBI1) || (portnr == SAA7164_PORT_VBI2)) {
port->type = SAA7164_MPEG_VBI; port->type = SAA7164_MPEG_VBI;
/* We need a deferred interrupt handler for cmd handling */ /* We need a deferred interrupt handler for cmd handling */
...@@ -1169,7 +1169,7 @@ static int saa7164_proc_open(struct inode *inode, struct file *filp) ...@@ -1169,7 +1169,7 @@ static int saa7164_proc_open(struct inode *inode, struct file *filp)
return single_open(filp, saa7164_proc_show, NULL); return single_open(filp, saa7164_proc_show, NULL);
} }
static struct file_operations saa7164_proc_fops = { static const struct file_operations saa7164_proc_fops = {
.open = saa7164_proc_open, .open = saa7164_proc_open,
.read = seq_read, .read = seq_read,
.llseek = seq_lseek, .llseek = seq_lseek,
......
...@@ -125,16 +125,22 @@ static int saa7164_encoder_buffers_alloc(struct saa7164_port *port) ...@@ -125,16 +125,22 @@ static int saa7164_encoder_buffers_alloc(struct saa7164_port *port)
dprintk(DBGLVL_ENC, "%s()\n", __func__); dprintk(DBGLVL_ENC, "%s()\n", __func__);
if (port->encoder_params.stream_type == V4L2_MPEG_STREAM_TYPE_MPEG2_PS) { if (port->encoder_params.stream_type ==
dprintk(DBGLVL_ENC, "%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_PS\n", __func__); V4L2_MPEG_STREAM_TYPE_MPEG2_PS) {
dprintk(DBGLVL_ENC,
"%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_PS\n",
__func__);
params->samplesperline = 128; params->samplesperline = 128;
params->numberoflines = 256; params->numberoflines = 256;
params->pitch = 128; params->pitch = 128;
params->numpagetables = 2 + params->numpagetables = 2 +
((SAA7164_PS_NUMBER_OF_LINES * 128) / PAGE_SIZE); ((SAA7164_PS_NUMBER_OF_LINES * 128) / PAGE_SIZE);
} else } else
if (port->encoder_params.stream_type == V4L2_MPEG_STREAM_TYPE_MPEG2_TS) { if (port->encoder_params.stream_type ==
dprintk(DBGLVL_ENC, "%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_TS\n", __func__); V4L2_MPEG_STREAM_TYPE_MPEG2_TS) {
dprintk(DBGLVL_ENC,
"%s() type=V4L2_MPEG_STREAM_TYPE_MPEG2_TS\n",
__func__);
params->samplesperline = 188; params->samplesperline = 188;
params->numberoflines = 312; params->numberoflines = 312;
params->pitch = 188; params->pitch = 188;
...@@ -826,7 +832,8 @@ static int fill_queryctrl(struct saa7164_encoder_params *params, ...@@ -826,7 +832,8 @@ static int fill_queryctrl(struct saa7164_encoder_params *params,
return v4l2_ctrl_query_fill(c, 1, 255, 1, 15); return v4l2_ctrl_query_fill(c, 1, 255, 1, 15);
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
return v4l2_ctrl_query_fill(c, return v4l2_ctrl_query_fill(c,
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR,
1, V4L2_MPEG_VIDEO_BITRATE_MODE_VBR); 1, V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
case V4L2_CID_MPEG_VIDEO_B_FRAMES: case V4L2_CID_MPEG_VIDEO_B_FRAMES:
return v4l2_ctrl_query_fill(c, return v4l2_ctrl_query_fill(c,
...@@ -1113,7 +1120,9 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port) ...@@ -1113,7 +1120,9 @@ struct saa7164_user_buffer *saa7164_enc_next_buf(struct saa7164_port *port)
if (crc_checking) { if (crc_checking) {
crc = crc32(0, ubuf->data, ubuf->actual_size); crc = crc32(0, ubuf->data, ubuf->actual_size);
if (crc != ubuf->crc) { if (crc != ubuf->crc) {
printk(KERN_ERR "%s() ubuf %p crc became invalid, was 0x%x became 0x%x\n", __func__, printk(KERN_ERR
"%s() ubuf %p crc became invalid, was 0x%x became 0x%x\n",
__func__,
ubuf, ubuf->crc, crc); ubuf, ubuf->crc, crc);
} }
} }
...@@ -1201,9 +1210,8 @@ static ssize_t fops_read(struct file *file, char __user *buffer, ...@@ -1201,9 +1210,8 @@ static ssize_t fops_read(struct file *file, char __user *buffer,
buffer += cnt; buffer += cnt;
ret += cnt; ret += cnt;
if (ubuf->pos > ubuf->actual_size) { if (ubuf->pos > ubuf->actual_size)
printk(KERN_ERR "read() pos > actual, huh?\n"); printk(KERN_ERR "read() pos > actual, huh?\n");
}
if (ubuf->pos == ubuf->actual_size) { if (ubuf->pos == ubuf->actual_size) {
...@@ -1227,16 +1235,16 @@ static ssize_t fops_read(struct file *file, char __user *buffer, ...@@ -1227,16 +1235,16 @@ static ssize_t fops_read(struct file *file, char __user *buffer,
} }
} }
err: err:
if (!ret && !ubuf) { if (!ret && !ubuf)
ret = -EAGAIN; ret = -EAGAIN;
}
return ret; return ret;
} }
static unsigned int fops_poll(struct file *file, poll_table *wait) static unsigned int fops_poll(struct file *file, poll_table *wait)
{ {
struct saa7164_encoder_fh *fh = (struct saa7164_encoder_fh *)file->private_data; struct saa7164_encoder_fh *fh =
(struct saa7164_encoder_fh *)file->private_data;
struct saa7164_port *port = fh->port; struct saa7164_port *port = fh->port;
struct saa7164_user_buffer *ubuf; struct saa7164_user_buffer *ubuf;
unsigned int mask = 0; unsigned int mask = 0;
...@@ -1249,9 +1257,8 @@ static unsigned int fops_poll(struct file *file, poll_table *wait) ...@@ -1249,9 +1257,8 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
saa7164_histogram_update(&port->poll_interval, saa7164_histogram_update(&port->poll_interval,
port->last_poll_msecs_diff); port->last_poll_msecs_diff);
if (!video_is_registered(port->v4l_device)) { if (!video_is_registered(port->v4l_device))
return -EIO; return -EIO;
}
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) { if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
if (atomic_inc_return(&port->v4l_reader_count) == 1) { if (atomic_inc_return(&port->v4l_reader_count) == 1) {
......
...@@ -178,7 +178,7 @@ int saa7164_downloadimage(struct saa7164_dev *dev, u8 *src, u32 srcsize, ...@@ -178,7 +178,7 @@ int saa7164_downloadimage(struct saa7164_dev *dev, u8 *src, u32 srcsize,
goto out; goto out;
} }
msleep(10); msleep(10); /* Checkpatch throws a < 20ms warning */
if (timeout++ > 60) if (timeout++ > 60)
break; break;
} }
...@@ -235,7 +235,7 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev) ...@@ -235,7 +235,7 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev)
while (err_flags != SAA_DEVICE_IMAGE_BOOTING) { while (err_flags != SAA_DEVICE_IMAGE_BOOTING) {
dprintk(DBGLVL_FW, "%s() err_flags = %x\n", dprintk(DBGLVL_FW, "%s() err_flags = %x\n",
__func__, err_flags); __func__, err_flags);
msleep(10); msleep(10); /* Checkpatch throws a < 20ms warning */
if (err_flags & SAA_DEVICE_IMAGE_CORRUPT) { if (err_flags & SAA_DEVICE_IMAGE_CORRUPT) {
printk(KERN_ERR "%s() firmware corrupt\n", printk(KERN_ERR "%s() firmware corrupt\n",
...@@ -294,7 +294,7 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev) ...@@ -294,7 +294,7 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev)
while (err_flags != SAA_DEVICE_IMAGE_BOOTING) { while (err_flags != SAA_DEVICE_IMAGE_BOOTING) {
dprintk(DBGLVL_FW, "%s() err_flags2 = %x\n", dprintk(DBGLVL_FW, "%s() err_flags2 = %x\n",
__func__, err_flags); __func__, err_flags);
msleep(10); msleep(10); /* Checkpatch throws a < 20ms warning */
if (err_flags & SAA_DEVICE_IMAGE_CORRUPT) { if (err_flags & SAA_DEVICE_IMAGE_CORRUPT) {
printk(KERN_ERR printk(KERN_ERR
...@@ -365,7 +365,7 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev) ...@@ -365,7 +365,7 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev)
first_timeout = SAA_DEVICE_TIMEOUT; first_timeout = SAA_DEVICE_TIMEOUT;
while (first_timeout) { while (first_timeout) {
msleep(10); msleep(10); /* Checkpatch throws a < 20ms warning */
version = version =
saa7164_getcurrentfirmwareversion(dev); saa7164_getcurrentfirmwareversion(dev);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/io.h> #include <linux/io.h>
#include "saa7164.h" #include "saa7164.h"
...@@ -65,7 +65,7 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) ...@@ -65,7 +65,7 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
} }
return num; return num;
err: err:
return retval; return retval;
} }
......
...@@ -51,11 +51,15 @@ static void saa7164_vbi_configure(struct saa7164_port *port) ...@@ -51,11 +51,15 @@ static void saa7164_vbi_configure(struct saa7164_port *port)
/* Set up the DIF (enable it) for analog mode by default */ /* Set up the DIF (enable it) for analog mode by default */
saa7164_api_initialize_dif(port); saa7164_api_initialize_dif(port);
// /* Configure the correct video standard */ /* Configure the correct video standard */
// saa7164_api_configure_dif(port, port->encodernorm.id); #if 0
saa7164_api_configure_dif(port, port->encodernorm.id);
#endif
// /* Ensure the audio decoder is correct configured */ #if 0
// saa7164_api_set_audio_std(port); /* Ensure the audio decoder is correct configured */
saa7164_api_set_audio_std(port);
#endif
dprintk(DBGLVL_VBI, "%s() ends\n", __func__); dprintk(DBGLVL_VBI, "%s() ends\n", __func__);
} }
...@@ -919,8 +923,10 @@ static int saa7164_vbi_start_streaming(struct saa7164_port *port) ...@@ -919,8 +923,10 @@ static int saa7164_vbi_start_streaming(struct saa7164_port *port)
saa7164_vbi_buffers_alloc(port); saa7164_vbi_buffers_alloc(port);
/* Configure the encoder with any cache values */ /* Configure the encoder with any cache values */
// saa7164_api_set_encoder(port); #if 0
// saa7164_api_get_encoder(port); saa7164_api_set_encoder(port);
saa7164_api_get_encoder(port);
#endif
/* Place the empty buffers on the hardware */ /* Place the empty buffers on the hardware */
saa7164_buffer_cfg_port(port); saa7164_buffer_cfg_port(port);
...@@ -1060,7 +1066,8 @@ struct saa7164_user_buffer *saa7164_vbi_next_buf(struct saa7164_port *port) ...@@ -1060,7 +1066,8 @@ struct saa7164_user_buffer *saa7164_vbi_next_buf(struct saa7164_port *port)
if (crc_checking) { if (crc_checking) {
crc = crc32(0, ubuf->data, ubuf->actual_size); crc = crc32(0, ubuf->data, ubuf->actual_size);
if (crc != ubuf->crc) { if (crc != ubuf->crc) {
printk(KERN_ERR "%s() ubuf %p crc became invalid, was 0x%x became 0x%x\n", __func__, printk(KERN_ERR "%s() ubuf %p crc became invalid, was 0x%x became 0x%x\n",
__func__,
ubuf, ubuf->crc, crc); ubuf, ubuf->crc, crc);
} }
} }
...@@ -1148,9 +1155,8 @@ static ssize_t fops_read(struct file *file, char __user *buffer, ...@@ -1148,9 +1155,8 @@ static ssize_t fops_read(struct file *file, char __user *buffer,
buffer += cnt; buffer += cnt;
ret += cnt; ret += cnt;
if (ubuf->pos > ubuf->actual_size) { if (ubuf->pos > ubuf->actual_size)
printk(KERN_ERR "read() pos > actual, huh?\n"); printk(KERN_ERR "read() pos > actual, huh?\n");
}
if (ubuf->pos == ubuf->actual_size) { if (ubuf->pos == ubuf->actual_size) {
...@@ -1197,9 +1203,8 @@ static unsigned int fops_poll(struct file *file, poll_table *wait) ...@@ -1197,9 +1203,8 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
saa7164_histogram_update(&port->poll_interval, saa7164_histogram_update(&port->poll_interval,
port->last_poll_msecs_diff); port->last_poll_msecs_diff);
if (!video_is_registered(port->v4l_device)) { if (!video_is_registered(port->v4l_device))
return -EIO; return -EIO;
}
if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) { if (atomic_cmpxchg(&fh->v4l_reading, 0, 1) == 0) {
if (atomic_inc_return(&port->v4l_reader_count) == 1) { if (atomic_inc_return(&port->v4l_reader_count) == 1) {
...@@ -1257,10 +1262,14 @@ static const struct v4l2_ioctl_ops vbi_ioctl_ops = { ...@@ -1257,10 +1262,14 @@ static const struct v4l2_ioctl_ops vbi_ioctl_ops = {
.vidioc_try_ext_ctrls = vidioc_try_ext_ctrls, .vidioc_try_ext_ctrls = vidioc_try_ext_ctrls,
.vidioc_log_status = vidioc_log_status, .vidioc_log_status = vidioc_log_status,
.vidioc_queryctrl = vidioc_queryctrl, .vidioc_queryctrl = vidioc_queryctrl,
// .vidioc_g_chip_ident = saa7164_g_chip_ident, #if 0
.vidioc_g_chip_ident = saa7164_g_chip_ident,
#endif
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
// .vidioc_g_register = saa7164_g_register, #if 0
// .vidioc_s_register = saa7164_s_register, .vidioc_g_register = saa7164_g_register,
.vidioc_s_register = saa7164_s_register,
#endif
#endif #endif
.vidioc_g_fmt_vbi_cap = saa7164_vbi_fmt, .vidioc_g_fmt_vbi_cap = saa7164_vbi_fmt,
.vidioc_try_fmt_vbi_cap = saa7164_vbi_fmt, .vidioc_try_fmt_vbi_cap = saa7164_vbi_fmt,
......
...@@ -113,7 +113,8 @@ ...@@ -113,7 +113,8 @@
#define DBGLVL_THR 4096 #define DBGLVL_THR 4096
#define DBGLVL_CPU 8192 #define DBGLVL_CPU 8192
#define SAA7164_NORMS (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443) #define SAA7164_NORMS \
(V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_443)
enum port_t { enum port_t {
SAA7164_MPEG_UNDEFINED = 0, SAA7164_MPEG_UNDEFINED = 0,
...@@ -182,15 +183,11 @@ struct saa7164_subid { ...@@ -182,15 +183,11 @@ struct saa7164_subid {
struct saa7164_encoder_fh { struct saa7164_encoder_fh {
struct saa7164_port *port; struct saa7164_port *port;
// u32 freq;
// u32 tuner_type;
atomic_t v4l_reading; atomic_t v4l_reading;
}; };
struct saa7164_vbi_fh { struct saa7164_vbi_fh {
struct saa7164_port *port; struct saa7164_port *port;
// u32 freq;
// u32 tuner_type;
atomic_t v4l_reading; atomic_t v4l_reading;
}; };
...@@ -265,8 +262,6 @@ struct saa7164_ctrl { ...@@ -265,8 +262,6 @@ struct saa7164_ctrl {
struct saa7164_tvnorm { struct saa7164_tvnorm {
char *name; char *name;
v4l2_std_id id; v4l2_std_id id;
// u32 cxiformat;
// u32 cxoformat;
}; };
struct saa7164_encoder_params { struct saa7164_encoder_params {
...@@ -510,7 +505,8 @@ extern void saa7164_call_i2c_clients(struct saa7164_i2c *bus, ...@@ -510,7 +505,8 @@ extern void saa7164_call_i2c_clients(struct saa7164_i2c *bus,
/* saa7164-bus.c */ /* saa7164-bus.c */
int saa7164_bus_setup(struct saa7164_dev *dev); int saa7164_bus_setup(struct saa7164_dev *dev);
void saa7164_bus_dump(struct saa7164_dev *dev); void saa7164_bus_dump(struct saa7164_dev *dev);
int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg, void *buf); int saa7164_bus_set(struct saa7164_dev *dev, struct tmComResInfo* msg,
void *buf);
int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg, int saa7164_bus_get(struct saa7164_dev *dev, struct tmComResInfo* msg,
void *buf, int peekonly); void *buf, int peekonly);
...@@ -552,7 +548,8 @@ int saa7164_api_get_videomux(struct saa7164_port *port); ...@@ -552,7 +548,8 @@ int saa7164_api_get_videomux(struct saa7164_port *port);
int saa7164_api_set_vbi_format(struct saa7164_port *port); int saa7164_api_set_vbi_format(struct saa7164_port *port);
int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level); int saa7164_api_set_debug(struct saa7164_dev *dev, u8 level);
int saa7164_api_collect_debug(struct saa7164_dev *dev); int saa7164_api_collect_debug(struct saa7164_dev *dev);
int saa7164_api_get_load_info(struct saa7164_dev *dev, struct tmFwInfoStruct *i); int saa7164_api_get_load_info(struct saa7164_dev *dev,
struct tmFwInfoStruct *i);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* saa7164-cards.c */ /* saa7164-cards.c */
......
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