#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/thermal.h>
#include <linux/util_macros.h>
enum tc654_regs { … };
#define TC654_REG_RPM(idx) …
#define TC654_REG_FAN_FAULT(idx) …
#define TC654_REG_CONFIG_RES …
#define TC654_REG_CONFIG_DUTYC …
#define TC654_REG_CONFIG_SDM …
#define TC654_REG_STATUS_F2F …
#define TC654_REG_STATUS_F1F …
#define TC654_HIGH_RPM_RESOLUTION …
#define TC654_LOW_RPM_RESOLUTION …
#define TC654_FAN_FAULT_FROM_REG(val) …
#define TC654_FAN_FAULT_TO_REG(val) …
#define TC654_UPDATE_INTERVAL …
struct tc654_data { … };
static struct tc654_data *tc654_update_client(struct device *dev)
{ … }
static ssize_t fan_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static ssize_t fan_min_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static ssize_t fan_min_store(struct device *dev, struct device_attribute *da,
const char *buf, size_t count)
{ … }
static ssize_t fan_alarm_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static const u8 TC654_FAN_PULSE_SHIFT[] = …;
static ssize_t fan_pulses_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t fan_pulses_store(struct device *dev,
struct device_attribute *da, const char *buf,
size_t count)
{ … }
static ssize_t pwm_mode_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static ssize_t pwm_mode_store(struct device *dev, struct device_attribute *da,
const char *buf, size_t count)
{ … }
static const int tc654_pwm_map[16] = …;
static ssize_t pwm_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static int _set_pwm(struct tc654_data *data, unsigned long val)
{ … }
static ssize_t pwm_store(struct device *dev, struct device_attribute *da,
const char *buf, size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RO(fan1_input, fan, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_input, fan, 1);
static SENSOR_DEVICE_ATTR_RW(fan1_min, fan_min, 0);
static SENSOR_DEVICE_ATTR_RW(fan2_min, fan_min, 1);
static SENSOR_DEVICE_ATTR_RO(fan1_alarm, fan_alarm, 0);
static SENSOR_DEVICE_ATTR_RO(fan2_alarm, fan_alarm, 1);
static SENSOR_DEVICE_ATTR_RW(fan1_pulses, fan_pulses, 0);
static SENSOR_DEVICE_ATTR_RW(fan2_pulses, fan_pulses, 1);
static SENSOR_DEVICE_ATTR_RW(pwm1_mode, pwm_mode, 0);
static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0);
static struct attribute *tc654_attrs[] = …;
ATTRIBUTE_GROUPS(…);
#define TC654_MAX_COOLING_STATE …
static int tc654_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state)
{ … }
static int tc654_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *state)
{ … }
static int tc654_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state)
{ … }
static const struct thermal_cooling_device_ops tc654_fan_cool_ops = …;
static int tc654_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id tc654_id[] = …;
MODULE_DEVICE_TABLE(i2c, tc654_id);
static struct i2c_driver tc654_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;