]> Git Repo - linux.git/blob - drivers/hwmon/pmbus/tda38640.c
arm64: avoid prototype warnings for syscalls
[linux.git] / drivers / hwmon / pmbus / tda38640.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Hardware monitoring driver for Infineon TDA38640
4  *
5  * Copyright (c) 2023 9elements GmbH
6  *
7  */
8
9 #include <linux/err.h>
10 #include <linux/i2c.h>
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/regulator/driver.h>
15 #include "pmbus.h"
16
17 static const struct regulator_desc __maybe_unused tda38640_reg_desc[] = {
18         PMBUS_REGULATOR("vout", 0),
19 };
20
21 static struct pmbus_driver_info tda38640_info = {
22         .pages = 1,
23         .format[PSC_VOLTAGE_IN] = linear,
24         .format[PSC_VOLTAGE_OUT] = linear,
25         .format[PSC_CURRENT_OUT] = linear,
26         .format[PSC_CURRENT_IN] = linear,
27         .format[PSC_POWER] = linear,
28         .format[PSC_TEMPERATURE] = linear,
29
30         .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
31             | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP
32             | PMBUS_HAVE_IIN
33             | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
34             | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
35             | PMBUS_HAVE_POUT | PMBUS_HAVE_PIN,
36 #if IS_ENABLED(CONFIG_SENSORS_TDA38640_REGULATOR)
37         .num_regulators = 1,
38         .reg_desc = tda38640_reg_desc,
39 #endif
40 };
41
42 static int tda38640_probe(struct i2c_client *client)
43 {
44         return pmbus_do_probe(client, &tda38640_info);
45 }
46
47 static const struct i2c_device_id tda38640_id[] = {
48         {"tda38640", 0},
49         {}
50 };
51 MODULE_DEVICE_TABLE(i2c, tda38640_id);
52
53 static const struct of_device_id __maybe_unused tda38640_of_match[] = {
54         { .compatible = "infineon,tda38640"},
55         { },
56 };
57 MODULE_DEVICE_TABLE(of, tda38640_of_match);
58
59 /* This is the driver that will be inserted */
60 static struct i2c_driver tda38640_driver = {
61         .driver = {
62                 .name = "tda38640",
63                 .of_match_table = of_match_ptr(tda38640_of_match),
64         },
65         .probe_new = tda38640_probe,
66         .id_table = tda38640_id,
67 };
68
69 module_i2c_driver(tda38640_driver);
70
71 MODULE_AUTHOR("Patrick Rudolph <[email protected]>");
72 MODULE_DESCRIPTION("PMBus driver for Infineon TDA38640");
73 MODULE_LICENSE("GPL");
74 MODULE_IMPORT_NS(PMBUS);
This page took 0.037604 seconds and 4 git commands to generate.