Commit 5ae98b5a authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge back thermal core material for 6.12.

parents 6e6f58a1 107280e1
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -459,14 +459,7 @@ are supposed to implement the callback. If they don't, the thermal
framework calculated the trend by comparing the previous and the current
temperature values.

4.2. get_thermal_instance
-------------------------

This function returns the thermal_instance corresponding to a given
{thermal_zone, cooling_device, trip_point} combination. Returns NULL
if such an instance does not exist.

4.3. thermal_cdev_update
4.2. thermal_cdev_update
------------------------

This function serves as an arbitrator to set the state of a cooling
+3 −4
Original line number Diff line number Diff line
@@ -208,8 +208,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
	 */
	val = readl(data->regs + BCM2835_TS_TSENSCTL);
	if (!(val & BCM2835_TS_TSENSCTL_RSTB)) {
		struct thermal_trip trip;
		int offset, slope;
		int offset, slope, crit_temp;

		slope = thermal_zone_get_slope(tz);
		offset = thermal_zone_get_offset(tz);
@@ -217,7 +216,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
		 * For now we deal only with critical, otherwise
		 * would need to iterate
		 */
		err = thermal_zone_get_trip(tz, 0, &trip);
		err = thermal_zone_get_crit_temp(tz, &crit_temp);
		if (err < 0) {
			dev_err(dev, "Not able to read trip_temp: %d\n", err);
			return err;
@@ -232,7 +231,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
		val |= (0xFE << BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT);

		/*  trip_adc value from info */
		val |= bcm2835_thermal_temp2adc(trip.temperature,
		val |= bcm2835_thermal_temp2adc(crit_temp,
						offset,
						slope)
			<< BCM2835_TS_TSENSCTL_THOLD_SHIFT;
+14 −11
Original line number Diff line number Diff line
@@ -465,11 +465,22 @@ static irqreturn_t hisi_thermal_alarm_irq_thread(int irq, void *dev)
	return IRQ_HANDLED;
}

static int hisi_trip_walk_cb(struct thermal_trip *trip, void *arg)
{
	struct hisi_thermal_sensor *sensor = arg;

	if (trip->type != THERMAL_TRIP_PASSIVE)
		return 0;

	sensor->thres_temp = trip->temperature;
	/* Return nonzero to terminate the search. */
	return 1;
}

static int hisi_thermal_register_sensor(struct platform_device *pdev,
					struct hisi_thermal_sensor *sensor)
{
	int ret, i;
	struct thermal_trip trip;
	int ret;

	sensor->tzd = devm_thermal_of_zone_register(&pdev->dev,
						    sensor->id, sensor,
@@ -482,15 +493,7 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev,
		return ret;
	}

	for (i = 0; i < thermal_zone_get_num_trips(sensor->tzd); i++) {

		thermal_zone_get_trip(sensor->tzd, i, &trip);

		if (trip.type == THERMAL_TRIP_PASSIVE) {
			sensor->thres_temp = trip.temperature;
			break;
		}
	}
	thermal_zone_for_each_trip(sensor->tzd, hisi_trip_walk_cb, sensor);

	return 0;
}
+3 −19
Original line number Diff line number Diff line
@@ -291,24 +291,6 @@ static irqreturn_t qpnp_tm_isr(int irq, void *data)
	return IRQ_HANDLED;
}

static int qpnp_tm_get_critical_trip_temp(struct qpnp_tm_chip *chip)
{
	struct thermal_trip trip;
	int i, ret;

	for (i = 0; i < thermal_zone_get_num_trips(chip->tz_dev); i++) {

		ret = thermal_zone_get_trip(chip->tz_dev, i, &trip);
		if (ret)
			continue;

		if (trip.type == THERMAL_TRIP_CRITICAL)
			return trip.temperature;
	}

	return THERMAL_TEMP_INVALID;
}

/*
 * This function initializes the internal temp value based on only the
 * current thermal stage and threshold. Setup threshold control and
@@ -343,7 +325,9 @@ static int qpnp_tm_init(struct qpnp_tm_chip *chip)

	mutex_unlock(&chip->lock);

	crit_temp = qpnp_tm_get_critical_trip_temp(chip);
	ret = thermal_zone_get_crit_temp(chip->tz_dev, &crit_temp);
	if (ret)
		crit_temp = THERMAL_TEMP_INVALID;

	mutex_lock(&chip->lock);

+1 −5
Original line number Diff line number Diff line
@@ -563,11 +563,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
		if (ret)
			goto error_unregister;

		ret = thermal_zone_get_num_trips(tsc->zone);
		if (ret < 0)
			goto error_unregister;

		dev_info(dev, "Sensor %u: Loaded %d trip points\n", i, ret);
		dev_info(dev, "Sensor %u: Loaded\n", i);
	}

	if (!priv->num_tscs) {
Loading