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

Commit 23be499a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Wait for Arm9 to go to WFI before power collapsing"

parents 88040bb2 aba57cd5
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -3055,6 +3055,8 @@ static void venus_hfi_pm_handler(struct work_struct *work)
{
	int rc = 0;
	u32 ctrl_status = 0;
	int count = 0;
	const int max_tries = 10;
	struct venus_hfi_device *device = list_first_entry(
			&hal_ctxt.dev_head, struct venus_hfi_device, list);
	if (!device) {
@@ -3092,21 +3094,28 @@ static void venus_hfi_pm_handler(struct work_struct *work)
	}

	if (device->last_packet_type != HFI_CMD_SYS_PC_PREP) {
		dprintk(VIDC_DBG,
			"Last command (%#x) is not PC_PREP cmd\n",
		dprintk(VIDC_WARN,
			"Skip PC. Reason: Last packet queued(%#x) is not PC_PREP\n",
			device->last_packet_type);
		goto skip_power_off;
	}

	if (__get_q_size(device, VIDC_IFACEQ_MSGQ_IDX) ||
		__get_q_size(device, VIDC_IFACEQ_CMDQ_IDX)) {
		dprintk(VIDC_DBG, "Cmd/msg queues are not empty\n");
		dprintk(VIDC_WARN,
			"Skip PC. Reason: Cmd/Msg queue not empty\n");
		goto skip_power_off;
	}

	ctrl_status = __read_register(device, VIDC_CPU_CS_SCIACMDARG0);
	if (!(ctrl_status & VIDC_CPU_CS_SCIACMDARG0_HFI_CTRL_PC_READY)) {
		dprintk(VIDC_DBG, "Venus not ready for power collapse (%#x)\n",
	while (!(ctrl_status & BIT(0)) && count < max_tries) {
		ctrl_status = __read_register(device, VIDC_WRAPPER_CPU_STATUS);
		usleep_range(1000, 1500);
		count++;
	}

	if (!(ctrl_status & BIT(0))) {
		dprintk(VIDC_WARN,
			"Skip PC. Reason: Core is not in WFI state (%#x)\n",
			ctrl_status);
		goto skip_power_off;
	}
@@ -3135,8 +3144,6 @@ skip_power_off:

	/* Cancel pending delayed works if any */
	cancel_delayed_work(&venus_hfi_pm_work);
	dprintk(VIDC_WARN, "Power off skipped (last pkt %#x, status: %#x)\n",
		device->last_packet_type, ctrl_status);

exit:
	mutex_unlock(&device->lock);
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -82,7 +82,6 @@
#define VIDC_WRAPPER_HW_VERSION_MINOR_VERSION_MASK  0xFFF0000
#define VIDC_WRAPPER_HW_VERSION_MINOR_VERSION_SHIFT 16
#define VIDC_WRAPPER_HW_VERSION_STEP_VERSION_MASK   0xFFFF

#define VIDC_WRAPPER_CLOCK_CONFIG	(VIDC_WRAPPER_BASE_OFFS + 0x04)

#define VIDC_WRAPPER_INTR_STATUS	(VIDC_WRAPPER_BASE_OFFS + 0x0C)
@@ -113,6 +112,7 @@
#define VIDC_WRAPPER_AXI_HALT		(VIDC_WRAPPER_BASE_OFFS + 0x2008)
#define VIDC_WRAPPER_AXI_HALT_STATUS	(VIDC_WRAPPER_BASE_OFFS + 0x200C)
#define VIDC_WRAPPER_CPU_CGC_DIS	(VIDC_WRAPPER_BASE_OFFS + 0x2010)
#define VIDC_WRAPPER_CPU_STATUS (VIDC_WRAPPER_BASE_OFFS + 0x2014)
#define VIDC_VENUS_VBIF_CLK_ON		(VIDC_VBIF_BASE_OFFS + 0x4)
#define VIDC_VBIF_IN_RD_LIM_CONF0       (VIDC_VBIF_BASE_OFFS + 0xB0)
#define VIDC_VBIF_IN_RD_LIM_CONF1       (VIDC_VBIF_BASE_OFFS + 0xB4)