linux/drivers/misc/ics932s401.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * A driver for the Integrated Circuits ICS932S401
 * Copyright (C) 2008 IBM
 *
 * Author: Darrick J. Wong <[email protected]>
 */

#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/log2.h>
#include <linux/slab.h>

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

/* ICS932S401 registers */
#define ICS932S401_REG_CFG2
#define ICS932S401_CFG1_SPREAD
#define ICS932S401_REG_CFG7
#define ICS932S401_FS_MASK
#define ICS932S401_REG_VENDOR_REV
#define ICS932S401_VENDOR
#define ICS932S401_VENDOR_MASK
#define ICS932S401_REV
#define ICS932S401_REV_SHIFT
#define ICS932S401_REG_DEVICE
#define ICS932S401_DEVICE
#define ICS932S401_REG_CTRL
#define ICS932S401_MN_ENABLED
#define ICS932S401_CPU_ALT
#define ICS932S401_SRC_ALT
#define ICS932S401_REG_CPU_M_CTRL
#define ICS932S401_M_MASK
#define ICS932S401_REG_CPU_N_CTRL
#define ICS932S401_REG_CPU_SPREAD1
#define ICS932S401_REG_CPU_SPREAD2
#define ICS932S401_SPREAD_MASK
#define ICS932S401_REG_SRC_M_CTRL
#define ICS932S401_REG_SRC_N_CTRL
#define ICS932S401_REG_SRC_SPREAD1
#define ICS932S401_REG_SRC_SPREAD2
#define ICS932S401_REG_CPU_DIVISOR
#define ICS932S401_CPU_DIVISOR_SHIFT
#define ICS932S401_REG_PCISRC_DIVISOR
#define ICS932S401_SRC_DIVISOR_MASK
#define ICS932S401_PCI_DIVISOR_SHIFT

/* Base clock is 14.318MHz */
#define BASE_CLOCK

#define NUM_REGS
#define NUM_MIRRORED_REGS

static int regs_to_copy[NUM_MIRRORED_REGS] =;

/* How often do we reread sensors values? (In jiffies) */
#define SENSOR_REFRESH_INTERVAL

/* How often do we reread sensor limit values? (In jiffies) */
#define LIMIT_REFRESH_INTERVAL

struct ics932s401_data {};

static int ics932s401_probe(struct i2c_client *client);
static int ics932s401_detect(struct i2c_client *client,
			  struct i2c_board_info *info);
static void ics932s401_remove(struct i2c_client *client);

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

static struct i2c_driver ics932s401_driver =;

static struct ics932s401_data *ics932s401_update_device(struct device *dev)
{}

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

/* bit to cpu khz map */
static const int fs_speeds[] =;

/* clock divisor map */
static const int divisors[] =;

/* Calculate CPU frequency from the M/N registers. */
static int calculate_cpu_freq(struct ics932s401_data *data)
{}

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

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

/* Calculate SRC frequency from the M/N registers. */
static int calculate_src_freq(struct ics932s401_data *data)
{}

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

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

/* Calculate PCI frequency from the SRC M/N registers. */
static int calculate_pci_freq(struct ics932s401_data *data)
{}

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

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

static ssize_t show_value(struct device *dev,
			  struct device_attribute *devattr,
			  char *buf);

static ssize_t show_spread(struct device *dev,
			   struct device_attribute *devattr,
			   char *buf);

static DEVICE_ATTR(spread_enabled, S_IRUGO, show_spread_enabled, NULL);
static DEVICE_ATTR(cpu_clock_selection, S_IRUGO, show_cpu_clock_sel, NULL);
static DEVICE_ATTR(cpu_clock, S_IRUGO, show_cpu_clock, NULL);
static DEVICE_ATTR(src_clock_selection, S_IRUGO, show_src_clock_sel, NULL);
static DEVICE_ATTR(src_clock, S_IRUGO, show_src_clock, NULL);
static DEVICE_ATTR(pci_clock_selection, S_IRUGO, show_pci_clock_sel, NULL);
static DEVICE_ATTR(pci_clock, S_IRUGO, show_pci_clock, NULL);
static DEVICE_ATTR(usb_clock, S_IRUGO, show_value, NULL);
static DEVICE_ATTR(ref_clock, S_IRUGO, show_value, NULL);
static DEVICE_ATTR(cpu_spread, S_IRUGO, show_spread, NULL);
static DEVICE_ATTR(src_spread, S_IRUGO, show_spread, NULL);

static struct attribute *ics932s401_attr[] =;

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

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

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

static int ics932s401_probe(struct i2c_client *client)
{}

static void ics932s401_remove(struct i2c_client *client)
{}

module_i2c_driver();

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

/* IBM IntelliStation Z30 */
MODULE_ALIAS();
MODULE_ALIAS();

/* IBM x3650/x3550 */
MODULE_ALIAS();
MODULE_ALIAS();