[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>
This commit is contained in:
parent
3108e02611
commit
7ed5de9751
@ -723,70 +723,71 @@ preview_config_yc_range(struct isp_prev_device *prev, const void *yclimit)
|
|||||||
|
|
||||||
/* preview parameters update structure */
|
/* preview parameters update structure */
|
||||||
struct preview_update {
|
struct preview_update {
|
||||||
int feature_bit;
|
|
||||||
void (*config)(struct isp_prev_device *, const void *);
|
void (*config)(struct isp_prev_device *, const void *);
|
||||||
void (*enable)(struct isp_prev_device *, u8);
|
void (*enable)(struct isp_prev_device *, u8);
|
||||||
bool skip;
|
bool skip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Keep the array indexed by the OMAP3ISP_PREV_* bit number. */
|
||||||
static struct preview_update update_attrs[] = {
|
static struct preview_update update_attrs[] = {
|
||||||
{OMAP3ISP_PREV_LUMAENH,
|
/* OMAP3ISP_PREV_LUMAENH */ {
|
||||||
preview_config_luma_enhancement,
|
preview_config_luma_enhancement,
|
||||||
preview_enable_luma_enhancement},
|
preview_enable_luma_enhancement,
|
||||||
{OMAP3ISP_PREV_INVALAW,
|
}, /* OMAP3ISP_PREV_INVALAW */ {
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_invalaw},
|
preview_enable_invalaw,
|
||||||
{OMAP3ISP_PREV_HRZ_MED,
|
}, /* OMAP3ISP_PREV_HRZ_MED */ {
|
||||||
preview_config_hmed,
|
preview_config_hmed,
|
||||||
preview_enable_hmed},
|
preview_enable_hmed,
|
||||||
{OMAP3ISP_PREV_CFA,
|
}, /* OMAP3ISP_PREV_CFA */ {
|
||||||
preview_config_cfa,
|
preview_config_cfa,
|
||||||
preview_enable_cfa},
|
preview_enable_cfa,
|
||||||
{OMAP3ISP_PREV_CHROMA_SUPP,
|
}, /* OMAP3ISP_PREV_CHROMA_SUPP */ {
|
||||||
preview_config_chroma_suppression,
|
preview_config_chroma_suppression,
|
||||||
preview_enable_chroma_suppression},
|
preview_enable_chroma_suppression,
|
||||||
{OMAP3ISP_PREV_WB,
|
}, /* OMAP3ISP_PREV_WB */ {
|
||||||
preview_config_whitebalance,
|
preview_config_whitebalance,
|
||||||
NULL},
|
NULL,
|
||||||
{OMAP3ISP_PREV_BLKADJ,
|
}, /* OMAP3ISP_PREV_BLKADJ */ {
|
||||||
preview_config_blkadj,
|
preview_config_blkadj,
|
||||||
NULL},
|
NULL,
|
||||||
{OMAP3ISP_PREV_RGB2RGB,
|
}, /* OMAP3ISP_PREV_RGB2RGB */ {
|
||||||
preview_config_rgb_blending,
|
preview_config_rgb_blending,
|
||||||
NULL},
|
NULL,
|
||||||
{OMAP3ISP_PREV_COLOR_CONV,
|
}, /* OMAP3ISP_PREV_COLOR_CONV */ {
|
||||||
preview_config_rgb_to_ycbcr,
|
preview_config_rgb_to_ycbcr,
|
||||||
NULL},
|
NULL,
|
||||||
{OMAP3ISP_PREV_YC_LIMIT,
|
}, /* OMAP3ISP_PREV_YC_LIMIT */ {
|
||||||
preview_config_yc_range,
|
preview_config_yc_range,
|
||||||
NULL},
|
NULL,
|
||||||
{OMAP3ISP_PREV_DEFECT_COR,
|
}, /* OMAP3ISP_PREV_DEFECT_COR */ {
|
||||||
preview_config_dcor,
|
preview_config_dcor,
|
||||||
preview_enable_dcor},
|
preview_enable_dcor,
|
||||||
{OMAP3ISP_PREV_GAMMABYPASS,
|
}, /* OMAP3ISP_PREV_GAMMABYPASS */ {
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_gammabypass},
|
preview_enable_gammabypass,
|
||||||
{OMAP3ISP_PREV_DRK_FRM_CAPTURE,
|
}, /* OMAP3ISP_PREV_DRK_FRM_CAPTURE */ {
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_drkframe_capture},
|
preview_enable_drkframe_capture,
|
||||||
{OMAP3ISP_PREV_DRK_FRM_SUBTRACT,
|
}, /* OMAP3ISP_PREV_DRK_FRM_SUBTRACT */ {
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_drkframe},
|
preview_enable_drkframe,
|
||||||
{OMAP3ISP_PREV_LENS_SHADING,
|
}, /* OMAP3ISP_PREV_LENS_SHADING */ {
|
||||||
preview_config_drkf_shadcomp,
|
preview_config_drkf_shadcomp,
|
||||||
preview_enable_drkframe},
|
preview_enable_drkframe,
|
||||||
{OMAP3ISP_PREV_NF,
|
}, /* OMAP3ISP_PREV_NF */ {
|
||||||
preview_config_noisefilter,
|
preview_config_noisefilter,
|
||||||
preview_enable_noisefilter},
|
preview_enable_noisefilter,
|
||||||
{OMAP3ISP_PREV_GAMMA,
|
}, /* OMAP3ISP_PREV_GAMMA */ {
|
||||||
preview_config_gammacorrn,
|
preview_config_gammacorrn,
|
||||||
NULL},
|
NULL,
|
||||||
{OMAP3ISP_PREV_CONTRAST,
|
}, /* OMAP3ISP_PREV_CONTRAST */ {
|
||||||
preview_config_contrast,
|
preview_config_contrast,
|
||||||
NULL, true},
|
NULL, true,
|
||||||
{OMAP3ISP_PREV_BRIGHTNESS,
|
}, /* OMAP3ISP_PREV_BRIGHTNESS */ {
|
||||||
preview_config_brightness,
|
preview_config_brightness,
|
||||||
NULL, true},
|
NULL, true,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -904,30 +905,28 @@ static int preview_config(struct isp_prev_device *prev,
|
|||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(update_attrs); i++) {
|
for (i = 0; i < ARRAY_SIZE(update_attrs); i++) {
|
||||||
attr = &update_attrs[i];
|
attr = &update_attrs[i];
|
||||||
bit = 0;
|
bit = 1 << i;
|
||||||
|
|
||||||
if (attr->skip || !(cfg->update & attr->feature_bit))
|
if (attr->skip || !(cfg->update & bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bit = cfg->flag & attr->feature_bit;
|
if (cfg->flag & bit) {
|
||||||
if (bit) {
|
|
||||||
void *to = NULL, __user *from = NULL;
|
void *to = NULL, __user *from = NULL;
|
||||||
unsigned long sz = 0;
|
unsigned long sz = 0;
|
||||||
|
|
||||||
sz = __preview_get_ptrs(params, &to, cfg, &from,
|
sz = __preview_get_ptrs(params, &to, cfg, &from, bit);
|
||||||
bit);
|
|
||||||
if (to && from && sz) {
|
if (to && from && sz) {
|
||||||
if (copy_from_user(to, from, sz)) {
|
if (copy_from_user(to, from, sz)) {
|
||||||
rval = -EFAULT;
|
rval = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params->features |= attr->feature_bit;
|
params->features |= bit;
|
||||||
} else {
|
} else {
|
||||||
params->features &= ~attr->feature_bit;
|
params->features &= ~bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev->update |= attr->feature_bit;
|
prev->update |= bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev->shadow_update = 0;
|
prev->shadow_update = 0;
|
||||||
@ -944,7 +943,8 @@ static void preview_setup_hw(struct isp_prev_device *prev)
|
|||||||
{
|
{
|
||||||
struct prev_params *params = &prev->params;
|
struct prev_params *params = &prev->params;
|
||||||
struct preview_update *attr;
|
struct preview_update *attr;
|
||||||
int i, bit;
|
unsigned int bit;
|
||||||
|
unsigned int i;
|
||||||
void *param_ptr;
|
void *param_ptr;
|
||||||
|
|
||||||
if (prev->update == 0)
|
if (prev->update == 0)
|
||||||
@ -952,11 +952,12 @@ static void preview_setup_hw(struct isp_prev_device *prev)
|
|||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(update_attrs); i++) {
|
for (i = 0; i < ARRAY_SIZE(update_attrs); i++) {
|
||||||
attr = &update_attrs[i];
|
attr = &update_attrs[i];
|
||||||
|
bit = 1 << i;
|
||||||
|
|
||||||
if (!(prev->update & attr->feature_bit))
|
if (!(prev->update & bit))
|
||||||
continue;
|
continue;
|
||||||
bit = params->features & attr->feature_bit;
|
|
||||||
if (bit) {
|
if (params->features & bit) {
|
||||||
if (attr->config) {
|
if (attr->config) {
|
||||||
__preview_get_ptrs(params, ¶m_ptr, NULL,
|
__preview_get_ptrs(params, ¶m_ptr, NULL,
|
||||||
NULL, bit);
|
NULL, bit);
|
||||||
@ -968,7 +969,7 @@ static void preview_setup_hw(struct isp_prev_device *prev)
|
|||||||
if (attr->enable)
|
if (attr->enable)
|
||||||
attr->enable(prev, 0);
|
attr->enable(prev, 0);
|
||||||
|
|
||||||
prev->update &= ~attr->feature_bit;
|
prev->update &= ~bit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user