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

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

Merge "msm: kgsl: show max gpu temperature"

parents dacdaa2e 5e83de56
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -218,6 +218,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
+2 −0
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@
		qcom,tsens-name = "tsens_tz_sensor12";
		#cooling-cells = <2>;

		tzone-names = "gpuss-0-usr", "gpuss-1-usr";

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

		clocks = <&clock_gpucc GPU_CC_CXO_CLK>,
+12 −16
Original line number Diff line number Diff line
@@ -1493,28 +1493,24 @@ 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;
	for (i = 0; i < KGSL_MAX_TZONE_NAMES; i++) {
		int temp = 0;

	thermal_dev = thermal_zone_get_zone_by_name((char *)pwr->tzone_name);
	if (thermal_dev == NULL)
		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);

	ret = thermal_zone_get_temp(thermal_dev, &temperature);
	if (ret)
		goto done;
	}

	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,
@@ -2453,9 +2449,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);
	/*
	 * Cx ipeak client support, default value of Cx Ipeak GPU freq
	 * is used if defined in GPU list and it is overridden by
+4 −2
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@

#define KGSL_MAX_PWRLEVELS 10

#define KGSL_MAX_TZONE_NAMES 2

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

@@ -171,7 +173,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
 * gpu_cx_ipeak - pointer to CX Ipeak client used by GPU
 * cx_ipeak_gpu_freq - Value of GPU CX Ipeak frequency
 */
@@ -231,7 +233,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];
	struct cx_ipeak_client *gpu_cx_ipeak;
	unsigned int cx_ipeak_gpu_freq;
};