aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2011-07-24 16:07:07 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:56:04 -0400
commitde99d5328c6d54694471da28711a05adec708c3b (patch)
treed05ab3d5e7a77ea9fff901108eea1b1431446cd6 /drivers/media
parent44ecf1df9493e6684cd1bb34abb107a0ffe1078a (diff)
[media] cx231xx: Provide signal lock status in G_INPUT
Make use of the signal state registers to properly populate the signal lock registers in the cx231xx driver. This allows applications to know whether there is a signal present even in devices which lack a tuner (since such apps typically won't call G_TUNER if no tuner is present). [mchehab@redhat.com: Fix CodingStyle: don't use {} for one-line if's] Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx231xx/cx231xx-video.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c
index 21fa54762be7..6e81f970dc7d 100644
--- a/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/drivers/media/video/cx231xx/cx231xx-video.c
@@ -1179,7 +1179,8 @@ static int vidioc_enum_input(struct file *file, void *priv,
1179{ 1179{
1180 struct cx231xx_fh *fh = priv; 1180 struct cx231xx_fh *fh = priv;
1181 struct cx231xx *dev = fh->dev; 1181 struct cx231xx *dev = fh->dev;
1182 unsigned int n; 1182 u32 gen_stat;
1183 unsigned int ret, n;
1183 1184
1184 n = i->index; 1185 n = i->index;
1185 if (n >= MAX_CX231XX_INPUT) 1186 if (n >= MAX_CX231XX_INPUT)
@@ -1198,6 +1199,18 @@ static int vidioc_enum_input(struct file *file, void *priv,
1198 1199
1199 i->std = dev->vdev->tvnorms; 1200 i->std = dev->vdev->tvnorms;
1200 1201
1202 /* If they are asking about the active input, read signal status */
1203 if (n == dev->video_input) {
1204 ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS,
1205 GEN_STAT, 2, &gen_stat, 4);
1206 if (ret > 0) {
1207 if ((gen_stat & FLD_VPRES) == 0x00)
1208 i->status |= V4L2_IN_ST_NO_SIGNAL;
1209 if ((gen_stat & FLD_HLOCK) == 0x00)
1210 i->status |= V4L2_IN_ST_NO_H_LOCK;
1211 }
1212 }
1213
1201 return 0; 1214 return 0;
1202} 1215}
1203 1216