aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-02-21 16:47:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:54 -0400
commit10afbef15e7bba5e1008f583852077743d28c395 (patch)
tree73dbfe2a3ccde6ef75c3403fb189274247740003 /drivers
parent1df795370c1392a026c63816368108187aec2ec1 (diff)
V4L/DVB (10698): v4l2-common: remove v4l2_ctrl_query_fill_std
The v4l2_ctrl_query_fill_std() function wasn't one the best idea I ever had. It doesn't add anything valuable that cannot be expressed equally well with v4l2_ctrl_query_fill and only adds overhead. Replace it with v4l2_ctrl_query_fill() everywhere it is used and remove it from v4l2_common.c. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c7
-rw-r--r--drivers/media/video/cx2341x.c108
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c7
-rw-r--r--drivers/media/video/msp3400-driver.c26
-rw-r--r--drivers/media/video/saa7115.c4
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c12
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c2
-rw-r--r--drivers/media/video/tda7432.c6
-rw-r--r--drivers/media/video/tda9875.c3
-rw-r--r--drivers/media/video/tvaudio.c17
-rw-r--r--drivers/media/video/tvp514x.c5
-rw-r--r--drivers/media/video/v4l2-common.c145
12 files changed, 141 insertions, 201 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index a3bd2c95f582..fc576cf1a8b5 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -788,10 +788,12 @@ int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg)
788 788
789 switch (qc->id) { 789 switch (qc->id) {
790 case V4L2_CID_BRIGHTNESS: 790 case V4L2_CID_BRIGHTNESS:
791 return v4l2_ctrl_query_fill(qc, 0, 255, 1, 128);
791 case V4L2_CID_CONTRAST: 792 case V4L2_CID_CONTRAST:
792 case V4L2_CID_SATURATION: 793 case V4L2_CID_SATURATION:
794 return v4l2_ctrl_query_fill(qc, 0, 127, 1, 64);
793 case V4L2_CID_HUE: 795 case V4L2_CID_HUE:
794 return v4l2_ctrl_query_fill_std(qc); 796 return v4l2_ctrl_query_fill(qc, -128, 127, 1, 0);
795 default: 797 default:
796 break; 798 break;
797 } 799 }
@@ -801,10 +803,11 @@ int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg)
801 return v4l2_ctrl_query_fill(qc, 0, 65535, 803 return v4l2_ctrl_query_fill(qc, 0, 65535,
802 65535 / 100, state->default_volume); 804 65535 / 100, state->default_volume);
803 case V4L2_CID_AUDIO_MUTE: 805 case V4L2_CID_AUDIO_MUTE:
806 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
804 case V4L2_CID_AUDIO_BALANCE: 807 case V4L2_CID_AUDIO_BALANCE:
805 case V4L2_CID_AUDIO_BASS: 808 case V4L2_CID_AUDIO_BASS:
806 case V4L2_CID_AUDIO_TREBLE: 809 case V4L2_CID_AUDIO_TREBLE:
807 return v4l2_ctrl_query_fill_std(qc); 810 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
808 default: 811 default:
809 return -EINVAL; 812 return -EINVAL;
810 } 813 }
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
index b36f522d2c55..8ded52946334 100644
--- a/drivers/media/video/cx2341x.c
+++ b/drivers/media/video/cx2341x.c
@@ -500,6 +500,29 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
500 int err; 500 int err;
501 501
502 switch (qctrl->id) { 502 switch (qctrl->id) {
503 case V4L2_CID_MPEG_STREAM_TYPE:
504 return v4l2_ctrl_query_fill(qctrl,
505 V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
506 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD, 1,
507 V4L2_MPEG_STREAM_TYPE_MPEG2_PS);
508
509 case V4L2_CID_MPEG_STREAM_VBI_FMT:
510 if (params->capabilities & CX2341X_CAP_HAS_SLICED_VBI)
511 return v4l2_ctrl_query_fill(qctrl,
512 V4L2_MPEG_STREAM_VBI_FMT_NONE,
513 V4L2_MPEG_STREAM_VBI_FMT_IVTV, 1,
514 V4L2_MPEG_STREAM_VBI_FMT_NONE);
515 return cx2341x_ctrl_query_fill(qctrl,
516 V4L2_MPEG_STREAM_VBI_FMT_NONE,
517 V4L2_MPEG_STREAM_VBI_FMT_NONE, 1,
518 default_params.stream_vbi_fmt);
519
520 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
521 return v4l2_ctrl_query_fill(qctrl,
522 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100,
523 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000, 1,
524 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000);
525
503 case V4L2_CID_MPEG_AUDIO_ENCODING: 526 case V4L2_CID_MPEG_AUDIO_ENCODING:
504 if (params->capabilities & CX2341X_CAP_HAS_AC3) { 527 if (params->capabilities & CX2341X_CAP_HAS_AC3) {
505 /* 528 /*
@@ -531,9 +554,36 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
531 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; 554 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
532 return 0; 555 return 0;
533 556
534 case V4L2_CID_MPEG_AUDIO_L1_BITRATE: 557 case V4L2_CID_MPEG_AUDIO_MODE:
535 case V4L2_CID_MPEG_AUDIO_L3_BITRATE: 558 return v4l2_ctrl_query_fill(qctrl,
536 return -EINVAL; 559 V4L2_MPEG_AUDIO_MODE_STEREO,
560 V4L2_MPEG_AUDIO_MODE_MONO, 1,
561 V4L2_MPEG_AUDIO_MODE_STEREO);
562
563 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
564 err = v4l2_ctrl_query_fill(qctrl,
565 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4,
566 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16, 1,
567 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4);
568 if (err == 0 &&
569 params->audio_mode != V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
570 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
571 return err;
572
573 case V4L2_CID_MPEG_AUDIO_EMPHASIS:
574 return v4l2_ctrl_query_fill(qctrl,
575 V4L2_MPEG_AUDIO_EMPHASIS_NONE,
576 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17, 1,
577 V4L2_MPEG_AUDIO_EMPHASIS_NONE);
578
579 case V4L2_CID_MPEG_AUDIO_CRC:
580 return v4l2_ctrl_query_fill(qctrl,
581 V4L2_MPEG_AUDIO_CRC_NONE,
582 V4L2_MPEG_AUDIO_CRC_CRC16, 1,
583 V4L2_MPEG_AUDIO_CRC_NONE);
584
585 case V4L2_CID_MPEG_AUDIO_MUTE:
586 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
537 587
538 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE: 588 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:
539 err = v4l2_ctrl_query_fill(qctrl, 589 err = v4l2_ctrl_query_fill(qctrl,
@@ -550,13 +600,6 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
550 qctrl->flags |= V4L2_CTRL_FLAG_DISABLED; 600 qctrl->flags |= V4L2_CTRL_FLAG_DISABLED;
551 return 0; 601 return 0;
552 602
553 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
554 err = v4l2_ctrl_query_fill_std(qctrl);
555 if (err == 0 &&
556 params->audio_mode != V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
557 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
558 return err;
559
560 case V4L2_CID_MPEG_VIDEO_ENCODING: 603 case V4L2_CID_MPEG_VIDEO_ENCODING:
561 /* this setting is read-only for the cx2341x since the 604 /* this setting is read-only for the cx2341x since the
562 V4L2_CID_MPEG_STREAM_TYPE really determines the 605 V4L2_CID_MPEG_STREAM_TYPE really determines the
@@ -569,32 +612,51 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
569 qctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; 612 qctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
570 return err; 613 return err;
571 614
615 case V4L2_CID_MPEG_VIDEO_ASPECT:
616 return v4l2_ctrl_query_fill(qctrl,
617 V4L2_MPEG_VIDEO_ASPECT_1x1,
618 V4L2_MPEG_VIDEO_ASPECT_221x100, 1,
619 V4L2_MPEG_VIDEO_ASPECT_4x3);
620
621 case V4L2_CID_MPEG_VIDEO_B_FRAMES:
622 return v4l2_ctrl_query_fill(qctrl, 0, 33, 1, 2);
623
624 case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
625 return v4l2_ctrl_query_fill(qctrl, 1, 34, 1,
626 params->is_50hz ? 12 : 15);
627
628 case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE:
629 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 1);
630
572 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: 631 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
573 err = v4l2_ctrl_query_fill_std(qctrl); 632 err = v4l2_ctrl_query_fill(qctrl,
633 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
634 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, 1,
635 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
574 if (err == 0 && 636 if (err == 0 &&
575 params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1) 637 params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1)
576 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; 638 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
577 return err; 639 return err;
578 640
641 case V4L2_CID_MPEG_VIDEO_BITRATE:
642 return v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 6000000);
643
579 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: 644 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
580 err = v4l2_ctrl_query_fill_std(qctrl); 645 err = v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 8000000);
581 if (err == 0 && 646 if (err == 0 &&
582 params->video_bitrate_mode == 647 params->video_bitrate_mode ==
583 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) 648 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR)
584 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; 649 qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE;
585 return err; 650 return err;
586 651
587 case V4L2_CID_MPEG_STREAM_VBI_FMT: 652 case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION:
588 if (params->capabilities & CX2341X_CAP_HAS_SLICED_VBI) 653 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
589 return v4l2_ctrl_query_fill_std(qctrl);
590 return cx2341x_ctrl_query_fill(qctrl,
591 V4L2_MPEG_STREAM_VBI_FMT_NONE,
592 V4L2_MPEG_STREAM_VBI_FMT_NONE, 1,
593 default_params.stream_vbi_fmt);
594 654
595 case V4L2_CID_MPEG_VIDEO_GOP_SIZE: 655 case V4L2_CID_MPEG_VIDEO_MUTE:
596 return v4l2_ctrl_query_fill(qctrl, 1, 34, 1, 656 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
597 params->is_50hz ? 12 : 15); 657
658 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: /* Init YUV (really YCbCr) to black */
659 return v4l2_ctrl_query_fill(qctrl, 0, 0xffffff, 1, 0x008080);
598 660
599 /* CX23415/6 specific */ 661 /* CX23415/6 specific */
600 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: 662 case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE:
@@ -696,7 +758,7 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
696 default_params.stream_insert_nav_packets); 758 default_params.stream_insert_nav_packets);
697 759
698 default: 760 default:
699 return v4l2_ctrl_query_fill_std(qctrl); 761 return -EINVAL;
700 762
701 } 763 }
702} 764}
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index d4059ecaa58e..4a5d5ef9dfc7 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1205,10 +1205,12 @@ static int cx25840_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
1205 1205
1206 switch (qc->id) { 1206 switch (qc->id) {
1207 case V4L2_CID_BRIGHTNESS: 1207 case V4L2_CID_BRIGHTNESS:
1208 return v4l2_ctrl_query_fill(qc, 0, 255, 1, 128);
1208 case V4L2_CID_CONTRAST: 1209 case V4L2_CID_CONTRAST:
1209 case V4L2_CID_SATURATION: 1210 case V4L2_CID_SATURATION:
1211 return v4l2_ctrl_query_fill(qc, 0, 127, 1, 64);
1210 case V4L2_CID_HUE: 1212 case V4L2_CID_HUE:
1211 return v4l2_ctrl_query_fill_std(qc); 1213 return v4l2_ctrl_query_fill(qc, -128, 127, 1, 0);
1212 default: 1214 default:
1213 break; 1215 break;
1214 } 1216 }
@@ -1220,10 +1222,11 @@ static int cx25840_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
1220 return v4l2_ctrl_query_fill(qc, 0, 65535, 1222 return v4l2_ctrl_query_fill(qc, 0, 65535,
1221 65535 / 100, state->default_volume); 1223 65535 / 100, state->default_volume);
1222 case V4L2_CID_AUDIO_MUTE: 1224 case V4L2_CID_AUDIO_MUTE:
1225 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
1223 case V4L2_CID_AUDIO_BALANCE: 1226 case V4L2_CID_AUDIO_BALANCE:
1224 case V4L2_CID_AUDIO_BASS: 1227 case V4L2_CID_AUDIO_BASS:
1225 case V4L2_CID_AUDIO_TREBLE: 1228 case V4L2_CID_AUDIO_TREBLE:
1226 return v4l2_ctrl_query_fill_std(qc); 1229 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
1227 default: 1230 default:
1228 return -EINVAL; 1231 return -EINVAL;
1229 } 1232 }
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 4d7a91852117..d972828d1cbe 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -713,22 +713,24 @@ static int msp_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
713 struct msp_state *state = to_state(sd); 713 struct msp_state *state = to_state(sd);
714 714
715 switch (qc->id) { 715 switch (qc->id) {
716 case V4L2_CID_AUDIO_VOLUME: 716 case V4L2_CID_AUDIO_VOLUME:
717 case V4L2_CID_AUDIO_MUTE: 717 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880);
718 return v4l2_ctrl_query_fill_std(qc); 718 case V4L2_CID_AUDIO_MUTE:
719 default: 719 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
720 break; 720 default:
721 break;
721 } 722 }
722 if (!state->has_sound_processing) 723 if (!state->has_sound_processing)
723 return -EINVAL; 724 return -EINVAL;
724 switch (qc->id) { 725 switch (qc->id) {
725 case V4L2_CID_AUDIO_LOUDNESS: 726 case V4L2_CID_AUDIO_LOUDNESS:
726 case V4L2_CID_AUDIO_BALANCE: 727 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
727 case V4L2_CID_AUDIO_BASS: 728 case V4L2_CID_AUDIO_BALANCE:
728 case V4L2_CID_AUDIO_TREBLE: 729 case V4L2_CID_AUDIO_BASS:
729 return v4l2_ctrl_query_fill_std(qc); 730 case V4L2_CID_AUDIO_TREBLE:
730 default: 731 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
731 return -EINVAL; 732 default:
733 return -EINVAL;
732 } 734 }
733 return 0; 735 return 0;
734} 736}
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index dd1943987ce6..a845582ca5d4 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1206,10 +1206,12 @@ static int saa711x_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
1206{ 1206{
1207 switch (qc->id) { 1207 switch (qc->id) {
1208 case V4L2_CID_BRIGHTNESS: 1208 case V4L2_CID_BRIGHTNESS:
1209 return v4l2_ctrl_query_fill(qc, 0, 255, 1, 128);
1209 case V4L2_CID_CONTRAST: 1210 case V4L2_CID_CONTRAST:
1210 case V4L2_CID_SATURATION: 1211 case V4L2_CID_SATURATION:
1212 return v4l2_ctrl_query_fill(qc, 0, 127, 1, 64);
1211 case V4L2_CID_HUE: 1213 case V4L2_CID_HUE:
1212 return v4l2_ctrl_query_fill_std(qc); 1214 return v4l2_ctrl_query_fill(qc, -128, 127, 1, 0);
1213 default: 1215 default:
1214 return -EINVAL; 1216 return -EINVAL;
1215 } 1217 }
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index 2d292ad776e9..dc2213e2f86e 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -592,7 +592,7 @@ static int saa6752hs_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc
592 V4L2_MPEG_VIDEO_ASPECT_4x3); 592 V4L2_MPEG_VIDEO_ASPECT_4x3);
593 593
594 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: 594 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
595 err = v4l2_ctrl_query_fill_std(qctrl); 595 err = v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 8000000);
596 if (err == 0 && 596 if (err == 0 &&
597 params->vi_bitrate_mode == 597 params->vi_bitrate_mode ==
598 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) 598 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR)
@@ -606,12 +606,20 @@ static int saa6752hs_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc
606 V4L2_MPEG_STREAM_TYPE_MPEG2_TS); 606 V4L2_MPEG_STREAM_TYPE_MPEG2_TS);
607 607
608 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: 608 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
609 return v4l2_ctrl_query_fill(qctrl,
610 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
611 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, 1,
612 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
609 case V4L2_CID_MPEG_VIDEO_BITRATE: 613 case V4L2_CID_MPEG_VIDEO_BITRATE:
614 return v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 6000000);
610 case V4L2_CID_MPEG_STREAM_PID_PMT: 615 case V4L2_CID_MPEG_STREAM_PID_PMT:
616 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 16);
611 case V4L2_CID_MPEG_STREAM_PID_AUDIO: 617 case V4L2_CID_MPEG_STREAM_PID_AUDIO:
618 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 260);
612 case V4L2_CID_MPEG_STREAM_PID_VIDEO: 619 case V4L2_CID_MPEG_STREAM_PID_VIDEO:
620 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 256);
613 case V4L2_CID_MPEG_STREAM_PID_PCR: 621 case V4L2_CID_MPEG_STREAM_PID_PCR:
614 return v4l2_ctrl_query_fill_std(qctrl); 622 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 259);
615 623
616 default: 624 default:
617 break; 625 break;
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 2e15bb7c3f0a..c6cfe0fe7e3d 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -390,7 +390,7 @@ static int empress_queryctrl(struct file *file, void *priv,
390 if (c->id == 0) 390 if (c->id == 0)
391 return -EINVAL; 391 return -EINVAL;
392 if (c->id == V4L2_CID_USER_CLASS || c->id == V4L2_CID_MPEG_CLASS) 392 if (c->id == V4L2_CID_USER_CLASS || c->id == V4L2_CID_MPEG_CLASS)
393 return v4l2_ctrl_query_fill_std(c); 393 return v4l2_ctrl_query_fill(c, 0, 0, 0, 0);
394 if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG) 394 if (V4L2_CTRL_ID2CLASS(c->id) != V4L2_CTRL_CLASS_MPEG)
395 return saa7134_queryctrl(file, priv, c); 395 return saa7134_queryctrl(file, priv, c);
396 return saa_call_empress(dev, core, queryctrl, c); 396 return saa_call_empress(dev, core, queryctrl, c);
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index 2090e170bd9c..976ce207cfcb 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -421,12 +421,14 @@ static int tda7432_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
421static int tda7432_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) 421static int tda7432_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
422{ 422{
423 switch (qc->id) { 423 switch (qc->id) {
424 case V4L2_CID_AUDIO_MUTE:
425 case V4L2_CID_AUDIO_VOLUME: 424 case V4L2_CID_AUDIO_VOLUME:
425 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880);
426 case V4L2_CID_AUDIO_MUTE:
427 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
426 case V4L2_CID_AUDIO_BALANCE: 428 case V4L2_CID_AUDIO_BALANCE:
427 case V4L2_CID_AUDIO_BASS: 429 case V4L2_CID_AUDIO_BASS:
428 case V4L2_CID_AUDIO_TREBLE: 430 case V4L2_CID_AUDIO_TREBLE:
429 return v4l2_ctrl_query_fill_std(qc); 431 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
430 } 432 }
431 return -EINVAL; 433 return -EINVAL;
432} 434}
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
index 19fbd18f4882..e71b2bd46612 100644
--- a/drivers/media/video/tda9875.c
+++ b/drivers/media/video/tda9875.c
@@ -313,9 +313,10 @@ static int tda9875_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
313{ 313{
314 switch (qc->id) { 314 switch (qc->id) {
315 case V4L2_CID_AUDIO_VOLUME: 315 case V4L2_CID_AUDIO_VOLUME:
316 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880);
316 case V4L2_CID_AUDIO_BASS: 317 case V4L2_CID_AUDIO_BASS:
317 case V4L2_CID_AUDIO_TREBLE: 318 case V4L2_CID_AUDIO_TREBLE:
318 return v4l2_ctrl_query_fill_std(qc); 319 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
319 } 320 }
320 return -EINVAL; 321 return -EINVAL;
321} 322}
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 076ed5bf48b1..0eb3b1694287 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1636,21 +1636,24 @@ static int tvaudio_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
1636 1636
1637 switch (qc->id) { 1637 switch (qc->id) {
1638 case V4L2_CID_AUDIO_MUTE: 1638 case V4L2_CID_AUDIO_MUTE:
1639 break; 1639 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0);
1640 case V4L2_CID_AUDIO_VOLUME: 1640 case V4L2_CID_AUDIO_VOLUME:
1641 if (desc->flags & CHIP_HAS_VOLUME)
1642 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880);
1643 break;
1641 case V4L2_CID_AUDIO_BALANCE: 1644 case V4L2_CID_AUDIO_BALANCE:
1642 if (!(desc->flags & CHIP_HAS_VOLUME)) 1645 if (desc->flags & CHIP_HAS_VOLUME)
1643 return -EINVAL; 1646 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
1644 break; 1647 break;
1645 case V4L2_CID_AUDIO_BASS: 1648 case V4L2_CID_AUDIO_BASS:
1646 case V4L2_CID_AUDIO_TREBLE: 1649 case V4L2_CID_AUDIO_TREBLE:
1647 if (!(desc->flags & CHIP_HAS_BASSTREBLE)) 1650 if (desc->flags & CHIP_HAS_BASSTREBLE)
1648 return -EINVAL; 1651 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
1649 break; 1652 break;
1650 default: 1653 default:
1651 return -EINVAL; 1654 break;
1652 } 1655 }
1653 return v4l2_ctrl_query_fill_std(qc); 1656 return -EINVAL;
1654} 1657}
1655 1658
1656static int tvaudio_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *rt) 1659static int tvaudio_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *rt)
diff --git a/drivers/media/video/tvp514x.c b/drivers/media/video/tvp514x.c
index f0b2b8ed2fe4..4262e60b8116 100644
--- a/drivers/media/video/tvp514x.c
+++ b/drivers/media/video/tvp514x.c
@@ -725,10 +725,9 @@ ioctl_queryctrl(struct v4l2_int_device *s, struct v4l2_queryctrl *qctrl)
725 725
726 switch (qctrl->id) { 726 switch (qctrl->id) {
727 case V4L2_CID_BRIGHTNESS: 727 case V4L2_CID_BRIGHTNESS:
728 /* Brightness supported is same as standard one (0-255), 728 /* Brightness supported is (0-255),
729 * so make use of standard API provided.
730 */ 729 */
731 err = v4l2_ctrl_query_fill_std(qctrl); 730 err = v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 128);
732 break; 731 break;
733 case V4L2_CID_CONTRAST: 732 case V4L2_CID_CONTRAST:
734 case V4L2_CID_SATURATION: 733 case V4L2_CID_SATURATION:
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index caa7ba0705a5..dbced906aa06 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -588,151 +588,6 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste
588} 588}
589EXPORT_SYMBOL(v4l2_ctrl_query_fill); 589EXPORT_SYMBOL(v4l2_ctrl_query_fill);
590 590
591/* Fill in a struct v4l2_queryctrl with standard values based on
592 the control ID. */
593int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl)
594{
595 switch (qctrl->id) {
596 /* USER controls */
597 case V4L2_CID_USER_CLASS:
598 case V4L2_CID_MPEG_CLASS:
599 case V4L2_CID_CAMERA_CLASS:
600 return v4l2_ctrl_query_fill(qctrl, 0, 0, 0, 0);
601 case V4L2_CID_AUDIO_VOLUME:
602 return v4l2_ctrl_query_fill(qctrl, 0, 65535, 65535 / 100, 58880);
603 case V4L2_CID_AUDIO_MUTE:
604 case V4L2_CID_AUDIO_LOUDNESS:
605 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
606 case V4L2_CID_AUDIO_BALANCE:
607 case V4L2_CID_AUDIO_BASS:
608 case V4L2_CID_AUDIO_TREBLE:
609 return v4l2_ctrl_query_fill(qctrl, 0, 65535, 65535 / 100, 32768);
610 case V4L2_CID_BRIGHTNESS:
611 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 128);
612 case V4L2_CID_CONTRAST:
613 case V4L2_CID_SATURATION:
614 return v4l2_ctrl_query_fill(qctrl, 0, 127, 1, 64);
615 case V4L2_CID_HUE:
616 return v4l2_ctrl_query_fill(qctrl, -128, 127, 1, 0);
617 case V4L2_CID_COLORFX:
618 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
619
620 /* MPEG controls */
621 case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
622 return v4l2_ctrl_query_fill(qctrl,
623 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100,
624 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000, 1,
625 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000);
626 case V4L2_CID_MPEG_AUDIO_ENCODING:
627 return v4l2_ctrl_query_fill(qctrl,
628 V4L2_MPEG_AUDIO_ENCODING_LAYER_1,
629 V4L2_MPEG_AUDIO_ENCODING_AC3, 1,
630 V4L2_MPEG_AUDIO_ENCODING_LAYER_2);
631 case V4L2_CID_MPEG_AUDIO_L1_BITRATE:
632 return v4l2_ctrl_query_fill(qctrl,
633 V4L2_MPEG_AUDIO_L1_BITRATE_32K,
634 V4L2_MPEG_AUDIO_L1_BITRATE_448K, 1,
635 V4L2_MPEG_AUDIO_L1_BITRATE_256K);
636 case V4L2_CID_MPEG_AUDIO_L2_BITRATE:
637 return v4l2_ctrl_query_fill(qctrl,
638 V4L2_MPEG_AUDIO_L2_BITRATE_32K,
639 V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1,
640 V4L2_MPEG_AUDIO_L2_BITRATE_224K);
641 case V4L2_CID_MPEG_AUDIO_L3_BITRATE:
642 return v4l2_ctrl_query_fill(qctrl,
643 V4L2_MPEG_AUDIO_L3_BITRATE_32K,
644 V4L2_MPEG_AUDIO_L3_BITRATE_320K, 1,
645 V4L2_MPEG_AUDIO_L3_BITRATE_192K);
646 case V4L2_CID_MPEG_AUDIO_AAC_BITRATE:
647 return v4l2_ctrl_query_fill(qctrl, 0, 6400, 1, 3200000);
648 case V4L2_CID_MPEG_AUDIO_AC3_BITRATE:
649 return v4l2_ctrl_query_fill(qctrl,
650 V4L2_MPEG_AUDIO_AC3_BITRATE_32K,
651 V4L2_MPEG_AUDIO_AC3_BITRATE_640K, 1,
652 V4L2_MPEG_AUDIO_AC3_BITRATE_384K);
653 case V4L2_CID_MPEG_AUDIO_MODE:
654 return v4l2_ctrl_query_fill(qctrl,
655 V4L2_MPEG_AUDIO_MODE_STEREO,
656 V4L2_MPEG_AUDIO_MODE_MONO, 1,
657 V4L2_MPEG_AUDIO_MODE_STEREO);
658 case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION:
659 return v4l2_ctrl_query_fill(qctrl,
660 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4,
661 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16, 1,
662 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4);
663 case V4L2_CID_MPEG_AUDIO_EMPHASIS:
664 return v4l2_ctrl_query_fill(qctrl,
665 V4L2_MPEG_AUDIO_EMPHASIS_NONE,
666 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17, 1,
667 V4L2_MPEG_AUDIO_EMPHASIS_NONE);
668 case V4L2_CID_MPEG_AUDIO_CRC:
669 return v4l2_ctrl_query_fill(qctrl,
670 V4L2_MPEG_AUDIO_CRC_NONE,
671 V4L2_MPEG_AUDIO_CRC_CRC16, 1,
672 V4L2_MPEG_AUDIO_CRC_NONE);
673 case V4L2_CID_MPEG_AUDIO_MUTE:
674 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
675 case V4L2_CID_MPEG_VIDEO_ENCODING:
676 return v4l2_ctrl_query_fill(qctrl,
677 V4L2_MPEG_VIDEO_ENCODING_MPEG_1,
678 V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 1,
679 V4L2_MPEG_VIDEO_ENCODING_MPEG_2);
680 case V4L2_CID_MPEG_VIDEO_ASPECT:
681 return v4l2_ctrl_query_fill(qctrl,
682 V4L2_MPEG_VIDEO_ASPECT_1x1,
683 V4L2_MPEG_VIDEO_ASPECT_221x100, 1,
684 V4L2_MPEG_VIDEO_ASPECT_4x3);
685 case V4L2_CID_MPEG_VIDEO_B_FRAMES:
686 return v4l2_ctrl_query_fill(qctrl, 0, 33, 1, 2);
687 case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
688 return v4l2_ctrl_query_fill(qctrl, 1, 34, 1, 12);
689 case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE:
690 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 1);
691 case V4L2_CID_MPEG_VIDEO_PULLDOWN:
692 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
693 case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
694 return v4l2_ctrl_query_fill(qctrl,
695 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR,
696 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, 1,
697 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
698 case V4L2_CID_MPEG_VIDEO_BITRATE:
699 return v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 6000000);
700 case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
701 return v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 8000000);
702 case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION:
703 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
704 case V4L2_CID_MPEG_VIDEO_MUTE:
705 return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0);
706 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: /* Init YUV (really YCbCr) to black */
707 return v4l2_ctrl_query_fill(qctrl, 0, 0xffffff, 1, 0x008080);
708 case V4L2_CID_MPEG_STREAM_TYPE:
709 return v4l2_ctrl_query_fill(qctrl,
710 V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
711 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD, 1,
712 V4L2_MPEG_STREAM_TYPE_MPEG2_PS);
713 case V4L2_CID_MPEG_STREAM_PID_PMT:
714 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 16);
715 case V4L2_CID_MPEG_STREAM_PID_AUDIO:
716 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 260);
717 case V4L2_CID_MPEG_STREAM_PID_VIDEO:
718 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 256);
719 case V4L2_CID_MPEG_STREAM_PID_PCR:
720 return v4l2_ctrl_query_fill(qctrl, 0, (1 << 14) - 1, 1, 259);
721 case V4L2_CID_MPEG_STREAM_PES_ID_AUDIO:
722 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
723 case V4L2_CID_MPEG_STREAM_PES_ID_VIDEO:
724 return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0);
725 case V4L2_CID_MPEG_STREAM_VBI_FMT:
726 return v4l2_ctrl_query_fill(qctrl,
727 V4L2_MPEG_STREAM_VBI_FMT_NONE,
728 V4L2_MPEG_STREAM_VBI_FMT_IVTV, 1,
729 V4L2_MPEG_STREAM_VBI_FMT_NONE);
730 default:
731 return -EINVAL;
732 }
733}
734EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
735
736/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and 591/* Fill in a struct v4l2_querymenu based on the struct v4l2_queryctrl and
737 the menu. The qctrl pointer may be NULL, in which case it is ignored. 592 the menu. The qctrl pointer may be NULL, in which case it is ignored.
738 If menu_items is NULL, then the menu items are retrieved using 593 If menu_items is NULL, then the menu items are retrieved using