24 #include <linux/kernel.h>
25 #include <linux/module.h>
27 #include <linux/slab.h>
31 #define DRIVER_NAME "mc13783-adc"
34 #define MC13783_ADC_16CHANS 1
35 #define MC13783_ADC_BPDIV2 2
51 static int mc13783_adc_read(
struct device *
dev,
62 channel, 0, 0, sample);
68 *val = (sample[channel % 4] >> (channel > 3 ? 14 : 2)) & 0x3ff;
79 int ret = mc13783_adc_read(dev, devattr, &val);
93 return sprintf(buf,
"%u\n", val);
100 int ret = mc13783_adc_read(dev, devattr, &val);
111 return sprintf(buf,
"%u\n", val);
128 static struct attribute *mc13783_attr_base[] = {
130 &sensor_dev_attr_in2_input.dev_attr.attr,
131 &sensor_dev_attr_in5_input.dev_attr.attr,
132 &sensor_dev_attr_in6_input.dev_attr.attr,
133 &sensor_dev_attr_in7_input.dev_attr.attr,
138 .attrs = mc13783_attr_base,
142 static struct attribute *mc13783_attr_16chans[] = {
143 &sensor_dev_attr_in8_input.dev_attr.attr,
144 &sensor_dev_attr_in9_input.dev_attr.attr,
145 &sensor_dev_attr_in10_input.dev_attr.attr,
146 &sensor_dev_attr_in11_input.dev_attr.attr,
151 .attrs = mc13783_attr_16chans,
155 static struct attribute *mc13783_attr_ts[] = {
156 &sensor_dev_attr_in12_input.dev_attr.attr,
157 &sensor_dev_attr_in13_input.dev_attr.attr,
158 &sensor_dev_attr_in14_input.dev_attr.attr,
159 &sensor_dev_attr_in15_input.dev_attr.attr,
164 .attrs = mc13783_attr_ts,
192 platform_set_drvdata(pdev, priv);
201 &mc13783_group_16chans);
203 goto out_err_create_16chans;
206 if (!mc13783_adc_use_touchscreen(pdev)) {
209 goto out_err_create_ts;
216 "hwmon_device_register failed with %d.\n", ret);
217 goto out_err_register;
224 if (!mc13783_adc_use_touchscreen(pdev))
230 out_err_create_16chans:
243 if (!mc13783_adc_use_touchscreen(pdev))
256 .name =
"mc13783-adc",
259 .name =
"mc13892-adc",
273 .id_table = mc13783_adc_idtable,
276 static int __init mc13783_adc_init(
void)
281 static void __exit mc13783_adc_exit(
void)