#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
enum g760a_regs { … };
#define G760A_REG_FAN_STA_RPM_OFF …
#define G760A_REG_FAN_STA_RPM_LOW …
#define G760A_UPDATE_INTERVAL …
struct g760a_data { … };
#define G760A_DEFAULT_CLK …
#define G760A_DEFAULT_FAN_DIV …
#define PWM_FROM_CNT(cnt) …
#define PWM_TO_CNT(pwm) …
static inline unsigned int rpm_from_cnt(u8 val, u32 clk, u16 div)
{ … }
static int g760a_read_value(struct i2c_client *client, enum g760a_regs reg)
{ … }
static int g760a_write_value(struct i2c_client *client, enum g760a_regs reg,
u16 value)
{ … }
static struct g760a_data *g760a_update_client(struct device *dev)
{ … }
static ssize_t fan1_input_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t fan1_alarm_show(struct device *dev,
struct device_attribute *da, char *buf)
{ … }
static ssize_t pwm1_show(struct device *dev, struct device_attribute *da,
char *buf)
{ … }
static ssize_t pwm1_store(struct device *dev, struct device_attribute *da,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(pwm1);
static DEVICE_ATTR_RO(fan1_input);
static DEVICE_ATTR_RO(fan1_alarm);
static struct attribute *g760a_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int g760a_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id g760a_id[] = …;
MODULE_DEVICE_TABLE(i2c, g760a_id);
static struct i2c_driver g760a_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;