linux/drivers/hwmon/jc42.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * jc42.c - driver for Jedec JC42.4 compliant temperature sensors
 *
 * Copyright (c) 2010  Ericsson AB.
 *
 * Derived from lm77.c by Andras BALI <[email protected]>.
 *
 * JC42.4 compliant temperature sensors are typically used on memory modules.
 */

#include <linux/bitops.h>
#include <linux/bitfield.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/regmap.h>

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

/* JC42 registers. All registers are 16 bit. */
#define JC42_REG_CAP
#define JC42_REG_CONFIG
#define JC42_REG_TEMP_UPPER
#define JC42_REG_TEMP_LOWER
#define JC42_REG_TEMP_CRITICAL
#define JC42_REG_TEMP
#define JC42_REG_MANID
#define JC42_REG_DEVICEID
#define JC42_REG_SMBUS

/* Status bits in temperature register */
#define JC42_ALARM_CRIT
#define JC42_ALARM_MAX
#define JC42_ALARM_MIN

/* Configuration register defines */
#define JC42_CFG_CRIT_ONLY
#define JC42_CFG_TCRIT_LOCK
#define JC42_CFG_EVENT_LOCK
#define JC42_CFG_SHUTDOWN
#define JC42_CFG_HYST_MASK

/* Capabilities */
#define JC42_CAP_RANGE

/* Manufacturer IDs */
#define ADT_MANID
#define ATMEL_MANID
#define ATMEL_MANID2
#define MAX_MANID
#define IDT_MANID
#define MCP_MANID
#define NXP_MANID
#define ONS_MANID
#define STM_MANID
#define GT_MANID
#define GT_MANID2
#define SI_MANID

/* SMBUS register */
#define SMBUS_STMOUT

/* Supported chips */

/* Analog Devices */
#define ADT7408_DEVID
#define ADT7408_DEVID_MASK

/* Atmel */
#define AT30TS00_DEVID
#define AT30TS00_DEVID_MASK

#define GT34TS02_DEVID
#define GT34TS02_DEVID_MASK

#define TS3000_DEVID
#define TS3000_DEVID_MASK

#define TS3001_DEVID
#define TS3001_DEVID_MASK

/* Maxim */
#define MAX6604_DEVID
#define MAX6604_DEVID_MASK

/* Microchip */
#define MCP9804_DEVID
#define MCP9804_DEVID_MASK

#define MCP9808_DEVID
#define MCP9808_DEVID_MASK

#define MCP98242_DEVID
#define MCP98242_DEVID_MASK

#define MCP98243_DEVID
#define MCP98243_DEVID_MASK

#define MCP9843_DEVID
#define MCP9843_DEVID_MASK

/* NXP */
#define SE97_DEVID
#define SE97_DEVID_MASK

#define SE98_DEVID
#define SE98_DEVID_MASK

/* ON Semiconductor */
#define CAT6095_DEVID
#define CAT6095_DEVID_MASK

#define CAT34TS02C_DEVID
#define CAT34TS02C_DEVID_MASK

/* ST Microelectronics */
#define STTS424_DEVID
#define STTS424_DEVID_MASK

#define STTS424E_DEVID
#define STTS424E_DEVID_MASK

#define STTS2002_DEVID
#define STTS2002_DEVID_MASK

#define STTS3000_DEVID
#define STTS3000_DEVID_MASK

/* TSE2004 compliant sensors */
#define TSE2004_DEVID
#define TSE2004_DEVID_MASK

static u16 jc42_hysteresis[] =;

struct jc42_chips {};

static struct jc42_chips jc42_chips[] =;

/* Each client has this additional data */
struct jc42_data {};

#define JC42_TEMP_MIN_EXTENDED
#define JC42_TEMP_MIN
#define JC42_TEMP_MAX

static u16 jc42_temp_to_reg(long temp, bool extended)
{}

static int jc42_temp_from_reg(s16 reg)
{}

static int jc42_read(struct device *dev, enum hwmon_sensor_types type,
		     u32 attr, int channel, long *val)
{}

static int jc42_write(struct device *dev, enum hwmon_sensor_types type,
		      u32 attr, int channel, long val)
{}

static umode_t jc42_is_visible(const void *_data, enum hwmon_sensor_types type,
			       u32 attr, int channel)
{}

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

static const struct hwmon_channel_info * const jc42_info[] =;

static const struct hwmon_ops jc42_hwmon_ops =;

static const struct hwmon_chip_info jc42_chip_info =;

static bool jc42_readable_reg(struct device *dev, unsigned int reg)
{}

static bool jc42_writable_reg(struct device *dev, unsigned int reg)
{}

static bool jc42_volatile_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config jc42_regmap_config =;

static int jc42_probe(struct i2c_client *client)
{}

static void jc42_remove(struct i2c_client *client)
{}

#ifdef CONFIG_PM

static int jc42_suspend(struct device *dev)
{}

static int jc42_resume(struct device *dev)
{}

static const struct dev_pm_ops jc42_dev_pm_ops =;

#define JC42_DEV_PM_OPS
#else
#define JC42_DEV_PM_OPS
#endif /* CONFIG_PM */

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

#ifdef CONFIG_OF
static const struct of_device_id jc42_of_ids[] =;
MODULE_DEVICE_TABLE(of, jc42_of_ids);
#endif

static struct i2c_driver jc42_driver =;

module_i2c_driver();

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