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

Commit bda2a635 authored by Deva Ramasubramanian's avatar Deva Ramasubramanian
Browse files

msm: vidc: Apply a QOS vote when Venus is active



During video playback, L2 power collapse is occurring far too often to
actually save power.  As such, apply a vote to prevent L2 PC from
occurring.

Change-Id: I1d86b47a1ed9dffb02d099d3158892bf99ed955e
Signed-off-by: default avatarDeva Ramasubramanian <dramasub@codeaurora.org>
parent 4c0e089f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ Optional properties:
           internal persist = 0x200
           internal persist1 = 0x400
           internal cmd queue = 0x800
- qcom,pm-qos-latency-us = The latency used to vote for QOS power manager. This
value is typically max(latencies of every cluster at all power levels) + 1

[Second level nodes]
Context Banks
+3 −0
Original line number Diff line number Diff line
@@ -745,6 +745,9 @@ int read_platform_resources_from_dt(
	res->never_unload_fw = of_property_read_bool(pdev->dev.of_node,
			"qcom,never-unload-fw");

	of_property_read_u32(pdev->dev.of_node,
			"qcom,pm-qos-latency-us", &res->pm_qos_latency_us);

	return rc;

err_setup_legacy_cb:
+1 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ struct msm_vidc_platform_resources {
	const char *fw_name;
	const char *hfi_version;
	bool never_unload_fw;
	uint32_t pm_qos_latency_us;
};

static inline bool is_iommu_present(struct msm_vidc_platform_resources *res)
+14 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <linux/iommu.h>
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/pm_qos.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
@@ -2054,6 +2055,10 @@ static int venus_hfi_core_init(void *device)
	if (rc || __iface_cmdq_write(dev, &version_pkt))
		dprintk(VIDC_WARN, "Failed to send image version pkt to f/w\n");

	if (dev->res->pm_qos_latency_us)
		pm_qos_add_request(&dev->qos, PM_QOS_CPU_DMA_LATENCY,
				dev->res->pm_qos_latency_us);

	mutex_unlock(&dev->lock);
	return rc;
err_core_init:
@@ -2075,8 +2080,11 @@ static int venus_hfi_core_release(void *dev)
	}

	mutex_lock(&device->lock);

	pm_qos_remove_request(&device->qos);
	__set_state(device, VENUS_STATE_DEINIT);
	__unload_fw(device);

	mutex_unlock(&device->lock);

	return rc;
@@ -4110,6 +4118,9 @@ static inline int __suspend(struct venus_hfi_device *device)
	}

	dprintk(VIDC_DBG, "Entering power collapse\n");

	pm_qos_remove_request(&device->qos);

	rc = __tzbsp_set_video_state(TZBSP_VIDEO_STATE_SUSPEND);
	if (rc) {
		dprintk(VIDC_WARN, "Failed to suspend video core %d\n", rc);
@@ -4169,6 +4180,9 @@ static inline int __resume(struct venus_hfi_device *device)
	 */
	__set_threshold_registers(device);

	if (device->res->pm_qos_latency_us)
		pm_qos_add_request(&device->qos, PM_QOS_CPU_DMA_LATENCY,
				device->res->pm_qos_latency_us);
	dprintk(VIDC_INFO, "Resumed from power collapse\n");
	return rc;
err_reset_core:
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/clk.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
#include <linux/spinlock.h>
#include "vmem/vmem.h"
#include "vidc_hfi_api.h"
@@ -247,6 +248,7 @@ struct venus_hfi_device {
	struct hfi_packetization_ops *pkt_ops;
	enum hfi_packetization_type packetization_type;
	struct msm_vidc_cb_info *response_pkt;
	struct pm_qos_request qos;
};

void venus_hfi_delete_device(void *device);