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

Commit fe6db34e authored by Santhosh Behara's avatar Santhosh Behara Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Poll for idle_status bit prior to power collapse



During hardware suspend, host prepares video firmware for
power collapse before waiting for vcodec hardware to go
into idle state.Video firmware expects power collapse
command from host only after the vcodec hardware is
in idle state. Without this, video hardware continues
to process frame with host disabling the clocks.

The change waits for vcodec hardware to go into
idle state before preparing for power collapse.

Change-Id: Ie83c65cfe0bfbcccfcc6b58e0e67faa0d065fc0e
Signed-off-by: default avatarSanthosh Behara <santhoshbehara@codeaurora.org>
parent a4cb23ac
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -154,6 +154,10 @@ static struct msm_vidc_common_data sdm845_common_data[] = {
		.key = "qcom,debug-timeout",
		.value = 0,
	},
	{
		.key = "qcom,enable-idle-indicator",
		.value = 1,
	},
};

static struct msm_vidc_common_data sdm670_common_data_v0[] = {
@@ -205,6 +209,10 @@ static struct msm_vidc_common_data sdm670_common_data_v0[] = {
		.key = "qcom,hw-resp-timeout",
		.value = 1000,
	},
	{
		.key = "qcom,enable-idle-indicator",
		.value = 1,
	},
};

static struct msm_vidc_common_data sdm670_common_data_v1[] = {
@@ -256,6 +264,10 @@ static struct msm_vidc_common_data sdm670_common_data_v1[] = {
		.key = "qcom,hw-resp-timeout",
		.value = 1000,
	},
	{
		.key = "qcom,enable-idle-indicator",
		.value = 1,
	},
};

static struct msm_vidc_efuse_data sdm670_efuse_data[] = {
+14 −6
Original line number Diff line number Diff line
@@ -2747,7 +2747,7 @@ static void venus_hfi_pm_handler(struct work_struct *work)
{
	int rc = 0;
	u32 wfi_status = 0, idle_status = 0, pc_ready = 0;
	int count = 0;
	int pc_count = 0, idle_count = 0;
	const int max_tries = 10;
	struct venus_hfi_device *device = list_first_entry(
			&hal_ctxt.dev_head, struct venus_hfi_device, list);
@@ -2796,8 +2796,16 @@ static void venus_hfi_pm_handler(struct work_struct *work)
				wfi_status);
			goto skip_power_off;
		}
		if (device->res->sys_idle_indicator &&
			!(idle_status & BIT(30))) {
		while (device->res->sys_idle_indicator &&
				idle_count < max_tries) {
			if (idle_status & BIT(30))
				break;
			usleep_range(50, 100);
			idle_status = __read_register(device,
				VIDC_CPU_CS_SCIACMDARG0);
			idle_count++;
		}
		if (idle_count == max_tries) {
			dprintk(VIDC_WARN,
				"Skipping PC as idle_status (%#x) bit not set\n",
				idle_status);
@@ -2810,7 +2818,7 @@ static void venus_hfi_pm_handler(struct work_struct *work)
			goto skip_power_off;
		}

		while (count < max_tries) {
		while (pc_count < max_tries) {
			wfi_status = __read_register(device,
					VIDC_WRAPPER_CPU_STATUS);
			pc_ready = __read_register(device,
@@ -2819,10 +2827,10 @@ static void venus_hfi_pm_handler(struct work_struct *work)
				VIDC_CPU_CS_SCIACMDARG0_HFI_CTRL_PC_READY))
				break;
			usleep_range(150, 250);
			count++;
			pc_count++;
		}

		if (count == max_tries) {
		if (pc_count == max_tries) {
			dprintk(VIDC_ERR,
					"Skip PC. Core is not in right state (%#x, %#x)\n",
					wfi_status, pc_ready);