#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/mfd/da9052/da9052.h>
#include <linux/mfd/da9052/reg.h>
#include <linux/regulator/consumer.h>
struct da9052_hwmon { … };
static const char * const input_names[] = …;
static inline int volt_reg_to_mv(int value)
{ … }
static inline int input_reg_to_mv(int value)
{ … }
static inline int vbbat_reg_to_mv(int value)
{ … }
static inline int input_tsireg_to_mv(struct da9052_hwmon *hwmon, int value)
{ … }
static inline int da9052_enable_vddout_channel(struct da9052 *da9052)
{ … }
static inline int da9052_disable_vddout_channel(struct da9052 *da9052)
{ … }
static ssize_t da9052_vddout_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t da9052_ich_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t da9052_tbat_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t da9052_vbat_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t da9052_misc_channel_show(struct device *dev,
struct device_attribute *devattr,
char *buf)
{ … }
static int da9052_request_tsi_read(struct da9052_hwmon *hwmon, int channel)
{ … }
static int da9052_get_tsi_result(struct da9052_hwmon *hwmon, int channel)
{ … }
static ssize_t __da9052_read_tsi(struct device *dev, int channel)
{ … }
static ssize_t da9052_tsi_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t da9052_tjunc_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t da9052_vbbat_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t label_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static umode_t da9052_channel_is_visible(struct kobject *kobj,
struct attribute *attr, int index)
{ … }
static SENSOR_DEVICE_ATTR_RO(in0_input, da9052_vddout, DA9052_ADC_VDDOUT);
static SENSOR_DEVICE_ATTR_RO(in0_label, label, DA9052_ADC_VDDOUT);
static SENSOR_DEVICE_ATTR_RO(in3_input, da9052_vbat, DA9052_ADC_VBAT);
static SENSOR_DEVICE_ATTR_RO(in3_label, label, DA9052_ADC_VBAT);
static SENSOR_DEVICE_ATTR_RO(in4_input, da9052_misc_channel, DA9052_ADC_IN4);
static SENSOR_DEVICE_ATTR_RO(in4_label, label, DA9052_ADC_IN4);
static SENSOR_DEVICE_ATTR_RO(in5_input, da9052_misc_channel, DA9052_ADC_IN5);
static SENSOR_DEVICE_ATTR_RO(in5_label, label, DA9052_ADC_IN5);
static SENSOR_DEVICE_ATTR_RO(in6_input, da9052_misc_channel, DA9052_ADC_IN6);
static SENSOR_DEVICE_ATTR_RO(in6_label, label, DA9052_ADC_IN6);
static SENSOR_DEVICE_ATTR_RO(in9_input, da9052_vbbat, DA9052_ADC_VBBAT);
static SENSOR_DEVICE_ATTR_RO(in9_label, label, DA9052_ADC_VBBAT);
static SENSOR_DEVICE_ATTR_RO(in70_input, da9052_tsi, DA9052_ADC_TSI_XP);
static SENSOR_DEVICE_ATTR_RO(in70_label, label, DA9052_ADC_TSI_XP);
static SENSOR_DEVICE_ATTR_RO(in71_input, da9052_tsi, DA9052_ADC_TSI_XN);
static SENSOR_DEVICE_ATTR_RO(in71_label, label, DA9052_ADC_TSI_XN);
static SENSOR_DEVICE_ATTR_RO(in72_input, da9052_tsi, DA9052_ADC_TSI_YP);
static SENSOR_DEVICE_ATTR_RO(in72_label, label, DA9052_ADC_TSI_YP);
static SENSOR_DEVICE_ATTR_RO(in73_input, da9052_tsi, DA9052_ADC_TSI_YN);
static SENSOR_DEVICE_ATTR_RO(in73_label, label, DA9052_ADC_TSI_YN);
static SENSOR_DEVICE_ATTR_RO(curr1_input, da9052_ich, DA9052_ADC_ICH);
static SENSOR_DEVICE_ATTR_RO(curr1_label, label, DA9052_ADC_ICH);
static SENSOR_DEVICE_ATTR_RO(temp2_input, da9052_tbat, DA9052_ADC_TBAT);
static SENSOR_DEVICE_ATTR_RO(temp2_label, label, DA9052_ADC_TBAT);
static SENSOR_DEVICE_ATTR_RO(temp8_input, da9052_tjunc, DA9052_ADC_TJUNC);
static SENSOR_DEVICE_ATTR_RO(temp8_label, label, DA9052_ADC_TJUNC);
static struct attribute *da9052_attrs[] = …;
static const struct attribute_group da9052_group = …;
__ATTRIBUTE_GROUPS(…);
static irqreturn_t da9052_tsi_datardy_irq(int irq, void *data)
{ … }
static int da9052_hwmon_probe(struct platform_device *pdev)
{ … }
static void da9052_hwmon_remove(struct platform_device *pdev)
{ … }
static struct platform_driver da9052_hwmon_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;