linux/drivers/hwmon/f75375s.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * f75375s.c - driver for the Fintek F75375/SP, F75373 and
 *             F75387SG/RG hardware monitoring features
 * Copyright (C) 2006-2007  Riku Voipio
 *
 * Datasheets available at:
 *
 * f75375:
 * http://www.fintek.com.tw/files/productfiles/F75375_V026P.pdf
 *
 * f75373:
 * http://www.fintek.com.tw/files/productfiles/F75373_V025P.pdf
 *
 * f75387:
 * http://www.fintek.com.tw/files/productfiles/F75387_V027P.pdf
 */

#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/f75375s.h>
#include <linux/slab.h>

/* Addresses to scan */
static const unsigned short normal_i2c[] =;

enum chips {};

/* Fintek F75375 registers  */
#define F75375_REG_CONFIG0
#define F75375_REG_CONFIG1
#define F75375_REG_CONFIG2
#define F75375_REG_CONFIG3
#define F75375_REG_ADDR
#define F75375_REG_INTR
#define F75375_CHIP_ID
#define F75375_REG_VERSION
#define F75375_REG_VENDOR
#define F75375_REG_FAN_TIMER

#define F75375_REG_VOLT(nr)
#define F75375_REG_VOLT_HIGH(nr)
#define F75375_REG_VOLT_LOW(nr)

#define F75375_REG_TEMP(nr)
#define F75387_REG_TEMP11_LSB(nr)
#define F75375_REG_TEMP_HIGH(nr)
#define F75375_REG_TEMP_HYST(nr)

#define F75375_REG_FAN(nr)
#define F75375_REG_FAN_MIN(nr)
#define F75375_REG_FAN_FULL(nr)
#define F75375_REG_FAN_PWM_DUTY(nr)
#define F75375_REG_FAN_PWM_CLOCK(nr)

#define F75375_REG_FAN_EXP(nr)
#define F75375_REG_FAN_B_TEMP(nr, step)
#define F75375_REG_FAN_B_SPEED(nr, step)

#define F75375_REG_PWM1_RAISE_DUTY
#define F75375_REG_PWM2_RAISE_DUTY
#define F75375_REG_PWM1_DROP_DUTY
#define F75375_REG_PWM2_DROP_DUTY

#define F75375_FAN_CTRL_LINEAR(nr)
#define F75387_FAN_CTRL_LINEAR(nr)
#define FAN_CTRL_MODE(nr)
#define F75387_FAN_DUTY_MODE(nr)
#define F75387_FAN_MANU_MODE(nr)

/*
 * Data structures and manipulation thereof
 */

struct f75375_data {};

static inline int f75375_read8(struct i2c_client *client, u8 reg)
{}

/* in most cases, should be called while holding update_lock */
static inline u16 f75375_read16(struct i2c_client *client, u8 reg)
{}

static inline void f75375_write8(struct i2c_client *client, u8 reg,
		u8 value)
{}

static inline void f75375_write16(struct i2c_client *client, u8 reg,
		u16 value)
{}

static void f75375_write_pwm(struct i2c_client *client, int nr)
{}

static struct f75375_data *f75375_update_device(struct device *dev)
{}

static inline u16 rpm_from_reg(u16 reg)
{}

static inline u16 rpm_to_reg(int rpm)
{}

static bool duty_mode_enabled(u8 pwm_enable)
{}

static bool auto_mode_enabled(u8 pwm_enable)
{}

static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static ssize_t set_fan_target(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static ssize_t show_pwm_enable(struct device *dev, struct device_attribute
		*attr, char *buf)
{}

static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
{}

static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static ssize_t show_pwm(struct device *dev, struct device_attribute
		*attr, char *buf)
{}

static ssize_t show_pwm_mode(struct device *dev, struct device_attribute
		*attr, char *buf)
{}

#define VOLT_FROM_REG(val)
#define VOLT_TO_REG(val)

static ssize_t show_in(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}
#define TEMP_FROM_REG(val)
#define TEMP_TO_REG(val)
#define TEMP11_FROM_REG(reg)

static ssize_t show_temp11(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static ssize_t show_temp_max_hyst(struct device *dev,
		struct device_attribute *attr, char *buf)
{}

static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static ssize_t set_temp_max_hyst(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count)
{}

#define show_fan(thing)

show_fan(fan);
show_fan(fan_min);
show_fan(fan_max);
show_fan(fan_target);

static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_in, NULL, 0);
static SENSOR_DEVICE_ATTR(in0_max, S_IRUGO|S_IWUSR,
	show_in_max, set_in_max, 0);
static SENSOR_DEVICE_ATTR(in0_min, S_IRUGO|S_IWUSR,
	show_in_min, set_in_min, 0);
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 1);
static SENSOR_DEVICE_ATTR(in1_max, S_IRUGO|S_IWUSR,
	show_in_max, set_in_max, 1);
static SENSOR_DEVICE_ATTR(in1_min, S_IRUGO|S_IWUSR,
	show_in_min, set_in_min, 1);
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 2);
static SENSOR_DEVICE_ATTR(in2_max, S_IRUGO|S_IWUSR,
	show_in_max, set_in_max, 2);
static SENSOR_DEVICE_ATTR(in2_min, S_IRUGO|S_IWUSR,
	show_in_min, set_in_min, 2);
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 3);
static SENSOR_DEVICE_ATTR(in3_max, S_IRUGO|S_IWUSR,
	show_in_max, set_in_max, 3);
static SENSOR_DEVICE_ATTR(in3_min, S_IRUGO|S_IWUSR,
	show_in_min, set_in_min, 3);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp11, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO|S_IWUSR,
	show_temp_max_hyst, set_temp_max_hyst, 0);
static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO|S_IWUSR,
	show_temp_max, set_temp_max, 0);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp11, NULL, 1);
static SENSOR_DEVICE_ATTR(temp2_max_hyst, S_IRUGO|S_IWUSR,
	show_temp_max_hyst, set_temp_max_hyst, 1);
static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO|S_IWUSR,
	show_temp_max, set_temp_max, 1);
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0);
static SENSOR_DEVICE_ATTR(fan1_max, S_IRUGO, show_fan_max, NULL, 0);
static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO|S_IWUSR,
	show_fan_min, set_fan_min, 0);
static SENSOR_DEVICE_ATTR(fan1_target, S_IRUGO|S_IWUSR,
	show_fan_target, set_fan_target, 0);
static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1);
static SENSOR_DEVICE_ATTR(fan2_max, S_IRUGO, show_fan_max, NULL, 1);
static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO|S_IWUSR,
	show_fan_min, set_fan_min, 1);
static SENSOR_DEVICE_ATTR(fan2_target, S_IRUGO|S_IWUSR,
	show_fan_target, set_fan_target, 1);
static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR,
	show_pwm, set_pwm, 0);
static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR,
	show_pwm_enable, set_pwm_enable, 0);
static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO,
	show_pwm_mode, set_pwm_mode, 0);
static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR,
	show_pwm, set_pwm, 1);
static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR,
	show_pwm_enable, set_pwm_enable, 1);
static SENSOR_DEVICE_ATTR(pwm2_mode, S_IRUGO,
	show_pwm_mode, set_pwm_mode, 1);

static struct attribute *f75375_attributes[] =;

static const struct attribute_group f75375_group =;

static void f75375_init(struct i2c_client *client, struct f75375_data *data,
		struct f75375s_platform_data *f75375s_pdata)
{}

static int f75375_probe(struct i2c_client *client)
{}

static void f75375_remove(struct i2c_client *client)
{}

/* Return 0 if detection is successful, -ENODEV otherwise */
static int f75375_detect(struct i2c_client *client,
			 struct i2c_board_info *info)
{}

static const struct i2c_device_id f75375_id[] =;
MODULE_DEVICE_TABLE(i2c, f75375_id);

static struct i2c_driver f75375_driver =;
module_i2c_driver();

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();