.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * HWMON Driver for Dialog DA9055 |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright(c) 2012 Dialog Semiconductor Ltd. |
---|
5 | 6 | * |
---|
6 | 7 | * Author: David Dajun Chen <dchen@diasemi.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify it |
---|
9 | | - * under the terms of the GNU General Public License as published by the |
---|
10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
11 | | - * option) any later version. |
---|
12 | | - * |
---|
13 | 8 | */ |
---|
14 | 9 | |
---|
15 | 10 | #include <linux/delay.h> |
---|
.. | .. |
---|
140 | 135 | return da9055_reg_update(da9055, DA9055_REG_ADC_CONT, 1 << channel, 0); |
---|
141 | 136 | } |
---|
142 | 137 | |
---|
143 | | -static ssize_t da9055_read_auto_ch(struct device *dev, |
---|
144 | | - struct device_attribute *devattr, char *buf) |
---|
| 138 | +static ssize_t da9055_auto_ch_show(struct device *dev, |
---|
| 139 | + struct device_attribute *devattr, |
---|
| 140 | + char *buf) |
---|
145 | 141 | { |
---|
146 | 142 | struct da9055_hwmon *hwmon = dev_get_drvdata(dev); |
---|
147 | 143 | int ret, adc; |
---|
.. | .. |
---|
176 | 172 | return ret; |
---|
177 | 173 | } |
---|
178 | 174 | |
---|
179 | | -static ssize_t da9055_read_tjunc(struct device *dev, |
---|
| 175 | +static ssize_t da9055_tjunc_show(struct device *dev, |
---|
180 | 176 | struct device_attribute *devattr, char *buf) |
---|
181 | 177 | { |
---|
182 | 178 | struct da9055_hwmon *hwmon = dev_get_drvdata(dev); |
---|
.. | .. |
---|
199 | 195 | + 3076332, 10000)); |
---|
200 | 196 | } |
---|
201 | 197 | |
---|
202 | | -static ssize_t show_label(struct device *dev, |
---|
| 198 | +static ssize_t label_show(struct device *dev, |
---|
203 | 199 | struct device_attribute *devattr, char *buf) |
---|
204 | 200 | { |
---|
205 | 201 | return sprintf(buf, "%s\n", |
---|
206 | 202 | input_names[to_sensor_dev_attr(devattr)->index]); |
---|
207 | 203 | } |
---|
208 | 204 | |
---|
209 | | -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, da9055_read_auto_ch, NULL, |
---|
210 | | - DA9055_ADC_VSYS); |
---|
211 | | -static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_label, NULL, |
---|
212 | | - DA9055_ADC_VSYS); |
---|
213 | | -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, da9055_read_auto_ch, NULL, |
---|
214 | | - DA9055_ADC_ADCIN1); |
---|
215 | | -static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_label, NULL, |
---|
216 | | - DA9055_ADC_ADCIN1); |
---|
217 | | -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, da9055_read_auto_ch, NULL, |
---|
218 | | - DA9055_ADC_ADCIN2); |
---|
219 | | -static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_label, NULL, |
---|
220 | | - DA9055_ADC_ADCIN2); |
---|
221 | | -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, da9055_read_auto_ch, NULL, |
---|
222 | | - DA9055_ADC_ADCIN3); |
---|
223 | | -static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, |
---|
224 | | - DA9055_ADC_ADCIN3); |
---|
| 205 | +static SENSOR_DEVICE_ATTR_RO(in0_input, da9055_auto_ch, DA9055_ADC_VSYS); |
---|
| 206 | +static SENSOR_DEVICE_ATTR_RO(in0_label, label, DA9055_ADC_VSYS); |
---|
| 207 | +static SENSOR_DEVICE_ATTR_RO(in1_input, da9055_auto_ch, DA9055_ADC_ADCIN1); |
---|
| 208 | +static SENSOR_DEVICE_ATTR_RO(in1_label, label, DA9055_ADC_ADCIN1); |
---|
| 209 | +static SENSOR_DEVICE_ATTR_RO(in2_input, da9055_auto_ch, DA9055_ADC_ADCIN2); |
---|
| 210 | +static SENSOR_DEVICE_ATTR_RO(in2_label, label, DA9055_ADC_ADCIN2); |
---|
| 211 | +static SENSOR_DEVICE_ATTR_RO(in3_input, da9055_auto_ch, DA9055_ADC_ADCIN3); |
---|
| 212 | +static SENSOR_DEVICE_ATTR_RO(in3_label, label, DA9055_ADC_ADCIN3); |
---|
225 | 213 | |
---|
226 | | -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, da9055_read_tjunc, NULL, |
---|
227 | | - DA9055_ADC_TJUNC); |
---|
228 | | -static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, |
---|
229 | | - DA9055_ADC_TJUNC); |
---|
| 214 | +static SENSOR_DEVICE_ATTR_RO(temp1_input, da9055_tjunc, DA9055_ADC_TJUNC); |
---|
| 215 | +static SENSOR_DEVICE_ATTR_RO(temp1_label, label, DA9055_ADC_TJUNC); |
---|
230 | 216 | |
---|
231 | 217 | static struct attribute *da9055_attrs[] = { |
---|
232 | 218 | &sensor_dev_attr_in0_input.dev_attr.attr, |
---|