techpack: camera: sensor: implement optimization disabling
This commit is contained in:
parent
84ef47733c
commit
06612551d0
@ -9,6 +9,10 @@
|
||||
#include "cam_req_mgr_workq.h"
|
||||
#include "cam_common_util.h"
|
||||
|
||||
|
||||
static int disable_optmz;
|
||||
module_param(disable_optmz, int, 0644);
|
||||
|
||||
static int32_t cam_cci_convert_type_to_num_bytes(
|
||||
enum camera_sensor_i2c_type type)
|
||||
{
|
||||
@ -525,22 +529,27 @@ static int32_t cam_cci_calc_cmd_len(struct cci_device *cci_dev,
|
||||
len = data_len + addr_len;
|
||||
pack_max_len = size < (cci_dev->payload_size-len) ?
|
||||
size : (cci_dev->payload_size-len);
|
||||
for (i = 0; i < pack_max_len;) {
|
||||
if (cmd->delay || ((cmd - i2c_cmd) >= (cmd_size - 1)))
|
||||
break;
|
||||
if (cmd->reg_addr + 1 ==
|
||||
(cmd+1)->reg_addr) {
|
||||
len += data_len;
|
||||
if (len > cci_dev->payload_size) {
|
||||
len = len - data_len;
|
||||
/* xiaomi add a flag to disable this optimization*/
|
||||
if ((!c_ctrl->cci_info->disable_optmz) && (!disable_optmz))
|
||||
{
|
||||
CAM_DBG(CAM_CCI, "enable writing optimization for 0x%02X", c_ctrl->cci_info->sid<<1);
|
||||
for (i = 0; i < pack_max_len;) {
|
||||
if (cmd->delay || ((cmd - i2c_cmd) >= (cmd_size - 1)))
|
||||
break;
|
||||
if (cmd->reg_addr + 1 ==
|
||||
(cmd+1)->reg_addr) {
|
||||
len += data_len;
|
||||
if (len > cci_dev->payload_size) {
|
||||
len = len - data_len;
|
||||
break;
|
||||
}
|
||||
(*pack)++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
(*pack)++;
|
||||
} else {
|
||||
break;
|
||||
i += data_len;
|
||||
cmd++;
|
||||
}
|
||||
i += data_len;
|
||||
cmd++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,6 +274,7 @@ struct cam_sensor_cci_client {
|
||||
uint16_t retries;
|
||||
uint16_t id_map;
|
||||
uint16_t cci_device;
|
||||
uint16_t disable_optmz; //xiaomi add the flag to disable CCI optimization
|
||||
};
|
||||
|
||||
struct cam_cci_ctrl {
|
||||
|
@ -338,10 +338,13 @@ static int cam_ois_slaveInfo_pkt_parser(struct cam_ois_ctrl_t *o_ctrl,
|
||||
o_ctrl->ois_name[OIS_NAME_LEN - 1] = '\0';
|
||||
o_ctrl->io_master_info.cci_client->retries = 3;
|
||||
o_ctrl->io_master_info.cci_client->id_map = 0;
|
||||
/* xiaomi add disable cci optmz for OIS by default */
|
||||
o_ctrl->io_master_info.cci_client->disable_optmz = 1;
|
||||
memcpy(&(o_ctrl->opcode), &(ois_info->opcode),
|
||||
sizeof(struct cam_ois_opcode));
|
||||
CAM_DBG(CAM_OIS, "Slave addr: 0x%x Freq Mode: %d",
|
||||
ois_info->slave_addr, ois_info->i2c_freq_mode);
|
||||
CAM_DBG(CAM_OIS, "Slave addr: 0x%x Freq Mode: %d, disable optmz %d",
|
||||
ois_info->slave_addr, ois_info->i2c_freq_mode,
|
||||
o_ctrl->io_master_info.cci_client->disable_optmz);
|
||||
} else if (o_ctrl->io_master_info.master_type == I2C_MASTER) {
|
||||
o_ctrl->io_master_info.client->addr = ois_info->slave_addr;
|
||||
CAM_DBG(CAM_OIS, "Slave addr: 0x%x", ois_info->slave_addr);
|
||||
|
Loading…
Reference in New Issue
Block a user