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

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/* Copyright (c) 2016-2018 Mellanox Technologies. All rights reserved
 * Copyright (c) 2016 Ivan Vecera <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/sysfs.h>
#include <linux/thermal.h>
#include <linux/err.h>
#include <linux/sfp.h>

#include "core.h"
#include "core_env.h"

#define MLXSW_THERMAL_POLL_INT
#define MLXSW_THERMAL_SLOW_POLL_INT
#define MLXSW_THERMAL_ASIC_TEMP_NORM
#define MLXSW_THERMAL_ASIC_TEMP_HIGH
#define MLXSW_THERMAL_ASIC_TEMP_HOT
#define MLXSW_THERMAL_MODULE_TEMP_NORM
#define MLXSW_THERMAL_MODULE_TEMP_HIGH
#define MLXSW_THERMAL_MODULE_TEMP_HOT
#define MLXSW_THERMAL_HYSTERESIS_TEMP
#define MLXSW_THERMAL_MODULE_TEMP_SHIFT
#define MLXSW_THERMAL_MAX_STATE
#define MLXSW_THERMAL_MIN_STATE
#define MLXSW_THERMAL_MAX_DUTY

/* External cooling devices, allowed for binding to mlxsw thermal zones. */
static char * const mlxsw_thermal_external_allowed_cdev[] =;

struct mlxsw_cooling_states {};

static const struct thermal_trip default_thermal_trips[] =;

static const struct thermal_trip default_thermal_module_trips[] =;

static const struct mlxsw_cooling_states default_cooling_states[] =;

#define MLXSW_THERMAL_NUM_TRIPS

struct mlxsw_thermal;

struct mlxsw_thermal_cooling_device {};

struct mlxsw_thermal_module {};

struct mlxsw_thermal_area {};

struct mlxsw_thermal {};

static inline u8 mlxsw_state_to_duty(int state)
{}

static inline int mlxsw_duty_to_state(u8 duty)
{}

static int mlxsw_get_cooling_device_idx(struct mlxsw_thermal *thermal,
					struct thermal_cooling_device *cdev)
{}

static bool mlxsw_thermal_should_bind(struct thermal_zone_device *tzdev,
				      const struct thermal_trip *trip,
				      struct thermal_cooling_device *cdev,
				      struct cooling_spec *c)
{}

static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
				  int *p_temp)
{}

static struct thermal_zone_params mlxsw_thermal_params =;

static struct thermal_zone_device_ops mlxsw_thermal_ops =;

static bool mlxsw_thermal_module_should_bind(struct thermal_zone_device *tzdev,
					     const struct thermal_trip *trip,
					     struct thermal_cooling_device *cdev,
					     struct cooling_spec *c)
{}

static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
					 int *p_temp)
{}

static struct thermal_zone_device_ops mlxsw_thermal_module_ops =;

static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
					  int *p_temp)
{}

static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops =;

static int mlxsw_thermal_get_max_state(struct thermal_cooling_device *cdev,
				       unsigned long *p_state)
{}

static int mlxsw_thermal_get_cur_state(struct thermal_cooling_device *cdev,
				       unsigned long *p_state)

{}

static int mlxsw_thermal_set_cur_state(struct thermal_cooling_device *cdev,
				       unsigned long state)

{}

static const struct thermal_cooling_device_ops mlxsw_cooling_ops =;

static int
mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
{}

static void mlxsw_thermal_module_tz_fini(struct thermal_zone_device *tzdev)
{}

static int
mlxsw_thermal_module_init(struct mlxsw_thermal *thermal,
			  struct mlxsw_thermal_area *area, u8 module)
{}

static void mlxsw_thermal_module_fini(struct mlxsw_thermal_module *module_tz)
{}

static int
mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
			   struct mlxsw_thermal *thermal,
			   struct mlxsw_thermal_area *area)
{}

static void
mlxsw_thermal_modules_fini(struct mlxsw_thermal *thermal,
			   struct mlxsw_thermal_area *area)
{}

static int
mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
{}

static void
mlxsw_thermal_gearbox_tz_fini(struct mlxsw_thermal_module *gearbox_tz)
{}

static int
mlxsw_thermal_gearboxes_init(struct device *dev, struct mlxsw_core *core,
			     struct mlxsw_thermal *thermal,
			     struct mlxsw_thermal_area *area)
{}

static void
mlxsw_thermal_gearboxes_fini(struct mlxsw_thermal *thermal,
			     struct mlxsw_thermal_area *area)
{}

static void
mlxsw_thermal_got_active(struct mlxsw_core *mlxsw_core, u8 slot_index,
			 void *priv)
{}

static void
mlxsw_thermal_got_inactive(struct mlxsw_core *mlxsw_core, u8 slot_index,
			   void *priv)
{}

static struct mlxsw_linecards_event_ops mlxsw_thermal_event_ops =;

int mlxsw_thermal_init(struct mlxsw_core *core,
		       const struct mlxsw_bus_info *bus_info,
		       struct mlxsw_thermal **p_thermal)
{}

void mlxsw_thermal_fini(struct mlxsw_thermal *thermal)
{}