Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d5a72e2 authored by Harsh Shah's avatar Harsh Shah
Browse files

msm: camera: isp: Move event payload to free list in deinit



As a safety check, to prevent any payload leaks from unclean stop,
move all the payloads back to free list on Deinit HW which happens
when the HW is being completely shut and no more processing is required.
Also, in runtime, if ever we run out of payloads, its a fatal error,
since the IRQ will be dropped. Given that there are 256 payloads, unless
there is an IRQ storm causing system freeze or some other deadlock
preventing bottom half to run and return the payload, such an error
should not happen. So changing the error to BUG().

Change-Id: Iffaea4a9fc9aceebcf431aa27d5421aca82d7cc0
Signed-off-by: default avatarHarsh Shah <harshs@codeaurora.org>
parent 8cb6469b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -616,9 +616,9 @@ static void cam_irq_controller_th_processing(
			rc = irq_bh_api->get_bh_payload_func(
				evt_handler->bottom_half, &bh_cmd);
			if (rc || !bh_cmd) {
				CAM_ERR_RATE_LIMIT(CAM_ISP,
					"Can't get bh payload");
				continue;
				CAM_ERR(CAM_ISP,
					"No payload, IRQ handling frozen");
				BUG();
			}
		}

+8 −1
Original line number Diff line number Diff line
@@ -3314,7 +3314,7 @@ static int cam_vfe_bus_deinit_hw(void *hw_priv,
	void *deinit_hw_args, uint32_t arg_size)
{
	struct cam_vfe_bus_ver2_priv    *bus_priv = hw_priv;
	int                              rc = 0;
	int                              rc = 0, i;

	if (!bus_priv) {
		CAM_ERR(CAM_ISP, "Error: Invalid args");
@@ -3343,6 +3343,13 @@ static int cam_vfe_bus_deinit_hw(void *hw_priv,
		bus_priv->irq_handle = 0;
	}

	INIT_LIST_HEAD(&bus_priv->common_data.free_payload_list);
	for (i = 0; i < CAM_VFE_BUS_VER2_PAYLOAD_MAX; i++) {
		INIT_LIST_HEAD(&bus_priv->common_data.evt_payload[i].list);
		list_add_tail(&bus_priv->common_data.evt_payload[i].list,
			&bus_priv->common_data.free_payload_list);
	}

	return rc;
}