#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/pmbus.h>
#include <linux/gpio/driver.h>
#include <linux/timekeeping.h>
#include "pmbus.h"
enum chips { … };
#define UCD9000_MONITOR_CONFIG …
#define UCD9000_NUM_PAGES …
#define UCD9000_FAN_CONFIG_INDEX …
#define UCD9000_FAN_CONFIG …
#define UCD9000_MFR_STATUS …
#define UCD9000_GPIO_SELECT …
#define UCD9000_GPIO_CONFIG …
#define UCD9000_DEVICE_ID …
#define UCD9000_GPIO_CONFIG_ENABLE …
#define UCD9000_GPIO_CONFIG_OUT_ENABLE …
#define UCD9000_GPIO_CONFIG_OUT_VALUE …
#define UCD9000_GPIO_CONFIG_STATUS …
#define UCD9000_GPIO_INPUT …
#define UCD9000_GPIO_OUTPUT …
#define UCD9000_MON_TYPE(x) …
#define UCD9000_MON_PAGE(x) …
#define UCD9000_MON_VOLTAGE …
#define UCD9000_MON_TEMPERATURE …
#define UCD9000_MON_CURRENT …
#define UCD9000_MON_VOLTAGE_HW …
#define UCD9000_NUM_FAN …
#define UCD9000_GPIO_NAME_LEN …
#define UCD9090_NUM_GPIOS …
#define UCD901XX_NUM_GPIOS …
#define UCD90320_NUM_GPIOS …
#define UCD90910_NUM_GPIOS …
#define UCD9000_DEBUGFS_NAME_LEN …
#define UCD9000_GPI_COUNT …
#define UCD90320_GPI_COUNT …
struct ucd9000_data { … };
#define to_ucd9000_data(_info) …
struct ucd9000_debugfs_entry { … };
#define UCD90320_WAIT_DELAY_US …
static inline void ucd90320_wait(const struct ucd9000_data *data)
{ … }
static int ucd90320_read_word_data(struct i2c_client *client, int page,
int phase, int reg)
{ … }
static int ucd90320_read_byte_data(struct i2c_client *client, int page, int reg)
{ … }
static int ucd90320_write_word_data(struct i2c_client *client, int page,
int reg, u16 word)
{ … }
static int ucd90320_write_byte(struct i2c_client *client, int page, u8 value)
{ … }
static int ucd9000_get_fan_config(struct i2c_client *client, int fan)
{ … }
static int ucd9000_read_byte_data(struct i2c_client *client, int page, int reg)
{ … }
static const struct i2c_device_id ucd9000_id[] = …;
MODULE_DEVICE_TABLE(i2c, ucd9000_id);
static const struct of_device_id __maybe_unused ucd9000_of_match[] = …;
MODULE_DEVICE_TABLE(of, ucd9000_of_match);
#ifdef CONFIG_GPIOLIB
static int ucd9000_gpio_read_config(struct i2c_client *client,
unsigned int offset)
{ … }
static int ucd9000_gpio_get(struct gpio_chip *gc, unsigned int offset)
{ … }
static void ucd9000_gpio_set(struct gpio_chip *gc, unsigned int offset,
int value)
{ … }
static int ucd9000_gpio_get_direction(struct gpio_chip *gc,
unsigned int offset)
{ … }
static int ucd9000_gpio_set_direction(struct gpio_chip *gc,
unsigned int offset, bool direction_out,
int requested_out)
{ … }
static int ucd9000_gpio_direction_input(struct gpio_chip *gc,
unsigned int offset)
{ … }
static int ucd9000_gpio_direction_output(struct gpio_chip *gc,
unsigned int offset, int val)
{ … }
static void ucd9000_probe_gpio(struct i2c_client *client,
const struct i2c_device_id *mid,
struct ucd9000_data *data)
{ … }
#else
static void ucd9000_probe_gpio(struct i2c_client *client,
const struct i2c_device_id *mid,
struct ucd9000_data *data)
{
}
#endif
#ifdef CONFIG_DEBUG_FS
static int ucd9000_get_mfr_status(struct i2c_client *client, u8 *buffer)
{ … }
static int ucd9000_debugfs_show_mfr_status_bit(void *data, u64 *val)
{ … }
DEFINE_DEBUGFS_ATTRIBUTE(…);
static ssize_t ucd9000_debugfs_read_mfr_status(struct file *file,
char __user *buf, size_t count,
loff_t *ppos)
{ … }
static const struct file_operations ucd9000_debugfs_show_mfr_status_fops = …;
static int ucd9000_init_debugfs(struct i2c_client *client,
const struct i2c_device_id *mid,
struct ucd9000_data *data)
{ … }
#else
static int ucd9000_init_debugfs(struct i2c_client *client,
const struct i2c_device_id *mid,
struct ucd9000_data *data)
{
return 0;
}
#endif
static int ucd9000_probe(struct i2c_client *client)
{ … }
static struct i2c_driver ucd9000_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);