mfd: MAX6650/6651 support
PATCH v2 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 provies 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 1 line
+ * Author: Milo Kim <[email protected]>
s/Milo Kim/Laszlo Papp/
I just copied and pasted some existing copyrights, and I, apparently, have not changed it properly to my name; apologies for that. I will fix this in the next batch after getting some review from others.
Hi,
Quoted 23 lines · Laszlo Papp
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 +0
-0@@ -368,6 +368,17 @@ config MFD_MAX8907 accessing the device; additional drivers must be enabled in order
drivers/mfd/Kconfig config MFD_MAX8907 · line 378
Quoted 10 lines
drivers/mfd/Kconfig +8
-0to 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 provies common support
s/provies/provides/
(...)
Quoted 8 lines
drivers/mfd/Kconfig +8
-0+const struct regmap_config max665x_regmap_config = { + .reg_bits = 5, +}; + +static int max665x_probe(struct i2c_client *i2c, + const struct i2c_device_id *id) +{ + struct max665x_dev *max665x;
drivers/mfd/Kconfig config MFD_MAX8907
Quoted 10 lines
drivers/mfd/Kconfig +10
-0+ int ret; + + max665x = devm_kzalloc(&i2c->dev, sizeof(*max665x), GFP_KERNEL); + if (!max665x) + return -ENOMEM; + + i2c_set_clientdata(i2c, max665x); + max665x->dev = &i2c->dev; + max665x->i2c = i2c; + max665x->map = regmap_init_i2c(i2c, &max665x_regmap_config);
Use devm_regmap_init_i2c() (or add missing regmap_exit()).
Best regards,
Krzysztof
Quoted 5 lines
drivers/mfd/Kconfig config MFD_MAX8907 · line 378
Quoted 3 lines
drivers/mfd/Kconfig +3
-0+ help + Say yes here to support for Maxim Semiconductor MAX6650/MAX6651. This is + a fan speed regulator and monitor IC. This driver provies common supports/provies/provides/
Good catch!
(Note to myself: I should have run my vim spellchecker... )
Quoted 3 lines
Quoted 1 line
+
max665x->map=regmap_init_i2c(i2c, &max665x_regmap_config);Use
devm_regmap_init_i2c()(or add missingregmap_exit()).
Ah, okay, I was not aware of that, thanks.
Hi Laszlo,
If you are considering re-spinning this patch based on Lee's comments, please also consider my comments inline.
Quoted 22 lines · Laszlo Papp
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 +0
-0
drivers/mfd/Kconfig config MFD_MAX8907 · line 375
Quoted 8 lines
drivers/mfd/Kconfig +5
-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
Move the "depends on" before the select MFD_CORE.
drivers/mfd/Kconfig config MFD_MAX8907 · line 377
Quoted 2 lines
drivers/mfd/Kconfig +2
-0+ help + Say yes here to support for Maxim Semiconductor MAX6650/MAX6651.
s/here to support/here to add support
Quoted 33 lines
This is
drivers/mfd/Kconfig +4
-0+ a fan speed regulator and monitor IC. This driver provies 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 +7
-0@@ -0,0 +1,88 @@ +/* +* Device access for MAX6650-MAX6651 +* +* Copyright(c) 2013 Polatis Ltd. +* +* Author: Laszlo Papp <[email protected]> +*
drivers/mfd/max665x.c line 17
Quoted 10 lines
drivers/mfd/max665x.c new file +10
-0+* 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. +*/ + +#include <linux/device.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/i2c.h>
Please arrange these alphabetically.
[snip]
drivers/mfd/max665x.c line 26
Quoted 9 lines
drivers/mfd/max665x.c new file +9
-0+ +struct max665x_dev { +struct device *dev; +struct mutex iolock; + +struct i2c_client *i2c; +struct regmap *map; + +int type;
Unnecessary extra lines above could be removed.
Signature · 2 lines
With warm regards, Sachin
Quoted 6 lines
drivers/mfd/max665x.c line 17
Quoted 4 lines
drivers/mfd/max665x.c new file +4
-0+#include <linux/device.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/i2c.h> Please arrange these alphabetically.
Why?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 8 lines · Lee Jones
Quoted 6 lines
drivers/mfd/max665x.c line 17
Quoted 4 lines
drivers/mfd/max665x.c new file +4
-0+#include <linux/device.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/i2c.h> Please arrange these alphabetically.
Why?
1. It makes it easier to avoid adding duplicate includes.
2. Code looks more ordered/organized.
3. Prevents further clean up patches arranging them so :)
Signature · 2 lines
With warm regards, Sachin
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/mfd/max665x.c line 17
Quoted 4 lines
drivers/mfd/max665x.c new file +4
-0+#include <linux/device.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/i2c.h> Please arrange these alphabetically.
Quoted 5 lines
Quoted 1 line
Why?
1. It makes it easier to avoid adding duplicate includes.
2. Code looks more ordered/organized.
3. Prevents further clean up patches arranging them so :)
I wouldn't accept any patches doing such worthless things. ;)
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 8 lines · Sachin Kamat
Quoted 7 lines · Lee Jones
Quoted 6 lines
drivers/mfd/max665x.c line 17
Quoted 4 lines
drivers/mfd/max665x.c new file +4
-0+#include <linux/device.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/i2c.h> Please arrange these alphabetically.
Quoted 5 lines
Quoted 1 line
Why?
1. It makes it easier to avoid adding duplicate includes.
2. Code looks more ordered/organized.
3. Prevents further clean up patches arranging them so :)
1) I am sorry, but I need to disagree with this one, personally. Check duplicates could be done by a util at any given moment if it becomes a pressing issue.
2) Not for me. I prefer hierarchical dependency based inclusion between headers if there is such a thing, or just orthogonal if not.
3) It does not apply to my taste due to 1-2).
I would also like to add further detriments:
4) file rename could rearrange the list with your suggestion.
5) It would be inconsistent with a large code base out there.
A message that is not in the archive (sent off-list or not yet received): CAOMwXhNmjehcd+aiWGuKs7CijheXXngsXTHMfG9SDLpHO=KaPw@mail.gmail.com
Quoted 113 lines · Laszlo Papp
Quoted 4 lines · Sachin Kamat
Hi Laszlo,
If you are considering re-spinning this patch based on Lee's comments, please also consider my comments inline.
Hi, sure, thanks.
Quoted 26 lines · Laszlo Papp
Quoted 25 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 +0
-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.Quoted 7 lines
drivers/mfd/Kconfig config MFD_MAX8907 · line 375
Quoted 5 lines
drivers/mfd/Kconfig +5
-0+config MFD_MAX665X + bool "Maxim Semiconductor MAX6650/MAX6651 Support" + select MFD_CORE + depends on I2C + select REGMAP_I2CMove the "depends on" before the select
MFD_CORE.OK.
Quoted 4 lines
drivers/mfd/Kconfig config MFD_MAX8907 · line 377
Quoted 2 lines
drivers/mfd/Kconfig +2
-0+ help + Say yes here to support for Maxim Semiconductor MAX6650/MAX6651.s/here to support/here to add support
OK.
Quoted 37 lines
Quoted 37 lines
This is
drivers/mfd/Kconfig +4
-0+ a fan speed regulator and monitor IC. This driver provies 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 +11
-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. Quoted 8 lines
drivers/mfd/max665x.c line 17
Quoted 6 lines
drivers/mfd/max665x.c new file +6
-0+*/ + +#include <linux/device.h> +#include <linux/mfd/core.h> +#include <linux/module.h> +#include <linux/i2c.h> Please arrange these alphabetically.
OK, it does not matter for me. Please agree upon something with Lee. :-)
Quoted 13 lines
[snip]
drivers/mfd/max665x.c
Quoted 9 lines
drivers/mfd/max665x.c new file +9
-0+ +struct max665x_dev { +struct device *dev; +struct mutex iolock; + +struct i2c_client *i2c; +struct regmap *map; + +int type;Unnecessary extra lines above could be removed.
Quoted 1 line
I prefer it that way, but I will remove the two extra lines as you wish.
As I already said, these are just nits and only since you were re-spinning the patch,
I suggested them. Also, since this is a new file being added, it avoids further patches
doing these same things.
Signature · 2 lines
With warm regards, Sachin
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
[snip]
include/linux/mfd/max665x-private.h line 34
Quoted 9 lines
include/linux/mfd/max665x-private.h new file +9
-0+ +struct max665x_dev { +struct device *dev; +struct mutex iolock; + +struct i2c_client *i2c; +struct regmap *map; + +int type;Unnecessary extra lines above could be removed.
Quoted 7 lines
Quoted 1 line
I prefer it that way, but I will remove the two extra lines as you wish.
As I already said, these are just nits and only since you were re-spinning the patch,
I suggested them. Also, since this is a new file being added, it avoids further patches
doing these same things.
Well, it is worse in my opinion because it makes the code more bloated without separation between units, but I made the requested change anyway because the feature matters lotta more to me than this styling. Hope it is OK now?
Quoted 21 lines · Laszlo Papp
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
[snip]
include/linux/mfd/max665x-private.h line 34
Quoted 9 lines
include/linux/mfd/max665x-private.h new file +9
-0+ +struct max665x_dev { +struct device *dev; +struct mutex iolock; + +struct i2c_client *i2c; +struct regmap *map; + +int type;Unnecessary extra lines above could be removed.
Quoted 7 lines
Quoted 1 line
I prefer it that way, but I will remove the two extra lines as you wish.
As I already said, these are just nits and only since you were re-spinning the patch,
I suggested them. Also, since this is a new file being added, it avoids further patches
doing these same things.
Quoted 4 lines
Well, it is worse in my opinion because it makes the code more bloated without separation between units, but I made the requested change anyway because the feature matters lotta more to me than this styling. Hope it is OK now?
The only thing that you missed among what you agreed to change is the arrangement of
"depends on" and "select" in Kconfig. Rest look OK. Thanks for taking care.
Signature · 2 lines
With warm regards, Sachin
Quoted 22 lines · Sachin Kamat
Quoted 21 lines · Laszlo Papp
Quoted 20 lines
Quoted 13 lines
Quoted 12 lines
[snip]
include/linux/mfd/max665x-private.h line 34
Quoted 9 lines
include/linux/mfd/max665x-private.h new file +9
-0+ +struct max665x_dev { +struct device *dev; +struct mutex iolock; + +struct i2c_client *i2c; +struct regmap *map; + +int type;Unnecessary extra lines above could be removed.
Quoted 1 line
I prefer it that way, but I will remove the two extra lines as you wish.
As I already said, these are just nits and only since you were re-spinning the patch,
I suggested them. Also, since this is a new file being added, it avoids further patches
doing these same things.
Quoted 8 lines
Quoted 4 lines
Well, it is worse in my opinion because it makes the code more bloated without separation between units, but I made the requested change anyway because the feature matters lotta more to me than this styling. Hope it is OK now?
The only thing that you missed among what you agreed to change is the arrangement of
"depends on" and "select" inKconfig. Rest look OK. Thanks for taking care.
Ah, true. I will do that tomorrow if it is a blocker for the integration.
Quoted 28 lines · Laszlo Papp
Quoted 27 lines · Sachin Kamat
Quoted 25 lines · Laszlo Papp
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
[snip]
Review
Quoted 9 lines
(quoted diff) +9
-0+ +struct max665x_dev { + struct device *dev; + struct mutex iolock; + + struct i2c_client *i2c; + struct regmap *map; + + int type;Unnecessary extra lines above could be removed.
Quoted 7 lines
Quoted 1 line
I prefer it that way, but I will remove the two extra lines as you wish.
As I already said, these are just nits and only since you were re-spinning the patch,
I suggested them. Also, since this is a new file being added, it avoids further patches
doing these same things.Well, it is worse in my opinion because it makes the code more bloated without separation between units, but I made the requested change anyway because the feature matters lotta more to me than this styling. Hope it is OK now?
Quoted 5 lines
Quoted 3 lines
The only thing that you missed among what you agreed to change is the arrangement of
"depends on" and "select" inKconfig. Rest look OK. Thanks for taking care.Ah, true. I will do that tomorrow if it is a blocker for the integration.
I don't think it is a blocker in any way and you may choose to ignore it as well.
Signature · 2 lines
With warm regards, Sachin
Quoted 29 lines · Sachin Kamat
Quoted 28 lines · Laszlo Papp
Quoted 27 lines · Sachin Kamat
Quoted 25 lines · Laszlo Papp
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
[snip]
Review
Quoted 9 lines
(quoted diff) +9
-0+ +struct max665x_dev { + struct device *dev; + struct mutex iolock; + + struct i2c_client *i2c; + struct regmap *map; + + int type;Unnecessary extra lines above could be removed.
Quoted 7 lines
Quoted 1 line
I prefer it that way, but I will remove the two extra lines as you wish.
As I already said, these are just nits and only since you were re-spinning the patch,
I suggested them. Also, since this is a new file being added, it avoids further patches
doing these same things.Well, it is worse in my opinion because it makes the code more bloated without separation between units, but I made the requested change anyway because the feature matters lotta more to me than this styling. Hope it is OK now?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
The only thing that you missed among what you agreed to change is the arrangement of
"depends on" and "select" inKconfig. Rest look OK. Thanks for taking care.Ah, true. I will do that tomorrow if it is a blocker for the integration.
I don't think it is a blocker in any way and you may choose to ignore it as well.
That is alright, Sachin. I will make this change from home. Perhaps, it is wise anyhow to wait for more feedback, like e.g. from Lee, etc.
Thanks again.
Quoted 5 lines
Quoted 2 lines
I don't think it is a blocker in any way and you may choose to ignore it as well.
That is alright, Sachin. I will make this change from home. Perhaps, it is wise anyhow to wait for more feedback, like e.g. from Lee, etc.
It's fine, just fixup and resend.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog