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

Commit 8545833d authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: ignore identical thermal state callbacks for CDSP"

parents 37a7a252 e15ff1bc
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;