aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx25821/cx25821-video.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2013-04-13 04:50:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-16 16:57:27 -0400
commit18c73af6961c528fe5ce95eb510ef63582d47014 (patch)
tree828c7d0464fb3cb38e98ad06951c625432ec08e0 /drivers/media/pci/cx25821/cx25821-video.c
parentffd3c2330473f6a07f36bf3bd64f7a1158bdd759 (diff)
[media] cx25821: remove unused fields, ioctls
Do some spring cleaning: - there are no board defines with tuners, so remove bogus tuner support. - tv standard handling has nothing to do with tuners, so keep that. - replace the deprecated current_norm by g_std. - querystd isn't implemented, so remove the ioctl. - remove a bunch of unused fields in cx25821.h Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/pci/cx25821/cx25821-video.c')
-rw-r--r--drivers/media/pci/cx25821/cx25821-video.c130
1 files changed, 10 insertions, 120 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-video.c b/drivers/media/pci/cx25821/cx25821-video.c
index e785bb98d533..8ff8fc218f38 100644
--- a/drivers/media/pci/cx25821/cx25821-video.c
+++ b/drivers/media/pci/cx25821/cx25821-video.c
@@ -138,7 +138,6 @@ void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q,
138 pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc); 138 pr_err("%s: %d buffers handled (should be 1)\n", __func__, bc);
139} 139}
140 140
141#ifdef TUNER_FLAG
142int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm) 141int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
143{ 142{
144 dprintk(1, "%s(norm = 0x%08x) name: [%s]\n", 143 dprintk(1, "%s(norm = 0x%08x) name: [%s]\n",
@@ -151,7 +150,6 @@ int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm)
151 150
152 return 0; 151 return 0;
153} 152}
154#endif
155 153
156struct video_device *cx25821_vdev_init(struct cx25821_dev *dev, 154struct video_device *cx25821_vdev_init(struct cx25821_dev *dev,
157 struct pci_dev *pci, 155 struct pci_dev *pci,
@@ -1036,8 +1034,6 @@ int cx25821_vidioc_querycap(struct file *file, void *priv,
1036 cap->version = CX25821_VERSION_CODE; 1034 cap->version = CX25821_VERSION_CODE;
1037 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | 1035 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
1038 V4L2_CAP_STREAMING; 1036 V4L2_CAP_STREAMING;
1039 if (UNSET != dev->tuner_type)
1040 cap->capabilities |= V4L2_CAP_TUNER;
1041 return 0; 1037 return 0;
1042} 1038}
1043 1039
@@ -1093,7 +1089,14 @@ int cx25821_vidioc_s_priority(struct file *file, void *f,
1093 prio); 1089 prio);
1094} 1090}
1095 1091
1096#ifdef TUNER_FLAG 1092int cx25821_vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvnorms)
1093{
1094 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1095
1096 *tvnorms = dev->tvnorm;
1097 return 0;
1098}
1099
1097int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms) 1100int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
1098{ 1101{
1099 struct cx25821_fh *fh = priv; 1102 struct cx25821_fh *fh = priv;
@@ -1120,7 +1123,6 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
1120 1123
1121 return 0; 1124 return 0;
1122} 1125}
1123#endif
1124 1126
1125int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i) 1127int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i)
1126{ 1128{
@@ -1189,57 +1191,6 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
1189 return 0; 1191 return 0;
1190} 1192}
1191 1193
1192#ifdef TUNER_FLAG
1193int cx25821_vidioc_g_frequency(struct file *file, void *priv,
1194 struct v4l2_frequency *f)
1195{
1196 struct cx25821_fh *fh = priv;
1197 struct cx25821_dev *dev = fh->dev;
1198
1199 f->frequency = dev->freq;
1200
1201 cx25821_call_all(dev, tuner, g_frequency, f);
1202
1203 return 0;
1204}
1205
1206int cx25821_set_freq(struct cx25821_dev *dev, const struct v4l2_frequency *f)
1207{
1208 mutex_lock(&dev->lock);
1209 dev->freq = f->frequency;
1210
1211 cx25821_call_all(dev, tuner, s_frequency, f);
1212
1213 /* When changing channels it is required to reset TVAUDIO */
1214 msleep(10);
1215
1216 mutex_unlock(&dev->lock);
1217
1218 return 0;
1219}
1220
1221int cx25821_vidioc_s_frequency(struct file *file, void *priv,
1222 const struct v4l2_frequency *f)
1223{
1224 struct cx25821_fh *fh = priv;
1225 struct cx25821_dev *dev;
1226 int err;
1227
1228 if (fh) {
1229 dev = fh->dev;
1230 err = v4l2_prio_check(&dev->channels[fh->channel_id].prio,
1231 fh->prio);
1232 if (0 != err)
1233 return err;
1234 } else {
1235 pr_err("Invalid fh pointer!\n");
1236 return -EINVAL;
1237 }
1238
1239 return cx25821_set_freq(dev, f);
1240}
1241#endif
1242
1243#ifdef CONFIG_VIDEO_ADV_DEBUG 1194#ifdef CONFIG_VIDEO_ADV_DEBUG
1244int cx25821_vidioc_g_register(struct file *file, void *fh, 1195int cx25821_vidioc_g_register(struct file *file, void *fh,
1245 struct v4l2_dbg_register *reg) 1196 struct v4l2_dbg_register *reg)
@@ -1269,48 +1220,6 @@ int cx25821_vidioc_s_register(struct file *file, void *fh,
1269 1220
1270#endif 1221#endif
1271 1222
1272#ifdef TUNER_FLAG
1273int cx25821_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1274{
1275 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1276
1277 if (unlikely(UNSET == dev->tuner_type))
1278 return -EINVAL;
1279 if (0 != t->index)
1280 return -EINVAL;
1281
1282 strcpy(t->name, "Television");
1283 t->type = V4L2_TUNER_ANALOG_TV;
1284 t->capability = V4L2_TUNER_CAP_NORM;
1285 t->rangehigh = 0xffffffffUL;
1286
1287 t->signal = 0xffff; /* LOCKED */
1288 return 0;
1289}
1290
1291int cx25821_vidioc_s_tuner(struct file *file, void *priv, const struct v4l2_tuner *t)
1292{
1293 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1294 struct cx25821_fh *fh = priv;
1295 int err;
1296
1297 if (fh) {
1298 err = v4l2_prio_check(&dev->channels[fh->channel_id].prio,
1299 fh->prio);
1300 if (0 != err)
1301 return err;
1302 }
1303
1304 dprintk(1, "%s()\n", __func__);
1305 if (UNSET == dev->tuner_type)
1306 return -EINVAL;
1307 if (0 != t->index)
1308 return -EINVAL;
1309
1310 return 0;
1311}
1312
1313#endif
1314/*****************************************************************************/ 1223/*****************************************************************************/
1315static const struct v4l2_queryctrl no_ctl = { 1224static const struct v4l2_queryctrl no_ctl = {
1316 .name = "42", 1225 .name = "42",
@@ -1523,14 +1432,6 @@ int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop)
1523 return -EINVAL; 1432 return -EINVAL;
1524} 1433}
1525 1434
1526int cx25821_vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm)
1527{
1528 /* medusa does not support video standard sensing of current input */
1529 *norm = CX25821_NORMS;
1530
1531 return 0;
1532}
1533
1534int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm) 1435int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm)
1535{ 1436{
1536 if (tvnorm == V4L2_STD_PAL_BG) { 1437 if (tvnorm == V4L2_STD_PAL_BG) {
@@ -1842,10 +1743,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
1842 .vidioc_querybuf = cx25821_vidioc_querybuf, 1743 .vidioc_querybuf = cx25821_vidioc_querybuf,
1843 .vidioc_qbuf = cx25821_vidioc_qbuf, 1744 .vidioc_qbuf = cx25821_vidioc_qbuf,
1844 .vidioc_dqbuf = vidioc_dqbuf, 1745 .vidioc_dqbuf = vidioc_dqbuf,
1845#ifdef TUNER_FLAG 1746 .vidioc_g_std = cx25821_vidioc_g_std,
1846 .vidioc_s_std = cx25821_vidioc_s_std, 1747 .vidioc_s_std = cx25821_vidioc_s_std,
1847 .vidioc_querystd = cx25821_vidioc_querystd,
1848#endif
1849 .vidioc_cropcap = cx25821_vidioc_cropcap, 1748 .vidioc_cropcap = cx25821_vidioc_cropcap,
1850 .vidioc_s_crop = cx25821_vidioc_s_crop, 1749 .vidioc_s_crop = cx25821_vidioc_s_crop,
1851 .vidioc_g_crop = cx25821_vidioc_g_crop, 1750 .vidioc_g_crop = cx25821_vidioc_g_crop,
@@ -1860,12 +1759,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
1860 .vidioc_log_status = vidioc_log_status, 1759 .vidioc_log_status = vidioc_log_status,
1861 .vidioc_g_priority = cx25821_vidioc_g_priority, 1760 .vidioc_g_priority = cx25821_vidioc_g_priority,
1862 .vidioc_s_priority = cx25821_vidioc_s_priority, 1761 .vidioc_s_priority = cx25821_vidioc_s_priority,
1863#ifdef TUNER_FLAG
1864 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
1865 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
1866 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
1867 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
1868#endif
1869#ifdef CONFIG_VIDEO_ADV_DEBUG 1762#ifdef CONFIG_VIDEO_ADV_DEBUG
1870 .vidioc_g_register = cx25821_vidioc_g_register, 1763 .vidioc_g_register = cx25821_vidioc_g_register,
1871 .vidioc_s_register = cx25821_vidioc_s_register, 1764 .vidioc_s_register = cx25821_vidioc_s_register,
@@ -1878,7 +1771,6 @@ static const struct video_device cx25821_video_device = {
1878 .minor = -1, 1771 .minor = -1,
1879 .ioctl_ops = &video_ioctl_ops, 1772 .ioctl_ops = &video_ioctl_ops,
1880 .tvnorms = CX25821_NORMS, 1773 .tvnorms = CX25821_NORMS,
1881 .current_norm = V4L2_STD_NTSC_M,
1882}; 1774};
1883 1775
1884void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) 1776void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
@@ -1953,10 +1845,8 @@ int cx25821_video_register(struct cx25821_dev *dev)
1953 1845
1954 /* initial device configuration */ 1846 /* initial device configuration */
1955 mutex_lock(&dev->lock); 1847 mutex_lock(&dev->lock);
1956#ifdef TUNER_FLAG 1848 dev->tvnorm = V4L2_STD_NTSC_M,
1957 dev->tvnorm = cx25821_video_device.current_norm;
1958 cx25821_set_tvnorm(dev, dev->tvnorm); 1849 cx25821_set_tvnorm(dev, dev->tvnorm);
1959#endif
1960 mutex_unlock(&dev->lock); 1850 mutex_unlock(&dev->lock);
1961 1851
1962 return 0; 1852 return 0;