#include <asm/page.h>
#include <linux/crc8.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
static const unsigned char sht3x_cmd_measure_single_hpm[] = …;
static const unsigned char sht3x_cmd_measure_single_mpm[] = …;
static const unsigned char sht3x_cmd_measure_single_lpm[] = …;
static const unsigned char sht3x_cmd_measure_periodic_mode[] = …;
static const unsigned char sht3x_cmd_break[] = …;
static const unsigned char sht3x_cmd_heater_on[] = …;
static const unsigned char sht3x_cmd_heater_off[] = …;
static const unsigned char sht3x_cmd_read_status_reg[] = …;
static const unsigned char sht3x_cmd_clear_status_reg[] = …;
static const unsigned char sht3x_cmd_read_serial_number[] = …;
static struct dentry *debugfs;
#define SHT3X_SINGLE_WAIT_TIME_HPM …
#define SHT3X_SINGLE_WAIT_TIME_MPM …
#define SHT3X_SINGLE_WAIT_TIME_LPM …
#define SHT3X_WORD_LEN …
#define SHT3X_CMD_LENGTH …
#define SHT3X_CRC8_LEN …
#define SHT3X_RESPONSE_LENGTH …
#define SHT3X_CRC8_POLYNOMIAL …
#define SHT3X_CRC8_INIT …
#define SHT3X_MIN_TEMPERATURE …
#define SHT3X_MAX_TEMPERATURE …
#define SHT3X_MIN_HUMIDITY …
#define SHT3X_MAX_HUMIDITY …
enum sht3x_chips { … };
enum sht3x_limits { … };
enum sht3x_repeatability { … };
DECLARE_CRC8_TABLE(sht3x_crc8_table);
static const char periodic_measure_commands_hpm[][SHT3X_CMD_LENGTH] = …;
static const char periodic_measure_commands_mpm[][SHT3X_CMD_LENGTH] = …;
static const char periodic_measure_commands_lpm[][SHT3X_CMD_LENGTH] = …;
struct sht3x_limit_commands { … };
static const struct sht3x_limit_commands limit_commands[] = …;
#define SHT3X_NUM_LIMIT_CMD …
static const u16 mode_to_update_interval[] = …;
static const struct hwmon_channel_info * const sht3x_channel_info[] = …;
struct sht3x_data { … };
static u8 get_mode_from_update_interval(u16 value)
{ … }
static int sht3x_read_from_command(struct i2c_client *client,
struct sht3x_data *data,
const char *command,
char *buf, int length, u32 wait_time)
{ … }
static int sht3x_extract_temperature(u16 raw)
{ … }
static u32 sht3x_extract_humidity(u16 raw)
{ … }
static struct sht3x_data *sht3x_update_client(struct device *dev)
{ … }
static int temp1_input_read(struct device *dev)
{ … }
static int humidity1_input_read(struct device *dev)
{ … }
static int limits_update(struct sht3x_data *data)
{ … }
static int temp1_limit_read(struct device *dev, int index)
{ … }
static int humidity1_limit_read(struct device *dev, int index)
{ … }
static size_t limit_write(struct device *dev,
u8 index,
int temperature,
u32 humidity)
{ … }
static int temp1_limit_write(struct device *dev, int index, int val)
{ … }
static int humidity1_limit_write(struct device *dev, int index, int val)
{ … }
static void sht3x_select_command(struct sht3x_data *data)
{ … }
static int status_register_read(struct device *dev,
char *buffer, int length)
{ … }
static int temp1_alarm_read(struct device *dev)
{ … }
static int humidity1_alarm_read(struct device *dev)
{ … }
static ssize_t heater_enable_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t heater_enable_store(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static int update_interval_read(struct device *dev)
{ … }
static int update_interval_write(struct device *dev, int val)
{ … }
static ssize_t repeatability_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t repeatability_store(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{ … }
static SENSOR_DEVICE_ATTR_RW(heater_enable, heater_enable, 0);
static SENSOR_DEVICE_ATTR_RW(repeatability, repeatability, 0);
static struct attribute *sht3x_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static umode_t sht3x_is_visible(const void *data, enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
static int sht3x_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{ … }
static int sht3x_write(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long val)
{ … }
static void sht3x_debugfs_init(struct sht3x_data *data)
{ … }
static void sht3x_debugfs_remove(void *sensor_dir)
{ … }
static int sht3x_serial_number_read(struct sht3x_data *data)
{ … }
static const struct hwmon_ops sht3x_ops = …;
static const struct hwmon_chip_info sht3x_chip_info = …;
static int sht3x_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id sht3x_ids[] = …;
MODULE_DEVICE_TABLE(i2c, sht3x_ids);
static struct i2c_driver sht3x_i2c_driver = …;
static int __init sht3x_init(void)
{ … }
module_init(…) …;
static void __exit sht3x_cleanup(void)
{ … }
module_exit(sht3x_cleanup);
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;