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

Merge branch 'thermal-core'

Merge updates related to the thermal core for 6.11-rc1:

 - Redesign the .set_trip_temp() thermal zone callback to take a trip
   pointer instead of a trip ID and update its users (Rafael Wysocki).

 - Avoid using invalid combinations of polling_delay and passive_delay
   thermal zone parameters (Rafael Wysocki).

 - Update a cooling device registration function to take a const
   argument (Krzysztof Kozlowski).

 - Make the uniphier thermal driver use thermal_zone_for_each_trip() for
   walking trip points (Rafael Wysocki).

* thermal-core:
  thermal: core: Add sanity checks for polling_delay and passive_delay
  thermal: trip: Fold __thermal_zone_get_trip() into its caller
  thermal: trip: Pass trip pointer to .set_trip_temp() thermal zone callback
  thermal: imx: Drop critical trip check from imx_set_trip_temp()
  thermal: trip: Add conversion macros for thermal trip priv field
  thermal: helpers: Introduce thermal_trip_is_bound_to_cdev()
  thermal: core: Change passive_delay and polling_delay data type
  thermal: core: constify 'type' in devm_thermal_of_cooling_device_register()
  thermal: uniphier: Use thermal_zone_for_each_trip() for walking trip points
parents 3fdd8ea3 36697164
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -638,7 +638,7 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
}

static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
				       int trip, int temp)
				       const struct thermal_trip *trip, int temp)
{
	struct iwl_mvm *mvm = thermal_zone_device_priv(device);
	int ret;
+2 −11
Original line number Diff line number Diff line
@@ -331,25 +331,16 @@ static int imx_change_mode(struct thermal_zone_device *tz,
	return 0;
}

static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip_id,
			     int temp)
static int imx_set_trip_temp(struct thermal_zone_device *tz,
			     const struct thermal_trip *trip, int temp)
{
	struct imx_thermal_data *data = thermal_zone_device_priv(tz);
	struct thermal_trip trip;
	int ret;

	ret = pm_runtime_resume_and_get(data->dev);
	if (ret < 0)
		return ret;

	ret = __thermal_zone_get_trip(tz, trip_id, &trip);
	if (ret)
		return ret;

	/* do not allow changing critical threshold */
	if (trip.type == THERMAL_TRIP_CRITICAL)
		return -EPERM;

	/* do not allow passive to be set higher than critical */
	if (temp < 0 || temp > trips[IMX_TRIP_CRITICAL].temperature)
		return -EINVAL;
+7 −15
Original line number Diff line number Diff line
@@ -39,13 +39,14 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
}

static int int340x_thermal_set_trip_temp(struct thermal_zone_device *zone,
					 int trip, int temp)
					 const struct thermal_trip *trip, int temp)
{
	struct int34x_thermal_zone *d = thermal_zone_device_priv(zone);
	char name[] = {'P', 'A', 'T', '0' + trip, '\0'};
	unsigned int trip_index = THERMAL_TRIP_PRIV_TO_INT(trip->priv);
	char name[] = {'P', 'A', 'T', '0' + trip_index, '\0'};
	acpi_status status;

	if (trip > 9)
	if (trip_index > 9)
		return -EINVAL;

	status = acpi_execute_simple_method(d->adev->handle, name,
@@ -62,16 +63,6 @@ static void int340x_thermal_critical(struct thermal_zone_device *zone)
		thermal_zone_device_type(zone));
}

static inline void *int_to_trip_priv(int i)
{
	return (void *)(long)i;
}

static inline int trip_priv_to_int(const struct thermal_trip *trip)
{
	return (long)trip->priv;
}

static int int340x_thermal_read_trips(struct acpi_device *zone_adev,
				      struct thermal_trip *zone_trips,
				      int trip_cnt)
@@ -106,7 +97,7 @@ static int int340x_thermal_read_trips(struct acpi_device *zone_adev,
			break;

		zone_trips[trip_cnt].type = THERMAL_TRIP_ACTIVE;
		zone_trips[trip_cnt].priv = int_to_trip_priv(i);
		zone_trips[trip_cnt].priv = THERMAL_INT_TO_TRIP_PRIV(i);
		trip_cnt++;
	}

@@ -154,6 +145,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
		zone_trips[i].type = THERMAL_TRIP_PASSIVE;
		zone_trips[i].temperature = THERMAL_TEMP_INVALID;
		zone_trips[i].flags |= THERMAL_TRIP_FLAG_RW_TEMP;
		zone_trips[i].priv = THERMAL_INT_TO_TRIP_PRIV(i);
	}

	trip_cnt = int340x_thermal_read_trips(adev, zone_trips, trip_cnt);
@@ -224,7 +216,7 @@ static int int340x_update_one_trip(struct thermal_trip *trip, void *arg)
		break;
	case THERMAL_TRIP_ACTIVE:
		err = thermal_acpi_active_trip_temp(zone_adev,
						    trip_priv_to_int(trip),
						    THERMAL_TRIP_PRIV_TO_INT(trip->priv),
						    &temp);
		break;
	default:
+2 −1
Original line number Diff line number Diff line
@@ -194,7 +194,8 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, int *temp)
	return 0;
}

static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp)
static int sys_set_trip_temp(struct thermal_zone_device *tzd,
			     const struct thermal_trip *trip, int temp)
{
	struct proc_thermal_pci *pci_info = thermal_zone_device_priv(tzd);
	int tjmax, _temp;
+22 −6
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ static int get_trip_temp(int trip)
}

static int update_trip_temp(struct soc_sensor_entry *aux_entry,
				int trip, int temp)
				int trip_index, int temp)
{
	u32 out;
	u32 temp_out;
@@ -230,9 +230,9 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry,
	 */
	temp_out = temp + QRK_DTS_TEMP_BASE;
	out = (store_ptps & ~(QRK_DTS_MASK_TP_THRES <<
		(trip * QRK_DTS_SHIFT_TP)));
		(trip_index * QRK_DTS_SHIFT_TP)));
	out |= (temp_out & QRK_DTS_MASK_TP_THRES) <<
		(trip * QRK_DTS_SHIFT_TP);
		(trip_index * QRK_DTS_SHIFT_TP);

	ret = iosf_mbi_write(QRK_MBI_UNIT_RMU, MBI_REG_WRITE,
			     QRK_DTS_REG_OFFSET_PTPS, out);
@@ -242,10 +242,26 @@ static int update_trip_temp(struct soc_sensor_entry *aux_entry,
	return ret;
}

static inline int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip,
static inline int sys_set_trip_temp(struct thermal_zone_device *tzd,
				    const struct thermal_trip *trip,
				    int temp)
{
	return update_trip_temp(thermal_zone_device_priv(tzd), trip, temp);
	unsigned int trip_index;

	switch (trip->type) {
	case THERMAL_TRIP_HOT:
		trip_index = QRK_DTS_ID_TP_HOT;
		break;

	case THERMAL_TRIP_CRITICAL:
		trip_index = QRK_DTS_ID_TP_CRITICAL;
		break;

	default:
		return -EINVAL;
	}

	return update_trip_temp(thermal_zone_device_priv(tzd), trip_index, temp);
}

static int sys_get_curr_temp(struct thermal_zone_device *tzd,
Loading