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

Commit 9099432d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: show max gpu temperature"

parents d81e4990 5d54a6b7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -208,6 +208,10 @@ Optional Properties:
				Specify the name of GPU temperature sensor. This name will be used
				to get the temperature from the thermal driver API.

- tzone-names:
				Specify the names of GPU thermal zones. These will be used
				to get the temperature from the thermal driver API.

- qcom,enable-midframe-timer:
				Boolean. Enables the use of midframe sampling timer. This timer
				samples the GPU powerstats if the cmdbatch expiry takes longer than
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-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
@@ -79,6 +79,8 @@
		qcom,tsens-name = "tsens_tz_sensor12";
		#cooling-cells = <2>;

		tzone-names = "gpu0-usr", "gpu1-usr";

		qcom,pm-qos-active-latency = <460>;

		clocks = <&clock_gfx GPU_CC_GX_GFX3D_CLK>,
+14 −18
Original line number Diff line number Diff line
/* Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-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
@@ -1462,28 +1462,23 @@ static ssize_t kgsl_pwrctrl_temp_show(struct device *dev,
	struct kgsl_device *device = kgsl_device_from_dev(dev);
	struct kgsl_pwrctrl *pwr;
	struct thermal_zone_device *thermal_dev;
	int ret, temperature = 0;
	int i, max_temp = 0;

	if (device == NULL)
		goto done;
		return 0;

	pwr = &device->pwrctrl;

	if (!pwr->tzone_name)
		goto done;

	thermal_dev = thermal_zone_get_zone_by_name((char *)pwr->tzone_name);
	if (thermal_dev == NULL)
		goto done;
	for (i = 0; i < KGSL_MAX_TZONE_NAMES; i++) {
		int temp = 0;

	ret = thermal_zone_get_temp(thermal_dev, &temperature);
	if (ret)
		goto done;
		thermal_dev = thermal_zone_get_zone_by_name(
				pwr->tzone_names[i]);
		if (!(thermal_zone_get_temp(thermal_dev, &temp)))
			max_temp = max_t(int, temp, max_temp);
	}

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

static ssize_t kgsl_pwrctrl_pwrscale_store(struct device *dev,
@@ -2414,8 +2409,9 @@ int kgsl_pwrctrl_init(struct kgsl_device *device)
	kgsl_pwrctrl_vbif_init();

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

	of_property_read_string_array(pdev->dev.of_node, "tzone-names",
		pwr->tzone_names, KGSL_MAX_TZONE_NAMES);

	return result;

+5 −3
Original line number Diff line number Diff line
/* Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-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
@@ -30,6 +30,8 @@

#define KGSL_MAX_PWRLEVELS 10

#define KGSL_MAX_TZONE_NAMES 2

/* Only two supported levels, min & max */
#define KGSL_CONSTRAINT_PWR_MAXLEVELS 2

@@ -169,7 +171,7 @@ struct kgsl_regulator {
 * @sysfs_pwr_limit - pointer to the sysfs 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
 * tzone_names - array of thermal zone names of GPU temperature sensors
 */

struct kgsl_pwrctrl {
@@ -226,7 +228,7 @@ struct kgsl_pwrctrl {
	struct kgsl_pwr_limit *sysfs_pwr_limit;
	unsigned int gpu_bimc_int_clk_freq;
	bool gpu_bimc_interface_enabled;
	const char *tzone_name;
	const char *tzone_names[KGSL_MAX_TZONE_NAMES];
};

int kgsl_pwrctrl_init(struct kgsl_device *device);