diff options
author | Tobias Lorenz <tobias.lorenz@gmx.net> | 2008-09-24 18:25:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-17 16:21:29 -0400 |
commit | eb6e3b860e36a3259d3694636ddce2660aabbd2c (patch) | |
tree | 752724a0a62aee995a21d296b753624b7232d134 /drivers | |
parent | a17c0019f24e46c608945d988375cc14a8bbde28 (diff) |
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: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/radio/radio-si470x.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 2f680268c545..31da21a38f24 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -1176,7 +1176,6 @@ static const struct file_operations si470x_fops = { | |||
1176 | * si470x_v4l2_queryctrl - query control | 1176 | * si470x_v4l2_queryctrl - query control |
1177 | */ | 1177 | */ |
1178 | static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = { | 1178 | static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = { |
1179 | /* HINT: the disabled controls are only here to satify kradio and such apps */ | ||
1180 | { | 1179 | { |
1181 | .id = V4L2_CID_AUDIO_VOLUME, | 1180 | .id = V4L2_CID_AUDIO_VOLUME, |
1182 | .type = V4L2_CTRL_TYPE_INTEGER, | 1181 | .type = V4L2_CTRL_TYPE_INTEGER, |
@@ -1187,18 +1186,6 @@ static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = { | |||
1187 | .default_value = 15, | 1186 | .default_value = 15, |
1188 | }, | 1187 | }, |
1189 | { | 1188 | { |
1190 | .id = V4L2_CID_AUDIO_BALANCE, | ||
1191 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
1192 | }, | ||
1193 | { | ||
1194 | .id = V4L2_CID_AUDIO_BASS, | ||
1195 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
1196 | }, | ||
1197 | { | ||
1198 | .id = V4L2_CID_AUDIO_TREBLE, | ||
1199 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
1200 | }, | ||
1201 | { | ||
1202 | .id = V4L2_CID_AUDIO_MUTE, | 1189 | .id = V4L2_CID_AUDIO_MUTE, |
1203 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 1190 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
1204 | .name = "Mute", | 1191 | .name = "Mute", |
@@ -1207,10 +1194,6 @@ static struct v4l2_queryctrl si470x_v4l2_queryctrl[] = { | |||
1207 | .step = 1, | 1194 | .step = 1, |
1208 | .default_value = 1, | 1195 | .default_value = 1, |
1209 | }, | 1196 | }, |
1210 | { | ||
1211 | .id = V4L2_CID_AUDIO_LOUDNESS, | ||
1212 | .flags = V4L2_CTRL_FLAG_DISABLED, | ||
1213 | }, | ||
1214 | }; | 1197 | }; |
1215 | 1198 | ||
1216 | 1199 | ||
@@ -1267,21 +1250,29 @@ static int si470x_vidioc_s_input(struct file *file, void *priv, unsigned int i) | |||
1267 | static int si470x_vidioc_queryctrl(struct file *file, void *priv, | 1250 | static int si470x_vidioc_queryctrl(struct file *file, void *priv, |
1268 | struct v4l2_queryctrl *qc) | 1251 | struct v4l2_queryctrl *qc) |
1269 | { | 1252 | { |
1270 | unsigned char i; | 1253 | unsigned char i = 0; |
1271 | int retval = -EINVAL; | 1254 | int retval = -EINVAL; |
1272 | 1255 | ||
1273 | /* safety checks */ | 1256 | /* abort if qc->id is below V4L2_CID_BASE */ |
1274 | if (!qc->id) | 1257 | if (qc->id < V4L2_CID_BASE) |
1275 | goto done; | 1258 | goto done; |
1276 | 1259 | ||
1260 | /* search video control */ | ||
1277 | for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) { | 1261 | for (i = 0; i < ARRAY_SIZE(si470x_v4l2_queryctrl); i++) { |
1278 | if (qc->id == si470x_v4l2_queryctrl[i].id) { | 1262 | if (qc->id == si470x_v4l2_queryctrl[i].id) { |
1279 | memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc)); | 1263 | memcpy(qc, &(si470x_v4l2_queryctrl[i]), sizeof(*qc)); |
1280 | retval = 0; | 1264 | retval = 0; /* found */ |
1281 | break; | 1265 | break; |
1282 | } | 1266 | } |
1283 | } | 1267 | } |
1284 | 1268 | ||
1269 | /* disable unsupported base controls */ | ||
1270 | /* to satisfy kradio and such apps */ | ||
1271 | if ((retval == -EINVAL) && (qc->id < V4L2_CID_LASTP1)) { | ||
1272 | qc->flags = V4L2_CTRL_FLAG_DISABLED; | ||
1273 | retval = 0; | ||
1274 | } | ||
1275 | |||
1285 | done: | 1276 | done: |
1286 | if (retval < 0) | 1277 | if (retval < 0) |
1287 | printk(KERN_WARNING DRIVER_NAME | 1278 | printk(KERN_WARNING DRIVER_NAME |