[media] omap3isp: preview: Merge configuration and feature bits
The preview engine parameters are referenced by a value suitable for being used in a bitmask. Two macros named OMAP3ISP_PREV_* and PREV_* are declared for each parameter and are used interchangeably. Remove the private macro. Replace the configuration bit field in the parameter update attributes structure with a boolean that indicates whether the parameter can be updated through the preview engine configuration ioctl. 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
9c3444c1b2
commit
3108e02611
|
@ -653,7 +653,7 @@ preview_update_contrast(struct isp_prev_device *prev, u8 contrast)
|
||||||
|
|
||||||
if (params->contrast != (contrast * ISPPRV_CONTRAST_UNITS)) {
|
if (params->contrast != (contrast * ISPPRV_CONTRAST_UNITS)) {
|
||||||
params->contrast = contrast * ISPPRV_CONTRAST_UNITS;
|
params->contrast = contrast * ISPPRV_CONTRAST_UNITS;
|
||||||
prev->update |= PREV_CONTRAST;
|
prev->update |= OMAP3ISP_PREV_CONTRAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,7 +685,7 @@ preview_update_brightness(struct isp_prev_device *prev, u8 brightness)
|
||||||
|
|
||||||
if (params->brightness != (brightness * ISPPRV_BRIGHT_UNITS)) {
|
if (params->brightness != (brightness * ISPPRV_BRIGHT_UNITS)) {
|
||||||
params->brightness = brightness * ISPPRV_BRIGHT_UNITS;
|
params->brightness = brightness * ISPPRV_BRIGHT_UNITS;
|
||||||
prev->update |= PREV_BRIGHTNESS;
|
prev->update |= OMAP3ISP_PREV_BRIGHTNESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,70 +723,70 @@ 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 cfg_bit;
|
|
||||||
int feature_bit;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct preview_update update_attrs[] = {
|
static struct preview_update update_attrs[] = {
|
||||||
{OMAP3ISP_PREV_LUMAENH, PREV_LUMA_ENHANCE,
|
{OMAP3ISP_PREV_LUMAENH,
|
||||||
preview_config_luma_enhancement,
|
preview_config_luma_enhancement,
|
||||||
preview_enable_luma_enhancement},
|
preview_enable_luma_enhancement},
|
||||||
{OMAP3ISP_PREV_INVALAW, PREV_INVERSE_ALAW,
|
{OMAP3ISP_PREV_INVALAW,
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_invalaw},
|
preview_enable_invalaw},
|
||||||
{OMAP3ISP_PREV_HRZ_MED, PREV_HORZ_MEDIAN_FILTER,
|
{OMAP3ISP_PREV_HRZ_MED,
|
||||||
preview_config_hmed,
|
preview_config_hmed,
|
||||||
preview_enable_hmed},
|
preview_enable_hmed},
|
||||||
{OMAP3ISP_PREV_CFA, PREV_CFA,
|
{OMAP3ISP_PREV_CFA,
|
||||||
preview_config_cfa,
|
preview_config_cfa,
|
||||||
preview_enable_cfa},
|
preview_enable_cfa},
|
||||||
{OMAP3ISP_PREV_CHROMA_SUPP, PREV_CHROMA_SUPPRESS,
|
{OMAP3ISP_PREV_CHROMA_SUPP,
|
||||||
preview_config_chroma_suppression,
|
preview_config_chroma_suppression,
|
||||||
preview_enable_chroma_suppression},
|
preview_enable_chroma_suppression},
|
||||||
{OMAP3ISP_PREV_WB, PREV_WB,
|
{OMAP3ISP_PREV_WB,
|
||||||
preview_config_whitebalance,
|
preview_config_whitebalance,
|
||||||
NULL},
|
NULL},
|
||||||
{OMAP3ISP_PREV_BLKADJ, PREV_BLKADJ,
|
{OMAP3ISP_PREV_BLKADJ,
|
||||||
preview_config_blkadj,
|
preview_config_blkadj,
|
||||||
NULL},
|
NULL},
|
||||||
{OMAP3ISP_PREV_RGB2RGB, PREV_RGB2RGB,
|
{OMAP3ISP_PREV_RGB2RGB,
|
||||||
preview_config_rgb_blending,
|
preview_config_rgb_blending,
|
||||||
NULL},
|
NULL},
|
||||||
{OMAP3ISP_PREV_COLOR_CONV, PREV_COLOR_CONV,
|
{OMAP3ISP_PREV_COLOR_CONV,
|
||||||
preview_config_rgb_to_ycbcr,
|
preview_config_rgb_to_ycbcr,
|
||||||
NULL},
|
NULL},
|
||||||
{OMAP3ISP_PREV_YC_LIMIT, PREV_YCLIMITS,
|
{OMAP3ISP_PREV_YC_LIMIT,
|
||||||
preview_config_yc_range,
|
preview_config_yc_range,
|
||||||
NULL},
|
NULL},
|
||||||
{OMAP3ISP_PREV_DEFECT_COR, PREV_DEFECT_COR,
|
{OMAP3ISP_PREV_DEFECT_COR,
|
||||||
preview_config_dcor,
|
preview_config_dcor,
|
||||||
preview_enable_dcor},
|
preview_enable_dcor},
|
||||||
{OMAP3ISP_PREV_GAMMABYPASS, PREV_GAMMA_BYPASS,
|
{OMAP3ISP_PREV_GAMMABYPASS,
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_gammabypass},
|
preview_enable_gammabypass},
|
||||||
{OMAP3ISP_PREV_DRK_FRM_CAPTURE, PREV_DARK_FRAME_CAPTURE,
|
{OMAP3ISP_PREV_DRK_FRM_CAPTURE,
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_drkframe_capture},
|
preview_enable_drkframe_capture},
|
||||||
{OMAP3ISP_PREV_DRK_FRM_SUBTRACT, PREV_DARK_FRAME_SUBTRACT,
|
{OMAP3ISP_PREV_DRK_FRM_SUBTRACT,
|
||||||
NULL,
|
NULL,
|
||||||
preview_enable_drkframe},
|
preview_enable_drkframe},
|
||||||
{OMAP3ISP_PREV_LENS_SHADING, PREV_LENS_SHADING,
|
{OMAP3ISP_PREV_LENS_SHADING,
|
||||||
preview_config_drkf_shadcomp,
|
preview_config_drkf_shadcomp,
|
||||||
preview_enable_drkframe},
|
preview_enable_drkframe},
|
||||||
{OMAP3ISP_PREV_NF, PREV_NOISE_FILTER,
|
{OMAP3ISP_PREV_NF,
|
||||||
preview_config_noisefilter,
|
preview_config_noisefilter,
|
||||||
preview_enable_noisefilter},
|
preview_enable_noisefilter},
|
||||||
{OMAP3ISP_PREV_GAMMA, PREV_GAMMA,
|
{OMAP3ISP_PREV_GAMMA,
|
||||||
preview_config_gammacorrn,
|
preview_config_gammacorrn,
|
||||||
NULL},
|
NULL},
|
||||||
{-1, PREV_CONTRAST,
|
{OMAP3ISP_PREV_CONTRAST,
|
||||||
preview_config_contrast,
|
preview_config_contrast,
|
||||||
NULL},
|
NULL, true},
|
||||||
{-1, PREV_BRIGHTNESS,
|
{OMAP3ISP_PREV_BRIGHTNESS,
|
||||||
preview_config_brightness,
|
preview_config_brightness,
|
||||||
NULL},
|
NULL, true},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -810,59 +810,59 @@ __preview_get_ptrs(struct prev_params *params, void **param,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (bit) {
|
switch (bit) {
|
||||||
case PREV_HORZ_MEDIAN_FILTER:
|
case OMAP3ISP_PREV_HRZ_MED:
|
||||||
*param = ¶ms->hmed;
|
*param = ¶ms->hmed;
|
||||||
CHKARG(configs, config, hmed)
|
CHKARG(configs, config, hmed)
|
||||||
return sizeof(params->hmed);
|
return sizeof(params->hmed);
|
||||||
case PREV_NOISE_FILTER:
|
case OMAP3ISP_PREV_NF:
|
||||||
*param = ¶ms->nf;
|
*param = ¶ms->nf;
|
||||||
CHKARG(configs, config, nf)
|
CHKARG(configs, config, nf)
|
||||||
return sizeof(params->nf);
|
return sizeof(params->nf);
|
||||||
break;
|
break;
|
||||||
case PREV_CFA:
|
case OMAP3ISP_PREV_CFA:
|
||||||
*param = ¶ms->cfa;
|
*param = ¶ms->cfa;
|
||||||
CHKARG(configs, config, cfa)
|
CHKARG(configs, config, cfa)
|
||||||
return sizeof(params->cfa);
|
return sizeof(params->cfa);
|
||||||
case PREV_LUMA_ENHANCE:
|
case OMAP3ISP_PREV_LUMAENH:
|
||||||
*param = ¶ms->luma;
|
*param = ¶ms->luma;
|
||||||
CHKARG(configs, config, luma)
|
CHKARG(configs, config, luma)
|
||||||
return sizeof(params->luma);
|
return sizeof(params->luma);
|
||||||
case PREV_CHROMA_SUPPRESS:
|
case OMAP3ISP_PREV_CHROMA_SUPP:
|
||||||
*param = ¶ms->csup;
|
*param = ¶ms->csup;
|
||||||
CHKARG(configs, config, csup)
|
CHKARG(configs, config, csup)
|
||||||
return sizeof(params->csup);
|
return sizeof(params->csup);
|
||||||
case PREV_DEFECT_COR:
|
case OMAP3ISP_PREV_DEFECT_COR:
|
||||||
*param = ¶ms->dcor;
|
*param = ¶ms->dcor;
|
||||||
CHKARG(configs, config, dcor)
|
CHKARG(configs, config, dcor)
|
||||||
return sizeof(params->dcor);
|
return sizeof(params->dcor);
|
||||||
case PREV_BLKADJ:
|
case OMAP3ISP_PREV_BLKADJ:
|
||||||
*param = ¶ms->blk_adj;
|
*param = ¶ms->blk_adj;
|
||||||
CHKARG(configs, config, blkadj)
|
CHKARG(configs, config, blkadj)
|
||||||
return sizeof(params->blk_adj);
|
return sizeof(params->blk_adj);
|
||||||
case PREV_YCLIMITS:
|
case OMAP3ISP_PREV_YC_LIMIT:
|
||||||
*param = ¶ms->yclimit;
|
*param = ¶ms->yclimit;
|
||||||
CHKARG(configs, config, yclimit)
|
CHKARG(configs, config, yclimit)
|
||||||
return sizeof(params->yclimit);
|
return sizeof(params->yclimit);
|
||||||
case PREV_RGB2RGB:
|
case OMAP3ISP_PREV_RGB2RGB:
|
||||||
*param = ¶ms->rgb2rgb;
|
*param = ¶ms->rgb2rgb;
|
||||||
CHKARG(configs, config, rgb2rgb)
|
CHKARG(configs, config, rgb2rgb)
|
||||||
return sizeof(params->rgb2rgb);
|
return sizeof(params->rgb2rgb);
|
||||||
case PREV_COLOR_CONV:
|
case OMAP3ISP_PREV_COLOR_CONV:
|
||||||
*param = ¶ms->rgb2ycbcr;
|
*param = ¶ms->rgb2ycbcr;
|
||||||
CHKARG(configs, config, csc)
|
CHKARG(configs, config, csc)
|
||||||
return sizeof(params->rgb2ycbcr);
|
return sizeof(params->rgb2ycbcr);
|
||||||
case PREV_WB:
|
case OMAP3ISP_PREV_WB:
|
||||||
*param = ¶ms->wbal;
|
*param = ¶ms->wbal;
|
||||||
CHKARG(configs, config, wbal)
|
CHKARG(configs, config, wbal)
|
||||||
return sizeof(params->wbal);
|
return sizeof(params->wbal);
|
||||||
case PREV_GAMMA:
|
case OMAP3ISP_PREV_GAMMA:
|
||||||
*param = ¶ms->gamma;
|
*param = ¶ms->gamma;
|
||||||
CHKARG(configs, config, gamma)
|
CHKARG(configs, config, gamma)
|
||||||
return sizeof(params->gamma);
|
return sizeof(params->gamma);
|
||||||
case PREV_CONTRAST:
|
case OMAP3ISP_PREV_CONTRAST:
|
||||||
*param = ¶ms->contrast;
|
*param = ¶ms->contrast;
|
||||||
return 0;
|
return 0;
|
||||||
case PREV_BRIGHTNESS:
|
case OMAP3ISP_PREV_BRIGHTNESS:
|
||||||
*param = ¶ms->brightness;
|
*param = ¶ms->brightness;
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
|
@ -906,10 +906,10 @@ static int preview_config(struct isp_prev_device *prev,
|
||||||
attr = &update_attrs[i];
|
attr = &update_attrs[i];
|
||||||
bit = 0;
|
bit = 0;
|
||||||
|
|
||||||
if (attr->cfg_bit == -1 || !(cfg->update & attr->cfg_bit))
|
if (attr->skip || !(cfg->update & attr->feature_bit))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bit = cfg->flag & attr->cfg_bit;
|
bit = cfg->flag & attr->feature_bit;
|
||||||
if (bit) {
|
if (bit) {
|
||||||
void *to = NULL, __user *from = NULL;
|
void *to = NULL, __user *from = NULL;
|
||||||
unsigned long sz = 0;
|
unsigned long sz = 0;
|
||||||
|
@ -1039,23 +1039,24 @@ static void preview_config_input_size(struct isp_prev_device *prev)
|
||||||
unsigned int slv = prev->crop.top;
|
unsigned int slv = prev->crop.top;
|
||||||
unsigned int elv = prev->crop.top + prev->crop.height - 1;
|
unsigned int elv = prev->crop.top + prev->crop.height - 1;
|
||||||
|
|
||||||
if (params->features & PREV_CFA) {
|
if (params->features & OMAP3ISP_PREV_CFA) {
|
||||||
sph -= 2;
|
sph -= 2;
|
||||||
eph += 2;
|
eph += 2;
|
||||||
slv -= 2;
|
slv -= 2;
|
||||||
elv += 2;
|
elv += 2;
|
||||||
}
|
}
|
||||||
if (params->features & (PREV_DEFECT_COR | PREV_NOISE_FILTER)) {
|
if (params->features & (OMAP3ISP_PREV_DEFECT_COR | OMAP3ISP_PREV_NF)) {
|
||||||
sph -= 2;
|
sph -= 2;
|
||||||
eph += 2;
|
eph += 2;
|
||||||
slv -= 2;
|
slv -= 2;
|
||||||
elv += 2;
|
elv += 2;
|
||||||
}
|
}
|
||||||
if (params->features & PREV_HORZ_MEDIAN_FILTER) {
|
if (params->features & OMAP3ISP_PREV_HRZ_MED) {
|
||||||
sph -= 2;
|
sph -= 2;
|
||||||
eph += 2;
|
eph += 2;
|
||||||
}
|
}
|
||||||
if (params->features & (PREV_CHROMA_SUPPRESS | PREV_LUMA_ENHANCE))
|
if (params->features & (OMAP3ISP_PREV_CHROMA_SUPP |
|
||||||
|
OMAP3ISP_PREV_LUMAENH))
|
||||||
sph -= 2;
|
sph -= 2;
|
||||||
|
|
||||||
isp_reg_writel(isp, (sph << ISPPRV_HORZ_INFO_SPH_SHIFT) | eph,
|
isp_reg_writel(isp, (sph << ISPPRV_HORZ_INFO_SPH_SHIFT) | eph,
|
||||||
|
@ -1190,7 +1191,7 @@ int omap3isp_preview_busy(struct isp_prev_device *prev)
|
||||||
*/
|
*/
|
||||||
void omap3isp_preview_restore_context(struct isp_device *isp)
|
void omap3isp_preview_restore_context(struct isp_device *isp)
|
||||||
{
|
{
|
||||||
isp->isp_prev.update = PREV_FEATURES_END - 1;
|
isp->isp_prev.update = OMAP3ISP_PREV_FEATURES_END - 1;
|
||||||
preview_setup_hw(&isp->isp_prev);
|
preview_setup_hw(&isp->isp_prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1293,12 +1294,14 @@ static void preview_init_params(struct isp_prev_device *prev)
|
||||||
params->yclimit.minY = ISPPRV_YC_MIN;
|
params->yclimit.minY = ISPPRV_YC_MIN;
|
||||||
params->yclimit.maxY = ISPPRV_YC_MAX;
|
params->yclimit.maxY = ISPPRV_YC_MAX;
|
||||||
|
|
||||||
params->features = PREV_CFA | PREV_DEFECT_COR | PREV_NOISE_FILTER
|
params->features = OMAP3ISP_PREV_CFA | OMAP3ISP_PREV_DEFECT_COR
|
||||||
| PREV_GAMMA | PREV_BLKADJ | PREV_YCLIMITS
|
| OMAP3ISP_PREV_NF | OMAP3ISP_PREV_GAMMA
|
||||||
| PREV_RGB2RGB | PREV_COLOR_CONV | PREV_WB
|
| OMAP3ISP_PREV_BLKADJ | OMAP3ISP_PREV_YC_LIMIT
|
||||||
| PREV_BRIGHTNESS | PREV_CONTRAST;
|
| OMAP3ISP_PREV_RGB2RGB | OMAP3ISP_PREV_COLOR_CONV
|
||||||
|
| OMAP3ISP_PREV_WB | OMAP3ISP_PREV_BRIGHTNESS
|
||||||
|
| OMAP3ISP_PREV_CONTRAST;
|
||||||
|
|
||||||
prev->update = PREV_FEATURES_END - 1;
|
prev->update = OMAP3ISP_PREV_FEATURES_END - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -45,28 +45,10 @@
|
||||||
#define ISPPRV_CONTRAST_HIGH 0xFF
|
#define ISPPRV_CONTRAST_HIGH 0xFF
|
||||||
#define ISPPRV_CONTRAST_UNITS 0x1
|
#define ISPPRV_CONTRAST_UNITS 0x1
|
||||||
|
|
||||||
/* Features list */
|
/* Additional features not listed in linux/omap3isp.h */
|
||||||
#define PREV_LUMA_ENHANCE OMAP3ISP_PREV_LUMAENH
|
#define OMAP3ISP_PREV_CONTRAST (1 << 17)
|
||||||
#define PREV_INVERSE_ALAW OMAP3ISP_PREV_INVALAW
|
#define OMAP3ISP_PREV_BRIGHTNESS (1 << 18)
|
||||||
#define PREV_HORZ_MEDIAN_FILTER OMAP3ISP_PREV_HRZ_MED
|
#define OMAP3ISP_PREV_FEATURES_END (1 << 19)
|
||||||
#define PREV_CFA OMAP3ISP_PREV_CFA
|
|
||||||
#define PREV_CHROMA_SUPPRESS OMAP3ISP_PREV_CHROMA_SUPP
|
|
||||||
#define PREV_WB OMAP3ISP_PREV_WB
|
|
||||||
#define PREV_BLKADJ OMAP3ISP_PREV_BLKADJ
|
|
||||||
#define PREV_RGB2RGB OMAP3ISP_PREV_RGB2RGB
|
|
||||||
#define PREV_COLOR_CONV OMAP3ISP_PREV_COLOR_CONV
|
|
||||||
#define PREV_YCLIMITS OMAP3ISP_PREV_YC_LIMIT
|
|
||||||
#define PREV_DEFECT_COR OMAP3ISP_PREV_DEFECT_COR
|
|
||||||
#define PREV_GAMMA_BYPASS OMAP3ISP_PREV_GAMMABYPASS
|
|
||||||
#define PREV_DARK_FRAME_CAPTURE OMAP3ISP_PREV_DRK_FRM_CAPTURE
|
|
||||||
#define PREV_DARK_FRAME_SUBTRACT OMAP3ISP_PREV_DRK_FRM_SUBTRACT
|
|
||||||
#define PREV_LENS_SHADING OMAP3ISP_PREV_LENS_SHADING
|
|
||||||
#define PREV_NOISE_FILTER OMAP3ISP_PREV_NF
|
|
||||||
#define PREV_GAMMA OMAP3ISP_PREV_GAMMA
|
|
||||||
|
|
||||||
#define PREV_CONTRAST (1 << 17)
|
|
||||||
#define PREV_BRIGHTNESS (1 << 18)
|
|
||||||
#define PREV_FEATURES_END (1 << 19)
|
|
||||||
|
|
||||||
enum preview_input_entity {
|
enum preview_input_entity {
|
||||||
PREVIEW_INPUT_NONE,
|
PREVIEW_INPUT_NONE,
|
||||||
|
|
Loading…
Reference in New Issue