forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/hwmon/pmbus/max31785.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2017 IBM Corp.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
84 */
95
106 #include <linux/kernel.h>
....@@ -76,7 +72,7 @@
7672
7773 cmdbuf[0] = reg;
7874
79
- rc = pmbus_set_page(client, page);
75
+ rc = pmbus_set_page(client, page, 0xff);
8076 if (rc < 0)
8177 return rc;
8278
....@@ -114,7 +110,7 @@
114110 if (config < 0)
115111 return config;
116112
117
- command = pmbus_read_word_data(client, page, PMBUS_FAN_COMMAND_1);
113
+ command = pmbus_read_word_data(client, page, 0xff, PMBUS_FAN_COMMAND_1);
118114 if (command < 0)
119115 return command;
120116
....@@ -130,7 +126,7 @@
130126 }
131127
132128 static int max31785_read_word_data(struct i2c_client *client, int page,
133
- int reg)
129
+ int phase, int reg)
134130 {
135131 u32 val;
136132 int rv;
....@@ -248,8 +244,6 @@
248244 #define MAX31785_VOUT_FUNCS \
249245 (PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT)
250246
251
-#define MAX37185_NUM_FAN_PAGES 6
252
-
253247 static const struct pmbus_driver_info max31785_info = {
254248 .pages = MAX31785_NR_PAGES,
255249
....@@ -330,8 +324,7 @@
330324 return 0;
331325 }
332326
333
-static int max31785_probe(struct i2c_client *client,
334
- const struct i2c_device_id *id)
327
+static int max31785_probe(struct i2c_client *client)
335328 {
336329 struct device *dev = &client->dev;
337330 struct pmbus_driver_info *info;
....@@ -360,7 +353,7 @@
360353 if (ret == MAX31785A) {
361354 dual_tach = true;
362355 } else if (ret == MAX31785) {
363
- if (!strcmp("max31785a", id->name))
356
+ if (!strcmp("max31785a", client->name))
364357 dev_warn(dev, "Expected max3175a, found max31785: cannot provide secondary tachometer readings\n");
365358 } else {
366359 return -ENODEV;
....@@ -372,7 +365,7 @@
372365 return ret;
373366 }
374367
375
- return pmbus_do_probe(client, id, info);
368
+ return pmbus_do_probe(client, info);
376369 }
377370
378371 static const struct i2c_device_id max31785_id[] = {
....@@ -396,7 +389,7 @@
396389 .name = "max31785",
397390 .of_match_table = max31785_of_match,
398391 },
399
- .probe = max31785_probe,
392
+ .probe_new = max31785_probe,
400393 .remove = pmbus_do_remove,
401394 .id_table = max31785_id,
402395 };