blob: 4e91d3e54a4a9f40fbec48176a11229a239fc9de [file] [log] [blame]
Maxim Sloyko00669d12019-04-12 13:37:56 -07001// 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
21static 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
Stephen Kittdd431932020-08-08 23:00:04 +020038static int ir38064_probe(struct i2c_client *client)
Maxim Sloyko00669d12019-04-12 13:37:56 -070039{
Stephen Kittdd431932020-08-08 23:00:04 +020040 return pmbus_do_probe(client, &ir38064_info);
Maxim Sloyko00669d12019-04-12 13:37:56 -070041}
42
43static const struct i2c_device_id ir38064_id[] = {
Patrick Rudolphca003af2021-12-13 15:28:12 +010044 {"ir38060", 0},
Maxim Sloyko00669d12019-04-12 13:37:56 -070045 {"ir38064", 0},
Patrick Rudolphca003af2021-12-13 15:28:12 +010046 {"ir38164", 0},
47 {"ir38263", 0},
Maxim Sloyko00669d12019-04-12 13:37:56 -070048 {}
49};
50
51MODULE_DEVICE_TABLE(i2c, ir38064_id);
52
53/* This is the driver that will be inserted */
54static struct i2c_driver ir38064_driver = {
55 .driver = {
56 .name = "ir38064",
57 },
Stephen Kittdd431932020-08-08 23:00:04 +020058 .probe_new = ir38064_probe,
Maxim Sloyko00669d12019-04-12 13:37:56 -070059 .id_table = ir38064_id,
60};
61
62module_i2c_driver(ir38064_driver);
63
64MODULE_AUTHOR("Maxim Sloyko <maxims@google.com>");
Patrick Rudolphca003af2021-12-13 15:28:12 +010065MODULE_DESCRIPTION("PMBus driver for Infineon IR38064 and comaptible chips");
Maxim Sloyko00669d12019-04-12 13:37:56 -070066MODULE_LICENSE("GPL");
Guenter Roeckb94ca772021-04-19 23:07:07 -070067MODULE_IMPORT_NS(PMBUS);