21
21
#define MLXSW_THERMAL_ASIC_TEMP_HOT 105000 /* 105C */
22
22
#define MLXSW_THERMAL_HYSTERESIS_TEMP 5000 /* 5C */
23
23
#define MLXSW_THERMAL_MODULE_TEMP_SHIFT (MLXSW_THERMAL_HYSTERESIS_TEMP * 2)
24
- #define MLXSW_THERMAL_TEMP_SCORE_MAX GENMASK(31, 0)
25
24
#define MLXSW_THERMAL_MAX_STATE 10
26
25
#define MLXSW_THERMAL_MIN_STATE 2
27
26
#define MLXSW_THERMAL_MAX_DUTY 255
@@ -101,8 +100,6 @@ struct mlxsw_thermal {
101
100
struct thermal_cooling_device * cdevs [MLXSW_MFCR_PWMS_MAX ];
102
101
u8 cooling_levels [MLXSW_THERMAL_MAX_STATE + 1 ];
103
102
struct mlxsw_thermal_trip trips [MLXSW_THERMAL_NUM_TRIPS ];
104
- unsigned int tz_highest_score ;
105
- struct thermal_zone_device * tz_highest_dev ;
106
103
struct mlxsw_thermal_area line_cards [];
107
104
};
108
105
@@ -193,34 +190,6 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
193
190
return 0 ;
194
191
}
195
192
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
-
224
193
static int mlxsw_thermal_bind (struct thermal_zone_device * tzdev ,
225
194
struct thermal_cooling_device * cdev )
226
195
{
@@ -286,9 +255,6 @@ static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
286
255
return err ;
287
256
}
288
257
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 );
292
258
293
259
* p_temp = temp ;
294
260
return 0 ;
@@ -349,21 +315,6 @@ static int mlxsw_thermal_set_trip_hyst(struct thermal_zone_device *tzdev,
349
315
return 0 ;
350
316
}
351
317
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
-
367
318
static struct thermal_zone_params mlxsw_thermal_params = {
368
319
.no_hwmon = true,
369
320
};
@@ -377,7 +328,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
377
328
.set_trip_temp = mlxsw_thermal_set_trip_temp ,
378
329
.get_trip_hyst = mlxsw_thermal_get_trip_hyst ,
379
330
.set_trip_hyst = mlxsw_thermal_set_trip_hyst ,
380
- .get_trend = mlxsw_thermal_trend_get ,
381
331
};
382
332
383
333
static 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,
463
413
int temp , crit_temp , emerg_temp ;
464
414
struct device * dev ;
465
415
u16 sensor_index ;
466
- int err ;
467
416
468
417
dev = thermal -> bus_info -> dev ;
469
418
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,
479
428
return 0 ;
480
429
481
430
/* 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 );
486
433
487
434
return 0 ;
488
435
}
@@ -546,22 +493,6 @@ mlxsw_thermal_module_trip_hyst_set(struct thermal_zone_device *tzdev, int trip,
546
493
return 0 ;
547
494
}
548
495
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
-
565
496
static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
566
497
.bind = mlxsw_thermal_module_bind ,
567
498
.unbind = mlxsw_thermal_module_unbind ,
@@ -571,7 +502,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
571
502
.set_trip_temp = mlxsw_thermal_module_trip_temp_set ,
572
503
.get_trip_hyst = mlxsw_thermal_module_trip_hyst_get ,
573
504
.set_trip_hyst = mlxsw_thermal_module_trip_hyst_set ,
574
- .get_trend = mlxsw_thermal_module_trend_get ,
575
505
};
576
506
577
507
static 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,
592
522
return err ;
593
523
594
524
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 );
597
525
598
526
* p_temp = temp ;
599
527
return 0 ;
@@ -608,7 +536,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
608
536
.set_trip_temp = mlxsw_thermal_module_trip_temp_set ,
609
537
.get_trip_hyst = mlxsw_thermal_module_trip_hyst_get ,
610
538
.set_trip_hyst = mlxsw_thermal_module_trip_hyst_set ,
611
- .get_trend = mlxsw_thermal_module_trend_get ,
612
539
};
613
540
614
541
static int mlxsw_thermal_get_max_state (struct thermal_cooling_device * cdev ,
0 commit comments