linux/drivers/hwmon/nct6775-platform.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * nct6775 - Platform driver for the hardware monitoring
 *	     functionality of Nuvoton NCT677x Super-I/O chips
 *
 * Copyright (C) 2012  Guenter Roeck <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon-vid.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>

#include "nct6775.h"

enum sensor_access {};

static const char * const nct6775_sio_names[] __initconst =;

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

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

#define DRVNAME

#define NCT6775_PORT_CHIPID

/*
 * ISA constants
 */

#define IOREGION_ALIGNMENT
#define IOREGION_OFFSET
#define IOREGION_LENGTH
#define ADDR_REG_OFFSET
#define DATA_REG_OFFSET

/*
 * Super-I/O constants and functions
 */

#define NCT6775_LD_ACPI
#define NCT6775_LD_HWM
#define NCT6775_LD_VID
#define NCT6775_LD_12

#define SIO_REG_LDSEL
#define SIO_REG_DEVID
#define SIO_REG_ENABLE
#define SIO_REG_ADDR

#define SIO_NCT6106_ID
#define SIO_NCT6116_ID
#define SIO_NCT6775_ID
#define SIO_NCT6776_ID
#define SIO_NCT6779_ID
#define SIO_NCT6791_ID
#define SIO_NCT6792_ID
#define SIO_NCT6793_ID
#define SIO_NCT6795_ID
#define SIO_NCT6796_ID
#define SIO_NCT6797_ID
#define SIO_NCT6798_ID
#define SIO_NCT6799_ID
#define SIO_ID_MASK

/*
 * Control registers
 */
#define NCT6775_REG_CR_FAN_DEBOUNCE

struct nct6775_sio_data {};

#define ASUSWMI_METHOD
#define ASUSWMI_METHODID_RSIO
#define ASUSWMI_METHODID_WSIO
#define ASUSWMI_METHODID_RHWM
#define ASUSWMI_METHODID_WHWM
#define ASUSWMI_UNSUPPORTED_METHOD
#define ASUSWMI_DEVICE_HID
#define ASUSWMI_DEVICE_UID
#define ASUSMSI_DEVICE_UID

#if IS_ENABLED(CONFIG_ACPI)
/*
 * ASUS boards have only one device with WMI "WMBD" method and have provided
 * access to only one SuperIO chip at 0x0290.
 */
static struct acpi_device *asus_acpi_dev;
#endif

static int nct6775_asuswmi_evaluate_method(u32 method_id, u8 bank, u8 reg, u8 val, u32 *retval)
{}

static inline int nct6775_asuswmi_write(u8 bank, u8 reg, u8 val)
{}

static inline int nct6775_asuswmi_read(u8 bank, u8 reg, u8 *val)
{}

static int superio_wmi_inb(struct nct6775_sio_data *sio_data, int reg)
{}

static void superio_wmi_outb(struct nct6775_sio_data *sio_data, int reg, int val)
{}

static void superio_wmi_select(struct nct6775_sio_data *sio_data, int ld)
{}

static int superio_wmi_enter(struct nct6775_sio_data *sio_data)
{}

static void superio_wmi_exit(struct nct6775_sio_data *sio_data)
{}

static void superio_outb(struct nct6775_sio_data *sio_data, int reg, int val)
{}

static int superio_inb(struct nct6775_sio_data *sio_data, int reg)
{}

static void superio_select(struct nct6775_sio_data *sio_data, int ld)
{}

static int superio_enter(struct nct6775_sio_data *sio_data)
{}

static void superio_exit(struct nct6775_sio_data *sio_data)
{}

static inline void nct6775_wmi_set_bank(struct nct6775_data *data, u16 reg)
{}

static int nct6775_wmi_reg_read(void *ctx, unsigned int reg, unsigned int *val)
{}

static int nct6775_wmi_reg_write(void *ctx, unsigned int reg, unsigned int value)
{}

/*
 * On older chips, only registers 0x50-0x5f are banked.
 * On more recent chips, all registers are banked.
 * Assume that is the case and set the bank number for each access.
 * Cache the bank number so it only needs to be set if it changes.
 */
static inline void nct6775_set_bank(struct nct6775_data *data, u16 reg)
{}

static int nct6775_reg_read(void *ctx, unsigned int reg, unsigned int *val)
{}

static int nct6775_reg_write(void *ctx, unsigned int reg, unsigned int value)
{}

static void nct6791_enable_io_mapping(struct nct6775_sio_data *sio_data)
{}

static int nct6775_suspend(struct device *dev)
{}

static int nct6775_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(nct6775_dev_pm_ops, nct6775_suspend, nct6775_resume);

static void
nct6775_check_fan_inputs(struct nct6775_data *data, struct nct6775_sio_data *sio_data)
{}

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

static DEVICE_ATTR_RO(cpu0_vid);

/* Case open detection */

static const u8 NCT6775_REG_CR_CASEOPEN_CLR[] =;
static const u8 NCT6775_CR_CASEOPEN_CLR_MASK[] =;

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

static SENSOR_DEVICE_ATTR(intrusion0_alarm, 0644, nct6775_show_alarm,
			  clear_caseopen, INTRUSION_ALARM_BASE);
static SENSOR_DEVICE_ATTR(intrusion1_alarm, 0644, nct6775_show_alarm,
			  clear_caseopen, INTRUSION_ALARM_BASE + 1);
static SENSOR_DEVICE_ATTR(intrusion0_beep, 0644, nct6775_show_beep,
			  nct6775_store_beep, INTRUSION_ALARM_BASE);
static SENSOR_DEVICE_ATTR(intrusion1_beep, 0644, nct6775_show_beep,
			  nct6775_store_beep, INTRUSION_ALARM_BASE + 1);
static SENSOR_DEVICE_ATTR(beep_enable, 0644, nct6775_show_beep,
			  nct6775_store_beep, BEEP_ENABLE_BASE);

static umode_t nct6775_other_is_visible(struct kobject *kobj,
					struct attribute *attr, int index)
{}

/*
 * nct6775_other_is_visible uses the index into the following array
 * to determine if attributes should be created or not.
 * Any change in order or content must be matched.
 */
static struct attribute *nct6775_attributes_other[] =;

static const struct attribute_group nct6775_group_other =;

static int nct6775_platform_probe_init(struct nct6775_data *data)
{}

static const struct regmap_config nct6775_regmap_config =;

static const struct regmap_config nct6775_wmi_regmap_config =;

static int nct6775_platform_probe(struct platform_device *pdev)
{}

static struct platform_driver nct6775_driver =;

/* nct6775_find() looks for a '627 in the Super-I/O config space */
static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
{}

/*
 * when Super-I/O functions move to a separate file, the Super-I/O
 * bus will manage the lifetime of the device and this module will only keep
 * track of the nct6775 driver. But since we use platform_device_alloc(), we
 * must keep track of the device
 */
static struct platform_device *pdev[2];

static const char * const asus_wmi_boards[] =;

static const char * const asus_msi_boards[] =;

#if IS_ENABLED(CONFIG_ACPI)
/*
 * Callback for acpi_bus_for_each_dev() to find the right device
 * by _UID and _HID and return 1 to stop iteration.
 */
static int nct6775_asuswmi_device_match(struct device *dev, void *data)
{}
#endif

static enum sensor_access nct6775_determine_access(const char *device_uid)
{}

static int __init sensors_nct6775_platform_init(void)
{}

static void __exit sensors_nct6775_platform_exit(void)
{}

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

module_init();
module_exit(sensors_nct6775_platform_exit);