sonic-buildimage/platform/pddf/i2c/modules/include/pddf_psu_driver.h
FuzailBrcm abc8ed8a79
[pddf]: Adding PDDF common framework enhancements. (#12863)
- Consolidating multiple read functions in a PSU driver on the basis of byte, word or block read,
- Enhancing PDDF parsing script support for CPU and PCH temperature reading,
- Adding missing methods in PDDF common APIs

Why I did it
- PSU driver changes are to optimize the code and increase the code coverage
- PDDF parser script enhancements to accommodate the CPU and PCH temp reading using hwmon device path
- Some of the new APIs were missing from the PDDF common platform classes

How I did it
Added code changes and verified them on AS7816 adn AS7726 platforms.
2022-12-17 14:36:52 -08:00

71 lines
1.8 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
* PSU driver data structures
*/
#ifndef __PDDF_PSU_DRIVER_H__
#define __PDDF_PSU_DRIVER_H__
enum psu_sysfs_attributes {
PSU_PRESENT,
PSU_MODEL_NAME,
PSU_POWER_GOOD,
PSU_MFR_ID,
PSU_SERIAL_NUM,
PSU_FAN_DIR,
PSU_V_OUT,
PSU_V_OUT_MIN,
PSU_V_OUT_MAX,
PSU_I_OUT,
PSU_P_OUT, /* This is in micro watts to comply with lm-sensors */
PSU_P_OUT_MAX,
PSU_FAN1_SPEED,
PSU_TEMP1_INPUT,
PSU_TEMP1_HIGH_THRESHOLD,
PSU_V_IN,
PSU_I_IN,
PSU_P_IN,
PSU_ATTR_MAX
};
/* Every client has psu_data which is divided into per attribute data */
struct psu_attr_info {
char name[ATTR_NAME_LEN];
struct mutex update_lock;
char valid; /* !=0 if registers are valid */
unsigned long last_updated; /* In jiffies */
u8 status;
union {
char strval[STR_ATTR_SIZE];
int intval;
u16 shortval;
u8 charval;
}val;
};
struct psu_data {
struct device *hwmon_dev;
u8 index;
int num_psu_fans;
int num_attr;
struct attribute *psu_attribute_list[MAX_PSU_ATTRS];
struct attribute_group psu_attribute_group;
struct psu_attr_info attr_info[MAX_PSU_ATTRS];
};
#endif