forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/hwmon/pmbus/ltc3815.c
....@@ -1,18 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Hardware monitoring driver for LTC3815
34 *
45 * Copyright (c) 2015 Linear Technology
56 * Copyright (c) 2015 Guenter Roeck
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
167 */
178
189 #include <linux/err.h>
....@@ -64,7 +55,7 @@
6455 * LTC3815 does not support the CLEAR_FAULTS command.
6556 * Emulate it by clearing the status register.
6657 */
67
- ret = pmbus_read_word_data(client, 0, PMBUS_STATUS_WORD);
58
+ ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_STATUS_WORD);
6859 if (ret > 0) {
6960 pmbus_write_word_data(client, 0, PMBUS_STATUS_WORD,
7061 ret);
....@@ -78,25 +69,31 @@
7869 return ret;
7970 }
8071
81
-static int ltc3815_read_word_data(struct i2c_client *client, int page, int reg)
72
+static int ltc3815_read_word_data(struct i2c_client *client, int page,
73
+ int phase, int reg)
8274 {
8375 int ret;
8476
8577 switch (reg) {
8678 case PMBUS_VIRT_READ_VIN_MAX:
87
- ret = pmbus_read_word_data(client, page, LTC3815_MFR_VIN_PEAK);
79
+ ret = pmbus_read_word_data(client, page, phase,
80
+ LTC3815_MFR_VIN_PEAK);
8881 break;
8982 case PMBUS_VIRT_READ_VOUT_MAX:
90
- ret = pmbus_read_word_data(client, page, LTC3815_MFR_VOUT_PEAK);
83
+ ret = pmbus_read_word_data(client, page, phase,
84
+ LTC3815_MFR_VOUT_PEAK);
9185 break;
9286 case PMBUS_VIRT_READ_TEMP_MAX:
93
- ret = pmbus_read_word_data(client, page, LTC3815_MFR_TEMP_PEAK);
87
+ ret = pmbus_read_word_data(client, page, phase,
88
+ LTC3815_MFR_TEMP_PEAK);
9489 break;
9590 case PMBUS_VIRT_READ_IOUT_MAX:
96
- ret = pmbus_read_word_data(client, page, LTC3815_MFR_IOUT_PEAK);
91
+ ret = pmbus_read_word_data(client, page, phase,
92
+ LTC3815_MFR_IOUT_PEAK);
9793 break;
9894 case PMBUS_VIRT_READ_IIN_MAX:
99
- ret = pmbus_read_word_data(client, page, LTC3815_MFR_IIN_PEAK);
95
+ ret = pmbus_read_word_data(client, page, phase,
96
+ LTC3815_MFR_IIN_PEAK);
10097 break;
10198 case PMBUS_VIRT_RESET_VOUT_HISTORY:
10299 case PMBUS_VIRT_RESET_VIN_HISTORY:
....@@ -181,8 +178,7 @@
181178 .write_word_data = ltc3815_write_word_data,
182179 };
183180
184
-static int ltc3815_probe(struct i2c_client *client,
185
- const struct i2c_device_id *id)
181
+static int ltc3815_probe(struct i2c_client *client)
186182 {
187183 int chip_id;
188184
....@@ -196,14 +192,14 @@
196192 if ((chip_id & LTC3815_ID_MASK) != LTC3815_ID)
197193 return -ENODEV;
198194
199
- return pmbus_do_probe(client, id, &ltc3815_info);
195
+ return pmbus_do_probe(client, &ltc3815_info);
200196 }
201197
202198 static struct i2c_driver ltc3815_driver = {
203199 .driver = {
204200 .name = "ltc3815",
205201 },
206
- .probe = ltc3815_probe,
202
+ .probe_new = ltc3815_probe,
207203 .remove = pmbus_do_remove,
208204 .id_table = ltc3815_id,
209205 };