mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
Merge 3e949eb2c0 on remote branch
Change-Id: I0a2e51ca9b3ae9b1d79b4e2c50240f3ee1dcc816
This commit is contained in:
commit
335b8575a0
11 changed files with 126 additions and 31 deletions
|
|
@ -6098,7 +6098,7 @@ static int cam_isp_context_dump_requests(void *data,
|
|||
static int cam_isp_context_handle_message(void *context,
|
||||
uint32_t msg_type, uint32_t *data)
|
||||
{
|
||||
int rc = 0;
|
||||
int rc = -EINVAL;
|
||||
struct cam_hw_cmd_args hw_cmd_args;
|
||||
struct cam_isp_hw_cmd_args isp_hw_cmd_args;
|
||||
struct cam_context *ctx = (struct cam_context *)context;
|
||||
|
|
|
|||
|
|
@ -319,9 +319,10 @@ static int cam_tfe_hw_mgr_get_clock_rate(
|
|||
continue;
|
||||
|
||||
hw_intf = isp_hw_res->hw_res[i]->hw_intf;
|
||||
CAM_DBG(CAM_ISP, "hw type %d hw index:%d",
|
||||
hw_intf->hw_type, hw_intf->hw_idx);
|
||||
if (hw_intf && hw_intf->hw_ops.process_cmd) {
|
||||
CAM_DBG(CAM_ISP, "hw type %d hw index:%d",
|
||||
hw_intf->hw_type, hw_intf->hw_idx);
|
||||
|
||||
rc = hw_intf->hw_ops.process_cmd(
|
||||
hw_intf->hw_priv,
|
||||
CAM_ISP_HW_CMD_GET_CLOCK_RATE,
|
||||
|
|
@ -343,7 +344,7 @@ static int cam_tfe_hw_mgr_update_clock_rate(
|
|||
uint32_t *updated_clock_rate)
|
||||
{
|
||||
int i;
|
||||
int rc = 0;
|
||||
int rc = -EINVAL;
|
||||
struct cam_hw_intf *hw_intf;
|
||||
|
||||
for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
|
||||
|
|
@ -351,29 +352,33 @@ static int cam_tfe_hw_mgr_update_clock_rate(
|
|||
continue;
|
||||
|
||||
hw_intf = isp_hw_res->hw_res[i]->hw_intf;
|
||||
CAM_DBG(CAM_ISP, "hw type %d hw index:%d",
|
||||
hw_intf->hw_type, hw_intf->hw_idx);
|
||||
|
||||
if (hw_intf && hw_intf->hw_ops.process_cmd) {
|
||||
CAM_DBG(CAM_ISP, "hw type %d hw index:%d",
|
||||
hw_intf->hw_type, hw_intf->hw_idx);
|
||||
|
||||
rc = hw_intf->hw_ops.process_cmd(
|
||||
hw_intf->hw_priv,
|
||||
CAM_ISP_HW_CMD_DYNAMIC_CLOCK_UPDATE,
|
||||
set_clock_rate,
|
||||
sizeof(uint32_t));
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_ISP, "Failed to get Clock rate");
|
||||
CAM_ERR(CAM_ISP, "Failed to set Clock rate");
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
if (hw_intf && hw_intf->hw_ops.process_cmd) {
|
||||
CAM_DBG(CAM_ISP, "hw type %d hw index:%d",
|
||||
hw_intf->hw_type, hw_intf->hw_idx);
|
||||
|
||||
rc = hw_intf->hw_ops.process_cmd(
|
||||
hw_intf->hw_priv,
|
||||
CAM_ISP_HW_CMD_GET_CLOCK_RATE,
|
||||
updated_clock_rate,
|
||||
sizeof(uint32_t));
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_ISP, "Failed to get Clock rate");
|
||||
CAM_ERR(CAM_ISP, "Failed to get updated clock rate");
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1589,12 +1589,13 @@ static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
|
|||
cam_io_w_mb(0, soc_info->reg_map[0].mem_base +
|
||||
csid_reg->cmn_reg->csid_top_irq_mask_addr);
|
||||
|
||||
cam_tasklet_stop(csid_hw->tasklet);
|
||||
|
||||
rc = cam_ife_csid_disable_soc_resources(soc_info);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_ISP, "CSID:%d Disable CSID SOC failed",
|
||||
csid_hw->hw_intf->hw_idx);
|
||||
|
||||
cam_tasklet_stop(csid_hw->tasklet);
|
||||
spin_lock_irqsave(&csid_hw->lock_state, flags);
|
||||
csid_hw->device_enabled = 0;
|
||||
spin_unlock_irqrestore(&csid_hw->lock_state, flags);
|
||||
|
|
|
|||
|
|
@ -1165,12 +1165,13 @@ static int cam_tfe_csid_disable_hw(struct cam_tfe_csid_hw *csid_hw)
|
|||
cam_io_w_mb(0, soc_info->reg_map[0].mem_base +
|
||||
csid_reg->cmn_reg->csid_top_irq_mask_addr);
|
||||
|
||||
cam_tasklet_stop(csid_hw->tasklet);
|
||||
|
||||
rc = cam_tfe_csid_disable_soc_resources(soc_info);
|
||||
if (rc)
|
||||
CAM_ERR(CAM_ISP, "CSID:%d Disable CSID SOC failed",
|
||||
csid_hw->hw_intf->hw_idx);
|
||||
|
||||
cam_tasklet_stop(csid_hw->tasklet);
|
||||
spin_lock_irqsave(&csid_hw->spin_lock, flags);
|
||||
csid_hw->device_enabled = 0;
|
||||
spin_unlock_irqrestore(&csid_hw->spin_lock, flags);
|
||||
|
|
|
|||
|
|
@ -4112,14 +4112,14 @@ static void cam_ope_mgr_dump_pf_data(
|
|||
packet = hw_cmd_args->u.pf_args.pf_data.packet;
|
||||
ope_request = hw_cmd_args->u.pf_args.pf_data.req;
|
||||
|
||||
if (ctx_data->pf_mid_found)
|
||||
goto stripedump;
|
||||
|
||||
ope_pid_mid_args.fault_mid = hw_cmd_args->u.pf_args.mid;
|
||||
ope_pid_mid_args.fault_pid = hw_cmd_args->u.pf_args.pid;
|
||||
ctx_found = hw_cmd_args->u.pf_args.ctx_found;
|
||||
resource_type = hw_cmd_args->u.pf_args.resource_type;
|
||||
|
||||
if (ctx_data->pf_mid_found)
|
||||
goto stripedump;
|
||||
|
||||
if (*ctx_found && *resource_type) {
|
||||
hw_pid_support = false;
|
||||
goto stripedump;
|
||||
|
|
@ -4162,13 +4162,13 @@ static void cam_ope_mgr_dump_pf_data(
|
|||
return;
|
||||
}
|
||||
|
||||
io_cfg = (struct cam_buf_io_cfg *)((uint32_t *)&packet->payload +
|
||||
packet->io_configs_offset / 4);
|
||||
|
||||
*resource_type = ope_pid_mid_args.match_res;
|
||||
CAM_INFO(CAM_OPE, "Fault port %d", *resource_type);
|
||||
|
||||
stripedump:
|
||||
io_cfg = (struct cam_buf_io_cfg *)((uint32_t *)&packet->payload +
|
||||
packet->io_configs_offset / 4);
|
||||
|
||||
if (!ope_request)
|
||||
goto iodump;
|
||||
|
||||
|
|
@ -4232,6 +4232,11 @@ iodump:
|
|||
io_cfg[i].mem_handle[j]);
|
||||
|
||||
if (io_buf_found) {
|
||||
if (j >= OPE_MAX_PLANES) {
|
||||
CAM_ERR(CAM_OPE, "Invalid plane idx: %d", j);
|
||||
break;
|
||||
}
|
||||
|
||||
for (stripe_num = 0; stripe_num < io_buf->num_stripes[j];
|
||||
stripe_num++) {
|
||||
CAM_INFO(CAM_OPE,
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
|
|||
link->last_flush_id = 0;
|
||||
link->initial_sync_req = -1;
|
||||
link->dual_trigger = false;
|
||||
link->trigger_cnt[0][0] = 0;
|
||||
link->trigger_cnt[0][1] = 0;
|
||||
link->trigger_cnt[1][0] = 0;
|
||||
link->trigger_cnt[1][1] = 0;
|
||||
link->trigger_cnt[0][CAM_TRIGGER_POINT_SOF] = 0;
|
||||
link->trigger_cnt[0][CAM_TRIGGER_POINT_EOF] = 0;
|
||||
link->trigger_cnt[1][CAM_TRIGGER_POINT_SOF] = 0;
|
||||
link->trigger_cnt[1][CAM_TRIGGER_POINT_EOF] = 0;
|
||||
link->in_msync_mode = false;
|
||||
link->retry_cnt = 0;
|
||||
link->is_shutdown = false;
|
||||
|
|
@ -574,10 +574,10 @@ static void __cam_req_mgr_flush_req_slot(
|
|||
atomic_set(&link->eof_event_cnt, 0);
|
||||
in_q->wr_idx = 0;
|
||||
in_q->rd_idx = 0;
|
||||
link->trigger_cnt[0][0] = 0;
|
||||
link->trigger_cnt[0][1] = 0;
|
||||
link->trigger_cnt[1][0] = 0;
|
||||
link->trigger_cnt[1][1] = 0;
|
||||
link->trigger_cnt[0][CAM_TRIGGER_POINT_SOF] = 0;
|
||||
link->trigger_cnt[0][CAM_TRIGGER_POINT_EOF] = 0;
|
||||
link->trigger_cnt[1][CAM_TRIGGER_POINT_SOF] = 0;
|
||||
link->trigger_cnt[1][CAM_TRIGGER_POINT_EOF] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4084,10 +4084,10 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info)
|
|||
goto setup_failed;
|
||||
}
|
||||
|
||||
link->trigger_cnt[0][0] = 0;
|
||||
link->trigger_cnt[0][1] = 0;
|
||||
link->trigger_cnt[1][0] = 0;
|
||||
link->trigger_cnt[1][1] = 0;
|
||||
link->trigger_cnt[0][CAM_TRIGGER_POINT_SOF] = 0;
|
||||
link->trigger_cnt[0][CAM_TRIGGER_POINT_EOF] = 0;
|
||||
link->trigger_cnt[1][CAM_TRIGGER_POINT_SOF] = 0;
|
||||
link->trigger_cnt[1][CAM_TRIGGER_POINT_EOF] = 0;
|
||||
|
||||
mutex_unlock(&link->lock);
|
||||
mutex_unlock(&g_crm_core_dev->crm_lock);
|
||||
|
|
|
|||
|
|
@ -415,7 +415,8 @@ struct cam_req_mgr_core_link {
|
|||
uint64_t sof_timestamp;
|
||||
uint64_t prev_sof_timestamp;
|
||||
bool dual_trigger;
|
||||
uint32_t trigger_cnt[CAM_REQ_MGR_MAX_TRIGGERS][CAM_TRIGGER_MAX_POINTS];
|
||||
uint32_t trigger_cnt[CAM_REQ_MGR_MAX_TRIGGERS]
|
||||
[CAM_TRIGGER_MAX_POINTS + 1];
|
||||
atomic_t eof_event_cnt;
|
||||
bool skip_init_frame;
|
||||
uint64_t last_sof_trigger_jiffies;
|
||||
|
|
|
|||
|
|
@ -459,6 +459,8 @@ static int cam_flash_ops(struct cam_flash_ctrl *flash_ctrl,
|
|||
|
||||
int cam_flash_off(struct cam_flash_ctrl *flash_ctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (!flash_ctrl) {
|
||||
CAM_ERR(CAM_FLASH, "Flash control Null");
|
||||
return -EINVAL;
|
||||
|
|
@ -467,6 +469,16 @@ int cam_flash_off(struct cam_flash_ctrl *flash_ctrl)
|
|||
if (flash_ctrl->switch_trigger)
|
||||
cam_res_mgr_led_trigger_event(flash_ctrl->switch_trigger,
|
||||
(enum led_brightness)LED_SWITCH_OFF);
|
||||
|
||||
if ((flash_ctrl->i2c_data.streamoff_settings.is_settings_valid) &&
|
||||
(flash_ctrl->i2c_data.streamoff_settings.request_id == 0)) {
|
||||
flash_ctrl->apply_streamoff = true;
|
||||
rc = cam_flash_i2c_apply_setting(flash_ctrl, 0);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"cannot apply streamoff settings");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -693,7 +705,22 @@ int cam_flash_i2c_apply_setting(struct cam_flash_ctrl *fctrl,
|
|||
CAM_DBG(CAM_FLASH, "req_id=%llu", req_id);
|
||||
if (req_id == 0) {
|
||||
/* NonRealTime Init settings*/
|
||||
if (fctrl->i2c_data.init_settings.is_settings_valid == true) {
|
||||
if (fctrl->apply_streamoff == true) {
|
||||
fctrl->apply_streamoff = false;
|
||||
i2c_set = &fctrl->i2c_data.streamoff_settings;
|
||||
list_for_each_entry(i2c_list,
|
||||
&(i2c_set->list_head),
|
||||
list) {
|
||||
rc = cam_sensor_util_i2c_apply_setting
|
||||
(&(fctrl->io_master_info), i2c_list);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_FLASH,
|
||||
"Failed to apply stream on settings: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (fctrl->i2c_data.init_settings.is_settings_valid == true) {
|
||||
list_for_each_entry(i2c_list,
|
||||
&(fctrl->i2c_data.init_settings.list_head),
|
||||
list) {
|
||||
|
|
@ -1217,6 +1244,16 @@ int cam_flash_i2c_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
|
|||
"Failed in parsing i2c packets");
|
||||
return rc;
|
||||
}
|
||||
if ((fctrl->flash_state == CAM_FLASH_STATE_ACQUIRE) ||
|
||||
(fctrl->flash_state == CAM_FLASH_STATE_CONFIG)) {
|
||||
fctrl->flash_state = CAM_FLASH_STATE_CONFIG;
|
||||
rc = fctrl->func_tbl.apply_setting(fctrl, 1);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_FLASH, "cannot apply fire settings rc = %d", rc);
|
||||
return rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CAM_FLASH_PACKET_OPCODE_NON_REALTIME_SET_OPS: {
|
||||
|
|
@ -1274,6 +1311,29 @@ int cam_flash_i2c_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
|
|||
csl_packet->header.request_id);
|
||||
goto update_req_mgr;
|
||||
}
|
||||
case CAM_FLASH_PACKET_OPCODE_STREAM_OFF: {
|
||||
if (fctrl->streamoff_count > 0)
|
||||
return rc;
|
||||
|
||||
CAM_DBG(CAM_FLASH, "Received Stream off Settings");
|
||||
i2c_data = &(fctrl->i2c_data);
|
||||
fctrl->streamoff_count = fctrl->streamoff_count + 1;
|
||||
i2c_reg_settings = &i2c_data->streamoff_settings;
|
||||
i2c_reg_settings->request_id = 0;
|
||||
i2c_reg_settings->is_settings_valid = 1;
|
||||
offset = (uint32_t *)((uint8_t *)&csl_packet->payload +
|
||||
csl_packet->cmd_buf_offset);
|
||||
cmd_desc = (struct cam_cmd_buf_desc *)(offset);
|
||||
rc = cam_sensor_i2c_command_parser(&fctrl->io_master_info,
|
||||
i2c_reg_settings,
|
||||
cmd_desc, 1, NULL);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_FLASH,
|
||||
"Failed in parsing i2c Stream off packets");
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CAM_ERR(CAM_FLASH, "Wrong Opcode : %d",
|
||||
(csl_packet->header.op_code & 0xFFFFFF));
|
||||
|
|
@ -1837,6 +1897,16 @@ int cam_flash_release_dev(struct cam_flash_ctrl *fctrl)
|
|||
{
|
||||
int rc = 0;
|
||||
|
||||
if (fctrl->i2c_data.streamoff_settings.is_settings_valid == true) {
|
||||
fctrl->i2c_data.streamoff_settings.is_settings_valid = false;
|
||||
rc = delete_request(&fctrl->i2c_data.streamoff_settings);
|
||||
if (rc) {
|
||||
CAM_WARN(CAM_FLASH,
|
||||
"Failed to delete Stream off i2c_setting: %d",
|
||||
rc);
|
||||
}
|
||||
}
|
||||
|
||||
if (fctrl->bridge_intf.device_hdl != 1) {
|
||||
rc = cam_destroy_device_hdl(fctrl->bridge_intf.device_hdl);
|
||||
if (rc)
|
||||
|
|
@ -1847,6 +1917,7 @@ int cam_flash_release_dev(struct cam_flash_ctrl *fctrl)
|
|||
fctrl->bridge_intf.link_hdl = -1;
|
||||
fctrl->bridge_intf.session_hdl = -1;
|
||||
fctrl->last_flush_req = 0;
|
||||
fctrl->streamoff_count = 0;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
|
|||
flash_acq_dev.device_handle;
|
||||
fctrl->bridge_intf.session_hdl =
|
||||
flash_acq_dev.session_handle;
|
||||
fctrl->apply_streamoff = false;
|
||||
|
||||
rc = copy_to_user(u64_to_user_ptr(cmd->handle),
|
||||
&flash_acq_dev,
|
||||
|
|
@ -126,6 +127,7 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
|
|||
CAM_WARN(CAM_FLASH, "Power Down Failed");
|
||||
}
|
||||
|
||||
fctrl->streamoff_count = 0;
|
||||
fctrl->flash_state = CAM_FLASH_STATE_INIT;
|
||||
break;
|
||||
}
|
||||
|
|
@ -165,6 +167,7 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
|
|||
goto release_mutex;
|
||||
}
|
||||
|
||||
fctrl->apply_streamoff = false;
|
||||
fctrl->flash_state = CAM_FLASH_STATE_START;
|
||||
break;
|
||||
}
|
||||
|
|
@ -493,6 +496,7 @@ static int cam_flash_component_bind(struct device *dev,
|
|||
|
||||
INIT_LIST_HEAD(&(fctrl->i2c_data.init_settings.list_head));
|
||||
INIT_LIST_HEAD(&(fctrl->i2c_data.config_settings.list_head));
|
||||
INIT_LIST_HEAD(&(fctrl->i2c_data.streamoff_settings.list_head));
|
||||
for (i = 0; i < MAX_PER_FRAME_ARRAY; i++)
|
||||
INIT_LIST_HEAD(
|
||||
&(fctrl->i2c_data.per_frame[i].list_head));
|
||||
|
|
@ -641,6 +645,7 @@ static int32_t cam_flash_i2c_driver_probe(struct i2c_client *client,
|
|||
|
||||
INIT_LIST_HEAD(&(fctrl->i2c_data.init_settings.list_head));
|
||||
INIT_LIST_HEAD(&(fctrl->i2c_data.config_settings.list_head));
|
||||
INIT_LIST_HEAD(&(fctrl->i2c_data.streamoff_settings.list_head));
|
||||
for (i = 0; i < MAX_PER_FRAME_ARRAY; i++)
|
||||
INIT_LIST_HEAD(&(fctrl->i2c_data.per_frame[i].list_head));
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#define CAM_FLASH_PACKET_OPCODE_INIT 0
|
||||
#define CAM_FLASH_PACKET_OPCODE_SET_OPS 1
|
||||
#define CAM_FLASH_PACKET_OPCODE_NON_REALTIME_SET_OPS 2
|
||||
#define CAM_FLASH_PACKET_OPCODE_STREAM_OFF 3
|
||||
|
||||
struct cam_flash_ctrl;
|
||||
|
||||
|
|
@ -189,6 +190,8 @@ struct cam_flash_func_tbl {
|
|||
* @io_master_info : Information about the communication master
|
||||
* @i2c_data : I2C register settings
|
||||
* @last_flush_req : last request to flush
|
||||
* @streamoff_count : Count to hold the number of times stream off called
|
||||
* @apply_streamoff : variable to store when to apply stream off
|
||||
*/
|
||||
struct cam_flash_ctrl {
|
||||
char device_name[CAM_CTX_DEV_NAME_MAX_LENGTH];
|
||||
|
|
@ -217,6 +220,8 @@ struct cam_flash_ctrl {
|
|||
struct camera_io_master io_master_info;
|
||||
struct i2c_data_settings i2c_data;
|
||||
uint32_t last_flush_req;
|
||||
uint32_t streamoff_count;
|
||||
int32_t apply_streamoff;
|
||||
};
|
||||
|
||||
int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
|
|
@ -477,6 +477,7 @@ static int cam_sync_handle_create(struct cam_private_ioctl_arg *k_ioctl)
|
|||
u64_to_user_ptr(k_ioctl->ioctl_ptr),
|
||||
k_ioctl->size))
|
||||
return -EFAULT;
|
||||
sync_create.name[SYNC_DEBUG_NAME_LEN] = '\0';
|
||||
|
||||
result = cam_sync_create(&sync_create.sync_obj,
|
||||
sync_create.name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue