37eddd479d
The S3IP (Simplified Switch System INtegration Program) sysfs specification defines a unified interface to access peripheral hardware on devices from different vendors, making it easier for SONiC to support different devices and platforms. PDDF is a framework to simplify the driver and SONiC platform APIs development for new platforms. This effort is first step in combining the two frameworks. This specific PR adds S3IP supported sysfs attribute in common FAN driver of PDDF.
125 lines
2.6 KiB
C
125 lines
2.6 KiB
C
/*
|
|
* 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,
|
|
FAN1_STATUS,
|
|
FAN2_STATUS,
|
|
FAN3_STATUS,
|
|
FAN4_STATUS,
|
|
FAN5_STATUS,
|
|
FAN6_STATUS,
|
|
FAN7_STATUS,
|
|
FAN8_STATUS,
|
|
FAN9_STATUS,
|
|
FAN10_STATUS,
|
|
FAN11_STATUS,
|
|
FAN12_STATUS,
|
|
FAN_DUTY_CYCLE,
|
|
FAN_MODEL_NAME,
|
|
FAN_SERIAL_NUM,
|
|
FAN_PART_NUM,
|
|
FAN_HW_VERSION,
|
|
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
|