[PATCH dev-5.0] hwmon: (pmbus/ir38064): Add driver for Infineon IR38064 Voltage Regulator

Patrick Venture venture at google.com
Fri Apr 12 06:00:23 AEST 2019


On Thu, Apr 11, 2019 at 12:46 PM Patrick Venture <venture at google.com> wrote:
>
> From: Maxim Sloyko <maxims at google.com>
>
> Add the pmbus driver for the Infineon ir38064 voltage regulator.
>
> Signed-off-by: Maxim Sloyko <maxims at google.com>
> Signed-off-by: Patrick Venture <venture at google.com>
> ---
>  drivers/hwmon/pmbus/Kconfig   |  9 ++++++
>  drivers/hwmon/pmbus/Makefile  |  1 +
>  drivers/hwmon/pmbus/ir38064.c | 60 +++++++++++++++++++++++++++++++++++
>  3 files changed, 70 insertions(+)
>  create mode 100644 drivers/hwmon/pmbus/ir38064.c
>
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index 15c197f1c4c4..b6c228a55da2 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -64,6 +64,15 @@ config SENSORS_ISL68137
>           This driver can also be built as a module. If so, the module will
>           be called isl68137.
>
> +config SENSORS_IR38064
> +       tristate "Infineon IR38064"
> +       help
> +         If you say yes here you get hardware monitoring support for Infineon
> +         IR38064.
> +
> +         This driver can also be built as a module. If so, the module will
> +         be called ir38064.
> +
>  config SENSORS_LM25066
>         tristate "National Semiconductor LM25066 and compatibles"
>         help
> diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
> index 0684b35216da..8ee236b1d986 100644
> --- a/drivers/hwmon/pmbus/Makefile
> +++ b/drivers/hwmon/pmbus/Makefile
> @@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ADM1275)   += adm1275.o
>  obj-$(CONFIG_SENSORS_IBM_CFFPS)        += ibm-cffps.o
>  obj-$(CONFIG_SENSORS_IR35221)  += ir35221.o
>  obj-$(CONFIG_SENSORS_ISL68137) += isl68137.o
> +obj-$(CONFIG_SENSORS_IR38064)  += ir38064.o
>  obj-$(CONFIG_SENSORS_LM25066)  += lm25066.o
>  obj-$(CONFIG_SENSORS_LTC2978)  += ltc2978.o
>  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..4b957ebb6fa7
> --- /dev/null
> +++ b/drivers/hwmon/pmbus/ir38064.c
> @@ -0,0 +1,60 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Hardware monitoring driver for Infineon IR38064
> + *
> + * Copyright (c) 2017 Google Inc
> + *
> + */
> +
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include "pmbus.h"
> +
> +static struct pmbus_driver_info ir38064_info = {
> +       .pages = 1,
> +       .format[PSC_VOLTAGE_IN] = linear,
> +       .format[PSC_VOLTAGE_OUT] = direct,
> +       .format[PSC_CURRENT_OUT] = linear,
> +       .format[PSC_POWER] = linear,
> +       .format[PSC_TEMPERATURE] = linear,
> +       .m[PSC_VOLTAGE_OUT] = 256,
> +       .b[PSC_VOLTAGE_OUT] = 0,
> +       .R[PSC_VOLTAGE_OUT] = 0,
> +       .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT
> +           | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP
> +           | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT
> +           | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
> +           | PMBUS_HAVE_POUT,
> +};
> +
> +static int ir38064_probe(struct i2c_client *client,
> +                        const struct i2c_device_id *id)
> +{
> +       return pmbus_do_probe(client, id, &ir38064_info);
> +}
> +
> +static const struct i2c_device_id ir38064_id[] = {
> +       {"ir38064", 0},
> +       {}
> +};
> +
> +MODULE_DEVICE_TABLE(i2c, ir38064_id);
> +
> +/* This is the driver that will be inserted */
> +static struct i2c_driver ir38064_driver = {
> +       .driver = {
> +                  .name = "ir38064",
> +                  },
> +       .probe = ir38064_probe,
> +       .remove = pmbus_do_remove,
> +       .id_table = ir38064_id,
> +};
> +
> +module_i2c_driver(ir38064_driver);
> +
> +MODULE_AUTHOR("Maxim Sloyko <maxims at google.com>");
> +MODULE_DESCRIPTION("PMBus driver for Infineon IR38064");
> +MODULE_LICENSE("GPL");
> --
> 2.21.0.392.gf8f6787159e-goog

I will also send this to upstream-upstream once I finish the isl
patchset since that will require documentation and reworking various
aspects of it... Although maybe I should flip them and push this
patchset up ahead -- maybe it'll require less documentation since it's
really an empty driver.

>


More information about the openbmc mailing list