#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/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/sysfs.h>
static const unsigned short normal_i2c[] = …;
enum chips { … };
#define MAX_CHANNELS …
#define TMP421_STATUS_REG …
#define TMP421_CONFIG_REG_1 …
#define TMP421_CONFIG_REG_2 …
#define TMP421_CONFIG_REG_REN(x) …
#define TMP421_CONFIG_REG_REN_MASK …
#define TMP421_CONVERSION_RATE_REG …
#define TMP421_N_FACTOR_REG_1 …
#define TMP421_MANUFACTURER_ID_REG …
#define TMP421_DEVICE_ID_REG …
static const u8 TMP421_TEMP_MSB[MAX_CHANNELS] = …;
static const u8 TMP421_TEMP_LSB[MAX_CHANNELS] = …;
#define TMP421_CONFIG_SHUTDOWN …
#define TMP421_CONFIG_RANGE …
#define TMP421_MANUFACTURER_ID …
#define TMP421_DEVICE_ID …
#define TMP422_DEVICE_ID …
#define TMP423_DEVICE_ID …
#define TMP441_DEVICE_ID …
#define TMP442_DEVICE_ID …
static const struct i2c_device_id tmp421_id[] = …;
MODULE_DEVICE_TABLE(i2c, tmp421_id);
static const struct of_device_id __maybe_unused tmp421_of_match[] = …;
MODULE_DEVICE_TABLE(of, tmp421_of_match);
struct tmp421_channel { … };
struct tmp421_data { … };
static int temp_from_raw(u16 reg, bool extended)
{ … }
static int tmp421_update_device(struct tmp421_data *data)
{ … }
static int tmp421_enable_channels(struct tmp421_data *data)
{ … }
static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int tmp421_read_string(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, const char **str)
{ … }
static int tmp421_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static int tmp421_init_client(struct tmp421_data *data)
{ … }
static int tmp421_detect(struct i2c_client *client,
struct i2c_board_info *info)
{ … }
static int tmp421_probe_child_from_dt(struct i2c_client *client,
struct device_node *child,
struct tmp421_data *data)
{ … }
static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *data)
{ … }
static const struct hwmon_ops tmp421_ops = …;
static int tmp421_probe(struct i2c_client *client)
{ … }
static struct i2c_driver tmp421_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;