21 #include <linux/kernel.h>
22 #include <linux/module.h>
27 #include <linux/slab.h>
40 return sprintf(buf,
"wm831x\n");
43 static const char *
const input_names[] = {
80 ret = 512180 - (ret * 1000);
83 return sprintf(buf,
"%d\n", ret);
91 return sprintf(buf,
"%s\n", input_names[channel]);
94 #define WM831X_VOLTAGE(id, name) \
95 static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage, \
98 #define WM831X_NAMED_VOLTAGE(id, name) \
99 WM831X_VOLTAGE(id, name); \
100 static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
129 static struct attribute *wm831x_attributes[] = {
132 &sensor_dev_attr_in0_input.dev_attr.attr,
133 &sensor_dev_attr_in1_input.dev_attr.attr,
134 &sensor_dev_attr_in2_input.dev_attr.attr,
135 &sensor_dev_attr_in3_input.dev_attr.attr,
137 &sensor_dev_attr_in4_input.dev_attr.attr,
138 &sensor_dev_attr_in4_label.dev_attr.attr,
139 &sensor_dev_attr_in5_input.dev_attr.attr,
140 &sensor_dev_attr_in5_label.dev_attr.attr,
141 &sensor_dev_attr_in6_input.dev_attr.attr,
142 &sensor_dev_attr_in6_label.dev_attr.attr,
143 &sensor_dev_attr_in7_input.dev_attr.attr,
144 &sensor_dev_attr_in7_label.dev_attr.attr,
145 &sensor_dev_attr_in8_input.dev_attr.attr,
146 &sensor_dev_attr_in8_label.dev_attr.attr,
148 &sensor_dev_attr_temp1_input.dev_attr.attr,
149 &sensor_dev_attr_temp1_label.dev_attr.attr,
150 &sensor_dev_attr_temp2_input.dev_attr.attr,
151 &sensor_dev_attr_temp2_label.dev_attr.attr,
157 .attrs = wm831x_attributes,
183 platform_set_drvdata(pdev, hwmon);
194 struct wm831x_hwmon *hwmon = platform_get_drvdata(pdev);
203 .probe = wm831x_hwmon_probe,
206 .name =
"wm831x-hwmon",