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

Commit e15ff1bc authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu
Browse files

soc: qcom: ignore identical thermal state callbacks for CDSP



CDSP and HVX based cooling devices from cdsprm module forward
the thermal state requests to CDSP subsystem. Thermal throttle
driver samples tsens post suspend-resume and sends desired
thermal state to all registered cooling devices. CDSP and HVX
cooling devices don't check if the same thermal state has been
sent by throttle driver, this results in unnecessary rpmsg based
CDSP communication which wakes up CDSP affecting power during the
resume sequence. Ignore identical thermal state notifications from
throttle driver for CDSP and HVX cooling devices.

Change-Id: I50f8725271f7669453ff24766d20f3261c52d665
Acked-by: default avatarSreekanth Gande <sgande@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent 154aa474
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
/*
 * CDSP Request Manager
 *
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2019, 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
@@ -398,21 +398,22 @@ static int cdsprm_thermal_cdsp_clk_limit(unsigned int level)
	struct sysmon_msg_tx rpmsg_msg_tx;

	mutex_lock(&gcdsprm.thermal_lock);
	gcdsprm.thermal_cdsp_level = level;

	if (gcdsprm.rpmsgdev && gcdsprm.cdsp_version) {
		rpmsg_msg_tx.feature_id =
			SYSMON_CDSP_FEATURE_THERMAL_LIMIT_TX;
		rpmsg_msg_tx.fs.thermal.hvx_level =
			gcdsprm.thermal_hvx_level;
		rpmsg_msg_tx.fs.thermal.cdsp_level =
			gcdsprm.thermal_cdsp_level;
		rpmsg_msg_tx.fs.thermal.cdsp_level = level;
		rpmsg_msg_tx.size = sizeof(rpmsg_msg_tx);
		result = rpmsg_send(gcdsprm.rpmsgdev->ept,
					&rpmsg_msg_tx,
					sizeof(rpmsg_msg_tx));
	}

	if (result == 0)
		gcdsprm.thermal_cdsp_level = level;

	mutex_unlock(&gcdsprm.thermal_lock);

	return result;
@@ -424,13 +425,11 @@ static int cdsprm_thermal_hvx_instruction_limit(unsigned int level)
	struct sysmon_msg_tx rpmsg_msg_tx;

	mutex_lock(&gcdsprm.thermal_lock);
	gcdsprm.thermal_hvx_level = level;

	if (gcdsprm.rpmsgdev && gcdsprm.cdsp_version) {
		rpmsg_msg_tx.feature_id =
			SYSMON_CDSP_FEATURE_THERMAL_LIMIT_TX;
		rpmsg_msg_tx.fs.thermal.hvx_level =
			gcdsprm.thermal_hvx_level;
		rpmsg_msg_tx.fs.thermal.hvx_level = level;
		rpmsg_msg_tx.fs.thermal.cdsp_level =
				gcdsprm.thermal_cdsp_level;
		rpmsg_msg_tx.size = sizeof(rpmsg_msg_tx);
@@ -439,6 +438,9 @@ static int cdsprm_thermal_hvx_instruction_limit(unsigned int level)
				sizeof(rpmsg_msg_tx));
	}

	if (result == 0)
		gcdsprm.thermal_hvx_level = level;

	mutex_unlock(&gcdsprm.thermal_lock);

	return result;
@@ -857,6 +859,9 @@ static int cdsp_get_cur_state(struct thermal_cooling_device *cdev,
static int cdsp_set_cur_state(struct thermal_cooling_device *cdev,
				unsigned long state)
{
	if (gcdsprm.thermal_cdsp_level == state)
		return 0;

	cdsprm_thermal_cdsp_clk_limit(state);

	return 0;
@@ -887,6 +892,9 @@ static int hvx_get_cur_state(struct thermal_cooling_device *cdev,
static int hvx_set_cur_state(struct thermal_cooling_device *cdev,
				unsigned long state)
{
	if (gcdsprm.thermal_hvx_level == state)
		return 0;

	cdsprm_thermal_hvx_instruction_limit(state);

	return 0;