*/
#define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__
+#include <linux/bitops.h>
#include <linux/bug.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+#include <linux/types.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
return 0;
}
+unsigned int __get_pending_param_count(struct fimc_is *is)
+{
+ struct is_config_param *config = &is->cfg_param[is->scenario_id];
+ unsigned long flags;
+ unsigned int count;
+
+ spin_lock_irqsave(&is->slock, flags);
+ count = hweight32(config->p_region_index1);
+ count += hweight32(config->p_region_index2);
+ spin_unlock_irqrestore(&is->slock, flags);
+
+ return count;
+}
+
int __is_hw_update_params(struct fimc_is *is)
{
unsigned long *p_index1, *p_index2;
/* Update field */
fimc_is_set_param_bit(is, PARAM_ISP_OTF_INPUT);
- fimc_is_inc_param_num(is);
fimc_is_set_param_bit(is, PARAM_ISP_OTF_OUTPUT);
- fimc_is_inc_param_num(is);
fimc_is_set_param_bit(is, PARAM_DRC_OTF_INPUT);
- fimc_is_inc_param_num(is);
fimc_is_set_param_bit(is, PARAM_DRC_OTF_OUTPUT);
- fimc_is_inc_param_num(is);
fimc_is_set_param_bit(is, PARAM_FD_OTF_INPUT);
- fimc_is_inc_param_num(is);
}
int fimc_is_hw_get_sensor_max_framerate(struct fimc_is *is)
isp->otf_input.frametime_max = (u32)1000000 / fps;
}
- if (!test_bit(PARAM_SENSOR_FRAME_RATE, p_index)) {
+ if (!test_bit(PARAM_SENSOR_FRAME_RATE, p_index))
fimc_is_set_param_bit(is, PARAM_SENSOR_FRAME_RATE);
- fimc_is_inc_param_num(is);
- }
- if (!test_bit(PARAM_ISP_OTF_INPUT, p_index)) {
+
+ if (!test_bit(PARAM_ISP_OTF_INPUT, p_index))
fimc_is_set_param_bit(is, PARAM_ISP_OTF_INPUT);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_init_isp_aa(struct fimc_is *is)
isp->aa.err = ISP_AF_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_AA);
- fimc_is_inc_param_num(is);
}
void __is_set_isp_flash(struct fimc_is *is, u32 cmd, u32 redeye)
isp->flash.redeye = redeye;
isp->flash.err = ISP_FLASH_ERROR_NONE;
- if (!test_bit(PARAM_ISP_FLASH, &cfg->p_region_index1)) {
+ if (!test_bit(PARAM_ISP_FLASH, &cfg->p_region_index1))
fimc_is_set_param_bit(is, PARAM_ISP_FLASH);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_isp_awb(struct fimc_is *is, u32 cmd, u32 val)
isp->awb.illumination = val;
isp->awb.err = ISP_AWB_ERROR_NONE;
- if (!test_bit(PARAM_ISP_AWB, p_index)) {
+ if (!test_bit(PARAM_ISP_AWB, p_index))
fimc_is_set_param_bit(is, PARAM_ISP_AWB);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_isp_effect(struct fimc_is *is, u32 cmd)
isp->effect.cmd = cmd;
isp->effect.err = ISP_IMAGE_EFFECT_ERROR_NONE;
- if (!test_bit(PARAM_ISP_IMAGE_EFFECT, p_index)) {
+ if (!test_bit(PARAM_ISP_IMAGE_EFFECT, p_index))
fimc_is_set_param_bit(is, PARAM_ISP_IMAGE_EFFECT);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_isp_iso(struct fimc_is *is, u32 cmd, u32 val)
isp->iso.value = val;
isp->iso.err = ISP_ISO_ERROR_NONE;
- if (!test_bit(PARAM_ISP_ISO, p_index)) {
+ if (!test_bit(PARAM_ISP_ISO, p_index))
fimc_is_set_param_bit(is, PARAM_ISP_ISO);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_isp_adjust(struct fimc_is *is, u32 cmd, u32 val)
isp->adjust.cmd = cmd;
isp->adjust.err = ISP_ADJUST_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_ADJUST);
- fimc_is_inc_param_num(is);
} else {
isp->adjust.cmd |= cmd;
}
if (!test_bit(PARAM_ISP_METERING, p_index)) {
isp->metering.err = ISP_METERING_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_METERING);
- fimc_is_inc_param_num(is);
}
}
isp->afc.manual = val;
isp->afc.err = ISP_AFC_ERROR_NONE;
- if (!test_bit(PARAM_ISP_AFC, p_index)) {
+ if (!test_bit(PARAM_ISP_AFC, p_index))
fimc_is_set_param_bit(is, PARAM_ISP_AFC);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_drc_control(struct fimc_is *is, u32 val)
drc->control.bypass = val;
- if (!test_bit(PARAM_DRC_CONTROL, p_index)) {
+ if (!test_bit(PARAM_DRC_CONTROL, p_index))
fimc_is_set_param_bit(is, PARAM_DRC_CONTROL);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_fd_control(struct fimc_is *is, u32 val)
fd->control.cmd = val;
- if (!test_bit((PARAM_FD_CONFIG - 32), p_index)) {
+ if (!test_bit((PARAM_FD_CONFIG - 32), p_index))
fimc_is_set_param_bit(is, PARAM_FD_CONTROL);
- fimc_is_inc_param_num(is);
- }
}
void __is_set_fd_config_maxface(struct fimc_is *is, u32 val)
fd->config.cmd = FD_CONFIG_COMMAND_MAXIMUM_NUMBER;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_MAXIMUM_NUMBER;
}
fd->config.cmd = FD_CONFIG_COMMAND_ROLL_ANGLE;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_ROLL_ANGLE;
}
fd->config.cmd = FD_CONFIG_COMMAND_YAW_ANGLE;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_YAW_ANGLE;
}
fd->config.cmd = FD_CONFIG_COMMAND_SMILE_MODE;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_SMILE_MODE;
}
fd->config.cmd = FD_CONFIG_COMMAND_BLINK_MODE;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_BLINK_MODE;
}
fd->config.cmd = FD_CONFIG_COMMAND_EYES_DETECT;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_EYES_DETECT;
}
fd->config.cmd = FD_CONFIG_COMMAND_MOUTH_DETECT;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_MOUTH_DETECT;
}
fd->config.cmd = FD_CONFIG_COMMAND_ORIENTATION;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_ORIENTATION;
}
fd->config.cmd = FD_CONFIG_COMMAND_ORIENTATION_VALUE;
fd->config.err = ERROR_FD_NONE;
fimc_is_set_param_bit(is, PARAM_FD_CONFIG);
- fimc_is_inc_param_num(is);
} else {
fd->config.cmd |= FD_CONFIG_COMMAND_ORIENTATION_VALUE;
}
/* Global */
global->shotmode.cmd = 1;
fimc_is_set_param_bit(is, PARAM_GLOBAL_SHOTMODE);
- fimc_is_inc_param_num(is);
/* ISP */
isp->control.cmd = CONTROL_COMMAND_START;
isp->control.bypass = CONTROL_BYPASS_DISABLE;
isp->control.err = CONTROL_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_CONTROL);
- fimc_is_inc_param_num(is);
isp->otf_input.cmd = OTF_INPUT_COMMAND_ENABLE;
if (!test_bit(PARAM_ISP_OTF_INPUT, p_index1)) {
isp->otf_input.width = DEFAULT_PREVIEW_STILL_WIDTH;
isp->otf_input.height = DEFAULT_PREVIEW_STILL_HEIGHT;
fimc_is_set_param_bit(is, PARAM_ISP_OTF_INPUT);
- fimc_is_inc_param_num(is);
}
if (is->sensor->test_pattern)
isp->otf_input.format = OTF_INPUT_FORMAT_STRGEN_COLORBAR_BAYER;
isp->dma1_input.width = 0;
isp->dma1_input.err = DMA_INPUT_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_DMA1_INPUT);
- fimc_is_inc_param_num(is);
isp->dma2_input.cmd = DMA_INPUT_COMMAND_DISABLE;
isp->dma2_input.width = 0;
isp->dma2_input.width = 0;
isp->dma2_input.err = DMA_INPUT_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_DMA2_INPUT);
- fimc_is_inc_param_num(is);
isp->aa.cmd = ISP_AA_COMMAND_START;
isp->aa.target = ISP_AA_TARGET_AE | ISP_AA_TARGET_AWB;
fimc_is_set_param_bit(is, PARAM_ISP_AA);
- fimc_is_inc_param_num(is);
if (!test_bit(PARAM_ISP_FLASH, p_index1))
__is_set_isp_flash(is, ISP_FLASH_COMMAND_DISABLE,
isp->otf_output.width = DEFAULT_PREVIEW_STILL_WIDTH;
isp->otf_output.height = DEFAULT_PREVIEW_STILL_HEIGHT;
fimc_is_set_param_bit(is, PARAM_ISP_OTF_OUTPUT);
- fimc_is_inc_param_num(is);
}
isp->otf_output.format = OTF_OUTPUT_FORMAT_YUV444;
isp->otf_output.bitwidth = 12;
isp->dma1_output.dma_out_mask = 0;
isp->dma1_output.err = DMA_OUTPUT_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_DMA1_OUTPUT);
- fimc_is_inc_param_num(is);
}
if (!test_bit(PARAM_ISP_DMA2_OUTPUT, p_index1)) {
isp->dma2_output.dma_out_mask = 0;
isp->dma2_output.err = DMA_OUTPUT_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_ISP_DMA2_OUTPUT);
- fimc_is_inc_param_num(is);
}
/* Sensor */
drc->otf_input.width = DEFAULT_PREVIEW_STILL_WIDTH;
drc->otf_input.height = DEFAULT_PREVIEW_STILL_HEIGHT;
fimc_is_set_param_bit(is, PARAM_DRC_OTF_INPUT);
- fimc_is_inc_param_num(is);
}
drc->otf_input.format = OTF_INPUT_FORMAT_YUV444;
drc->otf_input.bitwidth = 12;
drc->dma_input.width = 0;
drc->dma_input.err = DMA_INPUT_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_DRC_DMA_INPUT);
- fimc_is_inc_param_num(is);
drc->otf_output.cmd = OTF_OUTPUT_COMMAND_ENABLE;
if (!test_bit(PARAM_DRC_OTF_OUTPUT, p_index1)) {
drc->otf_output.width = DEFAULT_PREVIEW_STILL_WIDTH;
drc->otf_output.height = DEFAULT_PREVIEW_STILL_HEIGHT;
fimc_is_set_param_bit(is, PARAM_DRC_OTF_OUTPUT);
- fimc_is_inc_param_num(is);
}
drc->otf_output.format = OTF_OUTPUT_FORMAT_YUV444;
drc->otf_output.bitwidth = 8;
fd->otf_input.width = DEFAULT_PREVIEW_STILL_WIDTH;
fd->otf_input.height = DEFAULT_PREVIEW_STILL_HEIGHT;
fimc_is_set_param_bit(is, PARAM_FD_OTF_INPUT);
- fimc_is_inc_param_num(is);
}
+
fd->otf_input.format = OTF_INPUT_FORMAT_YUV444;
fd->otf_input.bitwidth = 8;
fd->otf_input.order = 0;
fd->dma_input.width = 0;
fd->dma_input.err = DMA_INPUT_ERROR_NONE;
fimc_is_set_param_bit(is, PARAM_FD_DMA_INPUT);
- fimc_is_inc_param_num(is);
__is_set_fd_config_maxface(is, 5);
__is_set_fd_config_rollangle(is, FD_CONFIG_ROLL_ANGLE_FULL);