Merge tag 'LA.UM.9.12.r1-15200-SMxx50.QSSI13.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel into android13-4.19-kona
"LA.UM.9.12.r1-15200-SMxx50.QSSI13.0" * tag 'LA.UM.9.12.r1-15200-SMxx50.QSSI13.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel: msm: camera: isp: Handle RUP in applied substate msm: camera: sensor: Using low priority queue for init setting msm: camera: common: Add conditions to catch invalid packet data Change-Id: I06c432bbad641facd48e65142398a1898863ea66
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -53,7 +54,9 @@ static int cam_fd_mgr_util_packet_validate(struct cam_packet *packet,
|
||||
}
|
||||
|
||||
/* All buffers must come through io config, do not support patching */
|
||||
if (packet->num_patches || !packet->num_io_configs) {
|
||||
if (packet->num_patches ||
|
||||
!packet->num_io_configs ||
|
||||
!packet->num_cmd_buf) {
|
||||
CAM_ERR(CAM_FD, "wrong number of cmd/patch info: %u %u",
|
||||
packet->num_cmd_buf, packet->num_patches);
|
||||
return -EINVAL;
|
||||
|
||||
@@ -4215,13 +4215,15 @@ static int cam_icp_mgr_pkt_validation(struct cam_packet *packet)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (packet->num_io_configs > IPE_IO_IMAGES_MAX) {
|
||||
if (!packet->num_io_configs ||
|
||||
packet->num_io_configs > IPE_IO_IMAGES_MAX) {
|
||||
CAM_ERR(CAM_ICP, "Invalid number of io configs: %d %d",
|
||||
IPE_IO_IMAGES_MAX, packet->num_io_configs);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (packet->num_cmd_buf > CAM_ICP_CTX_MAX_CMD_BUFFERS) {
|
||||
if (!packet->num_cmd_buf ||
|
||||
packet->num_cmd_buf > CAM_ICP_CTX_MAX_CMD_BUFFERS) {
|
||||
CAM_ERR(CAM_ICP, "Invalid number of cmd buffers: %d %d",
|
||||
CAM_ICP_CTX_MAX_CMD_BUFFERS, packet->num_cmd_buf);
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
@@ -3843,6 +3843,69 @@ static int __cam_isp_ctx_rdi_only_reg_upd_in_bubble_applied_state(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __cam_isp_ctx_rdi_only_reg_upd_in_applied_state(
|
||||
struct cam_isp_context *ctx_isp, void *evt_data)
|
||||
{
|
||||
struct cam_ctx_request *req = NULL;
|
||||
struct cam_context *ctx = ctx_isp->base;
|
||||
struct cam_isp_ctx_req *req_isp;
|
||||
uint64_t request_id = 0;
|
||||
|
||||
if (list_empty(&ctx->wait_req_list)) {
|
||||
CAM_ERR_RATE_LIMIT(CAM_ISP,
|
||||
"Reg upd ack with no waiting req ctx %u active cnt %d",
|
||||
ctx->ctx_id, ctx_isp->active_req_cnt);
|
||||
|
||||
/* move the sub state machine to SOF sub state */
|
||||
ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_SOF;
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_EPOCH;
|
||||
|
||||
req = list_first_entry(&ctx->wait_req_list,
|
||||
struct cam_ctx_request, list);
|
||||
list_del_init(&req->list);
|
||||
|
||||
req_isp = (struct cam_isp_ctx_req *) req->req_priv;
|
||||
|
||||
request_id = (req_isp->hw_update_data.packet_opcode_type ==
|
||||
CAM_ISP_PACKET_INIT_DEV) ? 0 : req->request_id;
|
||||
|
||||
if (req_isp->num_fence_map_out != 0) {
|
||||
list_add_tail(&req->list, &ctx->active_req_list);
|
||||
ctx_isp->active_req_cnt++;
|
||||
request_id = req->request_id;
|
||||
CAM_DBG(CAM_REQ,
|
||||
"move request %lld to active list(cnt = %d), ctx %u",
|
||||
req->request_id, ctx_isp->active_req_cnt, ctx->ctx_id);
|
||||
} else {
|
||||
/* no io config, so the request is completed. */
|
||||
list_add_tail(&req->list, &ctx->free_req_list);
|
||||
CAM_DBG(CAM_ISP,
|
||||
"move active req %lld to free list(cnt = %d), ctx %u",
|
||||
req->request_id, ctx_isp->active_req_cnt, ctx->ctx_id);
|
||||
}
|
||||
|
||||
if (request_id) {
|
||||
ctx_isp->reported_req_id = request_id;
|
||||
__cam_isp_ctx_send_sof_timestamp(ctx_isp, request_id,
|
||||
CAM_REQ_MGR_SOF_EVENT_SUCCESS);
|
||||
}
|
||||
|
||||
CAM_DBG(CAM_ISP, "next Substate[%s] ctx %u",
|
||||
__cam_isp_ctx_substate_val_to_type(ctx_isp->substate_activated),
|
||||
ctx->ctx_id);
|
||||
|
||||
__cam_isp_ctx_update_event_record(ctx_isp, CAM_ISP_CTX_EVENT_RUP, req);
|
||||
|
||||
return 0;
|
||||
end:
|
||||
__cam_isp_ctx_update_event_record(ctx_isp, CAM_ISP_CTX_EVENT_RUP, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cam_isp_ctx_irq_ops
|
||||
cam_isp_ctx_rdi_only_activated_state_machine_irq
|
||||
[CAM_ISP_CTX_ACTIVATED_MAX] = {
|
||||
@@ -3862,7 +3925,7 @@ static struct cam_isp_ctx_irq_ops
|
||||
.irq_ops = {
|
||||
__cam_isp_ctx_handle_error,
|
||||
__cam_isp_ctx_rdi_only_sof_in_applied_state,
|
||||
NULL,
|
||||
__cam_isp_ctx_rdi_only_reg_upd_in_applied_state,
|
||||
NULL,
|
||||
NULL,
|
||||
__cam_isp_ctx_buf_done_in_applied,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
@@ -727,8 +728,9 @@ static int cam_jpeg_mgr_prepare_hw_update(void *hw_mgr_priv,
|
||||
return rc;
|
||||
}
|
||||
|
||||
if ((packet->num_cmd_buf > 5) || !packet->num_patches ||
|
||||
!packet->num_io_configs ||
|
||||
if (!packet->num_cmd_buf ||
|
||||
(packet->num_cmd_buf > 5) ||
|
||||
!packet->num_patches || !packet->num_io_configs ||
|
||||
(packet->num_io_configs > CAM_JPEG_IMAGE_MAX)) {
|
||||
CAM_ERR(CAM_JPEG,
|
||||
"wrong number of cmd/patch/io_configs info: %u %u %u",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -112,6 +113,11 @@ static int cam_lrme_mgr_util_packet_validate(struct cam_packet *packet,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!packet->num_cmd_buf) {
|
||||
CAM_ERR(CAM_LRME, "no cmd bufs");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cmd_desc = (struct cam_cmd_buf_desc *)((uint8_t *)&packet->payload +
|
||||
packet->cmd_buf_offset);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -153,7 +154,7 @@ static int32_t cam_actuator_i2c_modes_util(
|
||||
|
||||
if (i2c_list->op_code == CAM_SENSOR_I2C_WRITE_RANDOM) {
|
||||
rc = camera_io_dev_write(io_master_info,
|
||||
&(i2c_list->i2c_settings));
|
||||
&(i2c_list->i2c_settings), false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_ACTUATOR,
|
||||
"Failed to random write I2C settings: %d",
|
||||
@@ -164,7 +165,7 @@ static int32_t cam_actuator_i2c_modes_util(
|
||||
rc = camera_io_dev_write_continuous(
|
||||
io_master_info,
|
||||
&(i2c_list->i2c_settings),
|
||||
0);
|
||||
0, false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_ACTUATOR,
|
||||
"Failed to seq write I2C settings: %d",
|
||||
@@ -175,7 +176,7 @@ static int32_t cam_actuator_i2c_modes_util(
|
||||
rc = camera_io_dev_write_continuous(
|
||||
io_master_info,
|
||||
&(i2c_list->i2c_settings),
|
||||
1);
|
||||
1, false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_ACTUATOR,
|
||||
"Failed to burst write I2C settings: %d",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -1654,18 +1655,27 @@ static int32_t cam_cci_write(struct v4l2_subdev *sd,
|
||||
case MSM_CCI_I2C_WRITE:
|
||||
case MSM_CCI_I2C_WRITE_SEQ:
|
||||
case MSM_CCI_I2C_WRITE_BURST:
|
||||
for (i = 0; i < NUM_QUEUES; i++) {
|
||||
if (mutex_trylock(&cci_master_info->mutex_q[i])) {
|
||||
rc = cam_cci_i2c_write(sd, c_ctrl, i,
|
||||
MSM_SYNC_DISABLE);
|
||||
mutex_unlock(&cci_master_info->mutex_q[i]);
|
||||
return rc;
|
||||
if (!c_ctrl->force_low_priority) {
|
||||
for (i = 0; i < NUM_QUEUES; i++) {
|
||||
if (mutex_trylock(
|
||||
&cci_master_info->mutex_q[i])) {
|
||||
rc = cam_cci_i2c_write(sd, c_ctrl, i,
|
||||
MSM_SYNC_DISABLE);
|
||||
mutex_unlock(
|
||||
&cci_master_info->mutex_q[i]);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
mutex_lock(&cci_master_info->mutex_q[PRIORITY_QUEUE]);
|
||||
rc = cam_cci_i2c_write(sd, c_ctrl,
|
||||
PRIORITY_QUEUE, MSM_SYNC_DISABLE);
|
||||
mutex_unlock(&cci_master_info->mutex_q[PRIORITY_QUEUE]);
|
||||
} else {
|
||||
mutex_lock(&cci_master_info->mutex_q[SYNC_QUEUE]);
|
||||
rc = cam_cci_i2c_write(sd, c_ctrl,
|
||||
SYNC_QUEUE, MSM_SYNC_DISABLE);
|
||||
mutex_unlock(&cci_master_info->mutex_q[SYNC_QUEUE]);
|
||||
}
|
||||
mutex_lock(&cci_master_info->mutex_q[PRIORITY_QUEUE]);
|
||||
rc = cam_cci_i2c_write(sd, c_ctrl,
|
||||
PRIORITY_QUEUE, MSM_SYNC_DISABLE);
|
||||
mutex_unlock(&cci_master_info->mutex_q[PRIORITY_QUEUE]);
|
||||
break;
|
||||
case MSM_CCI_I2C_WRITE_ASYNC:
|
||||
rc = cam_cci_i2c_write_async(sd, c_ctrl,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_CCI_DEV_H_
|
||||
@@ -284,6 +285,7 @@ struct cam_cci_ctrl {
|
||||
struct cam_cci_wait_sync_cfg cci_wait_sync_cfg;
|
||||
struct cam_cci_gpio_cfg gpio_cfg;
|
||||
} cfg;
|
||||
bool force_low_priority;
|
||||
};
|
||||
|
||||
struct cci_write_async {
|
||||
|
||||
@@ -261,9 +261,22 @@ int32_t cam_cmd_buf_parser(struct csiphy_device *csiphy_dev,
|
||||
return rc;
|
||||
}
|
||||
|
||||
cmd_desc = (struct cam_cmd_buf_desc *)
|
||||
((uint32_t *)&csl_packet->payload +
|
||||
csl_packet->cmd_buf_offset / 4);
|
||||
if (csl_packet->num_cmd_buf)
|
||||
cmd_desc = (struct cam_cmd_buf_desc *)
|
||||
((uint32_t *)&csl_packet->payload +
|
||||
csl_packet->cmd_buf_offset / 4);
|
||||
else {
|
||||
CAM_ERR(CAM_CSIPHY, "num_cmd_buffers = %d",
|
||||
csl_packet->num_cmd_buf);
|
||||
rc = -EINVAL;
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = cam_packet_util_validate_cmd_desc(cmd_desc);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_CSIPHY, "Invalid cmd desc ret: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = cam_mem_get_cpu_buf(cmd_desc->mem_handle,
|
||||
&generic_ptr, &len);
|
||||
|
||||
@@ -65,7 +65,7 @@ static int cam_eeprom_read_memory(struct cam_eeprom_ctrl_t *e_ctrl,
|
||||
i2c_reg_array.delay = emap[j].page.delay;
|
||||
i2c_reg_settings.reg_setting = &i2c_reg_array;
|
||||
rc = camera_io_dev_write(&e_ctrl->io_master_info,
|
||||
&i2c_reg_settings);
|
||||
&i2c_reg_settings, false);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_EEPROM, "page write failed rc %d",
|
||||
rc);
|
||||
@@ -82,7 +82,7 @@ static int cam_eeprom_read_memory(struct cam_eeprom_ctrl_t *e_ctrl,
|
||||
i2c_reg_array.delay = emap[j].pageen.delay;
|
||||
i2c_reg_settings.reg_setting = &i2c_reg_array;
|
||||
rc = camera_io_dev_write(&e_ctrl->io_master_info,
|
||||
&i2c_reg_settings);
|
||||
&i2c_reg_settings, false);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_EEPROM, "page enable failed rc %d",
|
||||
rc);
|
||||
@@ -126,7 +126,7 @@ static int cam_eeprom_read_memory(struct cam_eeprom_ctrl_t *e_ctrl,
|
||||
i2c_reg_array.delay = emap[j].pageen.delay;
|
||||
i2c_reg_settings.reg_setting = &i2c_reg_array;
|
||||
rc = camera_io_dev_write(&e_ctrl->io_master_info,
|
||||
&i2c_reg_settings);
|
||||
&i2c_reg_settings, false);
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_EEPROM,
|
||||
"page disable failed rc %d",
|
||||
@@ -1172,7 +1172,7 @@ static int32_t cam_eeprom_write(struct cam_eeprom_ctrl_t *e_ctrl)
|
||||
&(i2c_set->list_head), list) {
|
||||
rc = camera_io_dev_write_continuous(
|
||||
&e_ctrl->io_master_info,
|
||||
&i2c_list->i2c_settings, 1);
|
||||
&i2c_list->i2c_settings, 1, false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_EEPROM,
|
||||
"Error in EEPROM write");
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -223,7 +224,7 @@ static int cam_ois_apply_settings(struct cam_ois_ctrl_t *o_ctrl,
|
||||
&(i2c_set->list_head), list) {
|
||||
if (i2c_list->op_code == CAM_SENSOR_I2C_WRITE_RANDOM) {
|
||||
rc = camera_io_dev_write(&(o_ctrl->io_master_info),
|
||||
&(i2c_list->i2c_settings));
|
||||
&(i2c_list->i2c_settings), false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_OIS,
|
||||
"Failed in Applying i2c wrt settings");
|
||||
@@ -354,7 +355,7 @@ static int cam_ois_fw_download(struct cam_ois_ctrl_t *o_ctrl)
|
||||
}
|
||||
|
||||
rc = camera_io_dev_write_continuous(&(o_ctrl->io_master_info),
|
||||
&i2c_reg_setting, 1);
|
||||
&i2c_reg_setting, 1, false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_OIS, "OIS FW download failed %d", rc);
|
||||
goto release_firmware;
|
||||
@@ -399,7 +400,7 @@ static int cam_ois_fw_download(struct cam_ois_ctrl_t *o_ctrl)
|
||||
}
|
||||
|
||||
rc = camera_io_dev_write_continuous(&(o_ctrl->io_master_info),
|
||||
&i2c_reg_setting, 1);
|
||||
&i2c_reg_setting, 1, false);
|
||||
if (rc < 0)
|
||||
CAM_ERR(CAM_OIS, "OIS FW download failed %d", rc);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -12,7 +13,6 @@
|
||||
#include "cam_common_util.h"
|
||||
#include "cam_packet_util.h"
|
||||
|
||||
|
||||
static void cam_sensor_update_req_mgr(
|
||||
struct cam_sensor_ctrl_t *s_ctrl,
|
||||
struct cam_packet *csl_packet)
|
||||
@@ -384,7 +384,8 @@ static int32_t cam_sensor_update_i2c_info(struct cam_cmd_i2c_info *i2c_info,
|
||||
|
||||
static int32_t cam_sensor_i2c_modes_util(
|
||||
struct cam_sensor_ctrl_t *s_ctrl,
|
||||
struct i2c_settings_list *i2c_list)
|
||||
struct i2c_settings_list *i2c_list,
|
||||
bool force_low_priority)
|
||||
{
|
||||
int32_t rc = 0;
|
||||
uint32_t i, size;
|
||||
@@ -399,7 +400,8 @@ static int32_t cam_sensor_i2c_modes_util(
|
||||
|
||||
if (i2c_list->op_code == CAM_SENSOR_I2C_WRITE_RANDOM) {
|
||||
rc = camera_io_dev_write(io_master_info,
|
||||
&(i2c_list->i2c_settings));
|
||||
&(i2c_list->i2c_settings),
|
||||
force_low_priority);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to random write I2C settings: %d",
|
||||
@@ -410,7 +412,7 @@ static int32_t cam_sensor_i2c_modes_util(
|
||||
rc = camera_io_dev_write_continuous(
|
||||
io_master_info,
|
||||
&(i2c_list->i2c_settings),
|
||||
0);
|
||||
0, force_low_priority);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to seq write I2C settings: %d",
|
||||
@@ -421,7 +423,7 @@ static int32_t cam_sensor_i2c_modes_util(
|
||||
rc = camera_io_dev_write_continuous(
|
||||
io_master_info,
|
||||
&(i2c_list->i2c_settings),
|
||||
1);
|
||||
1, force_low_priority);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to burst write I2C settings: %d",
|
||||
@@ -1348,6 +1350,7 @@ int cam_sensor_apply_settings(struct cam_sensor_ctrl_t *s_ctrl,
|
||||
uint64_t top = 0, del_req_id = 0;
|
||||
struct i2c_settings_array *i2c_set = NULL;
|
||||
struct i2c_settings_list *i2c_list;
|
||||
bool force_low_priority = false;
|
||||
|
||||
if (req_id == 0) {
|
||||
switch (opcode) {
|
||||
@@ -1357,6 +1360,8 @@ int cam_sensor_apply_settings(struct cam_sensor_ctrl_t *s_ctrl,
|
||||
}
|
||||
case CAM_SENSOR_PACKET_OPCODE_SENSOR_INITIAL_CONFIG: {
|
||||
i2c_set = &s_ctrl->i2c_data.init_settings;
|
||||
force_low_priority =
|
||||
s_ctrl->force_low_priority_for_init_setting;
|
||||
break;
|
||||
}
|
||||
case CAM_SENSOR_PACKET_OPCODE_SENSOR_CONFIG: {
|
||||
@@ -1388,7 +1393,7 @@ int cam_sensor_apply_settings(struct cam_sensor_ctrl_t *s_ctrl,
|
||||
list_for_each_entry(i2c_list,
|
||||
&(i2c_set->list_head), list) {
|
||||
rc = cam_sensor_i2c_modes_util(s_ctrl,
|
||||
i2c_list);
|
||||
i2c_list, force_low_priority);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to apply settings: %d",
|
||||
@@ -1405,7 +1410,7 @@ int cam_sensor_apply_settings(struct cam_sensor_ctrl_t *s_ctrl,
|
||||
list_for_each_entry(i2c_list,
|
||||
&(i2c_set->list_head), list) {
|
||||
rc = cam_sensor_i2c_modes_util(s_ctrl,
|
||||
i2c_list);
|
||||
i2c_list, force_low_priority);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to apply settings: %d",
|
||||
|
||||
@@ -85,6 +85,8 @@ struct intf_params {
|
||||
* @bob_pwm_switch: Boolean flag to switch into PWM mode for BoB regulator
|
||||
* @last_flush_req: Last request to flush
|
||||
* @pipeline_delay: Sensor pipeline delay
|
||||
* @force_low_priority_for_init_setting: Using low priority queue to send
|
||||
* init setting
|
||||
*/
|
||||
struct cam_sensor_ctrl_t {
|
||||
char device_name[CAM_CTX_DEV_NAME_MAX_LENGTH];
|
||||
@@ -112,6 +114,7 @@ struct cam_sensor_ctrl_t {
|
||||
uint32_t last_flush_req;
|
||||
uint16_t pipeline_delay;
|
||||
int32_t open_cnt;
|
||||
bool force_low_priority_for_init_setting;
|
||||
};
|
||||
|
||||
#endif /* _CAM_SENSOR_DEV_H_ */
|
||||
|
||||
@@ -98,6 +98,7 @@ static int32_t cam_sensor_driver_get_dt_data(struct cam_sensor_ctrl_t *s_ctrl)
|
||||
{
|
||||
int32_t rc = 0;
|
||||
int i = 0;
|
||||
uint32_t concurrency_sensors = 0;
|
||||
struct cam_sensor_board_info *sensordata = NULL;
|
||||
struct device_node *of_node = s_ctrl->of_node;
|
||||
struct device_node *of_parent = NULL;
|
||||
@@ -185,6 +186,19 @@ static int32_t cam_sensor_driver_get_dt_data(struct cam_sensor_ctrl_t *s_ctrl)
|
||||
s_ctrl->cci_num = CCI_DEVICE_0;
|
||||
|
||||
CAM_DBG(CAM_SENSOR, "cci-index %d", s_ctrl->cci_num);
|
||||
|
||||
rc = of_property_read_u32(of_node,
|
||||
"concurrency-sensors-on-same-cci",
|
||||
&concurrency_sensors);
|
||||
CAM_DBG(CAM_SENSOR,
|
||||
"sensor %d concurrency_sensors %d, rc %d",
|
||||
soc_info->index, concurrency_sensors, rc);
|
||||
if (rc < 0 || concurrency_sensors < 2) {
|
||||
s_ctrl->force_low_priority_for_init_setting = false;
|
||||
rc = 0;
|
||||
} else
|
||||
s_ctrl->force_low_priority_for_init_setting = true;
|
||||
|
||||
}
|
||||
|
||||
if (of_property_read_u32(of_node, "sensor-position-pitch",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "cam_sensor_cmn_header.h"
|
||||
@@ -96,7 +97,8 @@ int32_t cam_camera_cci_i2c_read_seq(struct cam_sensor_cci_client *cci_client,
|
||||
static int32_t cam_cci_i2c_write_table_cmd(
|
||||
struct camera_io_master *client,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
enum cam_cci_cmd_type cmd)
|
||||
enum cam_cci_cmd_type cmd,
|
||||
bool force_low_priority)
|
||||
{
|
||||
int32_t rc = -EINVAL;
|
||||
struct cam_cci_ctrl cci_ctrl;
|
||||
@@ -117,6 +119,7 @@ static int32_t cam_cci_i2c_write_table_cmd(
|
||||
cci_ctrl.cfg.cci_i2c_write_cfg.data_type = write_setting->data_type;
|
||||
cci_ctrl.cfg.cci_i2c_write_cfg.addr_type = write_setting->addr_type;
|
||||
cci_ctrl.cfg.cci_i2c_write_cfg.size = write_setting->size;
|
||||
cci_ctrl.force_low_priority = force_low_priority;
|
||||
rc = v4l2_subdev_call(client->cci_client->cci_subdev,
|
||||
core, ioctl, VIDIOC_MSM_CCI_CFG, &cci_ctrl);
|
||||
if (rc < 0) {
|
||||
@@ -136,25 +139,27 @@ static int32_t cam_cci_i2c_write_table_cmd(
|
||||
|
||||
int32_t cam_cci_i2c_write_table(
|
||||
struct camera_io_master *client,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting)
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
bool force_low_priority)
|
||||
{
|
||||
return cam_cci_i2c_write_table_cmd(client, write_setting,
|
||||
MSM_CCI_I2C_WRITE);
|
||||
MSM_CCI_I2C_WRITE, force_low_priority);
|
||||
}
|
||||
|
||||
int32_t cam_cci_i2c_write_continuous_table(
|
||||
struct camera_io_master *client,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
uint8_t cam_sensor_i2c_write_flag)
|
||||
uint8_t cam_sensor_i2c_write_flag,
|
||||
bool force_low_priority)
|
||||
{
|
||||
int32_t rc = 0;
|
||||
|
||||
if (cam_sensor_i2c_write_flag == 1)
|
||||
rc = cam_cci_i2c_write_table_cmd(client, write_setting,
|
||||
MSM_CCI_I2C_WRITE_BURST);
|
||||
MSM_CCI_I2C_WRITE_BURST, force_low_priority);
|
||||
else if (cam_sensor_i2c_write_flag == 0)
|
||||
rc = cam_cci_i2c_write_table_cmd(client, write_setting,
|
||||
MSM_CCI_I2C_WRITE_SEQ);
|
||||
MSM_CCI_I2C_WRITE_SEQ, force_low_priority);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_SENSOR_I2C_H_
|
||||
@@ -57,7 +58,8 @@ int32_t cam_camera_cci_i2c_read_seq(struct cam_sensor_cci_client *client,
|
||||
*/
|
||||
int32_t cam_cci_i2c_write_table(
|
||||
struct camera_io_master *client,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting);
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
bool force_low_priority);
|
||||
|
||||
/**
|
||||
* @client: CCI client structure
|
||||
@@ -69,7 +71,8 @@ int32_t cam_cci_i2c_write_table(
|
||||
int32_t cam_cci_i2c_write_continuous_table(
|
||||
struct camera_io_master *client,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
uint8_t cam_sensor_i2c_write_flag);
|
||||
uint8_t cam_sensor_i2c_write_flag,
|
||||
bool force_low_priority);
|
||||
|
||||
/**
|
||||
* @cci_client: CCI client structure
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "cam_sensor_io.h"
|
||||
@@ -116,7 +117,8 @@ int32_t camera_io_dev_read_seq(struct camera_io_master *io_master_info,
|
||||
}
|
||||
|
||||
int32_t camera_io_dev_write(struct camera_io_master *io_master_info,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting)
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
bool force_low_priority)
|
||||
{
|
||||
if (!write_setting || !io_master_info) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
@@ -132,7 +134,7 @@ int32_t camera_io_dev_write(struct camera_io_master *io_master_info,
|
||||
|
||||
if (io_master_info->master_type == CCI_MASTER) {
|
||||
return cam_cci_i2c_write_table(io_master_info,
|
||||
write_setting);
|
||||
write_setting, force_low_priority);
|
||||
} else if (io_master_info->master_type == I2C_MASTER) {
|
||||
return cam_qup_i2c_write_table(io_master_info,
|
||||
write_setting);
|
||||
@@ -148,7 +150,8 @@ int32_t camera_io_dev_write(struct camera_io_master *io_master_info,
|
||||
|
||||
int32_t camera_io_dev_write_continuous(struct camera_io_master *io_master_info,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
uint8_t cam_sensor_i2c_write_flag)
|
||||
uint8_t cam_sensor_i2c_write_flag,
|
||||
bool force_low_priority)
|
||||
{
|
||||
if (!write_setting || !io_master_info) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
@@ -164,7 +167,8 @@ int32_t camera_io_dev_write_continuous(struct camera_io_master *io_master_info,
|
||||
|
||||
if (io_master_info->master_type == CCI_MASTER) {
|
||||
return cam_cci_i2c_write_continuous_table(io_master_info,
|
||||
write_setting, cam_sensor_i2c_write_flag);
|
||||
write_setting, cam_sensor_i2c_write_flag,
|
||||
force_low_priority);
|
||||
} else if (io_master_info->master_type == I2C_MASTER) {
|
||||
return cam_qup_i2c_write_continuous_table(io_master_info,
|
||||
write_setting, cam_sensor_i2c_write_flag);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_SENSOR_IO_H_
|
||||
@@ -78,7 +79,8 @@ int32_t camera_io_release(struct camera_io_master *io_master_info);
|
||||
* This API abstracts write functionality based on master type
|
||||
*/
|
||||
int32_t camera_io_dev_write(struct camera_io_master *io_master_info,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting);
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
bool force_low_priority);
|
||||
|
||||
/**
|
||||
* @io_master_info: I2C/SPI master information
|
||||
@@ -90,7 +92,8 @@ int32_t camera_io_dev_write(struct camera_io_master *io_master_info,
|
||||
*/
|
||||
int32_t camera_io_dev_write_continuous(struct camera_io_master *io_master_info,
|
||||
struct cam_sensor_i2c_reg_setting *write_setting,
|
||||
uint8_t cam_sensor_i2c_write_flag);
|
||||
uint8_t cam_sensor_i2c_write_flag,
|
||||
bool force_low_priority);
|
||||
|
||||
int32_t camera_io_dev_erase(struct camera_io_master *io_master_info,
|
||||
uint32_t addr, uint32_t size);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -724,7 +725,7 @@ int cam_sensor_util_i2c_apply_setting(
|
||||
switch (i2c_list->op_code) {
|
||||
case CAM_SENSOR_I2C_WRITE_RANDOM: {
|
||||
rc = camera_io_dev_write(io_master_info,
|
||||
&(i2c_list->i2c_settings));
|
||||
&(i2c_list->i2c_settings), false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to random write I2C settings: %d",
|
||||
@@ -735,7 +736,8 @@ int cam_sensor_util_i2c_apply_setting(
|
||||
}
|
||||
case CAM_SENSOR_I2C_WRITE_SEQ: {
|
||||
rc = camera_io_dev_write_continuous(
|
||||
io_master_info, &(i2c_list->i2c_settings), 0);
|
||||
io_master_info, &(i2c_list->i2c_settings),
|
||||
0, false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to seq write I2C settings: %d",
|
||||
@@ -746,7 +748,8 @@ int cam_sensor_util_i2c_apply_setting(
|
||||
}
|
||||
case CAM_SENSOR_I2C_WRITE_BURST: {
|
||||
rc = camera_io_dev_write_continuous(
|
||||
io_master_info, &(i2c_list->i2c_settings), 1);
|
||||
io_master_info, &(i2c_list->i2c_settings),
|
||||
1, false);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_SENSOR,
|
||||
"Failed to burst write I2C settings: %d",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
@@ -32,6 +33,12 @@ int cam_packet_util_get_cmd_mem_addr(int handle, uint32_t **buf_addr,
|
||||
|
||||
int cam_packet_util_validate_cmd_desc(struct cam_cmd_buf_desc *cmd_desc)
|
||||
{
|
||||
|
||||
if (!cmd_desc) {
|
||||
CAM_ERR(CAM_UTIL, "Invalid cmd desc");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((cmd_desc->length > cmd_desc->size) ||
|
||||
(cmd_desc->mem_handle <= 0)) {
|
||||
CAM_ERR(CAM_UTIL, "invalid cmd arg %d %d %d %d",
|
||||
@@ -72,6 +79,7 @@ int cam_packet_util_validate_packet(struct cam_packet *packet,
|
||||
pkt_wo_payload = offsetof(struct cam_packet, payload);
|
||||
|
||||
if ((!packet->header.size) ||
|
||||
((size_t)packet->header.size <= pkt_wo_payload) ||
|
||||
((pkt_wo_payload + (size_t)packet->cmd_buf_offset +
|
||||
sum_cmd_desc) > (size_t)packet->header.size) ||
|
||||
((pkt_wo_payload + (size_t)packet->io_configs_offset +
|
||||
@@ -101,6 +109,12 @@ int cam_packet_util_get_kmd_buffer(struct cam_packet *packet,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!packet->num_cmd_buf) {
|
||||
CAM_ERR(CAM_UTIL, "Invalid num_cmd_buf = %d",
|
||||
packet->num_cmd_buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((packet->kmd_cmd_buf_index < 0) ||
|
||||
(packet->kmd_cmd_buf_index >= packet->num_cmd_buf)) {
|
||||
CAM_ERR(CAM_UTIL, "Invalid kmd buf index: %d",
|
||||
|
||||
Reference in New Issue
Block a user