#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/sysfs.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
#include <linux/util_macros.h>
#define THERMAL_PID_REG …
#define THERMAL_SMSC_ID_REG …
#define THERMAL_REVISION_REG …
enum emc1403_chip { … };
struct thermal_data { … };
static ssize_t power_state_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static ssize_t power_state_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(power_state);
static struct attribute *emc1403_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int emc1403_detect(struct i2c_client *client,
struct i2c_board_info *info)
{ … }
static bool emc1403_regmap_is_volatile(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config emc1403_regmap_config = …;
enum emc1403_reg_map { … };
static u8 ema1403_temp_map[] = …;
static u8 emc1403_temp_regs[][4] = …;
static s8 emc1403_temp_regs_low[][4] = …;
static int __emc1403_get_temp(struct thermal_data *data, int channel,
enum emc1403_reg_map map, long *val)
{ … }
static int emc1403_get_temp(struct thermal_data *data, int channel,
enum emc1403_reg_map map, long *val)
{ … }
static int emc1403_get_hyst(struct thermal_data *data, int channel,
enum emc1403_reg_map map, long *val)
{ … }
static int emc1403_temp_read(struct thermal_data *data, u32 attr, int channel, long *val)
{ … }
static int emc1403_get_convrate(struct thermal_data *data, long *val)
{ … }
static int emc1403_chip_read(struct thermal_data *data, u32 attr, long *val)
{ … }
static int emc1403_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int emc1403_set_hyst(struct thermal_data *data, long val)
{ … }
static int emc1403_set_temp(struct thermal_data *data, int channel,
enum emc1403_reg_map map, long val)
{ … }
static int emc1403_temp_write(struct thermal_data *data, u32 attr, int channel, long val)
{ … }
static const u16 ina3221_conv_time[] = …;
static int emc1403_set_convrate(struct thermal_data *data, unsigned int interval)
{ … }
static int emc1403_chip_write(struct thermal_data *data, u32 attr, long val)
{ … }
static int emc1403_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static umode_t emc1403_temp_is_visible(const void *_data, u32 attr, int channel)
{ … }
static umode_t emc1403_chip_is_visible(const void *_data, u32 attr)
{ … }
static umode_t emc1403_is_visible(const void *data, enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static const struct hwmon_channel_info * const emc1403_info[] = …;
static const struct hwmon_ops emc1403_hwmon_ops = …;
static const struct hwmon_chip_info emc1403_chip_info = …;
static const struct i2c_device_id emc1403_idtable[] = …;
MODULE_DEVICE_TABLE(i2c, emc1403_idtable);
static int emc1403_probe(struct i2c_client *client)
{ … }
static const unsigned short emc1403_address_list[] = …;
static struct i2c_driver sensor_emc1403 = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;