Skip to content

Commit 97cd342

Browse files
mellanoxbmcdavem330
authored andcommitted
mlxsw: core: Allow thermal zone binding to an external cooling device
Allow thermal zone binding to an external cooling device from the cooling devices white list. It provides support for Mellanox next generation systems on which cooling device logic is not controlled through the switch registers. Signed-off-by: Vadim Pasternak <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a53779d commit 97cd342

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
#define MLXSW_THERMAL_SPEED_MAX (MLXSW_THERMAL_MAX_STATE * 2)
3232
#define MLXSW_THERMAL_SPEED_MIN_LEVEL 2 /* 20% */
3333

34+
/* External cooling devices, allowed for binding to mlxsw thermal zones. */
35+
static char * const mlxsw_thermal_external_allowed_cdev[] = {
36+
"mlxreg_fan",
37+
};
38+
3439
struct mlxsw_thermal_trip {
3540
int type;
3641
int temp;
@@ -107,6 +112,13 @@ static int mlxsw_get_cooling_device_idx(struct mlxsw_thermal *thermal,
107112
if (thermal->cdevs[i] == cdev)
108113
return i;
109114

115+
/* Allow mlxsw thermal zone binding to an external cooling device */
116+
for (i = 0; i < ARRAY_SIZE(mlxsw_thermal_external_allowed_cdev); i++) {
117+
if (strnstr(cdev->type, mlxsw_thermal_external_allowed_cdev[i],
118+
sizeof(cdev->type)))
119+
return 0;
120+
}
121+
110122
return -ENODEV;
111123
}
112124

0 commit comments

Comments
 (0)