mirror of
https://github.com/commaai/agnos-kernel-sdm845.git
synced 2026-06-08 11:24:51 +08:00
Merge "Revert "msm: camera: isp: Select epoch config based on Hardware""
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
408840624e
@@ -212,8 +212,6 @@ static int cam_vfe_camif_resource_start(
|
||||
uint32_t epoch0_irq_mask;
|
||||
uint32_t epoch1_irq_mask;
|
||||
uint32_t computed_epoch_line_cfg;
|
||||
uint32_t camera_hw_version = 0;
|
||||
int rc = 0;
|
||||
|
||||
if (!camif_res) {
|
||||
CAM_ERR(CAM_ISP, "Error! Invalid input arguments");
|
||||
@@ -253,50 +251,16 @@ static int cam_vfe_camif_resource_start(
|
||||
rsrc_data->common_reg->module_ctrl[
|
||||
CAM_VFE_TOP_VER2_MODULE_STATS]->cgc_ovd);
|
||||
|
||||
/* get the HW version */
|
||||
rc = cam_cpas_get_cpas_hw_version(&camera_hw_version);
|
||||
|
||||
if (rc) {
|
||||
CAM_ERR(CAM_ISP, "Couldn't find HW version. rc: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* epoch config */
|
||||
switch (camera_hw_version) {
|
||||
case CAM_CPAS_TITAN_175_V101:
|
||||
case CAM_CPAS_TITAN_175_V100:
|
||||
epoch0_irq_mask = ((rsrc_data->last_line -
|
||||
rsrc_data->first_line) / 2) +
|
||||
rsrc_data->first_line;
|
||||
epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg &
|
||||
0xFFFF;
|
||||
computed_epoch_line_cfg = (epoch0_irq_mask << 16) |
|
||||
epoch1_irq_mask;
|
||||
cam_io_w_mb(computed_epoch_line_cfg,
|
||||
rsrc_data->mem_base +
|
||||
rsrc_data->camif_reg->epoch_irq);
|
||||
CAM_DBG(CAM_ISP, "first_line: %u\n"
|
||||
"last_line: %u\n"
|
||||
"epoch_line_cfg: 0x%x",
|
||||
rsrc_data->first_line,
|
||||
rsrc_data->last_line,
|
||||
computed_epoch_line_cfg);
|
||||
break;
|
||||
case CAM_CPAS_TITAN_170_V100:
|
||||
case CAM_CPAS_TITAN_170_V110:
|
||||
case CAM_CPAS_TITAN_170_V120:
|
||||
cam_io_w_mb(rsrc_data->reg_data->epoch_line_cfg,
|
||||
rsrc_data->mem_base +
|
||||
rsrc_data->camif_reg->epoch_irq);
|
||||
break;
|
||||
default:
|
||||
cam_io_w_mb(rsrc_data->reg_data->epoch_line_cfg,
|
||||
rsrc_data->mem_base +
|
||||
rsrc_data->camif_reg->epoch_irq);
|
||||
CAM_WARN(CAM_ISP, "Hardware version not proper: 0x%x",
|
||||
camera_hw_version);
|
||||
break;
|
||||
}
|
||||
epoch0_irq_mask = ((rsrc_data->last_line - rsrc_data->first_line) / 2) +
|
||||
rsrc_data->first_line;
|
||||
epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg & 0xFFFF;
|
||||
computed_epoch_line_cfg = (epoch0_irq_mask << 16) | epoch1_irq_mask;
|
||||
cam_io_w_mb(computed_epoch_line_cfg,
|
||||
rsrc_data->mem_base + rsrc_data->camif_reg->epoch_irq);
|
||||
CAM_DBG(CAM_ISP, "first_line:%u last_line:%u epoch_line_cfg: 0x%x",
|
||||
rsrc_data->first_line, rsrc_data->last_line,
|
||||
computed_epoch_line_cfg);
|
||||
|
||||
camif_res->res_state = CAM_ISP_RESOURCE_STATE_STREAMING;
|
||||
|
||||
|
||||
54
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_dev.c
Normal file → Executable file
54
drivers/media/platform/msm/camera/cam_req_mgr/cam_req_mgr_dev.c
Normal file → Executable file
@@ -26,11 +26,15 @@
|
||||
#include "cam_mem_mgr.h"
|
||||
#include "cam_debug_util.h"
|
||||
#include <linux/slub_def.h>
|
||||
#include <linux/pm_qos.h>
|
||||
|
||||
#define CAM_REQ_MGR_EVENT_MAX 30
|
||||
#define CAMERA_DISABLE_PC_LATENCY 100
|
||||
#define CAMERA_ENABLE_PC_LATENCY PM_QOS_DEFAULT_VALUE
|
||||
|
||||
static struct cam_req_mgr_device g_dev;
|
||||
struct kmem_cache *g_cam_req_mgr_timer_cachep;
|
||||
static struct pm_qos_request cam_pm_qos_request;
|
||||
|
||||
static int cam_media_device_setup(struct device *dev)
|
||||
{
|
||||
@@ -97,12 +101,39 @@ static void cam_v4l2_device_cleanup(void)
|
||||
g_dev.v4l2_dev = NULL;
|
||||
}
|
||||
|
||||
static void cam_pm_qos_add_request(void)
|
||||
{
|
||||
pm_qos_add_request(&cam_pm_qos_request, PM_QOS_CPU_DMA_LATENCY,
|
||||
PM_QOS_DEFAULT_VALUE);
|
||||
}
|
||||
|
||||
static void cam_pm_qos_remove_request(void)
|
||||
{
|
||||
CAM_INFO(CAM_SENSOR, "%s: remove request", __func__);
|
||||
pm_qos_remove_request(&cam_pm_qos_request);
|
||||
}
|
||||
|
||||
static void cam_pm_qos_update_request(int val) {
|
||||
CAM_INFO(CAM_SENSOR, "%s: update request %d", __func__, val);
|
||||
pm_qos_update_request(&cam_pm_qos_request, val);
|
||||
}
|
||||
|
||||
static int cam_req_mgr_open(struct file *filep)
|
||||
{
|
||||
int rc;
|
||||
|
||||
mutex_lock(&g_dev.cam_lock);
|
||||
if (g_dev.open_cnt >= 1) {
|
||||
|
||||
g_dev.open_cnt++;
|
||||
|
||||
if (g_dev.open_cnt == 1) {
|
||||
CAM_INFO(CAM_CRM, "%s:%d disalbe lpm", __func__, __LINE__);
|
||||
/* register msm_v4l2_pm_qos_request */
|
||||
cam_pm_qos_add_request();
|
||||
cam_pm_qos_update_request(CAMERA_DISABLE_PC_LATENCY);
|
||||
}
|
||||
|
||||
if (g_dev.open_cnt > 1) {
|
||||
rc = -EALREADY;
|
||||
goto end;
|
||||
}
|
||||
@@ -117,10 +148,8 @@ static int cam_req_mgr_open(struct file *filep)
|
||||
g_dev.cam_eventq = filep->private_data;
|
||||
spin_unlock_bh(&g_dev.cam_eventq_lock);
|
||||
|
||||
g_dev.open_cnt++;
|
||||
rc = cam_mem_mgr_init();
|
||||
if (rc) {
|
||||
g_dev.open_cnt--;
|
||||
CAM_ERR(CAM_CRM, "mem mgr init failed");
|
||||
goto mem_mgr_init_fail;
|
||||
}
|
||||
@@ -131,6 +160,12 @@ static int cam_req_mgr_open(struct file *filep)
|
||||
mem_mgr_init_fail:
|
||||
v4l2_fh_release(filep);
|
||||
end:
|
||||
if (g_dev.open_cnt <= 1) {
|
||||
/* remove msm_v4l2_pm_qos_request */
|
||||
cam_pm_qos_update_request(CAMERA_ENABLE_PC_LATENCY);
|
||||
cam_pm_qos_remove_request();
|
||||
}
|
||||
g_dev.open_cnt--;
|
||||
mutex_unlock(&g_dev.cam_lock);
|
||||
return rc;
|
||||
}
|
||||
@@ -164,8 +199,13 @@ static int cam_req_mgr_close(struct file *filep)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
g_dev.open_cnt--;
|
||||
if (g_dev.open_cnt > 0) {
|
||||
CAM_ERR(CAM_CRM, "%s:%d open_cnt %d", __func__, __LINE__, g_dev.open_cnt);
|
||||
mutex_unlock(&g_dev.cam_lock);
|
||||
return 0;
|
||||
}
|
||||
cam_req_mgr_handle_core_shutdown();
|
||||
|
||||
list_for_each_entry(sd, &g_dev.v4l2_dev->subdevs, list) {
|
||||
if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE))
|
||||
continue;
|
||||
@@ -176,7 +216,6 @@ static int cam_req_mgr_close(struct file *filep)
|
||||
}
|
||||
}
|
||||
|
||||
g_dev.open_cnt--;
|
||||
v4l2_fh_release(filep);
|
||||
|
||||
spin_lock_bh(&g_dev.cam_eventq_lock);
|
||||
@@ -185,6 +224,11 @@ static int cam_req_mgr_close(struct file *filep)
|
||||
|
||||
cam_req_mgr_util_free_hdls();
|
||||
cam_mem_mgr_deinit();
|
||||
|
||||
CAM_INFO(CAM_CRM, "%s:%d enable lpm", __func__, __LINE__);
|
||||
cam_pm_qos_update_request(CAMERA_ENABLE_PC_LATENCY);
|
||||
/* remove msm_v4l2_pm_qos_request */
|
||||
cam_pm_qos_remove_request();
|
||||
mutex_unlock(&g_dev.cam_lock);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -261,9 +261,10 @@ static int cam_eeprom_i2c_driver_remove(struct i2c_client *client)
|
||||
for (i = 0; i < soc_info->num_clk; i++)
|
||||
devm_clk_put(soc_info->dev, soc_info->clk[i]);
|
||||
|
||||
if (soc_private)
|
||||
kfree(soc_private);
|
||||
|
||||
mutex_destroy(&(e_ctrl->eeprom_mutex));
|
||||
kfree(soc_private);
|
||||
kfree(e_ctrl->io_master_info.cci_client);
|
||||
v4l2_set_subdevdata(&e_ctrl->v4l2_dev_str.sd, NULL);
|
||||
kfree(e_ctrl);
|
||||
|
||||
return 0;
|
||||
@@ -394,6 +395,8 @@ static int cam_eeprom_spi_driver_remove(struct spi_device *sdev)
|
||||
kfree(soc_private->power_info.gpio_num_info);
|
||||
kfree(soc_private);
|
||||
}
|
||||
mutex_destroy(&(e_ctrl->eeprom_mutex));
|
||||
v4l2_set_subdevdata(&e_ctrl->v4l2_dev_str.sd, NULL);
|
||||
kfree(e_ctrl);
|
||||
|
||||
return 0;
|
||||
@@ -489,8 +492,11 @@ static int cam_eeprom_platform_driver_remove(struct platform_device *pdev)
|
||||
for (i = 0; i < soc_info->num_clk; i++)
|
||||
devm_clk_put(soc_info->dev, soc_info->clk[i]);
|
||||
|
||||
mutex_destroy(&(e_ctrl->eeprom_mutex));
|
||||
kfree(soc_info->soc_private);
|
||||
kfree(e_ctrl->io_master_info.cci_client);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
v4l2_set_subdevdata(&e_ctrl->v4l2_dev_str.sd, NULL);
|
||||
kfree(e_ctrl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user