aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
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
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')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c4
-rw-r--r--drivers/media/video/cx88/cx88-core.c6
-rw-r--r--drivers/media/video/cx88/cx88-video.c30
-rw-r--r--drivers/media/video/cx88/cx88.h3
4 files changed, 37 insertions, 6 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index d582395805df..8d54e7a90dc7 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -693,7 +693,7 @@ static int blackbird_queryctrl(struct cx8802_dev *dev, struct v4l2_queryctrl *qc
693 return -EINVAL; 693 return -EINVAL;
694 694
695 /* Standard V4L2 controls */ 695 /* Standard V4L2 controls */
696 if (cx8800_ctrl_query(qctrl) == 0) 696 if (cx8800_ctrl_query(dev->core, qctrl) == 0)
697 return 0; 697 return 0;
698 698
699 /* MPEG V4L2 controls */ 699 /* MPEG V4L2 controls */
@@ -933,7 +933,7 @@ static int vidioc_queryctrl (struct file *file, void *priv,
933 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); 933 qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id);
934 if (unlikely(qctrl->id == 0)) 934 if (unlikely(qctrl->id == 0))
935 return -EINVAL; 935 return -EINVAL;
936 return cx8800_ctrl_query(qctrl); 936 return cx8800_ctrl_query(dev->core, qctrl);
937} 937}
938 938
939static int vidioc_enum_input (struct file *file, void *priv, 939static int vidioc_enum_input (struct file *file, void *priv,
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 75b581048f6e..dca9f3ae5fdf 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -929,7 +929,11 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
929 929
930 dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n", 930 dprintk(1,"set_tvnorm: MO_INPUT_FORMAT 0x%08x [old=0x%08x]\n",
931 cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f); 931 cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
932 cx_andor(MO_INPUT_FORMAT, 0xf, cxiformat); 932 /* Chroma AGC must be disabled if SECAM is used */
933 if (norm & V4L2_STD_SECAM)
934 cx_andor(MO_INPUT_FORMAT, 0x40f, cxiformat);
935 else
936 cx_andor(MO_INPUT_FORMAT, 0xf, cxiformat);
933 937
934 // FIXME: as-is from DScaler 938 // FIXME: as-is from DScaler
935 dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n", 939 dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
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,
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index d17ca71c5d95..14ac173f4071 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -651,7 +651,8 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev);
651/* ----------------------------------------------------------- */ 651/* ----------------------------------------------------------- */
652/* cx88-video.c*/ 652/* cx88-video.c*/
653extern const u32 cx88_user_ctrls[]; 653extern const u32 cx88_user_ctrls[];
654extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl); 654extern int cx8800_ctrl_query(struct cx88_core *core,
655 struct v4l2_queryctrl *qctrl);
655int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i); 656int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i);
656int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f); 657int cx88_set_freq (struct cx88_core *core,struct v4l2_frequency *f);
657int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl); 658int cx88_get_control(struct cx88_core *core, struct v4l2_control *ctl);