.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* Texas Instruments TMP102 SMBus temperature sensor driver |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (C) 2010 Steven King <sfking@fdwdc.com> |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License as published by |
---|
7 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
8 | | - * (at your option) any later version. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | 5 | */ |
---|
15 | 6 | |
---|
16 | 7 | #include <linux/delay.h> |
---|
.. | .. |
---|
141 | 132 | |
---|
142 | 133 | switch (attr) { |
---|
143 | 134 | case hwmon_temp_input: |
---|
144 | | - return S_IRUGO; |
---|
| 135 | + return 0444; |
---|
145 | 136 | case hwmon_temp_max_hyst: |
---|
146 | 137 | case hwmon_temp_max: |
---|
147 | | - return S_IRUGO | S_IWUSR; |
---|
| 138 | + return 0644; |
---|
148 | 139 | default: |
---|
149 | 140 | return 0; |
---|
150 | 141 | } |
---|
151 | 142 | } |
---|
152 | 143 | |
---|
153 | | -static u32 tmp102_chip_config[] = { |
---|
154 | | - HWMON_C_REGISTER_TZ, |
---|
155 | | - 0 |
---|
156 | | -}; |
---|
157 | | - |
---|
158 | | -static const struct hwmon_channel_info tmp102_chip = { |
---|
159 | | - .type = hwmon_chip, |
---|
160 | | - .config = tmp102_chip_config, |
---|
161 | | -}; |
---|
162 | | - |
---|
163 | | -static u32 tmp102_temp_config[] = { |
---|
164 | | - HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST, |
---|
165 | | - 0 |
---|
166 | | -}; |
---|
167 | | - |
---|
168 | | -static const struct hwmon_channel_info tmp102_temp = { |
---|
169 | | - .type = hwmon_temp, |
---|
170 | | - .config = tmp102_temp_config, |
---|
171 | | -}; |
---|
172 | | - |
---|
173 | 144 | static const struct hwmon_channel_info *tmp102_info[] = { |
---|
174 | | - &tmp102_chip, |
---|
175 | | - &tmp102_temp, |
---|
| 145 | + HWMON_CHANNEL_INFO(chip, |
---|
| 146 | + HWMON_C_REGISTER_TZ), |
---|
| 147 | + HWMON_CHANNEL_INFO(temp, |
---|
| 148 | + HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST), |
---|
176 | 149 | NULL |
---|
177 | 150 | }; |
---|
178 | 151 | |
---|
.. | .. |
---|
212 | 185 | .volatile_reg = tmp102_is_volatile_reg, |
---|
213 | 186 | .val_format_endian = REGMAP_ENDIAN_BIG, |
---|
214 | 187 | .cache_type = REGCACHE_RBTREE, |
---|
215 | | - .use_single_rw = true, |
---|
| 188 | + .use_single_read = true, |
---|
| 189 | + .use_single_write = true, |
---|
216 | 190 | }; |
---|
217 | 191 | |
---|
218 | | -static int tmp102_probe(struct i2c_client *client, |
---|
219 | | - const struct i2c_device_id *id) |
---|
| 192 | +static int tmp102_probe(struct i2c_client *client) |
---|
220 | 193 | { |
---|
221 | 194 | struct device *dev = &client->dev; |
---|
222 | 195 | struct device *hwmon_dev; |
---|
.. | .. |
---|
320 | 293 | }; |
---|
321 | 294 | MODULE_DEVICE_TABLE(i2c, tmp102_id); |
---|
322 | 295 | |
---|
323 | | -static const struct of_device_id tmp102_of_match[] = { |
---|
| 296 | +static const struct of_device_id __maybe_unused tmp102_of_match[] = { |
---|
324 | 297 | { .compatible = "ti,tmp102" }, |
---|
325 | 298 | { }, |
---|
326 | 299 | }; |
---|
.. | .. |
---|
330 | 303 | .driver.name = DRIVER_NAME, |
---|
331 | 304 | .driver.of_match_table = of_match_ptr(tmp102_of_match), |
---|
332 | 305 | .driver.pm = &tmp102_dev_pm_ops, |
---|
333 | | - .probe = tmp102_probe, |
---|
| 306 | + .probe_new = tmp102_probe, |
---|
334 | 307 | .id_table = tmp102_id, |
---|
335 | 308 | }; |
---|
336 | 309 | |
---|