msm: camera: common: Make msg_cb for cam_subdev generic

The current implementation allows to pass uint_32 as
argument in the message callback. Changing it to (void *)
type so that any type of data can be passed in the future
implementations.

CRs-Fixed: 2847155
Change-Id: Ic52a5ccfe13efdba37bbcfdb7154ed789b1943fd
Signed-off-by: Shardul Bankar <sharbank@codeaurora.org>
This commit is contained in:
Shardul Bankar
2021-08-28 12:43:31 +05:30
parent 13d3e00200
commit dc53926c40
6 changed files with 23 additions and 14 deletions

View File

@@ -3275,6 +3275,7 @@ static int cam_ife_csid_ver1_sof_irq_debug(
bool sof_irq_enable = false; bool sof_irq_enable = false;
struct cam_hw_soc_info *soc_info; struct cam_hw_soc_info *soc_info;
struct cam_ife_csid_ver1_reg_info *csid_reg; struct cam_ife_csid_ver1_reg_info *csid_reg;
uint32_t data_idx;
if (*((uint32_t *)cmd_args) == 1) if (*((uint32_t *)cmd_args) == 1)
sof_irq_enable = true; sof_irq_enable = true;
@@ -3287,6 +3288,7 @@ static int cam_ife_csid_ver1_sof_irq_debug(
return 0; return 0;
} }
data_idx = csid_hw->rx_cfg.phy_sel;
soc_info = &csid_hw->hw_info->soc_info; soc_info = &csid_hw->hw_info->soc_info;
csid_reg = (struct cam_ife_csid_ver1_reg_info *) csid_reg = (struct cam_ife_csid_ver1_reg_info *)
csid_hw->core_info->csid_reg; csid_hw->core_info->csid_reg;
@@ -3353,7 +3355,7 @@ static int cam_ife_csid_ver1_sof_irq_debug(
cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE, cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
CAM_SUBDEV_MESSAGE_IRQ_ERR, CAM_SUBDEV_MESSAGE_IRQ_ERR,
(csid_hw->rx_cfg.phy_sel)); (void *)&data_idx);
return 0; return 0;
} }
@@ -3948,6 +3950,7 @@ static int cam_ife_csid_ver1_rx_bottom_half_handler(
uint32_t event_type = 0; uint32_t event_type = 0;
size_t len = 0; size_t len = 0;
struct cam_hw_soc_info *soc_info; struct cam_hw_soc_info *soc_info;
uint32_t data_idx;
if (!csid_hw || !evt_payload) { if (!csid_hw || !evt_payload) {
CAM_ERR(CAM_ISP, CAM_ERR(CAM_ISP,
@@ -3956,6 +3959,7 @@ static int cam_ife_csid_ver1_rx_bottom_half_handler(
return -EINVAL; return -EINVAL;
} }
data_idx = csid_hw->rx_cfg.phy_sel;
soc_info = &csid_hw->hw_info->soc_info; soc_info = &csid_hw->hw_info->soc_info;
csid_reg = (struct cam_ife_csid_ver1_reg_info *) csid_reg = (struct cam_ife_csid_ver1_reg_info *)
csid_hw->core_info->csid_reg; csid_hw->core_info->csid_reg;
@@ -4067,7 +4071,7 @@ static int cam_ife_csid_ver1_rx_bottom_half_handler(
event_type |= CAM_ISP_HW_ERROR_CSID_FATAL; event_type |= CAM_ISP_HW_ERROR_CSID_FATAL;
cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE, cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
CAM_SUBDEV_MESSAGE_IRQ_ERR, CAM_SUBDEV_MESSAGE_IRQ_ERR,
(csid_hw->rx_cfg.phy_sel)); (void *)&data_idx);
} }
if (event_type) if (event_type)
cam_ife_csid_ver1_handle_event_err(csid_hw, cam_ife_csid_ver1_handle_event_err(csid_hw,

View File

@@ -134,6 +134,7 @@ static int cam_ife_csid_ver2_sof_irq_debug(
struct cam_ife_csid_ver2_path_cfg *path_cfg; struct cam_ife_csid_ver2_path_cfg *path_cfg;
struct cam_isp_resource_node *res; struct cam_isp_resource_node *res;
uint32_t irq_mask[CAM_IFE_CSID_IRQ_REG_MAX] = {0}; uint32_t irq_mask[CAM_IFE_CSID_IRQ_REG_MAX] = {0};
uint32_t data_idx;
if (*((uint32_t *)cmd_args) == 1) if (*((uint32_t *)cmd_args) == 1)
sof_irq_enable = true; sof_irq_enable = true;
@@ -147,6 +148,7 @@ static int cam_ife_csid_ver2_sof_irq_debug(
return 0; return 0;
} }
data_idx = csid_hw->rx_cfg.phy_sel - 1;
csid_reg = (struct cam_ife_csid_ver2_reg_info *) csid_reg = (struct cam_ife_csid_ver2_reg_info *)
csid_hw->core_info->csid_reg; csid_hw->core_info->csid_reg;
@@ -185,8 +187,7 @@ static int cam_ife_csid_ver2_sof_irq_debug(
csid_hw->rx_cfg.phy_sel - 1); csid_hw->rx_cfg.phy_sel - 1);
cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE, cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
CAM_SUBDEV_MESSAGE_IRQ_ERR, CAM_SUBDEV_MESSAGE_IRQ_ERR, (void *)&data_idx);
(csid_hw->rx_cfg.phy_sel - 1));
return 0; return 0;
} }
@@ -952,6 +953,7 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
uint32_t event_type = 0; uint32_t event_type = 0;
uint32_t long_pkt_ftr_val; uint32_t long_pkt_ftr_val;
uint32_t total_crc; uint32_t total_crc;
uint32_t data_idx;
if (!handler_priv || !evt_payload_priv) { if (!handler_priv || !evt_payload_priv) {
CAM_ERR(CAM_ISP, "Invalid params"); CAM_ERR(CAM_ISP, "Invalid params");
@@ -961,6 +963,7 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
payload = evt_payload_priv; payload = evt_payload_priv;
csid_hw = handler_priv; csid_hw = handler_priv;
soc_info = &csid_hw->hw_info->soc_info; soc_info = &csid_hw->hw_info->soc_info;
data_idx = csid_hw->rx_cfg.phy_sel -1;
log_buf = csid_hw->log_buf; log_buf = csid_hw->log_buf;
memset(log_buf, 0, sizeof(csid_hw->log_buf)); memset(log_buf, 0, sizeof(csid_hw->log_buf));
@@ -1106,8 +1109,7 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
if (csid_hw->flags.fatal_err_detected) { if (csid_hw->flags.fatal_err_detected) {
event_type |= CAM_ISP_HW_ERROR_CSID_FATAL; event_type |= CAM_ISP_HW_ERROR_CSID_FATAL;
cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE, cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
CAM_SUBDEV_MESSAGE_IRQ_ERR, CAM_SUBDEV_MESSAGE_IRQ_ERR, (void *)&data_idx);
(csid_hw->rx_cfg.phy_sel -1));
} }
if (event_type) if (event_type)

View File

@@ -3258,6 +3258,7 @@ irqreturn_t cam_tfe_csid_irq(int irq_num, void *data)
uint32_t sof_irq_debug_en = 0, log_en = 0; uint32_t sof_irq_debug_en = 0, log_en = 0;
unsigned long flags; unsigned long flags;
uint32_t i, val, val1; uint32_t i, val, val1;
uint32_t data_idx;
if (!data) { if (!data) {
CAM_ERR(CAM_ISP, "CSID: Invalid arguments"); CAM_ERR(CAM_ISP, "CSID: Invalid arguments");
@@ -3265,6 +3266,7 @@ irqreturn_t cam_tfe_csid_irq(int irq_num, void *data)
} }
csid_hw = (struct cam_tfe_csid_hw *)data; csid_hw = (struct cam_tfe_csid_hw *)data;
data_idx = csid_hw->csi2_rx_cfg.phy_sel - 1;
CAM_DBG(CAM_ISP, "CSID %d IRQ Handling", csid_hw->hw_intf->hw_idx); CAM_DBG(CAM_ISP, "CSID %d IRQ Handling", csid_hw->hw_intf->hw_idx);
csid_reg = csid_hw->csid_info->csid_reg; csid_reg = csid_hw->csid_info->csid_reg;
@@ -3397,8 +3399,7 @@ handle_fatal_error:
/* phy_sel starts from 1 and should never be zero*/ /* phy_sel starts from 1 and should never be zero*/
if (csid_hw->csi2_rx_cfg.phy_sel > 0) { if (csid_hw->csi2_rx_cfg.phy_sel > 0) {
cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE, cam_subdev_notify_message(CAM_CSIPHY_DEVICE_TYPE,
CAM_SUBDEV_MESSAGE_IRQ_ERR, CAM_SUBDEV_MESSAGE_IRQ_ERR, (void *)&data_idx);
(csid_hw->csi2_rx_cfg.phy_sel - 1));
} }
cam_tfe_csid_handle_hw_err_irq(csid_hw, cam_tfe_csid_handle_hw_err_irq(csid_hw,
CAM_ISP_HW_ERROR_CSID_FATAL, irq_status); CAM_ISP_HW_ERROR_CSID_FATAL, irq_status);

View File

@@ -662,7 +662,7 @@ void cam_video_device_cleanup(void)
void cam_subdev_notify_message(u32 subdev_type, void cam_subdev_notify_message(u32 subdev_type,
enum cam_subdev_message_type_t message_type, enum cam_subdev_message_type_t message_type,
uint32_t data) void *data)
{ {
struct v4l2_subdev *sd = NULL; struct v4l2_subdev *sd = NULL;
struct cam_subdev *csd = NULL; struct cam_subdev *csd = NULL;

View File

@@ -65,7 +65,7 @@ struct cam_subdev {
void (*msg_cb)( void (*msg_cb)(
struct v4l2_subdev *sd, struct v4l2_subdev *sd,
enum cam_subdev_message_type_t msg_type, enum cam_subdev_message_type_t msg_type,
uint32_t data); void *data);
struct list_head list; struct list_head list;
enum cam_subdev_close_seq_priority close_seq_prior; enum cam_subdev_close_seq_priority close_seq_prior;
}; };
@@ -82,7 +82,7 @@ struct cam_subdev {
*/ */
void cam_subdev_notify_message(u32 subdev_type, void cam_subdev_notify_message(u32 subdev_type,
enum cam_subdev_message_type_t message_type, enum cam_subdev_message_type_t message_type,
uint32_t data); void *data);
/** /**
* cam_subdev_probe() * cam_subdev_probe()

View File

@@ -16,15 +16,17 @@ static struct dentry *root_dentry;
static void cam_csiphy_subdev_handle_message( static void cam_csiphy_subdev_handle_message(
struct v4l2_subdev *sd, struct v4l2_subdev *sd,
enum cam_subdev_message_type_t message_type, enum cam_subdev_message_type_t message_type,
uint32_t data) void *data)
{ {
struct csiphy_device *csiphy_dev = v4l2_get_subdevdata(sd); struct csiphy_device *csiphy_dev = v4l2_get_subdevdata(sd);
uint32_t data_idx;
switch (message_type) { switch (message_type) {
case CAM_SUBDEV_MESSAGE_IRQ_ERR: case CAM_SUBDEV_MESSAGE_IRQ_ERR:
data_idx = *(uint32_t *)data;
CAM_INFO(CAM_CSIPHY, "subdev index : %d CSIPHY index: %d", CAM_INFO(CAM_CSIPHY, "subdev index : %d CSIPHY index: %d",
csiphy_dev->soc_info.index, data); csiphy_dev->soc_info.index, data_idx);
if (data == csiphy_dev->soc_info.index) { if (data_idx == csiphy_dev->soc_info.index) {
cam_csiphy_common_status_reg_dump(csiphy_dev); cam_csiphy_common_status_reg_dump(csiphy_dev);
if (csiphy_dev->en_full_phy_reg_dump) if (csiphy_dev->en_full_phy_reg_dump)