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

Commit 2b81902e authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi Committed by Gerrit - the friendly Code Review server
Browse files

msm: limits: Add S1 supply current limiting driver for MSM8909



This driver is a current limit management module to help manage
instantaneous peak current drawn by multiple subsystems on shared
supply. The inputs to the mitigation algorithm are current states
of different subsystems sharing this supply like cpu frequency,
gpu frequency, number of cores online, soc temperature, core leakage,
and modem state. It throttles cpu frequency and limits number of
online cores to reduce the dynamic current so as to keep the total
current drawn from supply in safe limits.

Change-Id: I4592b8be48bad3709e8cfb09da53f23279a8ff9b
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent c121d8aa
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
PMIC supply(S1) current limiting driver(SUPPLY_LM)
=====================================

This driver is a current limit management module to help manage
instantaneous peak current drawn by multiple subsystems on shared
supply. The inputs to the mitigation algorithm are current states
of different subsystems sharing this supply like cpu frequency,
gpu frequency, number of cores online, soc temperature, core leakage,
and modem state. It throttles cpu frequency and limits number of
online cores to reduce the dynamic current so as to keep the total
current drawn from supply in safe limits.

The device tree parameters for SUPPLY_LM driver are:

Required parameters:
- compatible :	Must be "qcom,supply-lm"
- interrupts :	SUPPLY_LM modem to apps interrupt details.
- reg :         Base addresses of the SUPPLY_LM modem interrupt data and
		its size in bytes.
- reg-names :   Name of SUPPLY_LM modem register in reg node.
- qcom,supply-lm-very-hot-temp-range : SUPPLY_LM very hot temperature range
		info. It expects trigger and clear thresholds in order.
- qcom,supply-lm-hot-temp-range : SUPPLY_LM hot temperature range info.
		It expects trigger and clear thresholds in order.
- gpu-dev-opp:	Phandle for gpu dev.
Example:

	qcom,supply-lm {
		compatible = "qcom,supply-lm";
		interrupts = <0 133 4>;
		reg =	<0x01946000 0x8>; /* TCSR_TCSR_S1LM_MODEM_TO_APPS_INT and
					   * TCSR_TCSR_S1LM_MODEM_TO_APPS_INT_DATA */
		reg-names = "intr_reg";
		qcom,supply-lm-very-hot-temp-range = <75 72>;
		qcom,supply-lm-hot-temp-range = <65 62>;
		gpu-dev-opp = <&msm_gpu>;
	};
+9 −0
Original line number Diff line number Diff line
@@ -129,6 +129,15 @@ config THERMAL_MONITOR
	  entity starts running in the userspace. Monitors TSENS temperature
	  and limits the max frequency of the cores.

config SUPPLY_LM_MONITOR
	bool "SUPPLY current monitor driver"
	depends on THERMAL && PM_OPP && CPU_FREQ
	help
	 This enables to monitor power states of different HW blocks
	 including cpu, gpu and modem, number of cores online and SoC
	 temperature. Based on these inputs, the driver throttles
	 apps subsystem.

config SPEAR_THERMAL
	bool "SPEAr thermal sensor driver"
	depends on PLAT_SPEAR
+1 −0
Original line number Diff line number Diff line
@@ -29,3 +29,4 @@ obj-$(CONFIG_THERMAL_QPNP_ADC_TM) += qpnp-adc-tm.o
obj-$(CONFIG_THERMAL_MONITOR)	+= msm_thermal.o msm_thermal-dev.o
obj-$(CONFIG_LIMITS_MONITOR)	+= lmh_interface.o
obj-$(CONFIG_LIMITS_LITE_HW)	+= lmh_lite.o
obj-$(CONFIG_SUPPLY_LM_MONITOR)	+= supply_lm_core.o
+2149 −0

File added.

Preview size limit exceeded, changes collapsed.

+68 −1
Original line number Diff line number Diff line
@@ -19,7 +19,74 @@

#include <linux/tracepoint.h>

#ifdef TRACE_MSM_LMH
#ifdef TRACE_SUPPLY_LM
DECLARE_EVENT_CLASS(supply_lm_scm_ctl,

	TP_PROTO(unsigned int value),

	TP_ARGS(value),

	TP_STRUCT__entry(
		__field(unsigned int, value)
	),

	TP_fast_assign(
		__entry->value = value;
	),

	TP_printk("inp=0x%x", __entry->value)
);

DEFINE_EVENT(supply_lm_scm_ctl, supply_lm_pre_scm,

	TP_PROTO(unsigned int value),

	TP_ARGS(value)
);

DEFINE_EVENT(supply_lm_scm_ctl, supply_lm_post_scm,

	TP_PROTO(unsigned int ret),

	TP_ARGS(ret)
);

DECLARE_EVENT_CLASS(supply_lm_inp_ctl,

	TP_PROTO(unsigned int inp, unsigned int val),

	TP_ARGS(inp, val),

	TP_STRUCT__entry(
		__field(unsigned int, inp)
		__field(unsigned int, val)
	),

	TP_fast_assign(
		__entry->inp = inp;
		__entry->val = val;
	),

	TP_printk("inp=%u val=%u",
		 __entry->inp, __entry->val)
);

DEFINE_EVENT(supply_lm_inp_ctl, supply_lm_inp_start_trig,

	TP_PROTO(unsigned int inp, unsigned int val),

	TP_ARGS(inp, val)
);

DEFINE_EVENT(supply_lm_inp_ctl, supply_lm_inp_end_trig,

	TP_PROTO(unsigned int inp, unsigned int val),

	TP_ARGS(inp, val)
);

#elif defined(TRACE_MSM_LMH)

DECLARE_EVENT_CLASS(msm_lmh_print_sensor_reading,

	TP_PROTO(const char *sensor_name, unsigned int intensity),