sonic-buildimage/platform/pddf/i2c/modules/include/pddf_fan_driver.h

108 lines
2.3 KiB
C
Raw Normal View History

/*
* Copyright 2019 Broadcom.
* The term Broadcom refers to Broadcom Inc. and/or its subsidiaries.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* Description
* FAN driver related data structures
*/
#ifndef __PDDF_FAN_DRIVER_H__
#define __PDDF_FAN_DRIVER_H__
enum fan_sysfs_attributes {
FAN1_PRESENT,
FAN2_PRESENT,
FAN3_PRESENT,
FAN4_PRESENT,
FAN5_PRESENT,
FAN6_PRESENT,
FAN7_PRESENT,
FAN8_PRESENT,
FAN9_PRESENT,
FAN10_PRESENT,
FAN11_PRESENT,
FAN12_PRESENT,
FAN1_DIRECTION,
FAN2_DIRECTION,
FAN3_DIRECTION,
FAN4_DIRECTION,
FAN5_DIRECTION,
FAN6_DIRECTION,
FAN7_DIRECTION,
FAN8_DIRECTION,
FAN9_DIRECTION,
FAN10_DIRECTION,
FAN11_DIRECTION,
FAN12_DIRECTION,
FAN1_INPUT,
FAN2_INPUT,
FAN3_INPUT,
FAN4_INPUT,
FAN5_INPUT,
FAN6_INPUT,
FAN7_INPUT,
FAN8_INPUT,
FAN9_INPUT,
FAN10_INPUT,
FAN11_INPUT,
FAN12_INPUT,
FAN1_PWM,
FAN2_PWM,
FAN3_PWM,
FAN4_PWM,
FAN5_PWM,
FAN6_PWM,
FAN7_PWM,
FAN8_PWM,
FAN9_PWM,
FAN10_PWM,
FAN11_PWM,
FAN12_PWM,
FAN1_FAULT,
FAN2_FAULT,
FAN3_FAULT,
FAN4_FAULT,
FAN5_FAULT,
FAN6_FAULT,
FAN7_FAULT,
FAN8_FAULT,
FAN9_FAULT,
FAN10_FAULT,
FAN11_FAULT,
FAN12_FAULT,
FAN_MAX_ATTR
};
/* Each client has this additional data */
struct fan_attr_info {
char name[ATTR_NAME_LEN];
struct mutex update_lock;
char valid; /* != 0 if registers are valid */
unsigned long last_updated; /* In jiffies */
union {
char strval[STR_ATTR_SIZE];
int intval;
u16 shortval;
u8 charval;
}val;
};
struct fan_data {
struct device *hwmon_dev;
int num_attr;
struct attribute *fan_attribute_list[MAX_FAN_ATTRS];
struct attribute_group fan_attribute_group;
struct fan_attr_info attr_info[MAX_FAN_ATTRS];
};
#endif