19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/slab.h>
33 static const char *
const input_names[] = {
46 static inline int volt_reg_to_mV(
int value)
52 static inline int input_reg_to_mV(
int value)
58 static inline int vbbat_reg_to_mV(
int value)
63 static int da9052_enable_vddout_channel(
struct da9052 *
da9052)
76 static int da9052_disable_vddout_channel(
struct da9052 *da9052)
97 ret = da9052_enable_vddout_channel(hwmon->
da9052);
104 goto hwmon_err_release;
107 ret = da9052_disable_vddout_channel(hwmon->
da9052);
112 return sprintf(buf,
"%d\n", volt_reg_to_mV(vdd));
115 da9052_disable_vddout_channel(hwmon->
da9052);
153 return sprintf(buf,
"%d\n", volt_reg_to_mV(ret));
168 return sprintf(buf,
"%d\n", input_reg_to_mV(ret));
190 return sprintf(buf,
"%d\n", 1708 * (tjunc - toffset) - 108800);
203 return sprintf(buf,
"%d\n", vbbat_reg_to_mV(ret));
210 return sprintf(buf,
"da9052-hwmon\n");
261 static struct attribute *da9052_attr[] = {
263 &sensor_dev_attr_in0_input.dev_attr.attr,
264 &sensor_dev_attr_in0_label.dev_attr.attr,
265 &sensor_dev_attr_in3_input.dev_attr.attr,
266 &sensor_dev_attr_in3_label.dev_attr.attr,
267 &sensor_dev_attr_in4_input.dev_attr.attr,
268 &sensor_dev_attr_in4_label.dev_attr.attr,
269 &sensor_dev_attr_in5_input.dev_attr.attr,
270 &sensor_dev_attr_in5_label.dev_attr.attr,
271 &sensor_dev_attr_in6_input.dev_attr.attr,
272 &sensor_dev_attr_in6_label.dev_attr.attr,
273 &sensor_dev_attr_in9_input.dev_attr.attr,
274 &sensor_dev_attr_in9_label.dev_attr.attr,
275 &sensor_dev_attr_curr1_input.dev_attr.attr,
276 &sensor_dev_attr_curr1_label.dev_attr.attr,
277 &sensor_dev_attr_temp2_input.dev_attr.attr,
278 &sensor_dev_attr_temp2_label.dev_attr.attr,
279 &sensor_dev_attr_temp8_input.dev_attr.attr,
280 &sensor_dev_attr_temp8_label.dev_attr.attr,
284 static const struct attribute_group da9052_attr_group = {.attrs = da9052_attr};
299 platform_set_drvdata(pdev, hwmon);
321 struct da9052_hwmon *hwmon = platform_get_drvdata(pdev);
330 .probe = da9052_hwmon_probe,
333 .name =
"da9052-hwmon",