Commit eb6e3b86 authored by Tobias Lorenz's avatar Tobias Lorenz Committed by Mauro Carvalho Chehab

V4L/DVB (9215): si470x: improvement of unsupported base controls

This patch changes the handling of unsupported base controls.

In the former version, specific unsupported base controls were listed in
the queryctrl table and were flagged as disabled controls. This was done
for all base controls used by the applications.

The patch now removes the specific base controls and instead lets
queryctrl automatically return unsupported base controls flagged as
disabled.
Signed-off-by: default avatarTobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a17c0019
...@@ -1176,7 +1176,6 @@ static const struct file_operations si470x_fops = { ...@@ -1176,7 +1176,6 @@ static const struct file_operations si470x_fops = {
* si470x_v4l2_queryctrl - query control * si470x_v4l2_queryctrl - query control
*/ */
static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = { static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = {
/* HINT: the disabled controls are only here to satify kradio and such apps */
{ {
.id = V4L2_CID_AUDIO_VOLUME, .id = V4L2_CID_AUDIO_VOLUME,
.type = V4L2_CTRL_TYPE_INTEGER, .type = V4L2_CTRL_TYPE_INTEGER,
...@@ -1186,18 +1185,6 @@ static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = { ...@@ -1186,18 +1185,6 @@ static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = {
.step = 1, .step = 1,
.default_value = 15, .default_value = 15,
}, },
{
.id = V4L2_CID_AUDIO_BALANCE,
.flags = V4L2_CTRL_FLAG_DISABLED,
},
{
.id = V4L2_CID_AUDIO_BASS,
.flags = V4L2_CTRL_FLAG_DISABLED,
},
{
.id = V4L2_CID_AUDIO_TREBLE,
.flags = V4L2_CTRL_FLAG_DISABLED,
},
{ {
.id = V4L2_CID_AUDIO_MUTE, .id = V4L2_CID_AUDIO_MUTE,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
...@@ -1207,10 +1194,6 @@ static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = { ...@@ -1207,10 +1194,6 @@ static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = {
.step = 1, .step = 1,
.default_value = 1, .default_value = 1,
}, },
{
.id = V4L2_CID_AUDIO_LOUDNESS,
.flags = V4L2_CTRL_FLAG_DISABLED,
},
}; };
...@@ -1267,21 +1250,29 @@ static int si470x_vidioc_s_input(struct file *file, void *priv, unsigned int i) ...@@ -1267,21 +1250,29 @@ static int si470x_vidioc_s_input(struct file *file, void *priv, unsigned int i)
static int si470x_vidioc_queryctrl(struct file *file, void *priv, static int si470x_vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc) struct v4l2_queryctrl *qc)
{ {
unsigned char i; unsigned char i = 0;
int retval = -EINVAL; int retval = -EINVAL;
/* safety checks */ /* abort if qc->id is below V4L2_CID_BASE */
if (!qc->id) if (qc->id < V4L2_CID_BASE)
goto done; goto done;
/* search video control */
for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) { for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) {
if (qc->id == si470x_v4l2_queryctrl[i].id) { if (qc->id == si470x_v4l2_queryctrl[i].id) {
memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc)); memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc));
retval = 0; retval = 0; /* found */
break; break;
} }
} }
/* disable unsupported base controls */
/* to satisfy kradio and such apps */
if ((retval == -EINVAL) && (qc->id < V4L2_CID_LASTP1)) {
qc->flags = V4L2_CTRL_FLAG_DISABLED;
retval = 0;
}
done: done:
if (retval < 0) if (retval < 0)
printk(KERN_WARNING DRIVER_NAME printk(KERN_WARNING DRIVER_NAME
......
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