aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-04-05 12:51:17 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-08 12:58:53 -0400
commit7ed5de97511a3443d543cf569fb70bea11563ff0 (patch)
tree10fcb8dca1f0b6719ef3e716548351470fa518f2
parent3108e0261111412e9c459124bc07b34fc0d28f32 (diff)
[media] omap3isp: preview: Remove update_attrs feature_bit field
The feature_bit is always equal to 1 << array position, remove it and compute the value dynamically. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/omap3isp/isppreview.c107
1 files changed, 54 insertions, 53 deletions
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c
index a4009077e444..755006b946cb 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -723,70 +723,71 @@ preview_config_yc_range(struct isp_prev_device *prev, const void *yclimit)
723 723
724/* preview parameters update structure */ 724/* preview parameters update structure */
725struct preview_update { 725struct preview_update {
726 int feature_bit;
727 void (*config)(struct isp_prev_device *, const void *); 726 void (*config)(struct isp_prev_device *, const void *);
728 void (*enable)(struct isp_prev_device *, u8); 727 void (*enable)(struct isp_prev_device *, u8);
729 bool skip; 728 bool skip;
730}; 729};
731 730
731/* Keep the array indexed by the OMAP3ISP_PREV_* bit number. */
732static struct preview_update update_attrs[] = { 732static struct preview_update update_attrs[] = {
733 {OMAP3ISP_PREV_LUMAENH, 733 /* OMAP3ISP_PREV_LUMAENH */ {
734 preview_config_luma_enhancement, 734 preview_config_luma_enhancement,
735 preview_enable_luma_enhancement}, 735 preview_enable_luma_enhancement,
736 {OMAP3ISP_PREV_INVALAW, 736 }, /* OMAP3ISP_PREV_INVALAW */ {
737 NULL, 737 NULL,
738 preview_enable_invalaw}, 738 preview_enable_invalaw,
739 {OMAP3ISP_PREV_HRZ_MED, 739 }, /* OMAP3ISP_PREV_HRZ_MED */ {
740 preview_config_hmed, 740 preview_config_hmed,
741 preview_enable_hmed}, 741 preview_enable_hmed,
742 {OMAP3ISP_PREV_CFA, 742 }, /* OMAP3ISP_PREV_CFA */ {
743 preview_config_cfa, 743 preview_config_cfa,
744 preview_enable_cfa}, 744 preview_enable_cfa,
745 {OMAP3ISP_PREV_CHROMA_SUPP, 745 }, /* OMAP3ISP_PREV_CHROMA_SUPP */ {
746 preview_config_chroma_suppression, 746 preview_config_chroma_suppression,
747 preview_enable_chroma_suppression}, 747 preview_enable_chroma_suppression,
748 {OMAP3ISP_PREV_WB, 748 }, /* OMAP3ISP_PREV_WB */ {
749 preview_config_whitebalance, 749 preview_config_whitebalance,
750 NULL}, 750 NULL,
751 {OMAP3ISP_PREV_BLKADJ, 751 }, /* OMAP3ISP_PREV_BLKADJ */ {
752 preview_config_blkadj, 752 preview_config_blkadj,
753 NULL}, 753 NULL,
754 {OMAP3ISP_PREV_RGB2RGB, 754 }, /* OMAP3ISP_PREV_RGB2RGB */ {
755 preview_config_rgb_blending, 755 preview_config_rgb_blending,
756 NULL}, 756 NULL,
757 {OMAP3ISP_PREV_COLOR_CONV, 757 }, /* OMAP3ISP_PREV_COLOR_CONV */ {
758 preview_config_rgb_to_ycbcr, 758 preview_config_rgb_to_ycbcr,
759 NULL}, 759 NULL,
760 {OMAP3ISP_PREV_YC_LIMIT, 760 }, /* OMAP3ISP_PREV_YC_LIMIT */ {
761 preview_config_yc_range, 761 preview_config_yc_range,
762 NULL}, 762 NULL,
763 {OMAP3ISP_PREV_DEFECT_COR, 763 }, /* OMAP3ISP_PREV_DEFECT_COR */ {
764 preview_config_dcor, 764 preview_config_dcor,
765 preview_enable_dcor}, 765 preview_enable_dcor,
766 {OMAP3ISP_PREV_GAMMABYPASS, 766 }, /* OMAP3ISP_PREV_GAMMABYPASS */ {
767 NULL, 767 NULL,
768 preview_enable_gammabypass}, 768 preview_enable_gammabypass,
769 {OMAP3ISP_PREV_DRK_FRM_CAPTURE, 769 }, /* OMAP3ISP_PREV_DRK_FRM_CAPTURE */ {
770 NULL, 770 NULL,
771 preview_enable_drkframe_capture}, 771 preview_enable_drkframe_capture,
772 {OMAP3ISP_PREV_DRK_FRM_SUBTRACT, 772 }, /* OMAP3ISP_PREV_DRK_FRM_SUBTRACT */ {
773 NULL, 773 NULL,
774 preview_enable_drkframe}, 774 preview_enable_drkframe,
775 {OMAP3ISP_PREV_LENS_SHADING, 775 }, /* OMAP3ISP_PREV_LENS_SHADING */ {
776 preview_config_drkf_shadcomp, 776 preview_config_drkf_shadcomp,
777 preview_enable_drkframe}, 777 preview_enable_drkframe,
778 {OMAP3ISP_PREV_NF, 778 }, /* OMAP3ISP_PREV_NF */ {
779 preview_config_noisefilter, 779 preview_config_noisefilter,
780 preview_enable_noisefilter}, 780 preview_enable_noisefilter,
781 {OMAP3ISP_PREV_GAMMA, 781 }, /* OMAP3ISP_PREV_GAMMA */ {
782 preview_config_gammacorrn, 782 preview_config_gammacorrn,
783 NULL}, 783 NULL,
784 {OMAP3ISP_PREV_CONTRAST, 784 }, /* OMAP3ISP_PREV_CONTRAST */ {
785 preview_config_contrast, 785 preview_config_contrast,
786 NULL, true}, 786 NULL, true,
787 {OMAP3ISP_PREV_BRIGHTNESS, 787 }, /* OMAP3ISP_PREV_BRIGHTNESS */ {
788 preview_config_brightness, 788 preview_config_brightness,
789 NULL, true}, 789 NULL, true,
790 },
790}; 791};
791 792
792/* 793/*
@@ -904,30 +905,28 @@ static int preview_config(struct isp_prev_device *prev,
904 905
905 for (i = 0; i < ARRAY_SIZE(update_attrs); i++) { 906 for (i = 0; i < ARRAY_SIZE(update_attrs); i++) {
906 attr = &update_attrs[i]; 907 attr = &update_attrs[i];
907 bit = 0; 908 bit = 1 << i;
908 909
909 if (attr->skip || !(cfg->update & attr->feature_bit)) 910 if (attr->skip || !(cfg->update & bit))
910 continue; 911 continue;
911 912
912 bit = cfg->flag & attr->feature_bit; 913 if (cfg->flag & bit) {
913 if (bit) {
914 void *to = NULL, __user *from = NULL; 914 void *to = NULL, __user *from = NULL;
915 unsigned long sz = 0; 915 unsigned long sz = 0;
916 916
917 sz = __preview_get_ptrs(params, &to, cfg, &from, 917 sz = __preview_get_ptrs(params, &to, cfg, &from, bit);
918 bit);
919 if (to && from && sz) { 918 if (to && from && sz) {
920 if (copy_from_user(to, from, sz)) { 919 if (copy_from_user(to, from, sz)) {
921 rval = -EFAULT; 920 rval = -EFAULT;
922 break; 921 break;
923 } 922 }
924 } 923 }
925 params->features |= attr->feature_bit; 924 params->features |= bit;
926 } else { 925 } else {
927 params->features &= ~attr->feature_bit; 926 params->features &= ~bit;
928 } 927 }
929 928
930 prev->update |= attr->feature_bit; 929 prev->update |= bit;
931 } 930 }
932 931
933 prev->shadow_update = 0; 932 prev->shadow_update = 0;
@@ -944,7 +943,8 @@ static void preview_setup_hw(struct isp_prev_device *prev)
944{ 943{
945 struct prev_params *params = &prev->params; 944 struct prev_params *params = &prev->params;
946 struct preview_update *attr; 945 struct preview_update *attr;
947 int i, bit; 946 unsigned int bit;
947 unsigned int i;
948 void *param_ptr; 948 void *param_ptr;
949 949
950 if (prev->update == 0) 950 if (prev->update == 0)
@@ -952,11 +952,12 @@ static void preview_setup_hw(struct isp_prev_device *prev)
952 952
953 for (i = 0; i < ARRAY_SIZE(update_attrs); i++) { 953 for (i = 0; i < ARRAY_SIZE(update_attrs); i++) {
954 attr = &update_attrs[i]; 954 attr = &update_attrs[i];
955 bit = 1 << i;
955 956
956 if (!(prev->update & attr->feature_bit)) 957 if (!(prev->update & bit))
957 continue; 958 continue;
958 bit = params->features & attr->feature_bit; 959
959 if (bit) { 960 if (params->features & bit) {
960 if (attr->config) { 961 if (attr->config) {
961 __preview_get_ptrs(params, &param_ptr, NULL, 962 __preview_get_ptrs(params, &param_ptr, NULL,
962 NULL, bit); 963 NULL, bit);
@@ -968,7 +969,7 @@ static void preview_setup_hw(struct isp_prev_device *prev)
968 if (attr->enable) 969 if (attr->enable)
969 attr->enable(prev, 0); 970 attr->enable(prev, 0);
970 971
971 prev->update &= ~attr->feature_bit; 972 prev->update &= ~bit;
972 } 973 }
973} 974}
974 975