Browse Source

msm: camera: isp: Replace bit shift with mask for Bus comp groups

In current code, composite done values are stored as shift values and
converted to mask in the driver logic. This causes redundant operations
in the code as the masks are static values.
This commit replaces the bit shift values with masks so that they
can be converted at the compile time thereby reducing some CPU
execution cycles during start and IRQ handlers.

CRs-Fixed: 3321317
Change-Id: I1507b4dbee4855ad866f69ed16b0b9dafe0a4e99
Signed-off-by: Gaurav Jindal <[email protected]>
Gaurav Jindal 2 years ago
parent
commit
2728cb90e2

+ 3 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/cam_sfe680.h

@@ -1292,8 +1292,9 @@ static struct cam_sfe_bus_wr_hw_info sfe680_bus_wr_hw_info = {
 		},
 	},
 	.constraint_error_info = &sfe680_bus_wr_constraint_error_info,
-	.comp_done_shift = {
-		17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+	.comp_done_mask = {
+		BIT(17), BIT(18), BIT(19), BIT(20), BIT(21), BIT(22), BIT(23),
+		BIT(24), BIT(25), BIT(26),
 	},
 	.num_comp_grp          = 10,
 	.line_done_cfg         = 0x11,

+ 3 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/cam_sfe780.h

@@ -1672,8 +1672,9 @@ static struct cam_sfe_bus_wr_hw_info sfe780_bus_wr_hw_info = {
 		},
 	},
 	.constraint_error_info = &sfe780_bus_wr_constraint_error_info,
-	.comp_done_shift = {
-		17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+	.comp_done_mask = {
+		BIT(17), BIT(18), BIT(19), BIT(20), BIT(21), BIT(22), BIT(23),
+		BIT(24), BIT(25), BIT(26),
 	},
 	.num_comp_grp              = 10,
 	.line_done_cfg             = 0x11,

+ 3 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/cam_sfe880.h

@@ -1765,8 +1765,9 @@ static struct cam_sfe_bus_wr_hw_info sfe880_bus_wr_hw_info = {
 		},
 	},
 	.constraint_error_info = &sfe880_bus_wr_constraint_error_info,
-	.comp_done_shift = {
-		17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 22,
+	.comp_done_mask = {
+		BIT(17), BIT(18), BIT(19), BIT(20), BIT(21),  BIT(23),
+		BIT(24), BIT(25), BIT(26), BIT(27), BIT(22),
 	},
 	.num_comp_grp           = 11,
 	.line_done_cfg          = 0x11,

+ 5 - 5
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/sfe_bus/cam_sfe_bus_wr.c

@@ -143,7 +143,7 @@ struct cam_sfe_bus_wr_wm_resource_data {
 
 struct cam_sfe_bus_wr_comp_grp_data {
 	enum cam_sfe_bus_wr_comp_grp_type          comp_grp_type;
-	uint32_t                                   comp_done_shift;
+	uint32_t                                   comp_done_mask;
 	struct cam_sfe_bus_wr_common_data         *common_data;
 
 	uint32_t                                   is_master;
@@ -1249,7 +1249,7 @@ static int cam_sfe_bus_start_comp_grp(
 		return 0;
 
 	/* CSID buf done register */
-	bus_irq_reg_mask[0] = BIT(rsrc_data->comp_done_shift);
+	bus_irq_reg_mask[0] = rsrc_data->comp_done_mask;
 
 	CAM_DBG(CAM_SFE, "Start Done SFE:%d comp_grp:%d buf_done_mask:0x%x",
 		rsrc_data->common_data->core_index,
@@ -1290,7 +1290,7 @@ static int cam_sfe_bus_wr_init_comp_grp(uint32_t index,
 	rsrc_data->comp_grp_type   = index;
 	rsrc_data->common_data     = &bus_priv->common_data;
 	rsrc_data->dual_slave_core = CAM_SFE_CORE_MAX;
-	rsrc_data->comp_done_shift = hw_info->comp_done_shift[index];
+	rsrc_data->comp_done_mask = hw_info->comp_done_mask[index];
 
 	list_add_tail(&comp_grp->list, &bus_priv->free_comp_grp);
 
@@ -1810,7 +1810,7 @@ static int cam_sfe_bus_handle_sfe_out_done_top_half(
 
 	status_0 = th_payload->evt_status_arr[CAM_SFE_IRQ_BUS_WR_REG_STATUS0];
 
-	if (status_0 & BIT(resource_data->comp_done_shift)) {
+	if (status_0 & resource_data->comp_done_mask) {
 		trace_cam_log_event("bufdone", "bufdone_IRQ",
 			status_0, resource_data->comp_grp_type);
 	}
@@ -1842,7 +1842,7 @@ static int cam_sfe_bus_handle_comp_done_bottom_half(
 	cam_sfe_irq_regs = evt_payload->irq_reg_val;
 	status_0 = cam_sfe_irq_regs[CAM_SFE_IRQ_BUS_WR_REG_STATUS0];
 
-	if (status_0 & BIT(rsrc_data->comp_done_shift)) {
+	if (status_0 & rsrc_data->comp_done_mask) {
 		evt_payload->evt_id = CAM_ISP_HW_EVENT_DONE;
 		rc = CAM_SFE_IRQ_STATUS_SUCCESS;
 	}

+ 2 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/sfe_bus/cam_sfe_bus_wr.h

@@ -177,7 +177,7 @@ struct cam_sfe_bus_sfe_out_hw_info {
  * @bus_client_reg:            Bus client register info
  * @sfe_out_hw_info:           SFE output capability
  * @constraint_error_info:     Constraint Error information
- * @comp_done_shift:           List of buf done mask shift values for
+ * @comp_done_mask:           List of buf done mask shift values for
  *                             each comp grp
  * @num_comp_grp:              Number of composite groups
  * @line_done_cfg:             Line done cfg for wr/rd sync
@@ -198,7 +198,7 @@ struct cam_sfe_bus_wr_hw_info {
 		sfe_out_hw_info[CAM_SFE_BUS_SFE_OUT_MAX];
 	struct cam_sfe_bus_wr_constraint_error_info
 		*constraint_error_info;
-	uint32_t comp_done_shift[CAM_SFE_BUS_WR_COMP_GRP_MAX];
+	uint32_t comp_done_mask[CAM_SFE_BUS_WR_COMP_GRP_MAX];
 	uint32_t num_comp_grp;
 	uint32_t line_done_cfg;
 	uint32_t top_irq_shift;

+ 4 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe480.h

@@ -1604,8 +1604,10 @@ static struct cam_vfe_bus_ver3_hw_info vfe480_bus_hw_info = {
 	},
 
 	.num_comp_grp    = 14,
-	.comp_done_shift = {
-		6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+	.comp_done_mask = {
+		BIT(6), BIT(7), BIT(8), BIT(9), BIT(10),
+		BIT(11), BIT(12), BIT(13), BIT(14),
+		BIT(15), BIT(16), BIT(17), BIT(18), BIT(19),
 	},
 	.top_irq_shift   = 7,
 	.support_consumed_addr = true,

+ 5 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe680.h

@@ -2237,8 +2237,11 @@ static struct cam_vfe_bus_ver3_hw_info vfe680_bus_hw_info = {
 	},
 	.num_comp_grp          = 17,
 	.support_consumed_addr = true,
-	.comp_done_shift = {
-		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+	.comp_done_mask = {
+		BIT(0), BIT(1), BIT(2), BIT(3),
+		BIT(4), BIT(5), BIT(6), BIT(7),
+		BIT(8), BIT(9), BIT(10), BIT(11),
+		BIT(12), BIT(13), BIT(14), BIT(15), BIT(16),
 	},
 	.top_irq_shift         = 0,
 	.max_out_res           = CAM_ISP_IFE_OUT_RES_BASE + 33,

+ 4 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe780.h

@@ -2269,8 +2269,10 @@ static struct cam_vfe_bus_ver3_hw_info vfe780_bus_hw_info = {
 	},
 	.num_comp_grp          = 15,
 	.support_consumed_addr = true,
-	.comp_done_shift = {
-		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16,
+	.comp_done_mask = {
+		BIT(0), BIT(1), BIT(2), BIT(3), BIT(4),
+		BIT(5), BIT(6), BIT(7), BIT(8), BIT(9), BIT(10),
+		BIT(13), BIT(14), BIT(15), BIT(16),
 	},
 	.top_irq_shift         = 0,
 	.max_out_res           = CAM_ISP_IFE_OUT_RES_BASE + 36,

+ 5 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe880.h

@@ -2359,8 +2359,11 @@ static struct cam_vfe_bus_ver3_hw_info vfe880_bus_hw_info = {
 	},
 	.num_comp_grp          = 16,
 	.support_consumed_addr = true,
-	.comp_done_shift = {
-		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 11,
+	.comp_done_mask = {
+		BIT(0), BIT(1), BIT(2), BIT(3), BIT(4),
+		BIT(5), BIT(6), BIT(7), BIT(8),
+		BIT(9), BIT(10), BIT(13),
+		BIT(14), BIT(15), BIT(16), BIT(11),
 	},
 	.top_irq_shift         = 0,
 	.max_out_res           = CAM_ISP_IFE_OUT_RES_BASE + 37,

+ 2 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite48x.h

@@ -428,8 +428,8 @@ static struct cam_vfe_bus_ver3_hw_info vfe48x_bus_hw_info = {
 		},
 	},
 	.num_comp_grp    = 4,
-	.comp_done_shift = {
-		4, 5, 6, 7,
+	.comp_done_mask = {
+		BIT(4), BIT(5), BIT(6), BIT(7),
 	},
 	.top_irq_shift   = 4,
 	.support_consumed_addr = true,

+ 2 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite68x.h

@@ -553,8 +553,8 @@ static struct cam_vfe_bus_ver3_hw_info vfe680x_bus_hw_info = {
 	},
 	.num_comp_grp    = 5,
 	.support_consumed_addr = true,
-	.comp_done_shift = {
-		0, 1, 2, 3, 4,
+	.comp_done_mask = {
+		BIT(0), BIT(1), BIT(2), BIT(3), BIT(4),
 	},
 	.top_irq_shift   = 0,
 	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 33,

+ 2 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite78x.h

@@ -548,8 +548,8 @@ static struct cam_vfe_bus_ver3_hw_info vfe_lite78x_bus_hw_info = {
 	},
 	.num_comp_grp    = 5,
 	.support_consumed_addr = true,
-	.comp_done_shift = {
-		0, 1, 2, 3, 4,
+	.comp_done_mask = {
+		BIT(0), BIT(1), BIT(2), BIT(3), BIT(4),
 	},
 	.top_irq_shift   = 0,
 	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 34,

+ 2 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite88x.h

@@ -455,8 +455,8 @@ static struct cam_vfe_bus_ver3_hw_info vfe_lite88x_bus_hw_info = {
 	},
 	.num_comp_grp    = 5,
 	.support_consumed_addr = true,
-	.comp_done_shift = {
-		0, 1, 2, 3, 4,
+	.comp_done_mask = {
+		BIT(0), BIT(1), BIT(2), BIT(3), BIT(4),
 	},
 	.top_irq_shift   = 0,
 	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 34,

+ 5 - 5
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c

@@ -160,7 +160,7 @@ struct cam_vfe_bus_ver3_comp_grp_data {
 	struct cam_vfe_bus_ver3_common_data         *common_data;
 
 	uint64_t                                     composite_mask;
-	uint32_t                                     comp_done_shift;
+	uint32_t                                     comp_done_mask;
 	uint32_t                                     is_master;
 	uint32_t                                     is_dual;
 	uint32_t                                     dual_slave_core;
@@ -1814,7 +1814,7 @@ skip_comp_cfg:
 			common_data->common_reg->ubwc_static_ctrl);
 	}
 
-	bus_irq_reg_mask[CAM_VFE_BUS_VER3_IRQ_REG0] = BIT(rsrc_data->comp_done_shift);
+	bus_irq_reg_mask[CAM_VFE_BUS_VER3_IRQ_REG0] = rsrc_data->comp_done_mask;
 
 	CAM_DBG(CAM_ISP, "Start Done VFE:%d comp_grp:%d bus_irq_mask_0: 0x%X",
 		rsrc_data->common_data->core_index,
@@ -1865,7 +1865,7 @@ static int cam_vfe_bus_ver3_handle_comp_done_bottom_half(
 	cam_ife_irq_regs = evt_payload->irq_reg_val;
 	status_0 = cam_ife_irq_regs[CAM_IFE_IRQ_BUS_VER3_REG_STATUS0];
 
-	if (status_0 & BIT(rsrc_data->comp_done_shift)) {
+	if (status_0 & rsrc_data->comp_done_mask) {
 		evt_payload->evt_id = CAM_ISP_HW_EVENT_DONE;
 		rc = CAM_VFE_IRQ_STATUS_SUCCESS;
 	}
@@ -1902,7 +1902,7 @@ static int cam_vfe_bus_ver3_init_comp_grp(uint32_t index,
 	rsrc_data->comp_grp_type   = index;
 	rsrc_data->common_data     = &ver3_bus_priv->common_data;
 	rsrc_data->dual_slave_core = CAM_VFE_BUS_VER3_VFE_CORE_MAX;
-	rsrc_data->comp_done_shift = ver3_hw_info->comp_done_shift[index];
+	rsrc_data->comp_done_mask = ver3_hw_info->comp_done_mask[index];
 
 	if (rsrc_data->comp_grp_type != CAM_VFE_BUS_VER3_COMP_GRP_0 &&
 		rsrc_data->comp_grp_type != CAM_VFE_BUS_VER3_COMP_GRP_1)
@@ -2402,7 +2402,7 @@ static int cam_vfe_bus_ver3_handle_vfe_out_done_top_half(uint32_t evt_id,
 
 	status_0 = th_payload->evt_status_arr[CAM_IFE_IRQ_BUS_VER3_REG_STATUS0];
 
-	if (status_0 & BIT(resource_data->comp_done_shift)) {
+	if (status_0 & resource_data->comp_done_mask) {
 		trace_cam_log_event("bufdone", "bufdone_IRQ",
 			status_0, resource_data->comp_grp_type);
 	}

+ 2 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.h

@@ -212,7 +212,7 @@ struct cam_vfe_bus_ver3_vfe_out_hw_info {
  * @num_cons_err:          Number of constraint errors in list
  * @constraint_error_list: Static list of all constraint errors
  * @num_comp_grp:          Number of composite groups
- * @comp_done_shift:       Mask shift for comp done mask
+ * @comp_done_mask:       Mask shift for comp done mask
  * @top_irq_shift:         Mask shift for top level BUS WR irq
  * @support_consumed_addr: Indicate if bus support consumed address
  * @max_out_res:           Max vfe out resource value supported for hw
@@ -233,7 +233,7 @@ struct cam_vfe_bus_ver3_hw_info {
 	struct cam_vfe_constraint_error_info
 		constraint_error_list[CAM_VFE_BUS_VER3_CONS_ERR_MAX];
 	uint32_t num_comp_grp;
-	uint32_t comp_done_shift[CAM_VFE_BUS_VER3_COMP_GRP_MAX];
+	uint32_t comp_done_mask[CAM_VFE_BUS_VER3_COMP_GRP_MAX];
 	uint32_t top_irq_shift;
 	bool support_consumed_addr;
 	uint32_t max_out_res;