linux/drivers/hwmon/pc87360.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  pc87360.c - Part of lm_sensors, Linux kernel modules
 *              for hardware monitoring
 *  Copyright (C) 2004, 2007 Jean Delvare <[email protected]>
 *
 *  Copied from smsc47m1.c:
 *  Copyright (C) 2002 Mark D. Studebaker <[email protected]>
 *
 *  Supports the following chips:
 *
 *  Chip        #vin    #fan    #pwm    #temp   devid
 *  PC87360     -       2       2       -       0xE1
 *  PC87363     -       2       2       -       0xE8
 *  PC87364     -       3       3       -       0xE4
 *  PC87365     11      3       3       2       0xE5
 *  PC87366     11      3       3       3-4     0xE9
 *
 *  This driver assumes that no more than one chip is present, and one of
 *  the standard Super-I/O addresses is used (0x2E/0x2F or 0x4E/0x4F).
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/platform_device.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon-vid.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/acpi.h>
#include <linux/io.h>

#define DRIVER_NAME

/* (temp & vin) channel conversion status register flags (pdf sec.11.5.12) */
#define CHAN_CNVRTD
#define CHAN_ENA
#define CHAN_ALM_ENA
#define CHAN_READY

#define TEMP_OTS_OE
#define VIN_RW1C_MASK
#define TEMP_RW1C_MASK

static u8 devid;
static struct platform_device *pdev;
static unsigned short extra_isa[3];
static u8 confreg[4];

static int init =;
module_param(init, int, 0);
MODULE_PARM_DESC();

static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC();

/*
 * Super-I/O registers and operations
 */

#define DEV
#define DEVID
#define ACT
#define BASE

#define FSCM
#define VLM
#define TMS
#define LDNI_MAX
static const u8 logdev[LDNI_MAX] =;

#define LD_FAN
#define LD_IN
#define LD_TEMP

static inline void superio_outb(int sioaddr, int reg, int val)
{}

static inline int superio_inb(int sioaddr, int reg)
{}

static inline void superio_exit(int sioaddr)
{}

/*
 * Logical devices
 */

#define PC87360_EXTENT
#define PC87365_REG_BANK
#define NO_BANK

/*
 * Fan registers and conversions
 */

/* nr has to be 0 or 1 (PC87360/87363) or 2 (PC87364/87365/87366) */
#define PC87360_REG_PRESCALE(nr)
#define PC87360_REG_PWM(nr)
#define PC87360_REG_FAN_MIN(nr)
#define PC87360_REG_FAN(nr)
#define PC87360_REG_FAN_STATUS(nr)

#define FAN_FROM_REG(val, div)
#define FAN_TO_REG(val, div)
#define FAN_DIV_FROM_REG(val)
#define FAN_STATUS_FROM_REG(val)

#define FAN_CONFIG_MONITOR(val, nr)
#define FAN_CONFIG_CONTROL(val, nr)
#define FAN_CONFIG_INVERT(val, nr)

#define PWM_FROM_REG(val, inv)
static inline u8 PWM_TO_REG(int val, int inv)
{}

/*
 * Voltage registers and conversions
 */

#define PC87365_REG_IN_CONVRATE
#define PC87365_REG_IN_CONFIG
#define PC87365_REG_IN
#define PC87365_REG_IN_MIN
#define PC87365_REG_IN_MAX
#define PC87365_REG_IN_STATUS
#define PC87365_REG_IN_ALARMS1
#define PC87365_REG_IN_ALARMS2
#define PC87365_REG_VID

#define IN_FROM_REG(val, ref)
#define IN_TO_REG(val, ref)

/*
 * Temperature registers and conversions
 */

#define PC87365_REG_TEMP_CONFIG
#define PC87365_REG_TEMP
#define PC87365_REG_TEMP_MIN
#define PC87365_REG_TEMP_MAX
#define PC87365_REG_TEMP_CRIT
#define PC87365_REG_TEMP_STATUS
#define PC87365_REG_TEMP_ALARMS

#define TEMP_FROM_REG(val)
#define TEMP_TO_REG(val)

/*
 * Device data
 */

struct pc87360_data {};

/*
 * ldi is the logical device index
 * bank is for voltages and temperatures only
 */
static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank,
			      u8 reg)
{}

static void pc87360_write_value(struct pc87360_data *data, u8 ldi, u8 bank,
				u8 reg, u8 value)
{}

static void pc87360_autodiv(struct device *dev, int nr)
{}

static struct pc87360_data *pc87360_update_device(struct device *dev)
{}

static ssize_t in_input_show(struct device *dev,
			     struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute in_input[] =;

static ssize_t in_status_show(struct device *dev,
			      struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute in_status[] =;

static ssize_t in_min_show(struct device *dev,
			   struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute in_min[] =;

static ssize_t in_max_show(struct device *dev,
			   struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute in_max[] =;

/* (temp & vin) channel status register alarm bits (pdf sec.11.5.12) */
#define CHAN_ALM_MIN
#define CHAN_ALM_MAX
#define TEMP_ALM_CRIT

/*
 * show_in_min/max_alarm() reads data from the per-channel status
 * register (sec 11.5.12), not the vin event status registers (sec
 * 11.5.2) that (legacy) show_in_alarm() resds (via data->in_alarms)
 */

static ssize_t in_min_alarm_show(struct device *dev,
				 struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute in_min_alarm[] =;

static ssize_t in_max_alarm_show(struct device *dev,
				 struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute in_max_alarm[] =;

#define VIN_UNIT_ATTRS(X)

static ssize_t cpu0_vid_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(cpu0_vid);

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

static ssize_t vrm_store(struct device *dev, struct device_attribute *attr,
			 const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(vrm);

static ssize_t alarms_in_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(alarms_in);

static struct attribute *pc8736x_vin_attr_array[] =;
static const struct attribute_group pc8736x_vin_group =;

static ssize_t therm_input_show(struct device *dev,
				struct device_attribute *devattr, char *buf)
{}

/*
 * the +11 term below reflects the fact that VLM units 11,12,13 are
 * used in the chip to measure voltage across the thermistors
 */
static struct sensor_device_attribute therm_input[] =;

static ssize_t therm_status_show(struct device *dev,
				 struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute therm_status[] =;

static ssize_t therm_min_show(struct device *dev,
			      struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute therm_min[] =;

static ssize_t therm_max_show(struct device *dev,
			      struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute therm_max[] =;

static ssize_t therm_crit_show(struct device *dev,
			       struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute therm_crit[] =;

/*
 * show_therm_min/max_alarm() reads data from the per-channel voltage
 * status register (sec 11.5.12)
 */
static ssize_t therm_min_alarm_show(struct device *dev,
				    struct device_attribute *devattr,
				    char *buf)
{}

static struct sensor_device_attribute therm_min_alarm[] =;

static ssize_t therm_max_alarm_show(struct device *dev,
				    struct device_attribute *devattr,
				    char *buf)
{}

static struct sensor_device_attribute therm_max_alarm[] =;

static ssize_t therm_crit_alarm_show(struct device *dev,
				     struct device_attribute *devattr,
				     char *buf)
{}

static struct sensor_device_attribute therm_crit_alarm[] =;

#define THERM_UNIT_ATTRS(X)

static struct attribute *pc8736x_therm_attr_array[] =;
static const struct attribute_group pc8736x_therm_group =;

static ssize_t temp_input_show(struct device *dev,
			       struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute temp_input[] =;

static ssize_t temp_status_show(struct device *dev,
				struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute temp_status[] =;

static ssize_t temp_min_show(struct device *dev,
			     struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute temp_min[] =;

static ssize_t temp_max_show(struct device *dev,
			     struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute temp_max[] =;

static ssize_t temp_crit_show(struct device *dev,
			      struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute temp_crit[] =;

/*
 * temp_min/max_alarm_show() reads data from the per-channel status
 * register (sec 12.3.7), not the temp event status registers (sec
 * 12.3.2) that show_temp_alarm() reads (via data->temp_alarms)
 */
static ssize_t temp_min_alarm_show(struct device *dev,
				   struct device_attribute *devattr,
				   char *buf)
{}

static struct sensor_device_attribute temp_min_alarm[] =;

static ssize_t temp_max_alarm_show(struct device *dev,
				   struct device_attribute *devattr,
				   char *buf)
{}

static struct sensor_device_attribute temp_max_alarm[] =;

static ssize_t temp_crit_alarm_show(struct device *dev,
				    struct device_attribute *devattr,
				    char *buf)
{}

static struct sensor_device_attribute temp_crit_alarm[] =;

#define TEMP_FAULT
static ssize_t temp_fault_show(struct device *dev,
			       struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute temp_fault[] =;

#define TEMP_UNIT_ATTRS(X)

static struct attribute *pc8736x_temp_attr[][10] =;

static const struct attribute_group pc8736x_temp_attr_group[] =;

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

static DEVICE_ATTR_RO(alarms_temp);

static ssize_t fan_input_show(struct device *dev,
			      struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute fan_input[] =;

static ssize_t fan_status_show(struct device *dev,
			       struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute fan_status[] =;

static ssize_t fan_div_show(struct device *dev,
			    struct device_attribute *devattr, char *buf)
{}

static struct sensor_device_attribute fan_div[] =;

static ssize_t fan_min_show(struct device *dev,
			    struct device_attribute *devattr, char *buf)
{}

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

static struct sensor_device_attribute fan_min[] =;

#define FAN_UNIT_ATTRS(X)

static struct attribute *pc8736x_fan_attr[][5] =;

static const struct attribute_group pc8736x_fan_attr_group[] =;

static ssize_t pwm_show(struct device *dev, struct device_attribute *devattr,
			char *buf)
{}

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

static struct sensor_device_attribute pwm[] =;

static ssize_t name_show(struct device *dev,
			struct device_attribute *devattr, char *buf)
{}

static DEVICE_ATTR_RO(name);

static void pc87360_remove_files(struct device *dev)
{}

static void pc87360_init_device(struct platform_device *pdev,
				int use_thermistors)
{}

static int pc87360_probe(struct platform_device *pdev)
{}

static void pc87360_remove(struct platform_device *pdev)
{}

/*
 * Driver data
 */
static struct platform_driver pc87360_driver =;

/*
 * Device detection, registration and update
 */

static int __init pc87360_find(int sioaddr, u8 *devid,
			       unsigned short *addresses)
{}

static int __init pc87360_device_add(unsigned short address)
{}

static int __init pc87360_init(void)
{}

static void __exit pc87360_exit(void)
{}

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

module_init();
module_exit(pc87360_exit);