#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/slab.h>
#define MAX31790_REG_GLOBAL_CONFIG …
#define MAX31790_REG_FAN_CONFIG(ch) …
#define MAX31790_REG_FAN_DYNAMICS(ch) …
#define MAX31790_REG_FAN_FAULT_STATUS2 …
#define MAX31790_REG_FAN_FAULT_STATUS1 …
#define MAX31790_REG_TACH_COUNT(ch) …
#define MAX31790_REG_PWM_DUTY_CYCLE(ch) …
#define MAX31790_REG_PWMOUT(ch) …
#define MAX31790_REG_TARGET_COUNT(ch) …
#define MAX31790_FAN_CFG_RPM_MODE …
#define MAX31790_FAN_CFG_CTRL_MON …
#define MAX31790_FAN_CFG_TACH_INPUT_EN …
#define MAX31790_FAN_CFG_TACH_INPUT …
#define MAX31790_FAN_DYN_SR_SHIFT …
#define MAX31790_FAN_DYN_SR_MASK …
#define SR_FROM_REG(reg) …
#define FAN_RPM_MIN …
#define FAN_RPM_MAX …
#define FAN_COUNT_REG_MAX …
#define RPM_FROM_REG(reg, sr) …
#define RPM_TO_REG(rpm, sr) …
#define NR_CHANNEL …
#define PWM_INPUT_SCALE …
#define MAX31790_REG_PWMOUT_SCALE …
struct max31790_data { … };
static struct max31790_data *max31790_update_device(struct device *dev)
{ … }
static const u8 tach_period[8] = …;
static u8 get_tach_period(u8 fan_dynamics)
{ … }
static u8 bits_for_tach_period(int rpm)
{ … }
static int max31790_read_fan(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static int max31790_write_fan(struct device *dev, u32 attr, int channel,
long val)
{ … }
static umode_t max31790_fan_is_visible(const void *_data, u32 attr, int channel)
{ … }
static int max31790_read_pwm(struct device *dev, u32 attr, int channel,
long *val)
{ … }
static int max31790_write_pwm(struct device *dev, u32 attr, int channel,
long val)
{ … }
static umode_t max31790_pwm_is_visible(const void *_data, u32 attr, int channel)
{ … }
static int max31790_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int max31790_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static umode_t max31790_is_visible(const void *data,
enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static const struct hwmon_channel_info * const max31790_info[] = …;
static const struct hwmon_ops max31790_hwmon_ops = …;
static const struct hwmon_chip_info max31790_chip_info = …;
static int max31790_init_client(struct i2c_client *client,
struct max31790_data *data)
{ … }
static int max31790_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id max31790_id[] = …;
MODULE_DEVICE_TABLE(i2c, max31790_id);
static struct i2c_driver max31790_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;