mfd: MAX6650/6651 support
PATCH v3 1/1 mfd: MAX6650/6651 support
MAX6650/MAX6651 chip is a multi-function device with I2C busses. The chip includes fan-speed regulators and monitors, GPIO, and alarm.
This patch is an initial release of a MAX6650/6651 MFD driver that supports to enable the chip with its primary I2C bus that will connect the hwmon, and then the gpio devices for now.
--- drivers/mfd/Kconfig | 11 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/max665x.c | 88 +++++++++++++++++++++++++++++++++++++ include/linux/mfd/max665x-private.h | 42 ++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 drivers/mfd/max665x.c create mode 100644 include/linux/mfd/max665x-private.h
drivers/mfd/Kconfig +11 -0
@@ -368,6 +368,17 @@ config MFD_MAX8907 accessing the device; additional drivers must be enabled in order to use the functionality of the device. +config MFD_MAX665X + bool "Maxim Semiconductor MAX6650/MAX6651 Support" + select MFD_CORE + depends on I2C + select REGMAP_I2C + help + Say yes here to support for Maxim Semiconductor MAX6650/MAX6651. This is + a fan speed regulator and monitor IC. This driver provides common support + for accessing the device, additional drivers must be enabled in order to + use the functionality of the device. + config MFD_MAX8925 bool "Maxim Semiconductor MAX8925 PMIC Support" depends on I2C=y
drivers/mfd/Makefile +1 -0
@@ -111,6 +111,7 @@ obj-$(CONFIG_MFD_DA9055) += da9055.o da9063-objs := da9063-core.o da9063-irq.o da9063-i2c.o obj-$(CONFIG_MFD_DA9063) += da9063.o +obj-$(CONFIG_MFD_MAX665X) += max665x.o obj-$(CONFIG_MFD_MAX14577) += max14577.o obj-$(CONFIG_MFD_MAX77686) += max77686.o max77686-irq.o obj-$(CONFIG_MFD_MAX77693) += max77693.o max77693-irq.o
drivers/mfd/max665x.c new file +88 -0
88 lines not on this page · raw message
include/linux/mfd/max665x-private.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.8.5.4
Quoted 70 lines
MAX6650/MAX6651 chip is a multi-function device with I2C busses. The chip includes fan-speed regulators and monitors, GPIO, and alarm.
This patch is an initial release of a MAX6650/6651 MFD driver that supports to enable the chip with its primary I2C bus that will connect the hwmon, and then the gpio devices for now.
Signed-off-by Laszlo Papp <[email protected]>--- drivers/mfd/Kconfig | 11 +++++ drivers/mfd/Makefile | 1 + drivers/mfd/max665x.c | 88 +++++++++++++++++++++++++++++++++++++ include/linux/mfd/max665x-private.h | 42 ++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 drivers/mfd/max665x.c create mode 100644 include/linux/mfd/max665x-private.hdrivers/mfd/Kconfig +11
-0@@ -368,6 +368,17 @@ config MFD_MAX8907 accessing the device; additional drivers must be enabled in order to use the functionality of the device. +config MFD_MAX665X + bool "Maxim Semiconductor MAX6650/MAX6651 Support" + select MFD_CORE + depends on I2C + select REGMAP_I2C + help + Say yes here to support for Maxim Semiconductor MAX6650/MAX6651. This is + a fan speed regulator and monitor IC. This driver provides common support + for accessing the device, additional drivers must be enabled in order to + use the functionality of the device. + config MFD_MAX8925 bool "Maxim Semiconductor MAX8925 PMIC Support" depends on I2C=ydrivers/mfd/Makefile +1
-0@@ -111,6 +111,7 @@ obj-$(CONFIG_MFD_DA9055) += da9055.o da9063-objs := da9063-core.o da9063-irq.o da9063-i2c.o obj-$(CONFIG_MFD_DA9063) += da9063.o +obj-$(CONFIG_MFD_MAX665X) += max665x.o obj-$(CONFIG_MFD_MAX14577) += max14577.o obj-$(CONFIG_MFD_MAX77686) += max77686.o max77686-irq.o obj-$(CONFIG_MFD_MAX77693) += max77693.o max77693-irq.odrivers/mfd/max665x.c new file +13
-0@@ -0,0 +1,88 @@ +/* +* Device access for MAX6650-MAX6651 +* +* Copyright(c) 2013 Polatis Ltd. +* +* Author: Laszlo Papp <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +*/ +
drivers/mfd/max665x.c line 23
Quoted 10 lines
drivers/mfd/max665x.c new file +10
-0+#include <linux/device.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/i2c.h> + +#include <linux/mfd/max665x-private.h> + +static struct mfd_cell max665x_devs[] = { + { .name ="max6651-gpio" , }, + { .name ="max6650" , },/* hwmon driver */
What happened to renaming the hwmon driver, so we can have "max6650-hwmon" here?
<snip>
drivers/mfd/max665x.c line 70
Quoted 4 lines
drivers/mfd/max665x.c new file +4
-0+static const struct i2c_device_id max665x_id[] = { + {"max6650" ,TYPE_MAX6650 }, + {"max6651" ,TYPE_MAX6651 }, + {},
Can you remind me where these IDs are being used?
drivers/mfd/max665x.c line 77
Quoted 7 lines
drivers/mfd/max665x.c new file +7
-0+}; +MODULE_DEVICE_TABLE (i2c, max665x_id); + +static struct i2c_driver max665x_driver = { + .driver = { + .name ="max665x" , + .owner =THIS_MODULE ,
All new drivers are required to support Device Tree.
<snip>
drivers/mfd/max665x.c line 39
Quoted 5 lines
drivers/mfd/max665x.c new file +5
-0+#ifndef __LINUX_MFD_MAX665X_PRIVATE_H +#define __LINUX_MFD_MAX665X_PRIVATE_H + +#include <linux/i2c.h> +#include <linux/export.h>
What's this here for?
Quoted 18 lines
drivers/mfd/max665x.c new file +18
-0+#include <linux/regmap.h> + +struct max665x_dev { +struct device *dev; +struct mutex iolock; + +struct i2c_client *i2c; +struct regmap *map; + +int type; +}; + +enum max665x_types { +TYPE_MAX6650 , +TYPE_MAX6651 , +}; + +#endif
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 6 lines
drivers/mfd/max665x.c line 23
Quoted 3 lines
drivers/mfd/max665x.c new file +3
-0+static struct mfd_cell max665x_devs[] = { + { .name ="max6651-gpio" , }, + { .name ="max6650" , },/* hwmon driver */ What happened to renaming the hwmon driver, so we can have "max6650-hwmon" here?
I will add the alias in the next patch (e.g. hwmon change). I can come back to this and rename then.
Quoted 6 lines
drivers/mfd/max665x.c line 70
Quoted 4 lines
drivers/mfd/max665x.c new file +4
-0+static const struct i2c_device_id max665x_id[] = { + {"max6650" ,TYPE_MAX6650 }, + {"max6651" ,TYPE_MAX6651 }, + {},Can you remind me where these IDs are being used?
Strictly speaking, not in this change, so I can remove it and add later if needed.
Quoted 9 lines
drivers/mfd/max665x.c line 77
Quoted 7 lines
drivers/mfd/max665x.c new file +7
-0+}; +MODULE_DEVICE_TABLE (i2c, max665x_id); + +static struct i2c_driver max665x_driver = { + .driver = { + .name ="max665x" , + .owner =THIS_MODULE ,All new drivers are required to support Device Tree.
Do you have some recommendation for documentation, examples, etc? I am new to this.
Quoted 9 lines
<snip>
include/linux/mfd/max665x-private.h line 24
Quoted 5 lines
include/linux/mfd/max665x-private.h new file +5
-0+#ifndef __LINUX_MFD_MAX665X_PRIVATE_H +#define __LINUX_MFD_MAX665X_PRIVATE_H + +#include <linux/i2c.h> +#include <linux/export.h> What's this here for?
Good catch, the export line is a left-over.
Quoted 10 lines
Quoted 9 lines
drivers/mfd/max665x.c line 77
Quoted 7 lines
drivers/mfd/max665x.c new file +7
-0+}; +MODULE_DEVICE_TABLE (i2c, max665x_id); + +static struct i2c_driver max665x_driver = { + .driver = { + .name ="max665x" , + .owner =THIS_MODULE ,All new drivers are required to support Device Tree.
Quoted 2 lines
Do you have some recommendation for documentation, examples, etc? I am new to this.
I see .of_match_table added in certain mfd drivers, but I am not sure what I should put into the name or even the compatible member, I see them boot neglected in various drivers. The structure here does not seem to be documented either:
http://lxr.free-electrons.com/source/include/linux/mod_devicetable.h#L220
I do not know where to get the information for the .name and/or .compatible entry for, or if I need anything more.
Quoted 9 lines
Quoted 6 lines
drivers/mfd/max665x.c line 23
Quoted 3 lines
drivers/mfd/max665x.c new file +3
-0+static struct mfd_cell max665x_devs[] = { + { .name ="max6651-gpio" , }, + { .name ="max6650" , },/* hwmon driver */ What happened to renaming the hwmon driver, so we can have "max6650-hwmon" here?
I will add the alias in the next patch (e.g. hwmon change). I can come back to this and rename then.
Better add this patch _after_ that change. That will prevent any inherently awkward to handing 'cross subsystem' patches.
Quoted 9 lines
Quoted 6 lines
drivers/mfd/max665x.c line 70
Quoted 4 lines
drivers/mfd/max665x.c new file +4
-0+static const struct i2c_device_id max665x_id[] = { + {"max6650" ,TYPE_MAX6650 }, + {"max6651" ,TYPE_MAX6651 }, + {},Can you remind me where these IDs are being used?
Strictly speaking, not in this change, so I can remove it and add later if needed.
Please remove them if they're not being used.
Quoted 10 lines
Quoted 9 lines
drivers/mfd/max665x.c line 77
Quoted 7 lines
drivers/mfd/max665x.c new file +7
-0+}; +MODULE_DEVICE_TABLE (i2c, max665x_id); + +static struct i2c_driver max665x_driver = { + .driver = { + .name ="max665x" , + .owner =THIS_MODULE ,All new drivers are required to support Device Tree.
Quoted 2 lines
Do you have some recommendation for documentation, examples, etc? I am new to this.
Documentation/devicetree/usage-model.txtDocumentation/devicetree/bindings/mfd/*
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog