#include <linux/bitops.h>
#include <linux/bug.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/math.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/units.h>
#define TMP51X_SHUNT_CONFIG …
#define TMP51X_TEMP_CONFIG …
#define TMP51X_STATUS …
#define TMP51X_SMBUS_ALERT …
#define TMP51X_SHUNT_CURRENT_RESULT …
#define TMP51X_BUS_VOLTAGE_RESULT …
#define TMP51X_POWER_RESULT …
#define TMP51X_BUS_CURRENT_RESULT …
#define TMP51X_LOCAL_TEMP_RESULT …
#define TMP51X_REMOTE_TEMP_RESULT_1 …
#define TMP51X_REMOTE_TEMP_RESULT_2 …
#define TMP51X_SHUNT_CURRENT_H_LIMIT …
#define TMP51X_SHUNT_CURRENT_L_LIMIT …
#define TMP51X_BUS_VOLTAGE_H_LIMIT …
#define TMP51X_BUS_VOLTAGE_L_LIMIT …
#define TMP51X_POWER_LIMIT …
#define TMP51X_LOCAL_TEMP_LIMIT …
#define TMP51X_REMOTE_TEMP_LIMIT_1 …
#define TMP51X_REMOTE_TEMP_LIMIT_2 …
#define TMP51X_SHUNT_CALIBRATION …
#define TMP51X_N_FACTOR_AND_HYST_1 …
#define TMP51X_N_FACTOR_2 …
#define TMP51X_MAN_ID_REG …
#define TMP51X_DEVICE_ID_REG …
#define TMP513_REMOTE_TEMP_RESULT_3 …
#define TMP513_REMOTE_TEMP_LIMIT_3 …
#define TMP513_N_FACTOR_3 …
#define TMP51X_MANUFACTURER_ID …
#define TMP512_DEVICE_ID …
#define TMP513_DEVICE_ID …
#define TMP51X_SHUNT_CONFIG_DEFAULT …
#define TMP51X_SHUNT_VALUE_DEFAULT …
#define TMP51X_VBUS_RANGE_DEFAULT …
#define TMP51X_PGA_DEFAULT …
#define TMP51X_MAX_REGISTER_ADDR …
#define CURRENT_SENSE_VOLTAGE_320_MASK …
#define CURRENT_SENSE_VOLTAGE_160_MASK …
#define CURRENT_SENSE_VOLTAGE_80_MASK …
#define CURRENT_SENSE_VOLTAGE_40_MASK …
#define TMP51X_BUS_VOLTAGE_MASK …
#define TMP51X_NFACTOR_MASK …
#define TMP51X_HYST_MASK …
#define TMP51X_BUS_VOLTAGE_SHIFT …
#define TMP51X_TEMP_SHIFT …
#define TMP51X_SHUNT_CURRENT_H_LIMIT_POS …
#define TMP51X_SHUNT_CURRENT_L_LIMIT_POS …
#define TMP51X_BUS_VOLTAGE_H_LIMIT_POS …
#define TMP51X_BUS_VOLTAGE_L_LIMIT_POS …
#define TMP51X_POWER_LIMIT_POS …
#define TMP51X_LOCAL_TEMP_LIMIT_POS …
#define TMP51X_REMOTE_TEMP_LIMIT_1_POS …
#define TMP51X_REMOTE_TEMP_LIMIT_2_POS …
#define TMP513_REMOTE_TEMP_LIMIT_3_POS …
#define TMP51X_VBUS_RANGE_32V …
#define TMP51X_VBUS_RANGE_16V …
#define MAX_BUS_VOLTAGE_32_LIMIT …
#define MAX_BUS_VOLTAGE_16_LIMIT …
#define MAX_TEMP_LIMIT …
#define MIN_TEMP_LIMIT …
#define MAX_TEMP_HYST …
#define TMP512_MAX_CHANNELS …
#define TMP513_MAX_CHANNELS …
#define TMP51X_TEMP_CONFIG_CONV_RATE …
#define TMP51X_TEMP_CONFIG_RC …
#define TMP51X_TEMP_CHANNEL_MASK(n) …
#define TMP51X_TEMP_CONFIG_CONT …
#define TMP51X_TEMP_CONFIG_DEFAULT(n) …
static const u8 TMP51X_TEMP_INPUT[4] = …;
static const u8 TMP51X_TEMP_CRIT[4] = …;
static const u8 TMP51X_TEMP_CRIT_ALARM[4] = …;
static const u8 TMP51X_TEMP_CRIT_HYST[4] = …;
static const u8 TMP51X_CURR_INPUT[2] = …;
static const struct regmap_config tmp51x_regmap_config = …;
struct tmp51x_data { … };
static inline u8 tmp51x_get_pga_shift(struct tmp51x_data *data)
{ … }
static int tmp51x_get_value(struct tmp51x_data *data, u8 reg, u8 pos,
unsigned int regval, long *val)
{ … }
static int tmp51x_set_value(struct tmp51x_data *data, u8 reg, long val)
{ … }
static u8 tmp51x_get_reg(enum hwmon_sensor_types type, u32 attr, int channel)
{ … }
static u8 tmp51x_get_status_pos(enum hwmon_sensor_types type, u32 attr,
int channel)
{ … }
static int tmp51x_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int tmp51x_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static umode_t tmp51x_is_visible(const void *_data,
enum hwmon_sensor_types type, u32 attr,
int channel)
{ … }
static const struct hwmon_channel_info * const tmp51x_info[] = …;
static const struct hwmon_ops tmp51x_hwmon_ops = …;
static const struct hwmon_chip_info tmp51x_chip_info = …;
static int tmp51x_calibrate(struct tmp51x_data *data)
{ … }
static int tmp51x_init(struct tmp51x_data *data)
{ … }
static const struct i2c_device_id tmp51x_id[] = …;
MODULE_DEVICE_TABLE(i2c, tmp51x_id);
static const struct of_device_id tmp51x_of_match[] = …;
MODULE_DEVICE_TABLE(of, tmp51x_of_match);
static int tmp51x_vbus_range_to_reg(struct device *dev,
struct tmp51x_data *data)
{ … }
static int tmp51x_pga_gain_to_reg(struct device *dev, struct tmp51x_data *data)
{ … }
static int tmp51x_read_properties(struct device *dev, struct tmp51x_data *data)
{ … }
static void tmp51x_use_default(struct tmp51x_data *data)
{ … }
static int tmp51x_configure(struct device *dev, struct tmp51x_data *data)
{ … }
static int tmp51x_probe(struct i2c_client *client)
{ … }
static struct i2c_driver tmp51x_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;