16 #include <linux/module.h>
18 #include <linux/slab.h>
20 #include <linux/i2c.h>
39 #define G760A_REG_FAN_STA_RPM_OFF 0x1
40 #define G760A_REG_FAN_STA_RPM_LOW 0x2
43 #define G760A_UPDATE_INTERVAL (HZ)
66 #define G760A_DEFAULT_CLK 32768
67 #define G760A_DEFAULT_FAN_DIV 2
69 #define PWM_FROM_CNT(cnt) (0xff-(cnt))
70 #define PWM_TO_CNT(pwm) (0xff-(pwm))
74 return ((val == 0x00) ? 0 : ((clk*30)/(val*div)));
87 .remove = g760a_remove,
116 dev_dbg(&client->
dev,
"Starting g760a update\n");
134 struct g760a_data *data = g760a_update_client(dev);
135 unsigned int rpm = 0;
142 return sprintf(buf,
"%d\n", rpm);
148 struct g760a_data *data = g760a_update_client(dev);
152 return sprintf(buf,
"%d\n", fan_alarm);
158 struct g760a_data *data = g760a_update_client(dev);
164 const char *buf,
size_t count)
167 struct g760a_data *data = g760a_update_client(dev);
170 if (kstrtoul(buf, 10, &val))
185 static struct attribute *g760a_attributes[] = {
187 &dev_attr_fan1_input.attr,
188 &dev_attr_fan1_alarm.attr,
193 .attrs = g760a_attributes,
200 static int g760a_probe(
struct i2c_client *client,
206 if (!i2c_check_functionality(client->
adapter,
215 i2c_set_clientdata(client, data);
232 goto error_hwmon_device_register;
237 error_hwmon_device_register:
242 static int g760a_remove(
struct i2c_client *client)
244 struct g760a_data *data = i2c_get_clientdata(client);