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

Commit 66c3a546 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Show max gpu temperature"

parents edde3db9 8ee1fec3
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2010-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2010-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/msm-bus.h>
@@ -1524,23 +1524,29 @@ static ssize_t temp_show(struct device *dev,
					char *buf)
{
	struct kgsl_device *device = dev_get_drvdata(dev);
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;
	struct device *_dev;
	struct thermal_zone_device *thermal_dev;
	int ret, temperature = 0;
	int temperature = INT_MIN, max_temp = INT_MIN;
	const char *name;
	struct property *prop;

	if (!pwr->tzone_name)
		return 0;
	_dev = &device->pdev->dev;

	thermal_dev = thermal_zone_get_zone_by_name((char *)pwr->tzone_name);
	if (thermal_dev == NULL)
		return 0;
	of_property_for_each_string(_dev->of_node,
		"qcom,tzone-names", prop, name) {
		thermal_dev = thermal_zone_get_zone_by_name(name);

	ret = thermal_zone_get_temp(thermal_dev, &temperature);
	if (ret)
		return 0;
		if (IS_ERR(thermal_dev))
			continue;

		if (thermal_zone_get_temp(thermal_dev, &temperature))
			continue;

		max_temp = max(temperature, max_temp);
	}

	return scnprintf(buf, PAGE_SIZE, "%d\n",
			temperature);
			max_temp);
}

static ssize_t pwrscale_store(struct device *dev,
@@ -2427,10 +2433,6 @@ int kgsl_pwrctrl_init(struct kgsl_device *device)

	kgsl_pwrctrl_vbif_init(device);

	/* temperature sensor name */
	of_property_read_string(pdev->dev.of_node, "qcom,tzone-name",
		&pwr->tzone_name);

	return result;

error_cleanup_bus_ib:
+1 −3
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2010-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2010-2021, The Linux Foundation. All rights reserved.
 */
#ifndef __KGSL_PWRCTRL_H
#define __KGSL_PWRCTRL_H
@@ -180,7 +180,6 @@ struct gpu_cx_ipeak_client {
 * @cx_ipeak_pwr_limit - pointer to the cx_ipeak limits node
 * isense_clk_indx - index of isense clock, 0 if no isense
 * isense_clk_on_level - isense clock rate is XO rate below this level.
 * tzone_name - pointer to thermal zone name of GPU temperature sensor
 * gpu_cx_ipeak_client - CX Ipeak clients used by GPU
 */

@@ -240,7 +239,6 @@ struct kgsl_pwrctrl {
	struct kgsl_pwr_limit *cx_ipeak_pwr_limit;
	unsigned int gpu_bimc_int_clk_freq;
	bool gpu_bimc_interface_enabled;
	const char *tzone_name;
	struct gpu_cx_ipeak_client gpu_ipeak_client[2];
};