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

Commit 8b32da87 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: Set "power_enabled" properly in venus HFI"

parents 215077ea c4925d68
Loading
Loading
Loading
Loading
+9 −19
Original line number Diff line number Diff line
@@ -1494,6 +1494,12 @@ static inline int __power_on(struct venus_hfi_device *device)
	if (device->power_enabled)
		return 0;

	/*
	 * Set the flag here to skip __power_on() which is
	 * being called again via *_alloc_set_imem() if imem is enabled
	 */
	device->power_enabled = true;

	dprintk(VIDC_DBG, "Resuming from power collapse\n");
	rc = __vote_buses(device, device->bus_vote.data,
			device->bus_vote.data_count);
@@ -1553,12 +1559,6 @@ static inline int __power_on(struct venus_hfi_device *device)
		goto err_reset_core;
	}

	/*
	 * Set the flag here to skip __power_on() which is
	 * being called again via *_alloc_set_imem() if imem is enabled
	 */
	device->power_enabled = true;

	rc = __alloc_set_imem(device);
	if (rc) {
		dprintk(VIDC_ERR, "Failed to allocate IMEM");
@@ -3818,11 +3818,6 @@ static inline void __disable_unprepare_clks(struct venus_hfi_device *device)
		return;
	}

	if (!device->power_enabled) {
		dprintk(VIDC_DBG, "Clocks already unprepared and disabled\n");
		return;
	}

	venus_hfi_for_each_clock(device, cl) {
		 usleep_range(100, 500);
		dprintk(VIDC_DBG, "Clock: %s disable and unprepare\n",
@@ -3840,11 +3835,6 @@ static inline int __prepare_enable_clks(struct venus_hfi_device *device)
		return -EINVAL;
	}

	if (device->power_enabled) {
		dprintk(VIDC_DBG, "Clocks already prepared and enabled\n");
		return 0;
	}

	venus_hfi_for_each_clock(device, cl) {
		/*
		 * For the clocks we control, set the rate prior to preparing
@@ -4260,6 +4250,8 @@ static int __load_fw(struct venus_hfi_device *device)

	trace_msm_v4l2_vidc_fw_load_start("msm_v4l2_vidc venus_fw load start");

	device->power_enabled = true;

	/* Vote for all hardware resources */
	rc = __vote_buses(device, device->bus_vote.data,
			device->bus_vote.data_count);
@@ -4300,8 +4292,6 @@ static int __load_fw(struct venus_hfi_device *device)
		}
	}

	device->power_enabled = true;

	/* Hand off control of regulators to h/w _after_ enabling clocks */
	__enable_hw_power_collapse(device);

@@ -4316,7 +4306,6 @@ static int __load_fw(struct venus_hfi_device *device)
	trace_msm_v4l2_vidc_fw_load_end("msm_v4l2_vidc venus_fw load end");
	return rc;
fail_protect_mem:
	device->power_enabled = false;
	if (device->resources.fw.cookie)
		subsystem_put(device->resources.fw.cookie);
	device->resources.fw.cookie = NULL;
@@ -4330,6 +4319,7 @@ fail_vote_buses:
fail_init_pkt:
	__deinit_resources(device);
fail_init_res:
	device->power_enabled = false;
	trace_msm_v4l2_vidc_fw_load_end("msm_v4l2_vidc venus_fw load end");
	return rc;
}