diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-06-18 13:49:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 01:05:22 -0400 |
commit | 18318e00040e0a5c783f6d79c136c2141b779dbd (patch) | |
tree | 17939de5ef7387dfd80a288ed4221ba1eeb1d31a | |
parent | 5d1a9ae6d9d7fc14b2259cd550eb87364a21190a (diff) |
V4L/DVB (4192): Use control helpers for saa7115, cx25840, msp3400.
Replace hardcoded control description by the standard ones supplied
by v4l2-common.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 119 | ||||
-rw-r--r-- | drivers/media/video/msp3400-driver.c | 89 | ||||
-rw-r--r-- | drivers/media/video/saa7115.c | 58 |
3 files changed, 44 insertions, 222 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index cb9e8625708d..5c2036b40ea1 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -617,95 +617,6 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) | |||
617 | 617 | ||
618 | /* ----------------------------------------------------------------------- */ | 618 | /* ----------------------------------------------------------------------- */ |
619 | 619 | ||
620 | static struct v4l2_queryctrl cx25836_qctrl[] = { | ||
621 | { | ||
622 | .id = V4L2_CID_BRIGHTNESS, | ||
623 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
624 | .name = "Brightness", | ||
625 | .minimum = 0, | ||
626 | .maximum = 255, | ||
627 | .step = 1, | ||
628 | .default_value = 128, | ||
629 | .flags = 0, | ||
630 | }, { | ||
631 | .id = V4L2_CID_CONTRAST, | ||
632 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
633 | .name = "Contrast", | ||
634 | .minimum = 0, | ||
635 | .maximum = 127, | ||
636 | .step = 1, | ||
637 | .default_value = 64, | ||
638 | .flags = 0, | ||
639 | }, { | ||
640 | .id = V4L2_CID_SATURATION, | ||
641 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
642 | .name = "Saturation", | ||
643 | .minimum = 0, | ||
644 | .maximum = 127, | ||
645 | .step = 1, | ||
646 | .default_value = 64, | ||
647 | .flags = 0, | ||
648 | }, { | ||
649 | .id = V4L2_CID_HUE, | ||
650 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
651 | .name = "Hue", | ||
652 | .minimum = -128, | ||
653 | .maximum = 127, | ||
654 | .step = 1, | ||
655 | .default_value = 0, | ||
656 | .flags = 0, | ||
657 | }, | ||
658 | }; | ||
659 | |||
660 | static struct v4l2_queryctrl cx25840_qctrl[] = { | ||
661 | { | ||
662 | .id = V4L2_CID_AUDIO_VOLUME, | ||
663 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
664 | .name = "Volume", | ||
665 | .minimum = 0, | ||
666 | .maximum = 65535, | ||
667 | .step = 65535/100, | ||
668 | .default_value = 58880, | ||
669 | .flags = 0, | ||
670 | }, { | ||
671 | .id = V4L2_CID_AUDIO_BALANCE, | ||
672 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
673 | .name = "Balance", | ||
674 | .minimum = 0, | ||
675 | .maximum = 65535, | ||
676 | .step = 65535/100, | ||
677 | .default_value = 32768, | ||
678 | .flags = 0, | ||
679 | }, { | ||
680 | .id = V4L2_CID_AUDIO_MUTE, | ||
681 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
682 | .name = "Mute", | ||
683 | .minimum = 0, | ||
684 | .maximum = 1, | ||
685 | .step = 1, | ||
686 | .default_value = 1, | ||
687 | .flags = 0, | ||
688 | }, { | ||
689 | .id = V4L2_CID_AUDIO_BASS, | ||
690 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
691 | .name = "Bass", | ||
692 | .minimum = 0, | ||
693 | .maximum = 65535, | ||
694 | .step = 65535/100, | ||
695 | .default_value = 32768, | ||
696 | }, { | ||
697 | .id = V4L2_CID_AUDIO_TREBLE, | ||
698 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
699 | .name = "Treble", | ||
700 | .minimum = 0, | ||
701 | .maximum = 65535, | ||
702 | .step = 65535/100, | ||
703 | .default_value = 32768, | ||
704 | }, | ||
705 | }; | ||
706 | |||
707 | /* ----------------------------------------------------------------------- */ | ||
708 | |||
709 | static int cx25840_command(struct i2c_client *client, unsigned int cmd, | 620 | static int cx25840_command(struct i2c_client *client, unsigned int cmd, |
710 | void *arg) | 621 | void *arg) |
711 | { | 622 | { |
@@ -773,21 +684,29 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
773 | case VIDIOC_QUERYCTRL: | 684 | case VIDIOC_QUERYCTRL: |
774 | { | 685 | { |
775 | struct v4l2_queryctrl *qc = arg; | 686 | struct v4l2_queryctrl *qc = arg; |
776 | int i; | ||
777 | 687 | ||
778 | for (i = 0; i < ARRAY_SIZE(cx25836_qctrl); i++) | 688 | switch (qc->id) { |
779 | if (qc->id && qc->id == cx25836_qctrl[i].id) { | 689 | case V4L2_CID_BRIGHTNESS: |
780 | memcpy(qc, &cx25836_qctrl[i], sizeof(*qc)); | 690 | case V4L2_CID_CONTRAST: |
781 | return 0; | 691 | case V4L2_CID_SATURATION: |
782 | } | 692 | case V4L2_CID_HUE: |
693 | return v4l2_ctrl_query_fill_std(qc); | ||
694 | default: | ||
695 | break; | ||
696 | } | ||
783 | if (state->is_cx25836) | 697 | if (state->is_cx25836) |
784 | return -EINVAL; | 698 | return -EINVAL; |
785 | 699 | ||
786 | for (i = 0; i < ARRAY_SIZE(cx25840_qctrl); i++) | 700 | switch (qc->id) { |
787 | if (qc->id && qc->id == cx25840_qctrl[i].id) { | 701 | case V4L2_CID_AUDIO_VOLUME: |
788 | memcpy(qc, &cx25840_qctrl[i], sizeof(*qc)); | 702 | case V4L2_CID_AUDIO_MUTE: |
789 | return 0; | 703 | case V4L2_CID_AUDIO_BALANCE: |
790 | } | 704 | case V4L2_CID_AUDIO_BASS: |
705 | case V4L2_CID_AUDIO_TREBLE: | ||
706 | return v4l2_ctrl_query_fill_std(qc); | ||
707 | default: | ||
708 | return -EINVAL; | ||
709 | } | ||
791 | return -EINVAL; | 710 | return -EINVAL; |
792 | } | 711 | } |
793 | 712 | ||
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 5e55f71572f3..dbb75a7db199 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -385,67 +385,6 @@ static int msp_mode_v4l1_to_v4l2(int mode) | |||
385 | return V4L2_TUNER_MODE_MONO; | 385 | return V4L2_TUNER_MODE_MONO; |
386 | } | 386 | } |
387 | 387 | ||
388 | static struct v4l2_queryctrl msp_qctrl_std[] = { | ||
389 | { | ||
390 | .id = V4L2_CID_AUDIO_VOLUME, | ||
391 | .name = "Volume", | ||
392 | .minimum = 0, | ||
393 | .maximum = 65535, | ||
394 | .step = 65535/100, | ||
395 | .default_value = 58880, | ||
396 | .flags = 0, | ||
397 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
398 | },{ | ||
399 | .id = V4L2_CID_AUDIO_MUTE, | ||
400 | .name = "Mute", | ||
401 | .minimum = 0, | ||
402 | .maximum = 1, | ||
403 | .step = 1, | ||
404 | .default_value = 1, | ||
405 | .flags = 0, | ||
406 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
407 | }, | ||
408 | }; | ||
409 | |||
410 | static struct v4l2_queryctrl msp_qctrl_sound_processing[] = { | ||
411 | { | ||
412 | .id = V4L2_CID_AUDIO_BALANCE, | ||
413 | .name = "Balance", | ||
414 | .minimum = 0, | ||
415 | .maximum = 65535, | ||
416 | .step = 65535/100, | ||
417 | .default_value = 32768, | ||
418 | .flags = 0, | ||
419 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
420 | },{ | ||
421 | .id = V4L2_CID_AUDIO_BASS, | ||
422 | .name = "Bass", | ||
423 | .minimum = 0, | ||
424 | .maximum = 65535, | ||
425 | .step = 65535/100, | ||
426 | .default_value = 32768, | ||
427 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
428 | },{ | ||
429 | .id = V4L2_CID_AUDIO_TREBLE, | ||
430 | .name = "Treble", | ||
431 | .minimum = 0, | ||
432 | .maximum = 65535, | ||
433 | .step = 65535/100, | ||
434 | .default_value = 32768, | ||
435 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
436 | },{ | ||
437 | .id = V4L2_CID_AUDIO_LOUDNESS, | ||
438 | .name = "Loudness", | ||
439 | .minimum = 0, | ||
440 | .maximum = 1, | ||
441 | .step = 1, | ||
442 | .default_value = 1, | ||
443 | .flags = 0, | ||
444 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
445 | }, | ||
446 | }; | ||
447 | |||
448 | |||
449 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | 388 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) |
450 | { | 389 | { |
451 | struct msp_state *state = i2c_get_clientdata(client); | 390 | struct msp_state *state = i2c_get_clientdata(client); |
@@ -753,21 +692,25 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
753 | case VIDIOC_QUERYCTRL: | 692 | case VIDIOC_QUERYCTRL: |
754 | { | 693 | { |
755 | struct v4l2_queryctrl *qc = arg; | 694 | struct v4l2_queryctrl *qc = arg; |
756 | int i; | ||
757 | 695 | ||
758 | for (i = 0; i < ARRAY_SIZE(msp_qctrl_std); i++) | 696 | switch (qc->id) { |
759 | if (qc->id && qc->id == msp_qctrl_std[i].id) { | 697 | case V4L2_CID_AUDIO_VOLUME: |
760 | memcpy(qc, &msp_qctrl_std[i], sizeof(*qc)); | 698 | case V4L2_CID_AUDIO_MUTE: |
761 | return 0; | 699 | return v4l2_ctrl_query_fill_std(qc); |
762 | } | 700 | default: |
701 | break; | ||
702 | } | ||
763 | if (!state->has_sound_processing) | 703 | if (!state->has_sound_processing) |
764 | return -EINVAL; | 704 | return -EINVAL; |
765 | for (i = 0; i < ARRAY_SIZE(msp_qctrl_sound_processing); i++) | 705 | switch (qc->id) { |
766 | if (qc->id && qc->id == msp_qctrl_sound_processing[i].id) { | 706 | case V4L2_CID_AUDIO_LOUDNESS: |
767 | memcpy(qc, &msp_qctrl_sound_processing[i], sizeof(*qc)); | 707 | case V4L2_CID_AUDIO_BALANCE: |
768 | return 0; | 708 | case V4L2_CID_AUDIO_BASS: |
769 | } | 709 | case V4L2_CID_AUDIO_TREBLE: |
770 | return -EINVAL; | 710 | return v4l2_ctrl_query_fill_std(qc); |
711 | default: | ||
712 | return -EINVAL; | ||
713 | } | ||
771 | } | 714 | } |
772 | 715 | ||
773 | case VIDIOC_G_CTRL: | 716 | case VIDIOC_G_CTRL: |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index f4843bb45347..b59c11717273 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1090,48 +1090,6 @@ static void saa7115_decode_vbi_line(struct i2c_client *client, | |||
1090 | 1090 | ||
1091 | /* ============ SAA7115 AUDIO settings (end) ============= */ | 1091 | /* ============ SAA7115 AUDIO settings (end) ============= */ |
1092 | 1092 | ||
1093 | static struct v4l2_queryctrl saa7115_qctrl[] = { | ||
1094 | { | ||
1095 | .id = V4L2_CID_BRIGHTNESS, | ||
1096 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
1097 | .name = "Brightness", | ||
1098 | .minimum = 0, | ||
1099 | .maximum = 255, | ||
1100 | .step = 1, | ||
1101 | .default_value = 128, | ||
1102 | .flags = 0, | ||
1103 | }, { | ||
1104 | .id = V4L2_CID_CONTRAST, | ||
1105 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
1106 | .name = "Contrast", | ||
1107 | .minimum = 0, | ||
1108 | .maximum = 127, | ||
1109 | .step = 1, | ||
1110 | .default_value = 64, | ||
1111 | .flags = 0, | ||
1112 | }, { | ||
1113 | .id = V4L2_CID_SATURATION, | ||
1114 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
1115 | .name = "Saturation", | ||
1116 | .minimum = 0, | ||
1117 | .maximum = 127, | ||
1118 | .step = 1, | ||
1119 | .default_value = 64, | ||
1120 | .flags = 0, | ||
1121 | }, { | ||
1122 | .id = V4L2_CID_HUE, | ||
1123 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
1124 | .name = "Hue", | ||
1125 | .minimum = -128, | ||
1126 | .maximum = 127, | ||
1127 | .step = 1, | ||
1128 | .default_value = 0, | ||
1129 | .flags = 0, | ||
1130 | }, | ||
1131 | }; | ||
1132 | |||
1133 | /* ----------------------------------------------------------------------- */ | ||
1134 | |||
1135 | static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *arg) | 1093 | static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *arg) |
1136 | { | 1094 | { |
1137 | struct saa7115_state *state = i2c_get_clientdata(client); | 1095 | struct saa7115_state *state = i2c_get_clientdata(client); |
@@ -1175,14 +1133,16 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1175 | case VIDIOC_QUERYCTRL: | 1133 | case VIDIOC_QUERYCTRL: |
1176 | { | 1134 | { |
1177 | struct v4l2_queryctrl *qc = arg; | 1135 | struct v4l2_queryctrl *qc = arg; |
1178 | int i; | ||
1179 | 1136 | ||
1180 | for (i = 0; i < ARRAY_SIZE(saa7115_qctrl); i++) | 1137 | switch (qc->id) { |
1181 | if (qc->id && qc->id == saa7115_qctrl[i].id) { | 1138 | case V4L2_CID_BRIGHTNESS: |
1182 | memcpy(qc, &saa7115_qctrl[i], sizeof(*qc)); | 1139 | case V4L2_CID_CONTRAST: |
1183 | return 0; | 1140 | case V4L2_CID_SATURATION: |
1184 | } | 1141 | case V4L2_CID_HUE: |
1185 | return -EINVAL; | 1142 | return v4l2_ctrl_query_fill_std(qc); |
1143 | default: | ||
1144 | return -EINVAL; | ||
1145 | } | ||
1186 | } | 1146 | } |
1187 | 1147 | ||
1188 | case VIDIOC_G_STD: | 1148 | case VIDIOC_G_STD: |