diff options
author | Maxim Sloyko <maxims@google.com> | 2019-04-12 16:37:56 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-04-15 20:19:53 -0400 |
commit | 00669d196c616c0a9970a3a9ee66efab6868df0c (patch) | |
tree | 8dd0fadd55b1e4b6c714bc105da522eea8001e77 | |
parent | c49b7b3981f5c39b9b50dc65e32d3c6a553825de (diff) |
hwmon: (pmbus/ir38064) Add driver for Infineon IR38064 Voltage Regulator
Add the pmbus driver for the Infineon ir38064 voltage regulator.
VOUT_MODE is not supported by the device. The driver fakes linear16
mode with exponent value -8.
The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however
this driver does not enable them.
Signed-off-by: Maxim Sloyko <maxims@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | Documentation/hwmon/ir38064 | 64 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/Kconfig | 9 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/Makefile | 1 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ir38064.c | 65 |
4 files changed, 139 insertions, 0 deletions
diff --git a/Documentation/hwmon/ir38064 b/Documentation/hwmon/ir38064 new file mode 100644 index 000000000000..c3697d7aaaa4 --- /dev/null +++ b/Documentation/hwmon/ir38064 | |||
@@ -0,0 +1,64 @@ | |||
1 | Kernel driver ir38064 | ||
2 | ===================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Infineon IR38064 | ||
6 | Prefix: 'ir38064' | ||
7 | Addresses scanned: - | ||
8 | Datasheet: Publicly available at the Infineon webiste | ||
9 | https://www.infineon.com/dgdl/Infineon-IR38064MTRPBF-DS-v03_07-EN.pdf?fileId=5546d462584d1d4a0158db0d9efb67ca | ||
10 | |||
11 | Datasheet is not publicly available. | ||
12 | |||
13 | |||
14 | Authors: | ||
15 | Maxim Sloyko <maxims@google.com> | ||
16 | Patrick Venture <venture@google.com> | ||
17 | |||
18 | Description | ||
19 | ----------- | ||
20 | |||
21 | IR38064 is a Single-input Voltage, Synchronous Buck Regulator, DC-DC Converter. | ||
22 | |||
23 | Usage Notes | ||
24 | ----------- | ||
25 | |||
26 | This driver does not probe for PMBus devices. You will have to instantiate | ||
27 | devices explicitly. | ||
28 | |||
29 | Sysfs attributes | ||
30 | ---------------- | ||
31 | |||
32 | curr1_label "iout1" | ||
33 | curr1_input Measured output current | ||
34 | curr1_crit Critical maximum current | ||
35 | curr1_crit_alarm Current critical high alarm | ||
36 | curr1_max Maximum current | ||
37 | curr1_max_alarm Current high alarm | ||
38 | |||
39 | in1_label "vin" | ||
40 | in1_input Measured input voltage | ||
41 | in1_crit Critical maximum input voltage | ||
42 | in1_crit_alarm Input voltage critical high alarm | ||
43 | in1_min Minimum input voltage | ||
44 | in1_min_alarm Input voltage low alarm | ||
45 | |||
46 | in2_label "vout1" | ||
47 | in2_input Measured output voltage | ||
48 | in2_lcrit Critical minimum output voltage | ||
49 | in2_lcrit_alarm Output voltage critical low alarm | ||
50 | in2_crit Critical maximum output voltage | ||
51 | in2_crit_alarm Output voltage critical high alarm | ||
52 | in2_max Maximum output voltage | ||
53 | in2_max_alarm Output voltage high alarm | ||
54 | in2_min Minimum output voltage | ||
55 | in2_min_alarm Output voltage low alarm | ||
56 | |||
57 | power1_label "pout1" | ||
58 | power1_input Measured output power | ||
59 | |||
60 | temp1_input Measured temperature | ||
61 | temp1_crit Critical high temperature | ||
62 | temp1_crit_alarm Chip temperature critical high alarm | ||
63 | temp1_max Maximum temperature | ||
64 | temp1_max_alarm Chip temperature high alarm | ||
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 629cb45f8557..de87abab990e 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig | |||
@@ -54,6 +54,15 @@ config SENSORS_IR35221 | |||
54 | This driver can also be built as a module. If so, the module will | 54 | This driver can also be built as a module. If so, the module will |
55 | be called ir35521. | 55 | be called ir35521. |
56 | 56 | ||
57 | config SENSORS_IR38064 | ||
58 | tristate "Infineon IR38064" | ||
59 | help | ||
60 | If you say yes here you get hardware monitoring support for Infineon | ||
61 | IR38064. | ||
62 | |||
63 | This driver can also be built as a module. If so, the module will | ||
64 | be called ir38064. | ||
65 | |||
57 | config SENSORS_LM25066 | 66 | config SENSORS_LM25066 |
58 | tristate "National Semiconductor LM25066 and compatibles" | 67 | tristate "National Semiconductor LM25066 and compatibles" |
59 | help | 68 | help |
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index ea0e39518c21..7d1fa6b3c8c9 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile | |||
@@ -8,6 +8,7 @@ obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o | |||
8 | obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o | 8 | obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o |
9 | obj-$(CONFIG_SENSORS_IBM_CFFPS) += ibm-cffps.o | 9 | obj-$(CONFIG_SENSORS_IBM_CFFPS) += ibm-cffps.o |
10 | obj-$(CONFIG_SENSORS_IR35221) += ir35221.o | 10 | obj-$(CONFIG_SENSORS_IR35221) += ir35221.o |
11 | obj-$(CONFIG_SENSORS_IR38064) += ir38064.o | ||
11 | obj-$(CONFIG_SENSORS_LM25066) += lm25066.o | 12 | obj-$(CONFIG_SENSORS_LM25066) += lm25066.o |
12 | obj-$(CONFIG_SENSORS_LTC2978) += ltc2978.o | 13 | obj-$(CONFIG_SENSORS_LTC2978) += ltc2978.o |
13 | obj-$(CONFIG_SENSORS_LTC3815) += ltc3815.o | 14 | obj-$(CONFIG_SENSORS_LTC3815) += ltc3815.o |
diff --git a/drivers/hwmon/pmbus/ir38064.c b/drivers/hwmon/pmbus/ir38064.c new file mode 100644 index 000000000000..1820f5077f66 --- /dev/null +++ b/drivers/hwmon/pmbus/ir38064.c | |||
@@ -0,0 +1,65 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0+ | ||
2 | /* | ||
3 | * Hardware monitoring driver for Infineon IR38064 | ||
4 | * | ||
5 | * Copyright (c) 2017 Google Inc | ||
6 | * | ||
7 | * VOUT_MODE is not supported by the device. The driver fakes VOUT linear16 | ||
8 | * mode with exponent value -8 as direct mode with m=256/b=0/R=0. | ||
9 | * | ||
10 | * The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however | ||
11 | * this driver does not currently support them. | ||
12 | */ | ||
13 | |||
14 | #include <linux/err.h> | ||
15 | #include <linux/i2c.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/module.h> | ||
19 | #include "pmbus.h" | ||
20 | |||
21 | static struct pmbus_driver_info ir38064_info = { | ||
22 | .pages = 1, | ||
23 | .format[PSC_VOLTAGE_IN] = linear, | ||
24 | .format[PSC_VOLTAGE_OUT] = direct, | ||
25 | .format[PSC_CURRENT_OUT] = linear, | ||
26 | .format[PSC_POWER] = linear, | ||
27 | .format[PSC_TEMPERATURE] = linear, | ||
28 | .m[PSC_VOLTAGE_OUT] = 256, | ||
29 | .b[PSC_VOLTAGE_OUT] = 0, | ||
30 | .R[PSC_VOLTAGE_OUT] = 0, | ||
31 | .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT | ||
32 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | ||
33 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | ||
34 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | ||
35 | | PMBUS_HAVE_POUT, | ||
36 | }; | ||
37 | |||
38 | static int ir38064_probe(struct i2c_client *client, | ||
39 | const struct i2c_device_id *id) | ||
40 | { | ||
41 | return pmbus_do_probe(client, id, &ir38064_info); | ||
42 | } | ||
43 | |||
44 | static const struct i2c_device_id ir38064_id[] = { | ||
45 | {"ir38064", 0}, | ||
46 | {} | ||
47 | }; | ||
48 | |||
49 | MODULE_DEVICE_TABLE(i2c, ir38064_id); | ||
50 | |||
51 | /* This is the driver that will be inserted */ | ||
52 | static struct i2c_driver ir38064_driver = { | ||
53 | .driver = { | ||
54 | .name = "ir38064", | ||
55 | }, | ||
56 | .probe = ir38064_probe, | ||
57 | .remove = pmbus_do_remove, | ||
58 | .id_table = ir38064_id, | ||
59 | }; | ||
60 | |||
61 | module_i2c_driver(ir38064_driver); | ||
62 | |||
63 | MODULE_AUTHOR("Maxim Sloyko <maxims@google.com>"); | ||
64 | MODULE_DESCRIPTION("PMBus driver for Infineon IR38064"); | ||
65 | MODULE_LICENSE("GPL"); | ||