aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
authorFrej Drejhammar <frej.drejhammar@gmail.com>2008-03-23 21:43:21 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:07:55 -0400
commit6d04203c7f49a4d93304b5754de5457297fa04eb (patch)
treea76667e334af96bca870add2fc7f36f7cebedf95 /drivers/media/video/cx88/cx88-video.c
parent1c412d1236b98bfc59fc694238cd26e6ed7f4f4b (diff)
V4L/DVB (7451): cx88: Add user control for chroma AGC
The cx2388x family has support for chroma AGC. This patch implements a the V4L2_CID_CHROMA_AGC control for the cx2388x family. By default chroma AGC is disabled, as in previous versions of the driver. Signed-off-by: "Frej Drejhammar <frej.drejhammar@gmail.com>" Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r--drivers/media/video/cx88/cx88-video.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 1eea044969a1..7ec6763f0e79 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -228,6 +228,18 @@ static struct cx88_ctrl cx8800_ctls[] = {
228 .mask = 0x00ff, 228 .mask = 0x00ff,
229 .shift = 0, 229 .shift = 0,
230 },{ 230 },{
231 .v = {
232 .id = V4L2_CID_CHROMA_AGC,
233 .name = "Chroma AGC",
234 .minimum = 0,
235 .maximum = 1,
236 .default_value = 0x0,
237 .type = V4L2_CTRL_TYPE_BOOLEAN,
238 },
239 .reg = MO_INPUT_FORMAT,
240 .mask = 1 << 10,
241 .shift = 10,
242 }, {
231 /* --- audio --- */ 243 /* --- audio --- */
232 .v = { 244 .v = {
233 .id = V4L2_CID_AUDIO_MUTE, 245 .id = V4L2_CID_AUDIO_MUTE,
@@ -282,6 +294,7 @@ const u32 cx88_user_ctrls[] = {
282 V4L2_CID_AUDIO_VOLUME, 294 V4L2_CID_AUDIO_VOLUME,
283 V4L2_CID_AUDIO_BALANCE, 295 V4L2_CID_AUDIO_BALANCE,
284 V4L2_CID_AUDIO_MUTE, 296 V4L2_CID_AUDIO_MUTE,
297 V4L2_CID_CHROMA_AGC,
285 0 298 0
286}; 299};
287EXPORT_SYMBOL(cx88_user_ctrls); 300EXPORT_SYMBOL(cx88_user_ctrls);
@@ -291,7 +304,7 @@ static const u32 *ctrl_classes[] = {
291 NULL 304 NULL
292}; 305};
293 306
294int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl) 307int cx8800_ctrl_query(struct cx88_core *core, struct v4l2_queryctrl *qctrl)
295{ 308{
296 int i; 309 int i;
297 310
@@ -306,6 +319,11 @@ int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl)
306 return 0; 319 return 0;
307 } 320 }
308 *qctrl = cx8800_ctls[i].v; 321 *qctrl = cx8800_ctls[i].v;
322 /* Report chroma AGC as inactive when SECAM is selected */
323 if (cx8800_ctls[i].v.id == V4L2_CID_CHROMA_AGC &&
324 core->tvnorm & V4L2_STD_SECAM)
325 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
326
309 return 0; 327 return 0;
310} 328}
311EXPORT_SYMBOL(cx8800_ctrl_query); 329EXPORT_SYMBOL(cx8800_ctrl_query);
@@ -976,6 +994,12 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
976 } 994 }
977 mask=0xffff; 995 mask=0xffff;
978 break; 996 break;
997 case V4L2_CID_CHROMA_AGC:
998 /* Do not allow chroma AGC to be enabled for SECAM */
999 value = ((ctl->value - c->off) << c->shift) & c->mask;
1000 if (core->tvnorm & V4L2_STD_SECAM && value)
1001 return -EINVAL;
1002 break;
979 default: 1003 default:
980 value = ((ctl->value - c->off) << c->shift) & c->mask; 1004 value = ((ctl->value - c->off) << c->shift) & c->mask;
981 break; 1005 break;
@@ -1268,10 +1292,12 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int i)
1268static int vidioc_queryctrl (struct file *file, void *priv, 1292static int vidioc_queryctrl (struct file *file, void *priv,
1269 struct v4l2_queryctrl *qctrl) 1293 struct v4l2_queryctrl *qctrl)
1270{ 1294{
1295 struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
1296
1271 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); 1297 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
1272 if (unlikely(qctrl->id == 0)) 1298 if (unlikely(qctrl->id == 0))
1273 return -EINVAL; 1299 return -EINVAL;
1274 return cx8800_ctrl_query(qctrl); 1300 return cx8800_ctrl_query(core, qctrl);
1275} 1301}
1276 1302
1277static int vidioc_g_ctrl (struct file *file, void *priv, 1303static int vidioc_g_ctrl (struct file *file, void *priv,