2121#define MLXSW_THERMAL_ASIC_TEMP_HOT 105000 /* 105C */
2222#define MLXSW_THERMAL_HYSTERESIS_TEMP 5000 /* 5C */
2323#define MLXSW_THERMAL_MODULE_TEMP_SHIFT (MLXSW_THERMAL_HYSTERESIS_TEMP * 2)
24- #define MLXSW_THERMAL_TEMP_SCORE_MAX GENMASK(31, 0)
2524#define MLXSW_THERMAL_MAX_STATE 10
2625#define MLXSW_THERMAL_MIN_STATE 2
2726#define MLXSW_THERMAL_MAX_DUTY 255
@@ -101,8 +100,6 @@ struct mlxsw_thermal {
101100 struct thermal_cooling_device * cdevs [MLXSW_MFCR_PWMS_MAX ];
102101 u8 cooling_levels [MLXSW_THERMAL_MAX_STATE + 1 ];
103102 struct mlxsw_thermal_trip trips [MLXSW_THERMAL_NUM_TRIPS ];
104- unsigned int tz_highest_score ;
105- struct thermal_zone_device * tz_highest_dev ;
106103 struct mlxsw_thermal_area line_cards [];
107104};
108105
@@ -193,34 +190,6 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
193190 return 0 ;
194191}
195192
196- static void mlxsw_thermal_tz_score_update (struct mlxsw_thermal * thermal ,
197- struct thermal_zone_device * tzdev ,
198- struct mlxsw_thermal_trip * trips ,
199- int temp )
200- {
201- struct mlxsw_thermal_trip * trip = trips ;
202- unsigned int score , delta , i , shift = 1 ;
203-
204- /* Calculate thermal zone score, if temperature is above the hot
205- * threshold score is set to MLXSW_THERMAL_TEMP_SCORE_MAX.
206- */
207- score = MLXSW_THERMAL_TEMP_SCORE_MAX ;
208- for (i = MLXSW_THERMAL_TEMP_TRIP_NORM ; i < MLXSW_THERMAL_NUM_TRIPS ;
209- i ++ , trip ++ ) {
210- if (temp < trip -> temp ) {
211- delta = DIV_ROUND_CLOSEST (temp , trip -> temp - temp );
212- score = delta * shift ;
213- break ;
214- }
215- shift *= 256 ;
216- }
217-
218- if (score > thermal -> tz_highest_score ) {
219- thermal -> tz_highest_score = score ;
220- thermal -> tz_highest_dev = tzdev ;
221- }
222- }
223-
224193static int mlxsw_thermal_bind (struct thermal_zone_device * tzdev ,
225194 struct thermal_cooling_device * cdev )
226195{
@@ -286,9 +255,6 @@ static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
286255 return err ;
287256 }
288257 mlxsw_reg_mtmp_unpack (mtmp_pl , & temp , NULL , NULL , NULL , NULL );
289- if (temp > 0 )
290- mlxsw_thermal_tz_score_update (thermal , tzdev , thermal -> trips ,
291- temp );
292258
293259 * p_temp = temp ;
294260 return 0 ;
@@ -349,21 +315,6 @@ static int mlxsw_thermal_set_trip_hyst(struct thermal_zone_device *tzdev,
349315 return 0 ;
350316}
351317
352- static int mlxsw_thermal_trend_get (struct thermal_zone_device * tzdev ,
353- int trip , enum thermal_trend * trend )
354- {
355- struct mlxsw_thermal * thermal = tzdev -> devdata ;
356-
357- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS )
358- return - EINVAL ;
359-
360- if (tzdev == thermal -> tz_highest_dev )
361- return 1 ;
362-
363- * trend = THERMAL_TREND_STABLE ;
364- return 0 ;
365- }
366-
367318static struct thermal_zone_params mlxsw_thermal_params = {
368319 .no_hwmon = true,
369320};
@@ -377,7 +328,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
377328 .set_trip_temp = mlxsw_thermal_set_trip_temp ,
378329 .get_trip_hyst = mlxsw_thermal_get_trip_hyst ,
379330 .set_trip_hyst = mlxsw_thermal_set_trip_hyst ,
380- .get_trend = mlxsw_thermal_trend_get ,
381331};
382332
383333static int mlxsw_thermal_module_bind (struct thermal_zone_device * tzdev ,
@@ -463,7 +413,6 @@ static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
463413 int temp , crit_temp , emerg_temp ;
464414 struct device * dev ;
465415 u16 sensor_index ;
466- int err ;
467416
468417 dev = thermal -> bus_info -> dev ;
469418 sensor_index = MLXSW_REG_MTMP_MODULE_INDEX_MIN + tz -> module ;
@@ -479,10 +428,8 @@ static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
479428 return 0 ;
480429
481430 /* Update trip points. */
482- err = mlxsw_thermal_module_trips_update (dev , thermal -> core , tz ,
483- crit_temp , emerg_temp );
484- if (!err && temp > 0 )
485- mlxsw_thermal_tz_score_update (thermal , tzdev , tz -> trips , temp );
431+ mlxsw_thermal_module_trips_update (dev , thermal -> core , tz ,
432+ crit_temp , emerg_temp );
486433
487434 return 0 ;
488435}
@@ -546,22 +493,6 @@ mlxsw_thermal_module_trip_hyst_set(struct thermal_zone_device *tzdev, int trip,
546493 return 0 ;
547494}
548495
549- static int mlxsw_thermal_module_trend_get (struct thermal_zone_device * tzdev ,
550- int trip , enum thermal_trend * trend )
551- {
552- struct mlxsw_thermal_module * tz = tzdev -> devdata ;
553- struct mlxsw_thermal * thermal = tz -> parent ;
554-
555- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS )
556- return - EINVAL ;
557-
558- if (tzdev == thermal -> tz_highest_dev )
559- return 1 ;
560-
561- * trend = THERMAL_TREND_STABLE ;
562- return 0 ;
563- }
564-
565496static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
566497 .bind = mlxsw_thermal_module_bind ,
567498 .unbind = mlxsw_thermal_module_unbind ,
@@ -571,7 +502,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
571502 .set_trip_temp = mlxsw_thermal_module_trip_temp_set ,
572503 .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get ,
573504 .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set ,
574- .get_trend = mlxsw_thermal_module_trend_get ,
575505};
576506
577507static int mlxsw_thermal_gearbox_temp_get (struct thermal_zone_device * tzdev ,
@@ -592,8 +522,6 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
592522 return err ;
593523
594524 mlxsw_reg_mtmp_unpack (mtmp_pl , & temp , NULL , NULL , NULL , NULL );
595- if (temp > 0 )
596- mlxsw_thermal_tz_score_update (thermal , tzdev , tz -> trips , temp );
597525
598526 * p_temp = temp ;
599527 return 0 ;
@@ -608,7 +536,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
608536 .set_trip_temp = mlxsw_thermal_module_trip_temp_set ,
609537 .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get ,
610538 .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set ,
611- .get_trend = mlxsw_thermal_module_trend_get ,
612539};
613540
614541static int mlxsw_thermal_get_max_state (struct thermal_cooling_device * cdev ,
0 commit comments