Skip to content

Commit 5c9353f

Browse files
usugurgroeck
authored andcommitted
hwmon: (pmbus/max20730) Add max20710 support
Add support for max20710 into the existing max20730 driver. Signed-off-by: Ugur Usug <[email protected]> Link: https://lore.kernel.org/r/BYAPR11MB317423C13909AE6F1913BBD7FD9C0@BYAPR11MB3174.namprd11.prod.outlook.com [groeck: Fixed various whitespace errors] Signed-off-by: Guenter Roeck <[email protected]>
1 parent a4872f7 commit 5c9353f

File tree

3 files changed

+54
-9
lines changed

3 files changed

+54
-9
lines changed

Documentation/hwmon/max20730.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ Kernel driver max20730
55

66
Supported chips:
77

8+
* Maxim MAX20710
9+
10+
Prefix: 'max20710'
11+
12+
Addresses scanned: -
13+
14+
Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX20710.pdf
15+
816
* Maxim MAX20730
917

1018
Prefix: 'max20730'
@@ -35,7 +43,7 @@ Author: Guenter Roeck <[email protected]>
3543
Description
3644
-----------
3745

38-
This driver implements support for Maxim MAX20730, MAX20734, and MAX20743
46+
This driver implements support for Maxim MAX20710, MAX20730, MAX20734, and MAX20743
3947
Integrated, Step-Down Switching Regulators with PMBus support.
4048

4149
The driver is a client driver to the core PMBus driver.

drivers/hwmon/pmbus/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ config SENSORS_MAX16601
156156
be called max16601.
157157

158158
config SENSORS_MAX20730
159-
tristate "Maxim MAX20730, MAX20734, MAX20743"
159+
tristate "Maxim MAX20710, MAX20730, MAX20734, MAX20743"
160160
help
161161
If you say yes here you get hardware monitoring support for Maxim
162-
MAX20730, MAX20734, and MAX20743.
162+
MAX20710, MAX20730, MAX20734, and MAX20743.
163163

164164
This driver can also be built as a module. If so, the module will
165165
be called max20730.

drivers/hwmon/pmbus/max20730.c

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
/*
3-
* Driver for MAX20730, MAX20734, and MAX20743 Integrated, Step-Down
4-
* Switching Regulators
3+
* Driver for MAX20710, MAX20730, MAX20734, and MAX20743 Integrated,
4+
* Step-Down Switching Regulators
55
*
66
* Copyright 2019 Google LLC.
7+
* Copyright 2020 Maxim Integrated
78
*/
89

910
#include <linux/bits.h>
@@ -19,6 +20,7 @@
1920
#include "pmbus.h"
2021

2122
enum chips {
23+
max20710,
2224
max20730,
2325
max20734,
2426
max20743
@@ -80,6 +82,7 @@ static long direct_to_val(u16 w, enum pmbus_sensor_classes class,
8082
}
8183

8284
static u32 max_current[][5] = {
85+
[max20710] = { 6200, 8000, 9700, 11600 },
8386
[max20730] = { 13000, 16600, 20100, 23600 },
8487
[max20734] = { 21000, 27000, 32000, 38000 },
8588
[max20743] = { 18900, 24100, 29200, 34100 },
@@ -164,6 +167,35 @@ static int max20730_write_word_data(struct i2c_client *client, int page,
164167
}
165168

166169
static const struct pmbus_driver_info max20730_info[] = {
170+
[max20710] = {
171+
.pages = 1,
172+
.read_word_data = max20730_read_word_data,
173+
.write_word_data = max20730_write_word_data,
174+
175+
/* Source : Maxim AN6140 and AN6042 */
176+
.format[PSC_TEMPERATURE] = direct,
177+
.m[PSC_TEMPERATURE] = 21,
178+
.b[PSC_TEMPERATURE] = 5887,
179+
.R[PSC_TEMPERATURE] = -1,
180+
181+
.format[PSC_VOLTAGE_IN] = direct,
182+
.m[PSC_VOLTAGE_IN] = 3609,
183+
.b[PSC_VOLTAGE_IN] = 0,
184+
.R[PSC_VOLTAGE_IN] = -2,
185+
186+
.format[PSC_CURRENT_OUT] = direct,
187+
.m[PSC_CURRENT_OUT] = 153,
188+
.b[PSC_CURRENT_OUT] = 4976,
189+
.R[PSC_CURRENT_OUT] = -1,
190+
191+
.format[PSC_VOLTAGE_OUT] = linear,
192+
193+
.func[0] = PMBUS_HAVE_VIN |
194+
PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
195+
PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
196+
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
197+
PMBUS_HAVE_STATUS_INPUT,
198+
},
167199
[max20730] = {
168200
.pages = 1,
169201
.read_word_data = max20730_read_word_data,
@@ -200,7 +232,8 @@ static const struct pmbus_driver_info max20730_info[] = {
200232
.func[0] = PMBUS_HAVE_VIN |
201233
PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
202234
PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
203-
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
235+
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
236+
PMBUS_HAVE_STATUS_INPUT,
204237
},
205238
[max20734] = {
206239
.pages = 1,
@@ -228,7 +261,8 @@ static const struct pmbus_driver_info max20730_info[] = {
228261
.func[0] = PMBUS_HAVE_VIN |
229262
PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
230263
PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
231-
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
264+
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
265+
PMBUS_HAVE_STATUS_INPUT,
232266
},
233267
[max20743] = {
234268
.pages = 1,
@@ -256,7 +290,8 @@ static const struct pmbus_driver_info max20730_info[] = {
256290
.func[0] = PMBUS_HAVE_VIN |
257291
PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
258292
PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
259-
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
293+
PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
294+
PMBUS_HAVE_STATUS_INPUT,
260295
},
261296
};
262297

@@ -339,6 +374,7 @@ static int max20730_probe(struct i2c_client *client,
339374
}
340375

341376
static const struct i2c_device_id max20730_id[] = {
377+
{ "max20710", max20710 },
342378
{ "max20730", max20730 },
343379
{ "max20734", max20734 },
344380
{ "max20743", max20743 },
@@ -348,6 +384,7 @@ static const struct i2c_device_id max20730_id[] = {
348384
MODULE_DEVICE_TABLE(i2c, max20730_id);
349385

350386
static const struct of_device_id max20730_of_match[] = {
387+
{ .compatible = "maxim,max20710", .data = (void *)max20710 },
351388
{ .compatible = "maxim,max20730", .data = (void *)max20730 },
352389
{ .compatible = "maxim,max20734", .data = (void *)max20734 },
353390
{ .compatible = "maxim,max20743", .data = (void *)max20743 },
@@ -369,5 +406,5 @@ static struct i2c_driver max20730_driver = {
369406
module_i2c_driver(max20730_driver);
370407

371408
MODULE_AUTHOR("Guenter Roeck <[email protected]>");
372-
MODULE_DESCRIPTION("PMBus driver for Maxim MAX20730 / MAX20734 / MAX20743");
409+
MODULE_DESCRIPTION("PMBus driver for Maxim MAX20710 / MAX20730 / MAX20734 / MAX20743");
373410
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)