Commit 33eaee16 authored by Antoine Cellerier's avatar Antoine Cellerier Committed by Ugo Riboni

Implement V4L2_CTRL_FLAG_NEXT_CTRL.

This patch implements support for the V4L2_CTRL_FLAG_NEXT_CTRL flag in
the tvp5146 video 4 linux 2 driver. Although support for that flag is
not required, it makes iterations on the list of available controls more
efficient.
parent b6d398c9
...@@ -244,12 +244,13 @@ static int queryctrl(void *arg) ...@@ -244,12 +244,13 @@ static int queryctrl(void *arg)
{ {
struct v4l2_queryctrl *queryctrl = arg; struct v4l2_queryctrl *queryctrl = arg;
int ret = 0; int ret = 0;
int id = queryctrl->id; __u32 id = queryctrl->id;
memset(queryctrl, 0, sizeof(*queryctrl)); memset(queryctrl, 0, sizeof(*queryctrl));
queryctrl->id = id;
switch (id) { switch (id) {
case V4L2_CTRL_FLAG_NEXT_CTRL:
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
queryctrl->id = V4L2_CID_BRIGHTNESS;
strcpy(queryctrl->name, "BRIGHTNESS"); strcpy(queryctrl->name, "BRIGHTNESS");
queryctrl->type = V4L2_CTRL_TYPE_INTEGER; queryctrl->type = V4L2_CTRL_TYPE_INTEGER;
queryctrl->minimum = 0; queryctrl->minimum = 0;
...@@ -257,7 +258,10 @@ static int queryctrl(void *arg) ...@@ -257,7 +258,10 @@ static int queryctrl(void *arg)
queryctrl->step = 1; queryctrl->step = 1;
queryctrl->default_value = 128; queryctrl->default_value = 128;
break; break;
case V4L2_CID_BRIGHTNESS|V4L2_CTRL_FLAG_NEXT_CTRL:
case V4L2_CID_CONTRAST: case V4L2_CID_CONTRAST:
queryctrl->id = V4L2_CID_CONTRAST;
strcpy(queryctrl->name, "CONTRAST"); strcpy(queryctrl->name, "CONTRAST");
queryctrl->type = V4L2_CTRL_TYPE_INTEGER; queryctrl->type = V4L2_CTRL_TYPE_INTEGER;
queryctrl->minimum = 0; queryctrl->minimum = 0;
...@@ -266,7 +270,9 @@ static int queryctrl(void *arg) ...@@ -266,7 +270,9 @@ static int queryctrl(void *arg)
queryctrl->default_value = 128; queryctrl->default_value = 128;
break; break;
case V4L2_CID_CONTRAST|V4L2_CTRL_FLAG_NEXT_CTRL:
case V4L2_CID_SATURATION: case V4L2_CID_SATURATION:
queryctrl->id = V4L2_CID_SATURATION;
strcpy(queryctrl->name, "SATURATION"); strcpy(queryctrl->name, "SATURATION");
queryctrl->type = V4L2_CTRL_TYPE_INTEGER; queryctrl->type = V4L2_CTRL_TYPE_INTEGER;
queryctrl->minimum = 0; queryctrl->minimum = 0;
...@@ -274,7 +280,10 @@ static int queryctrl(void *arg) ...@@ -274,7 +280,10 @@ static int queryctrl(void *arg)
queryctrl->step = 1; queryctrl->step = 1;
queryctrl->default_value = 128; queryctrl->default_value = 128;
break; break;
case V4L2_CID_SATURATION|V4L2_CTRL_FLAG_NEXT_CTRL:
case V4L2_CID_HUE: case V4L2_CID_HUE:
queryctrl->id = V4L2_CID_HUE;
strcpy(queryctrl->name, "HUE"); strcpy(queryctrl->name, "HUE");
queryctrl->type = V4L2_CTRL_TYPE_INTEGER; queryctrl->type = V4L2_CTRL_TYPE_INTEGER;
queryctrl->minimum = -128; /* -180 DEGREE */ queryctrl->minimum = -128; /* -180 DEGREE */
...@@ -283,7 +292,9 @@ static int queryctrl(void *arg) ...@@ -283,7 +292,9 @@ static int queryctrl(void *arg)
queryctrl->default_value = 0; /* 0 DEGREE */ queryctrl->default_value = 0; /* 0 DEGREE */
break; break;
case V4L2_CID_HUE|V4L2_CTRL_FLAG_NEXT_CTRL:
case V4L2_CID_AUTOGAIN: case V4L2_CID_AUTOGAIN:
queryctrl->id = V4L2_CID_AUTOGAIN;
strcpy(queryctrl->name, "Automatic Gain Control"); strcpy(queryctrl->name, "Automatic Gain Control");
queryctrl->type = V4L2_CTRL_TYPE_BOOLEAN; queryctrl->type = V4L2_CTRL_TYPE_BOOLEAN;
queryctrl->minimum = 0; queryctrl->minimum = 0;
...@@ -291,11 +302,15 @@ static int queryctrl(void *arg) ...@@ -291,11 +302,15 @@ static int queryctrl(void *arg)
queryctrl->step = 1; queryctrl->step = 1;
queryctrl->default_value = 1; queryctrl->default_value = 1;
break; break;
default: default:
if (id < V4L2_CID_LASTP1) if (id < V4L2_CID_LASTP1)
{
queryctrl->flags = V4L2_CTRL_FLAG_DISABLED; queryctrl->flags = V4L2_CTRL_FLAG_DISABLED;
else break;
ret = -EINVAL; }
case V4L2_CID_AUTOGAIN|V4L2_CTRL_FLAG_NEXT_CTRL:
ret = -EINVAL;
break; break;
} /* end switch (id) */ } /* end switch (id) */
return ret; return ret;
......
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