* [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function
@ 2022-10-14 7:32 Daniel Lezcano
2022-10-14 7:32 ` [PATCH 2/2] thermal/drivers/mellanox: " Daniel Lezcano
2022-10-14 10:15 ` [PATCH 1/2] thermal/drivers/iwlwifi: " Kalle Valo
0 siblings, 2 replies; 11+ messages in thread
From: Daniel Lezcano @ 2022-10-14 7:32 UTC (permalink / raw)
To: rafael, daniel.lezcano
Cc: linux-pm, linux-kernel, Gregory Greenman, Kalle Valo,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Luca Coelho, Johannes Berg, Emmanuel Grumbach, Miri Korenblit,
Nathan Errera, open list:INTEL WIRELESS WIFI LINK (iwlwifi),
open list:NETWORKING DRIVERS
The thermal framework gives the possibility to register the trip
points with the thermal zone. When that is done, no get_trip_* ops are
needed and they can be removed.
The get_trip_temp, get_trip_hyst and get_trip_type are handled by the
get_trip_point().
The set_trip_temp() generic function does some checks which are no
longer needed in the set_trip_point() ops.
Convert ops content logic into generic trip points and register them
with the thermal zone.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +-
drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 71 ++++----------------
2 files changed, 13 insertions(+), 60 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index bf35e130c876..38e7426f98c0 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -501,7 +501,7 @@ struct iwl_mvm_tt_mgmt {
* @tzone: thermal zone device data
*/
struct iwl_mvm_thermal_device {
- s16 temp_trips[IWL_MAX_DTS_TRIPS];
+ struct thermal_trip trips[IWL_MAX_DTS_TRIPS];
u8 fw_trips_index[IWL_MAX_DTS_TRIPS];
struct thermal_zone_device *tzone;
};
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 69cf3a372759..3da4af7bc1ca 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -573,11 +573,11 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
* and uncompressed, the FW should get it compressed and sorted
*/
- /* compress temp_trips to cmd array, remove uninitialized values*/
+ /* compress trips to cmd array, remove uninitialized values*/
for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) {
- if (mvm->tz_device.temp_trips[i] != S16_MIN) {
+ if (mvm->tz_device.trips[i].temperature != INT_MIN) {
cmd.thresholds[idx++] =
- cpu_to_le16(mvm->tz_device.temp_trips[i]);
+ cpu_to_le16((s16)(mvm->tz_device.trips[i].temperature / 1000));
}
}
cmd.num_temps = cpu_to_le32(idx);
@@ -593,8 +593,8 @@ int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm)
*/
for (i = 0; i < idx; i++) {
for (j = 0; j < IWL_MAX_DTS_TRIPS; j++) {
- if (le16_to_cpu(cmd.thresholds[i]) ==
- mvm->tz_device.temp_trips[j])
+ if ((int)(le16_to_cpu(cmd.thresholds[i]) * 1000) ==
+ mvm->tz_device.trips[j].temperature)
mvm->tz_device.fw_trips_index[i] = j;
}
}
@@ -638,37 +638,12 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,
return ret;
}
-static int iwl_mvm_tzone_get_trip_temp(struct thermal_zone_device *device,
- int trip, int *temp)
-{
- struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata;
-
- if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS)
- return -EINVAL;
-
- *temp = mvm->tz_device.temp_trips[trip] * 1000;
-
- return 0;
-}
-
-static int iwl_mvm_tzone_get_trip_type(struct thermal_zone_device *device,
- int trip, enum thermal_trip_type *type)
-{
- if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS)
- return -EINVAL;
-
- *type = THERMAL_TRIP_PASSIVE;
-
- return 0;
-}
-
static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
int trip, int temp)
{
struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata;
struct iwl_mvm_thermal_device *tzone;
- int i, ret;
- s16 temperature;
+ int ret;
mutex_lock(&mvm->mutex);
@@ -678,40 +653,17 @@ static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
goto out;
}
- if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) {
- ret = -EINVAL;
- goto out;
- }
-
if ((temp / 1000) > S16_MAX) {
ret = -EINVAL;
goto out;
}
- temperature = (s16)(temp / 1000);
tzone = &mvm->tz_device;
-
if (!tzone) {
ret = -EIO;
goto out;
}
- /* no updates*/
- if (tzone->temp_trips[trip] == temperature) {
- ret = 0;
- goto out;
- }
-
- /* already existing temperature */
- for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) {
- if (tzone->temp_trips[i] == temperature) {
- ret = -EINVAL;
- goto out;
- }
- }
-
- tzone->temp_trips[trip] = temperature;
-
ret = iwl_mvm_send_temp_report_ths_cmd(mvm);
out:
mutex_unlock(&mvm->mutex);
@@ -720,8 +672,6 @@ static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
static struct thermal_zone_device_ops tzone_ops = {
.get_temp = iwl_mvm_tzone_get_temp,
- .get_trip_temp = iwl_mvm_tzone_get_trip_temp,
- .get_trip_type = iwl_mvm_tzone_get_trip_type,
.set_trip_temp = iwl_mvm_tzone_set_trip_temp,
};
@@ -743,7 +693,8 @@ static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm)
BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH);
sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF);
- mvm->tz_device.tzone = thermal_zone_device_register(name,
+ mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name,
+ mvm->tz_device.trips,
IWL_MAX_DTS_TRIPS,
IWL_WRITABLE_TRIPS_MSK,
mvm, &tzone_ops,
@@ -766,8 +717,10 @@ static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm)
/* 0 is a valid temperature,
* so initialize the array with S16_MIN which invalid temperature
*/
- for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++)
- mvm->tz_device.temp_trips[i] = S16_MIN;
+ for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) {
+ mvm->tz_device.trips[i].temperature = INT_MIN;
+ mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE;
+ }
}
static int iwl_mvm_tcool_get_max_state(struct thermal_cooling_device *cdev,
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/2] thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function
2022-10-14 7:32 [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function Daniel Lezcano
@ 2022-10-14 7:32 ` Daniel Lezcano
2022-10-18 6:28 ` Ido Schimmel
2022-10-14 10:15 ` [PATCH 1/2] thermal/drivers/iwlwifi: " Kalle Valo
1 sibling, 1 reply; 11+ messages in thread
From: Daniel Lezcano @ 2022-10-14 7:32 UTC (permalink / raw)
To: rafael, daniel.lezcano
Cc: linux-pm, linux-kernel, Ido Schimmel, Petr Machata,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:MELLANOX ETHERNET SWITCH DRIVERS
The thermal framework gives the possibility to register the trip
points with the thermal zone. When that is done, no get_trip_* ops are
needed and they can be removed.
Convert ops content logic into generic trip points and register them with the
thermal zone.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
.../ethernet/mellanox/mlxsw/core_thermal.c | 209 ++++--------------
1 file changed, 48 insertions(+), 161 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index 987fe5c9d5a3..c5240d38c9db 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -36,33 +36,39 @@ enum mlxsw_thermal_trips {
MLXSW_THERMAL_TEMP_TRIP_HOT,
};
-struct mlxsw_thermal_trip {
- int type;
- int temp;
- int hyst;
+struct mlxsw_cooling_states {
int min_state;
int max_state;
};
-static const struct mlxsw_thermal_trip default_thermal_trips[] = {
+static const struct thermal_trip default_thermal_trips[] = {
{ /* In range - 0-40% PWM */
.type = THERMAL_TRIP_ACTIVE,
- .temp = MLXSW_THERMAL_ASIC_TEMP_NORM,
- .hyst = MLXSW_THERMAL_HYSTERESIS_TEMP,
- .min_state = 0,
- .max_state = (4 * MLXSW_THERMAL_MAX_STATE) / 10,
+ .temperature = MLXSW_THERMAL_ASIC_TEMP_NORM,
+ .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP,
},
{
/* In range - 40-100% PWM */
.type = THERMAL_TRIP_ACTIVE,
- .temp = MLXSW_THERMAL_ASIC_TEMP_HIGH,
- .hyst = MLXSW_THERMAL_HYSTERESIS_TEMP,
- .min_state = (4 * MLXSW_THERMAL_MAX_STATE) / 10,
- .max_state = MLXSW_THERMAL_MAX_STATE,
+ .temperature = MLXSW_THERMAL_ASIC_TEMP_HIGH,
+ .hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP,
},
{ /* Warning */
.type = THERMAL_TRIP_HOT,
- .temp = MLXSW_THERMAL_ASIC_TEMP_HOT,
+ .temperature = MLXSW_THERMAL_ASIC_TEMP_HOT,
+ },
+};
+
+static const struct mlxsw_cooling_states default_cooling_states[] = {
+ {
+ .min_state = 0,
+ .max_state = (4 * MLXSW_THERMAL_MAX_STATE) / 10,
+ },
+ {
+ .min_state = (4 * MLXSW_THERMAL_MAX_STATE) / 10,
+ .max_state = MLXSW_THERMAL_MAX_STATE,
+ },
+ {
.min_state = MLXSW_THERMAL_MAX_STATE,
.max_state = MLXSW_THERMAL_MAX_STATE,
},
@@ -78,7 +84,8 @@ struct mlxsw_thermal;
struct mlxsw_thermal_module {
struct mlxsw_thermal *parent;
struct thermal_zone_device *tzdev;
- struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
+ struct thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
+ struct mlxsw_cooling_states cooling_states[MLXSW_THERMAL_NUM_TRIPS];
int module; /* Module or gearbox number */
u8 slot_index;
};
@@ -99,7 +106,8 @@ struct mlxsw_thermal {
int polling_delay;
struct thermal_cooling_device *cdevs[MLXSW_MFCR_PWMS_MAX];
u8 cooling_levels[MLXSW_THERMAL_MAX_STATE + 1];
- struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
+ struct thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
+ struct mlxsw_cooling_states cooling_states[MLXSW_THERMAL_NUM_TRIPS];
struct mlxsw_thermal_area line_cards[];
};
@@ -136,9 +144,9 @@ static int mlxsw_get_cooling_device_idx(struct mlxsw_thermal *thermal,
static void
mlxsw_thermal_module_trips_reset(struct mlxsw_thermal_module *tz)
{
- tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temp = 0;
- tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temp = 0;
- tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temp = 0;
+ tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temperature = 0;
+ tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temperature = 0;
+ tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temperature = 0;
}
static int
@@ -180,12 +188,12 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
* by subtracting double hysteresis value.
*/
if (crit_temp >= MLXSW_THERMAL_MODULE_TEMP_SHIFT)
- tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temp = crit_temp -
+ tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temperature = crit_temp -
MLXSW_THERMAL_MODULE_TEMP_SHIFT;
else
- tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temp = crit_temp;
- tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temp = crit_temp;
- tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temp = emerg_temp;
+ tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temperature = crit_temp;
+ tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temperature = crit_temp;
+ tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temperature = emerg_temp;
return 0;
}
@@ -202,11 +210,11 @@ static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
return 0;
for (i = 0; i < MLXSW_THERMAL_NUM_TRIPS; i++) {
- const struct mlxsw_thermal_trip *trip = &thermal->trips[i];
+ const struct mlxsw_cooling_states *state = &thermal->cooling_states[i];
err = thermal_zone_bind_cooling_device(tzdev, i, cdev,
- trip->max_state,
- trip->min_state,
+ state->max_state,
+ state->min_state,
THERMAL_WEIGHT_DEFAULT);
if (err < 0) {
dev_err(dev, "Failed to bind cooling device to trip %d\n", i);
@@ -260,61 +268,6 @@ static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
return 0;
}
-static int mlxsw_thermal_get_trip_type(struct thermal_zone_device *tzdev,
- int trip,
- enum thermal_trip_type *p_type)
-{
- struct mlxsw_thermal *thermal = tzdev->devdata;
-
- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
- return -EINVAL;
-
- *p_type = thermal->trips[trip].type;
- return 0;
-}
-
-static int mlxsw_thermal_get_trip_temp(struct thermal_zone_device *tzdev,
- int trip, int *p_temp)
-{
- struct mlxsw_thermal *thermal = tzdev->devdata;
-
- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
- return -EINVAL;
-
- *p_temp = thermal->trips[trip].temp;
- return 0;
-}
-
-static int mlxsw_thermal_set_trip_temp(struct thermal_zone_device *tzdev,
- int trip, int temp)
-{
- struct mlxsw_thermal *thermal = tzdev->devdata;
-
- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
- return -EINVAL;
-
- thermal->trips[trip].temp = temp;
- return 0;
-}
-
-static int mlxsw_thermal_get_trip_hyst(struct thermal_zone_device *tzdev,
- int trip, int *p_hyst)
-{
- struct mlxsw_thermal *thermal = tzdev->devdata;
-
- *p_hyst = thermal->trips[trip].hyst;
- return 0;
-}
-
-static int mlxsw_thermal_set_trip_hyst(struct thermal_zone_device *tzdev,
- int trip, int hyst)
-{
- struct mlxsw_thermal *thermal = tzdev->devdata;
-
- thermal->trips[trip].hyst = hyst;
- return 0;
-}
-
static struct thermal_zone_params mlxsw_thermal_params = {
.no_hwmon = true,
};
@@ -323,11 +276,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
.bind = mlxsw_thermal_bind,
.unbind = mlxsw_thermal_unbind,
.get_temp = mlxsw_thermal_get_temp,
- .get_trip_type = mlxsw_thermal_get_trip_type,
- .get_trip_temp = mlxsw_thermal_get_trip_temp,
- .set_trip_temp = mlxsw_thermal_set_trip_temp,
- .get_trip_hyst = mlxsw_thermal_get_trip_hyst,
- .set_trip_hyst = mlxsw_thermal_set_trip_hyst,
};
static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
@@ -342,11 +290,11 @@ static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
return 0;
for (i = 0; i < MLXSW_THERMAL_NUM_TRIPS; i++) {
- const struct mlxsw_thermal_trip *trip = &tz->trips[i];
+ const struct mlxsw_cooling_states *state = &tz->cooling_states[i];
err = thermal_zone_bind_cooling_device(tzdev, i, cdev,
- trip->max_state,
- trip->min_state,
+ state->max_state,
+ state->min_state,
THERMAL_WEIGHT_DEFAULT);
if (err < 0)
goto err_thermal_zone_bind_cooling_device;
@@ -434,74 +382,10 @@ static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
return 0;
}
-static int
-mlxsw_thermal_module_trip_type_get(struct thermal_zone_device *tzdev, int trip,
- enum thermal_trip_type *p_type)
-{
- struct mlxsw_thermal_module *tz = tzdev->devdata;
-
- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
- return -EINVAL;
-
- *p_type = tz->trips[trip].type;
- return 0;
-}
-
-static int
-mlxsw_thermal_module_trip_temp_get(struct thermal_zone_device *tzdev,
- int trip, int *p_temp)
-{
- struct mlxsw_thermal_module *tz = tzdev->devdata;
-
- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
- return -EINVAL;
-
- *p_temp = tz->trips[trip].temp;
- return 0;
-}
-
-static int
-mlxsw_thermal_module_trip_temp_set(struct thermal_zone_device *tzdev,
- int trip, int temp)
-{
- struct mlxsw_thermal_module *tz = tzdev->devdata;
-
- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
- return -EINVAL;
-
- tz->trips[trip].temp = temp;
- return 0;
-}
-
-static int
-mlxsw_thermal_module_trip_hyst_get(struct thermal_zone_device *tzdev, int trip,
- int *p_hyst)
-{
- struct mlxsw_thermal_module *tz = tzdev->devdata;
-
- *p_hyst = tz->trips[trip].hyst;
- return 0;
-}
-
-static int
-mlxsw_thermal_module_trip_hyst_set(struct thermal_zone_device *tzdev, int trip,
- int hyst)
-{
- struct mlxsw_thermal_module *tz = tzdev->devdata;
-
- tz->trips[trip].hyst = hyst;
- return 0;
-}
-
static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
.bind = mlxsw_thermal_module_bind,
.unbind = mlxsw_thermal_module_unbind,
.get_temp = mlxsw_thermal_module_temp_get,
- .get_trip_type = mlxsw_thermal_module_trip_type_get,
- .get_trip_temp = mlxsw_thermal_module_trip_temp_get,
- .set_trip_temp = mlxsw_thermal_module_trip_temp_set,
- .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
- .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
};
static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
@@ -531,11 +415,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
.bind = mlxsw_thermal_module_bind,
.unbind = mlxsw_thermal_module_unbind,
.get_temp = mlxsw_thermal_gearbox_temp_get,
- .get_trip_type = mlxsw_thermal_module_trip_type_get,
- .get_trip_temp = mlxsw_thermal_module_trip_temp_get,
- .set_trip_temp = mlxsw_thermal_module_trip_temp_set,
- .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
- .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
};
static int mlxsw_thermal_get_max_state(struct thermal_cooling_device *cdev,
@@ -617,7 +496,8 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
else
snprintf(tz_name, sizeof(tz_name), "mlxsw-module%d",
module_tz->module + 1);
- module_tz->tzdev = thermal_zone_device_register(tz_name,
+ module_tz->tzdev = thermal_zone_device_register_with_trips(tz_name,
+ module_tz->trips,
MLXSW_THERMAL_NUM_TRIPS,
MLXSW_THERMAL_TRIP_MASK,
module_tz,
@@ -661,6 +541,8 @@ mlxsw_thermal_module_init(struct device *dev, struct mlxsw_core *core,
module_tz->parent = thermal;
memcpy(module_tz->trips, default_thermal_trips,
sizeof(thermal->trips));
+ memcpy(module_tz->cooling_states, default_cooling_states,
+ sizeof(thermal->cooling_states));
/* Initialize all trip point. */
mlxsw_thermal_module_trips_reset(module_tz);
/* Read module temperature and thresholds. */
@@ -756,7 +638,8 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
else
snprintf(tz_name, sizeof(tz_name), "mlxsw-gearbox%d",
gearbox_tz->module + 1);
- gearbox_tz->tzdev = thermal_zone_device_register(tz_name,
+ gearbox_tz->tzdev = thermal_zone_device_register_with_trips(tz_name,
+ gearbox_tz->trips,
MLXSW_THERMAL_NUM_TRIPS,
MLXSW_THERMAL_TRIP_MASK,
gearbox_tz,
@@ -813,6 +696,8 @@ mlxsw_thermal_gearboxes_init(struct device *dev, struct mlxsw_core *core,
gearbox_tz = &area->tz_gearbox_arr[i];
memcpy(gearbox_tz->trips, default_thermal_trips,
sizeof(thermal->trips));
+ memcpy(gearbox_tz->cooling_states, default_cooling_states,
+ sizeof(thermal->cooling_states));
gearbox_tz->module = i;
gearbox_tz->parent = thermal;
gearbox_tz->slot_index = area->slot_index;
@@ -928,6 +813,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
thermal->core = core;
thermal->bus_info = bus_info;
memcpy(thermal->trips, default_thermal_trips, sizeof(thermal->trips));
+ memcpy(thermal->cooling_states, default_cooling_states, sizeof(thermal->cooling_states));
thermal->line_cards[0].slot_index = 0;
err = mlxsw_reg_query(thermal->core, MLXSW_REG(mfcr), mfcr_pl);
@@ -981,7 +867,8 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
MLXSW_THERMAL_SLOW_POLL_INT :
MLXSW_THERMAL_POLL_INT;
- thermal->tzdev = thermal_zone_device_register("mlxsw",
+ thermal->tzdev = thermal_zone_device_register_with_trips("mlxsw",
+ thermal->trips,
MLXSW_THERMAL_NUM_TRIPS,
MLXSW_THERMAL_TRIP_MASK,
thermal,
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function
2022-10-14 7:32 [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function Daniel Lezcano
2022-10-14 7:32 ` [PATCH 2/2] thermal/drivers/mellanox: " Daniel Lezcano
@ 2022-10-14 10:15 ` Kalle Valo
2022-10-14 10:21 ` Daniel Lezcano
1 sibling, 1 reply; 11+ messages in thread
From: Kalle Valo @ 2022-10-14 10:15 UTC (permalink / raw)
To: Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Gregory Greenman,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Luca Coelho, Johannes Berg, Emmanuel Grumbach, Miri Korenblit,
Nathan Errera, open list:INTEL WIRELESS WIFI LINK (iwlwifi),
open list:NETWORKING DRIVERS
Daniel Lezcano <daniel.lezcano@linaro.org> writes:
> The thermal framework gives the possibility to register the trip
> points with the thermal zone. When that is done, no get_trip_* ops are
> needed and they can be removed.
>
> The get_trip_temp, get_trip_hyst and get_trip_type are handled by the
> get_trip_point().
>
> The set_trip_temp() generic function does some checks which are no
> longer needed in the set_trip_point() ops.
>
> Convert ops content logic into generic trip points and register them
> with the thermal zone.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +-
> drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 71 ++++----------------
> 2 files changed, 13 insertions(+), 60 deletions(-)
The subject should begin with "wifi: iwlwifi: ".
I don't see patch 2. Via which tree is the plan for this patch?
Gregory, please review this.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function
2022-10-14 10:15 ` [PATCH 1/2] thermal/drivers/iwlwifi: " Kalle Valo
@ 2022-10-14 10:21 ` Daniel Lezcano
2022-10-18 9:38 ` Greenman, Gregory
2022-10-19 6:04 ` Kalle Valo
0 siblings, 2 replies; 11+ messages in thread
From: Daniel Lezcano @ 2022-10-14 10:21 UTC (permalink / raw)
To: Kalle Valo
Cc: rafael, linux-pm, linux-kernel, Gregory Greenman,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Luca Coelho, Johannes Berg, Emmanuel Grumbach, Miri Korenblit,
Nathan Errera, open list:INTEL WIRELESS WIFI LINK (iwlwifi),
open list:NETWORKING DRIVERS
On 14/10/2022 12:15, Kalle Valo wrote:
> Daniel Lezcano <daniel.lezcano@linaro.org> writes:
>
>> The thermal framework gives the possibility to register the trip
>> points with the thermal zone. When that is done, no get_trip_* ops are
>> needed and they can be removed.
>>
>> The get_trip_temp, get_trip_hyst and get_trip_type are handled by the
>> get_trip_point().
>>
>> The set_trip_temp() generic function does some checks which are no
>> longer needed in the set_trip_point() ops.
>>
>> Convert ops content logic into generic trip points and register them
>> with the thermal zone.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>> drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +-
>> drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 71 ++++----------------
>> 2 files changed, 13 insertions(+), 60 deletions(-)
>
> The subject should begin with "wifi: iwlwifi: ".
>
> I don't see patch 2. Via which tree is the plan for this patch?
patch 2 are similar changes but related to the mellanox driver.
This is the continuation of the trip point rework:
https://lore.kernel.org/netdev/20221003092602.1323944-22-daniel.lezcano@linaro.org/t/
This patch is planned to go through the thermal tree
Sorry I should have mentioned that.
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function
2022-10-14 7:32 ` [PATCH 2/2] thermal/drivers/mellanox: " Daniel Lezcano
@ 2022-10-18 6:28 ` Ido Schimmel
2022-10-25 7:02 ` Daniel Lezcano
0 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2022-10-18 6:28 UTC (permalink / raw)
To: Daniel Lezcano, vadimp
Cc: rafael, linux-pm, linux-kernel, Petr Machata, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:MELLANOX ETHERNET SWITCH DRIVERS
+ Vadim
On Fri, Oct 14, 2022 at 09:32:51AM +0200, Daniel Lezcano wrote:
> The thermal framework gives the possibility to register the trip
> points with the thermal zone. When that is done, no get_trip_* ops are
> needed and they can be removed.
>
> Convert ops content logic into generic trip points and register them with the
> thermal zone.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Vadim, can you please review and test?
Daniel, I saw that you wrote to Kalle that you want to take it via the
thermal tree. Any reason not to take it via net-next? I'm asking because
it will be the second release in a row where we need to try to avoid
conflicts in this file.
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function
2022-10-14 10:21 ` Daniel Lezcano
@ 2022-10-18 9:38 ` Greenman, Gregory
2022-10-19 6:04 ` Kalle Valo
1 sibling, 0 replies; 11+ messages in thread
From: Greenman, Gregory @ 2022-10-18 9:38 UTC (permalink / raw)
To: kvalo, daniel.lezcano
Cc: Coelho, Luciano, davem, rafael, Berg, Johannes, Errera, Nathan,
linux-kernel, linux-wireless, pabeni, kuba, linux-pm, edumazet,
Grumbach, Emmanuel, netdev, Korenblit, Miriam Rachel
On Fri, 2022-10-14 at 12:21 +0200, Daniel Lezcano wrote:
> On 14/10/2022 12:15, Kalle Valo wrote:
> > Daniel Lezcano <daniel.lezcano@linaro.org> writes:
> >
> > > The thermal framework gives the possibility to register the trip
> > > points with the thermal zone. When that is done, no get_trip_* ops are
> > > needed and they can be removed.
> > >
> > > The get_trip_temp, get_trip_hyst and get_trip_type are handled by the
> > > get_trip_point().
> > >
> > > The set_trip_temp() generic function does some checks which are no
> > > longer needed in the set_trip_point() ops.
> > >
> > > Convert ops content logic into generic trip points and register them
> > > with the thermal zone.
> > >
> > > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> > > ---
> > > drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +-
> > > drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 71 ++++----------------
> > > 2 files changed, 13 insertions(+), 60 deletions(-)
> >
> > The subject should begin with "wifi: iwlwifi: ".
> >
> > I don't see patch 2. Via which tree is the plan for this patch?
>
> patch 2 are similar changes but related to the mellanox driver.
>
> This is the continuation of the trip point rework:
>
> https://lore.kernel.org/netdev/20221003092602.1323944-22-daniel.lezcano@linaro.org/t/
>
> This patch is planned to go through the thermal tree
>
> Sorry I should have mentioned that.
>
As Kalle commented above, the subject should start with wifi: iwlwifi:
The commit itself seems fine to me.
Acked-by: Gregory Greenman <gregory.greenman@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function
2022-10-14 10:21 ` Daniel Lezcano
2022-10-18 9:38 ` Greenman, Gregory
@ 2022-10-19 6:04 ` Kalle Valo
1 sibling, 0 replies; 11+ messages in thread
From: Kalle Valo @ 2022-10-19 6:04 UTC (permalink / raw)
To: Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Gregory Greenman,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Luca Coelho, Johannes Berg, Emmanuel Grumbach, Miri Korenblit,
Nathan Errera, open list:INTEL WIRELESS WIFI LINK (iwlwifi),
open list:NETWORKING DRIVERS
Daniel Lezcano <daniel.lezcano@linaro.org> writes:
> On 14/10/2022 12:15, Kalle Valo wrote:
>
>> Daniel Lezcano <daniel.lezcano@linaro.org> writes:
>>
>>> The thermal framework gives the possibility to register the trip
>>> points with the thermal zone. When that is done, no get_trip_* ops are
>>> needed and they can be removed.
>>>
>>> The get_trip_temp, get_trip_hyst and get_trip_type are handled by the
>>> get_trip_point().
>>>
>>> The set_trip_temp() generic function does some checks which are no
>>> longer needed in the set_trip_point() ops.
>>>
>>> Convert ops content logic into generic trip points and register them
>>> with the thermal zone.
>>>
>>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>>> ---
>>> drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +-
>>> drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 71 ++++----------------
>>> 2 files changed, 13 insertions(+), 60 deletions(-)
>>
>> The subject should begin with "wifi: iwlwifi: ".
>>
>> I don't see patch 2. Via which tree is the plan for this patch?
>
> patch 2 are similar changes but related to the mellanox driver.
>
> This is the continuation of the trip point rework:
>
> https://lore.kernel.org/netdev/20221003092602.1323944-22-daniel.lezcano@linaro.org/t/
>
> This patch is planned to go through the thermal tree
Ok, feel free to take this via the thermal tree:
Acked-by: Kalle Valo <kvalo@kernel.org>
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function
2022-10-18 6:28 ` Ido Schimmel
@ 2022-10-25 7:02 ` Daniel Lezcano
2022-10-25 10:32 ` Ido Schimmel
0 siblings, 1 reply; 11+ messages in thread
From: Daniel Lezcano @ 2022-10-25 7:02 UTC (permalink / raw)
To: Ido Schimmel, vadimp
Cc: rafael, linux-pm, linux-kernel, Petr Machata, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:MELLANOX ETHERNET SWITCH DRIVERS
Hi Ido,
On 18/10/2022 08:28, Ido Schimmel wrote:
> + Vadim
>
> On Fri, Oct 14, 2022 at 09:32:51AM +0200, Daniel Lezcano wrote:
>> The thermal framework gives the possibility to register the trip
>> points with the thermal zone. When that is done, no get_trip_* ops are
>> needed and they can be removed.
>>
>> Convert ops content logic into generic trip points and register them with the
>> thermal zone.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>
> Vadim, can you please review and test?
>
> Daniel, I saw that you wrote to Kalle that you want to take it via the
> thermal tree. Any reason not to take it via net-next? I'm asking because
> it will be the second release in a row where we need to try to avoid
> conflicts in this file.
Because I hope I can remove the ops->get_trip_ ops from thermal_ops
structure before the end of this cycle.
May be you can consider moving the thermal driver into drivers/thermal?
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function
2022-10-25 7:02 ` Daniel Lezcano
@ 2022-10-25 10:32 ` Ido Schimmel
2022-10-30 17:24 ` Vadim Pasternak
0 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2022-10-25 10:32 UTC (permalink / raw)
To: Daniel Lezcano, vadimp
Cc: vadimp, rafael, linux-pm, linux-kernel, Petr Machata,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:MELLANOX ETHERNET SWITCH DRIVERS
On Tue, Oct 25, 2022 at 09:02:23AM +0200, Daniel Lezcano wrote:
> Because I hope I can remove the ops->get_trip_ ops from thermal_ops
> structure before the end of this cycle.
OK. Vadim, any chance you can review the patch?
> May be you can consider moving the thermal driver into drivers/thermal?
I don't think it's worth the hassle (if possible at all). In practice,
this code is upstream for almost six years and IIRC we didn't have any
conflicts with the thermal tree. I don't expect conflicts this cycle
either.
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 2/2] thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function
2022-10-25 10:32 ` Ido Schimmel
@ 2022-10-30 17:24 ` Vadim Pasternak
2022-11-06 18:13 ` Vadim Pasternak
0 siblings, 1 reply; 11+ messages in thread
From: Vadim Pasternak @ 2022-10-30 17:24 UTC (permalink / raw)
To: Ido Schimmel, Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Petr Machata, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:MELLANOX ETHERNET SWITCH DRIVERS
> -----Original Message-----
> From: Ido Schimmel <idosch@nvidia.com>
> Sent: Tuesday, 25 October 2022 13:32
> To: Daniel Lezcano <daniel.lezcano@linaro.org>; Vadim Pasternak
> <vadimp@nvidia.com>
> Cc: Vadim Pasternak <vadimp@nvidia.com>; rafael@kernel.org; linux-
> pm@vger.kernel.org; linux-kernel@vger.kernel.org; Petr Machata
> <petrm@nvidia.com>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo Abeni <pabeni@redhat.com>; open list:MELLANOX ETHERNET SWITCH
> DRIVERS <netdev@vger.kernel.org>
> Subject: Re: [PATCH 2/2] thermal/drivers/mellanox: Use generic
> thermal_zone_get_trip() function
>
> On Tue, Oct 25, 2022 at 09:02:23AM +0200, Daniel Lezcano wrote:
> > Because I hope I can remove the ops->get_trip_ ops from thermal_ops
> > structure before the end of this cycle.
>
> OK. Vadim, any chance you can review the patch?
It seems to be OK.
Anyway, I'll take this patch for testing by the end of this week and update.
>
> > May be you can consider moving the thermal driver into drivers/thermal?
>
> I don't think it's worth the hassle (if possible at all). In practice, this code is
> upstream for almost six years and IIRC we didn't have any conflicts with the
> thermal tree. I don't expect conflicts this cycle either.
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 2/2] thermal/drivers/mellanox: Use generic thermal_zone_get_trip() function
2022-10-30 17:24 ` Vadim Pasternak
@ 2022-11-06 18:13 ` Vadim Pasternak
0 siblings, 0 replies; 11+ messages in thread
From: Vadim Pasternak @ 2022-11-06 18:13 UTC (permalink / raw)
To: Ido Schimmel, Daniel Lezcano
Cc: rafael, linux-pm, linux-kernel, Petr Machata, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:MELLANOX ETHERNET SWITCH DRIVERS
> -----Original Message-----
> From: Vadim Pasternak
> Sent: Sunday, 30 October 2022 19:24
> To: Ido Schimmel <idosch@nvidia.com>; Daniel Lezcano
> <daniel.lezcano@linaro.org>
> Cc: rafael@kernel.org; linux-pm@vger.kernel.org; linux-
> kernel@vger.kernel.org; Petr Machata <petrm@nvidia.com>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; open
> list:MELLANOX ETHERNET SWITCH DRIVERS <netdev@vger.kernel.org>
> Subject: RE: [PATCH 2/2] thermal/drivers/mellanox: Use generic
> thermal_zone_get_trip() function
>
>
>
> > -----Original Message-----
> > From: Ido Schimmel <idosch@nvidia.com>
> > Sent: Tuesday, 25 October 2022 13:32
> > To: Daniel Lezcano <daniel.lezcano@linaro.org>; Vadim Pasternak
> > <vadimp@nvidia.com>
> > Cc: Vadim Pasternak <vadimp@nvidia.com>; rafael@kernel.org; linux-
> > pm@vger.kernel.org; linux-kernel@vger.kernel.org; Petr Machata
> > <petrm@nvidia.com>; David S. Miller <davem@davemloft.net>; Eric
> > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> Paolo
> > Abeni <pabeni@redhat.com>; open list:MELLANOX ETHERNET SWITCH
> DRIVERS
> > <netdev@vger.kernel.org>
> > Subject: Re: [PATCH 2/2] thermal/drivers/mellanox: Use generic
> > thermal_zone_get_trip() function
> >
> > On Tue, Oct 25, 2022 at 09:02:23AM +0200, Daniel Lezcano wrote:
> > > Because I hope I can remove the ops->get_trip_ ops from thermal_ops
> > > structure before the end of this cycle.
> >
> > OK. Vadim, any chance you can review the patch?
>
> It seems to be OK.
> Anyway, I'll take this patch for testing by the end of this week and update.
>
Hi guys,
I see this patch is already applied to Linux-next.
I tested it along with relevant patches from drivers/thermal and it looks OK.
Thanks,
Vadim.
> >
> > > May be you can consider moving the thermal driver into drivers/thermal?
> >
> > I don't think it's worth the hassle (if possible at all). In practice,
> > this code is upstream for almost six years and IIRC we didn't have any
> > conflicts with the thermal tree. I don't expect conflicts this cycle either.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-11-06 18:13 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 7:32 [PATCH 1/2] thermal/drivers/iwlwifi: Use generic thermal_zone_get_trip() function Daniel Lezcano
2022-10-14 7:32 ` [PATCH 2/2] thermal/drivers/mellanox: " Daniel Lezcano
2022-10-18 6:28 ` Ido Schimmel
2022-10-25 7:02 ` Daniel Lezcano
2022-10-25 10:32 ` Ido Schimmel
2022-10-30 17:24 ` Vadim Pasternak
2022-11-06 18:13 ` Vadim Pasternak
2022-10-14 10:15 ` [PATCH 1/2] thermal/drivers/iwlwifi: " Kalle Valo
2022-10-14 10:21 ` Daniel Lezcano
2022-10-18 9:38 ` Greenman, Gregory
2022-10-19 6:04 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).