sonic-buildimage/platform/pddf/i2c/modules/include/pddf_psu_driver.h
fk410167 a3dd3f55f9
Platform Driver Developement Framework (PDDF) (#4756)
This change introduces PDDF which is described here: https://github.com/Azure/SONiC/pull/536

Most of the platform bring up effort goes in developing the platform device drivers, SONiC platform APIs and validating them. Typically each platform vendor writes their own drivers and platform APIs which is very tailor made to that platform. This involves writing code, building, installing it on the target platform devices and testing. Many of the details of the platform are hard coded into these drivers, from the HW spec. They go through this cycle repetitively till everything works fine, and is validated before upstreaming the code.
PDDF aims to make this platform driver and platform APIs development process much simpler by providing a data driven development framework. This is enabled by:

JSON descriptor files for platform data
Generic data-driven drivers for various devices
Generic SONiC platform APIs
Vendor specific extensions for customisation and extensibility

Signed-off-by: Fuzail Khan <fuzail.khan@broadcom.com>
2020-11-12 10:22:38 -08:00

66 lines
1.7 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_I_OUT,
PSU_P_OUT, /* This is in micro watts to comply with lm-sensors */
PSU_FAN1_SPEED,
PSU_TEMP1_INPUT,
PSU_V_IN,
PSU_I_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