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

Commit 913d6989 authored by Vikash Garodia's avatar Vikash Garodia
Browse files

msm: vidc: Unset mem core for unused clocks



For a SDM670 SKU, one video core is disabled. The
memory associated with the disable core remains
ON as the associated clock keeps it ON. Set the
clock flags to disable the mem_core for disable
video core.

Change-Id: Ife973b25d247d8b562372c87d7b59f8a583f8365
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent b851c923
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
enum clock_properties {
	CLOCK_PROP_HAS_SCALING = 1 << 0,
	CLOCK_PROP_HAS_MEM_RETENTION    = 1 << 1,
	CLOCK_PROP_DISABLE_MEMCORE_ONLY = 1 << 2,
};

#define PERF_GOV "performance"
@@ -666,6 +667,11 @@ static int msm_vidc_load_clock_table(
		else
			vc->has_mem_retention = false;

		if (clock_props[c] & CLOCK_PROP_DISABLE_MEMCORE_ONLY)
			vc->disable_memcore_only = true;
		else
			vc->disable_memcore_only = false;

		dprintk(VIDC_DBG, "Found clock %s: scale-able = %s\n", vc->name,
			vc->count ? "yes" : "no");
	}
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018, 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
@@ -90,6 +90,7 @@ struct clock_info {
	u32 count;
	bool has_scaling;
	bool has_mem_retention;
	bool disable_memcore_only;
};

struct clock_set {
+11 −0
Original line number Diff line number Diff line
@@ -1097,6 +1097,8 @@ static int __set_clocks(struct venus_hfi_device *device, u32 freq)
	int rc = 0;

	venus_hfi_for_each_clock(device, cl) {
		if (cl->disable_memcore_only)
			continue;
		if (cl->has_scaling) {/* has_scaling */
			device->clk_freq = freq;
			rc = clk_set_rate(cl->clk, freq);
@@ -3362,6 +3364,8 @@ static inline void __disable_unprepare_clks(struct venus_hfi_device *device)
	}

	venus_hfi_for_each_clock_reverse(device, cl) {
		if (cl->disable_memcore_only)
			continue;
		dprintk(VIDC_DBG, "Clock: %s disable and unprepare\n",
				cl->name);
		rc = clk_set_flags(cl->clk, CLKFLAG_NORETAIN_PERIPH);
@@ -3391,6 +3395,11 @@ static inline int __prepare_enable_clks(struct venus_hfi_device *device)
	}

	venus_hfi_for_each_clock(device, cl) {
		/* MEM CORE is ON by default. Unset it for unused clocks*/
		if (cl->disable_memcore_only) {
			clk_set_flags(cl->clk, CLKFLAG_NORETAIN_MEM);
			continue;
		}
		/*
		 * For the clocks we control, set the rate prior to preparing
		 * them.  Since we don't really have a load at this point, scale
@@ -3428,6 +3437,8 @@ static inline int __prepare_enable_clks(struct venus_hfi_device *device)

fail_clk_enable:
	venus_hfi_for_each_clock_reverse_continue(device, cl, c) {
		if (cl->disable_memcore_only)
			continue;
		dprintk(VIDC_ERR, "Clock: %s disable and unprepare\n",
			cl->name);
		clk_disable_unprepare(cl->clk);