linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
@ 2014-04-14  9:17 Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 1/9] extcon: max14577: Change extcon name instead of static name according to device type Krzysztof Kozlowski
                   ` (10 more replies)
  0 siblings, 11 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

Hi,


This is first part of fifth version of patchset adding support for
MAX77836 device to the max14577 driver.

I decided to split the patchset into smaller parts. I hope this would
help in getting necessary review/acks from maintainers.

The first part introduces changes in max14577 driver and adds support
for MAX77836 in MFD, extcon and regulator drivers. Most of these
patches already have required acks from maintainers.
Full v4 patchset can be found here:
http://thread.gmane.org/gmane.linux.kernel/1654267


Changes since v4
================
1. Updated Kconfig entries mentioning MAX77836.
2. Removed rename-like patches:
   [PATCH v4 02/16] mfd: max14577: Rename and add MAX14577 symbols
   [PATCH v4 03/16] mfd: max14577: Rename state container to maxim_core
3. Added new patches (not yet reviewed):
   [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
   [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
4. Rebased on 3.15-rc1.

Changes since v3
================
1. Applied minor fixes (pointed by Lee Jones).
2. Added one ACK (Lee Jones) and Review-by (Tomasz Figa).
3. Patch 14/charger: Minor change in parsing EOC value from DTS.
4. Rebased on next-20140224.

Changes since v2
================
1. Added ACK-s.
2. Applied minor checkpatch fixes (pointed by Lee Jones).
3. Rebased on next-20140217.

Changes since v1
================
1. Added ACK-s, reviews and tested-by tags.
2. Removed applied patches (they were merged to the linux-next tree).
3. Applied comments from review (Lee Jones) to 5/15 (detection of device type)
   and 8/15 (add max77836 support to max14577).
4. Rebased on next tree.
5. Added patch 13 and 14 (pointed by Jenny Tc):
   - regulator/mfd: max14577: Export symbols for calculating charger current
   - charger: max14577: Configure battery-dependent settings from DTS
6. Updated bindings documentation with new charger bindings.
Previous thread:
 - [PATCH 00/18] mfd: max14577: Add support for MAX77836
   http://thread.gmane.org/gmane.linux.kernel/1636654/focus=1636674


Description
===========
The MAX77836 is almost the same as MAX14577. Basically it is an extended
version of MAX14577. The chipsets have same MUIC component so the extcon,
charger and regulators require only little adjustments. More changes were
needed in the charger (because it uses lower charging current) and regulator
drivers (because mentioned different charing current and additional
regulators). The MAX77836 has also PMIC and Fuel Gauge (which is the same
as MAX17040/17048 Fuel Gauge).

The MAX77836 uses three I2C slave addresses and has additional interrupts
(related to PMIC and Fuel Gauge). It has also Interrupt Source register,
just like MAX77686 and MAX77693.


Best regards,
Krzysztof Kozlowski


Chanwoo Choi (1):
  extcon: max14577: Change extcon name instead of static name according
    to device type

Krzysztof Kozlowski (8):
  mfd: max14577: Add muic prefix to regmap config
  mfd: max14577: Add detection of device type
  extcon: max14577: Add max14577 prefix to muic_irqs
  extcon: max14577: Choose muic_irqs according to device type
  mfd: max14577: Add MAX14577 prefix to IRQ defines
  mfd: max77836: Add MAX77836 support to max14577 driver
  extcon: max14577: Add support for MAX77836
  regulator: max14577: Add support for MAX77836 regulators

 drivers/extcon/Kconfig               |   4 +-
 drivers/extcon/extcon-max14577.c     | 174 +++++++++++++------
 drivers/mfd/Kconfig                  |   6 +-
 drivers/mfd/max14577.c               | 315 ++++++++++++++++++++++++++++++-----
 drivers/regulator/Kconfig            |   7 +-
 drivers/regulator/max14577.c         | 277 ++++++++++++++++++++++++++----
 include/linux/mfd/max14577-private.h | 222 ++++++++++++++++++------
 include/linux/mfd/max14577.h         |  19 ++-
 8 files changed, 836 insertions(+), 188 deletions(-)

-- 
1.8.3.2


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v5 1/9] extcon: max14577: Change extcon name instead of static name according to device type
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config Krzysztof Kozlowski
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

From: Chanwoo Choi <cw00.choi@samsung.com>

This patch use device name to make sysfs path according to device type:

max14577-muic
- /sys/class/extcon/max14577-muic/
max77836-muic
- /sys/class/extcon/max77836-muic/

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-max14577.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 3846941801b8..59f084fee4f3 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -24,7 +24,6 @@
 #include <linux/mfd/max14577-private.h>
 #include <linux/extcon.h>
 
-#define	DEV_NAME			"max14577-muic"
 #define	DELAY_MS_DEFAULT		17000		/* unit: millisecond */
 
 enum max14577_muic_adc_debounce_time {
@@ -673,7 +672,8 @@ static int max14577_muic_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
 		return -ENOMEM;
 	}
-	info->edev->name = DEV_NAME;
+
+	info->edev->name = dev_name(&pdev->dev);
 	info->edev->supported_cable = max14577_extcon_cable;
 	ret = extcon_dev_register(info->edev);
 	if (ret) {
@@ -737,7 +737,7 @@ static int max14577_muic_remove(struct platform_device *pdev)
 
 static struct platform_driver max14577_muic_driver = {
 	.driver		= {
-		.name	= DEV_NAME,
+		.name	= "max14577-muic",
 		.owner	= THIS_MODULE,
 	},
 	.probe		= max14577_muic_probe,
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 1/9] extcon: max14577: Change extcon name instead of static name according to device type Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-15  6:36   ` Chanwoo Choi
  2014-04-16 10:22   ` Lee Jones
  2014-04-14  9:17 ` [PATCH v5 3/9] mfd: max14577: Add detection of device type Krzysztof Kozlowski
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

Add muic prefix to regmap config to differentiate between another regmap
config for MAX77836 PMIC node. Additionally remove unused
symbols: MAX14577_REG_INVALID and max14577_irq_source.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mfd/max14577.c               | 9 +++++----
 include/linux/mfd/max14577-private.h | 4 +---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 5f13cefe8def..d180fae8e317 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -37,7 +37,7 @@ static struct mfd_cell max14577_devs[] = {
 	{ .name = "max14577-charger", },
 };
 
-static bool max14577_volatile_reg(struct device *dev, unsigned int reg)
+static bool max14577_muic_volatile_reg(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
 	case MAX14577_REG_INT1 ... MAX14577_REG_STATUS3:
@@ -48,10 +48,10 @@ static bool max14577_volatile_reg(struct device *dev, unsigned int reg)
 	return false;
 }
 
-static const struct regmap_config max14577_regmap_config = {
+static const struct regmap_config max14577_muic_regmap_config = {
 	.reg_bits	= 8,
 	.val_bits	= 8,
-	.volatile_reg	= max14577_volatile_reg,
+	.volatile_reg	= max14577_muic_volatile_reg,
 	.max_register	= MAX14577_REG_END,
 };
 
@@ -113,7 +113,8 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 	max14577->i2c = i2c;
 	max14577->irq = i2c->irq;
 
-	max14577->regmap = devm_regmap_init_i2c(i2c, &max14577_regmap_config);
+	max14577->regmap = devm_regmap_init_i2c(i2c,
+			&max14577_muic_regmap_config);
 	if (IS_ERR(max14577->regmap)) {
 		ret = PTR_ERR(max14577->regmap);
 		dev_err(max14577->dev, "Failed to allocate register map: %d\n",
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index c9b332fb0d5d..97b78d94f92f 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -22,9 +22,7 @@
 #include <linux/i2c.h>
 #include <linux/regmap.h>
 
-#define MAX14577_REG_INVALID		(0xff)
-
-/* Slave addr = 0x4A: Interrupt */
+/* Slave addr = 0x4A: MUIC and Charger */
 enum max14577_reg {
 	MAX14577_REG_DEVICEID		= 0x00,
 	MAX14577_REG_INT1		= 0x01,
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 3/9] mfd: max14577: Add detection of device type
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 1/9] extcon: max14577: Change extcon name instead of static name according to device type Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 4/9] extcon: max14577: Add max14577 prefix to muic_irqs Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

This patch continues the preparation for adding support for MAX77836
device to existing max14577 driver.

Add enum for types of devices supported by this driver. The device type
will be detected by matching of_device_id, or i2c_device_id as a
fallback.

The patch also moves to separate function the code related to displaying
DeviceID register values.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/max14577.c               | 64 +++++++++++++++++++++++++-----------
 include/linux/mfd/max14577-private.h | 12 ++++---
 2 files changed, 53 insertions(+), 23 deletions(-)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index d180fae8e317..0e07ed74ab41 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -21,6 +21,7 @@
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/of_device.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/max14577.h>
 #include <linux/mfd/max14577-private.h>
@@ -37,6 +38,14 @@ static struct mfd_cell max14577_devs[] = {
 	{ .name = "max14577-charger", },
 };
 
+static struct of_device_id max14577_dt_match[] = {
+	{
+		.compatible = "maxim,max14577",
+		.data = (void *)MAXIM_DEVICE_TYPE_MAX14577,
+	},
+	{},
+};
+
 static bool max14577_muic_volatile_reg(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
@@ -83,13 +92,34 @@ static const struct regmap_irq_chip max14577_irq_chip = {
 	.num_irqs		= ARRAY_SIZE(max14577_irqs),
 };
 
+static void max14577_print_dev_type(struct max14577 *max14577)
+{
+	u8 reg_data, vendor_id, device_id;
+	int ret;
+
+	ret = max14577_read_reg(max14577->regmap, MAX14577_REG_DEVICEID,
+			&reg_data);
+	if (ret) {
+		dev_err(max14577->dev,
+			"Failed to read DEVICEID register: %d\n", ret);
+		return;
+	}
+
+	vendor_id = ((reg_data & DEVID_VENDORID_MASK) >>
+				DEVID_VENDORID_SHIFT);
+	device_id = ((reg_data & DEVID_DEVICEID_MASK) >>
+				DEVID_DEVICEID_SHIFT);
+
+	dev_info(max14577->dev, "Device type: %u (ID: 0x%x, vendor: 0x%x)\n",
+			max14577->dev_type, device_id, vendor_id);
+}
+
 static int max14577_i2c_probe(struct i2c_client *i2c,
 			      const struct i2c_device_id *id)
 {
 	struct max14577 *max14577;
 	struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev);
 	struct device_node *np = i2c->dev.of_node;
-	u8 reg_data;
 	int ret = 0;
 
 	if (np) {
@@ -122,19 +152,17 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	ret = max14577_read_reg(max14577->regmap, MAX14577_REG_DEVICEID,
-			&reg_data);
-	if (ret) {
-		dev_err(max14577->dev, "Device not found on this channel: %d\n",
-				ret);
-		return ret;
+	if (np) {
+		const struct of_device_id *of_id;
+
+		of_id = of_match_device(max14577_dt_match, &i2c->dev);
+		if (of_id)
+			max14577->dev_type = (unsigned int)of_id->data;
+	} else {
+		max14577->dev_type = id->driver_data;
 	}
-	max14577->vendor_id = ((reg_data & DEVID_VENDORID_MASK) >>
-				DEVID_VENDORID_SHIFT);
-	max14577->device_id = ((reg_data & DEVID_DEVICEID_MASK) >>
-				DEVID_DEVICEID_SHIFT);
-	dev_info(max14577->dev, "Device ID: 0x%x, vendor: 0x%x\n",
-			max14577->device_id, max14577->vendor_id);
+
+	max14577_print_dev_type(max14577);
 
 	ret = regmap_add_irq_chip(max14577->regmap, max14577->irq,
 				  IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 0,
@@ -173,7 +201,7 @@ static int max14577_i2c_remove(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id max14577_i2c_id[] = {
-	{ "max14577", 0 },
+	{ "max14577", MAXIM_DEVICE_TYPE_MAX14577, },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
@@ -216,11 +244,6 @@ static int max14577_resume(struct device *dev)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-static struct of_device_id max14577_dt_match[] = {
-	{ .compatible = "maxim,max14577", },
-	{},
-};
-
 static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume);
 
 static struct i2c_driver max14577_i2c_driver = {
@@ -237,6 +260,9 @@ static struct i2c_driver max14577_i2c_driver = {
 
 static int __init max14577_i2c_init(void)
 {
+	BUILD_BUG_ON(ARRAY_SIZE(max14577_i2c_id) != MAXIM_DEVICE_TYPE_NUM);
+	BUILD_BUG_ON(ARRAY_SIZE(max14577_dt_match) != MAXIM_DEVICE_TYPE_NUM);
+
 	return i2c_add_driver(&max14577_i2c_driver);
 }
 subsys_initcall(max14577_i2c_init);
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index 97b78d94f92f..1ce6f2952cc9 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -22,6 +22,13 @@
 #include <linux/i2c.h>
 #include <linux/regmap.h>
 
+enum maxim_device_type {
+	MAXIM_DEVICE_TYPE_UNKNOWN	= 0,
+	MAXIM_DEVICE_TYPE_MAX14577,
+
+	MAXIM_DEVICE_TYPE_NUM,
+};
+
 /* Slave addr = 0x4A: MUIC and Charger */
 enum max14577_reg {
 	MAX14577_REG_DEVICEID		= 0x00,
@@ -271,15 +278,12 @@ enum max14577_irq {
 struct max14577 {
 	struct device *dev;
 	struct i2c_client *i2c; /* Slave addr = 0x4A */
+	enum maxim_device_type dev_type;
 
 	struct regmap *regmap;
 
 	struct regmap_irq_chip_data *irq_data;
 	int irq;
-
-	/* Device ID */
-	u8 vendor_id;	/* Vendor Identification */
-	u8 device_id;	/* Chip Version */
 };
 
 /* MAX14577 shared regmap API function */
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 4/9] extcon: max14577: Add max14577 prefix to muic_irqs
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2014-04-14  9:17 ` [PATCH v5 3/9] mfd: max14577: Add detection of device type Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 5/9] extcon: max14577: Choose muic_irqs according to device type Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

Add max14577 prefix to muic_irqs array. This prepares for max77836
support in this extcon driver.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-max14577.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 59f084fee4f3..6f921b7c3e5b 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -85,7 +85,7 @@ struct max14577_muic_irq {
 	unsigned int virq;
 };
 
-static struct max14577_muic_irq muic_irqs[] = {
+static struct max14577_muic_irq max14577_muic_irqs[] = {
 	{ MAX14577_IRQ_INT1_ADC,	"muic-ADC" },
 	{ MAX14577_IRQ_INT1_ADCLOW,	"muic-ADCLOW" },
 	{ MAX14577_IRQ_INT1_ADCERR,	"muic-ADCError" },
@@ -538,9 +538,9 @@ static irqreturn_t max14577_muic_irq_handler(int irq, void *data)
 	 * However we only need to know whether it was ADC, charger
 	 * or both interrupts so decode IRQ and turn on proper flags.
 	 */
-	for (i = 0; i < ARRAY_SIZE(muic_irqs); i++)
-		if (irq == muic_irqs[i].virq)
-			irq_type = muic_irqs[i].irq;
+	for (i = 0; i < ARRAY_SIZE(max14577_muic_irqs); i++)
+		if (irq == max14577_muic_irqs[i].virq)
+			irq_type = max14577_muic_irqs[i].irq;
 
 	switch (irq_type) {
 	case MAX14577_IRQ_INT1_ADC:
@@ -644,8 +644,8 @@ static int max14577_muic_probe(struct platform_device *pdev)
 	INIT_WORK(&info->irq_work, max14577_muic_irq_work);
 
 	/* Support irq domain for max14577 MUIC device */
-	for (i = 0; i < ARRAY_SIZE(muic_irqs); i++) {
-		struct max14577_muic_irq *muic_irq = &muic_irqs[i];
+	for (i = 0; i < ARRAY_SIZE(max14577_muic_irqs); i++) {
+		struct max14577_muic_irq *muic_irq = &max14577_muic_irqs[i];
 		unsigned int virq = 0;
 
 		virq = regmap_irq_get_virq(max14577->irq_data, muic_irq->irq);
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 5/9] extcon: max14577: Choose muic_irqs according to device type
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2014-04-14  9:17 ` [PATCH v5 4/9] extcon: max14577: Add max14577 prefix to muic_irqs Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

This patch continues the preparation for adding support for max77836
device to existing max14577 driver.

During probe choose muic_irqs according to device type. Currently there
are only "max14577_muic_irqs" but later patch will add max77836
interrupts.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-max14577.c | 65 +++++++++++++++++++++++-----------------
 1 file changed, 37 insertions(+), 28 deletions(-)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 6f921b7c3e5b..1513013a92f1 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -39,6 +39,29 @@ enum max14577_muic_status {
 	MAX14577_MUIC_STATUS_END,
 };
 
+/**
+ * struct max14577_muic_irq
+ * @irq: the index of irq list of MUIC device.
+ * @name: the name of irq.
+ * @virq: the virtual irq to use irq domain
+ */
+struct max14577_muic_irq {
+	unsigned int irq;
+	const char *name;
+	unsigned int virq;
+};
+
+static struct max14577_muic_irq max14577_muic_irqs[] = {
+	{ MAX14577_IRQ_INT1_ADC,	"muic-ADC" },
+	{ MAX14577_IRQ_INT1_ADCLOW,	"muic-ADCLOW" },
+	{ MAX14577_IRQ_INT1_ADCERR,	"muic-ADCError" },
+	{ MAX14577_IRQ_INT2_CHGTYP,	"muic-CHGTYP" },
+	{ MAX14577_IRQ_INT2_CHGDETRUN,	"muic-CHGDETRUN" },
+	{ MAX14577_IRQ_INT2_DCDTMR,	"muic-DCDTMR" },
+	{ MAX14577_IRQ_INT2_DBCHG,	"muic-DBCHG" },
+	{ MAX14577_IRQ_INT2_VBVOLT,	"muic-VBVOLT" },
+};
+
 struct max14577_muic_info {
 	struct device *dev;
 	struct max14577 *max14577;
@@ -47,6 +70,8 @@ struct max14577_muic_info {
 	int prev_chg_type;
 	u8 status[MAX14577_MUIC_STATUS_END];
 
+	struct max14577_muic_irq *muic_irqs;
+	unsigned int muic_irqs_num;
 	bool irq_adc;
 	bool irq_chg;
 	struct work_struct irq_work;
@@ -73,29 +98,6 @@ enum max14577_muic_cable_group {
 	MAX14577_CABLE_GROUP_CHG,
 };
 
-/**
- * struct max14577_muic_irq
- * @irq: the index of irq list of MUIC device.
- * @name: the name of irq.
- * @virq: the virtual irq to use irq domain
- */
-struct max14577_muic_irq {
-	unsigned int irq;
-	const char *name;
-	unsigned int virq;
-};
-
-static struct max14577_muic_irq max14577_muic_irqs[] = {
-	{ MAX14577_IRQ_INT1_ADC,	"muic-ADC" },
-	{ MAX14577_IRQ_INT1_ADCLOW,	"muic-ADCLOW" },
-	{ MAX14577_IRQ_INT1_ADCERR,	"muic-ADCError" },
-	{ MAX14577_IRQ_INT2_CHGTYP,	"muic-CHGTYP" },
-	{ MAX14577_IRQ_INT2_CHGDETRUN,	"muic-CHGDETRUN" },
-	{ MAX14577_IRQ_INT2_DCDTMR,	"muic-DCDTMR" },
-	{ MAX14577_IRQ_INT2_DBCHG,	"muic-DBCHG" },
-	{ MAX14577_IRQ_INT2_VBVOLT,	"muic-VBVOLT" },
-};
-
 /* Define supported accessory type */
 enum max14577_muic_acc_type {
 	MAX14577_MUIC_ADC_GROUND = 0x0,
@@ -538,9 +540,9 @@ static irqreturn_t max14577_muic_irq_handler(int irq, void *data)
 	 * However we only need to know whether it was ADC, charger
 	 * or both interrupts so decode IRQ and turn on proper flags.
 	 */
-	for (i = 0; i < ARRAY_SIZE(max14577_muic_irqs); i++)
-		if (irq == max14577_muic_irqs[i].virq)
-			irq_type = max14577_muic_irqs[i].irq;
+	for (i = 0; i < info->muic_irqs_num; i++)
+		if (irq == info->muic_irqs[i].virq)
+			irq_type = info->muic_irqs[i].irq;
 
 	switch (irq_type) {
 	case MAX14577_IRQ_INT1_ADC:
@@ -643,9 +645,16 @@ static int max14577_muic_probe(struct platform_device *pdev)
 
 	INIT_WORK(&info->irq_work, max14577_muic_irq_work);
 
+	switch (max14577->dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX14577:
+	default:
+		info->muic_irqs = max14577_muic_irqs;
+		info->muic_irqs_num = ARRAY_SIZE(max14577_muic_irqs);
+	}
+
 	/* Support irq domain for max14577 MUIC device */
-	for (i = 0; i < ARRAY_SIZE(max14577_muic_irqs); i++) {
-		struct max14577_muic_irq *muic_irq = &max14577_muic_irqs[i];
+	for (i = 0; i < info->muic_irqs_num; i++) {
+		struct max14577_muic_irq *muic_irq = &info->muic_irqs[i];
 		unsigned int virq = 0;
 
 		virq = regmap_irq_get_virq(max14577->irq_data, muic_irq->irq);
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2014-04-14  9:17 ` [PATCH v5 5/9] extcon: max14577: Choose muic_irqs according to device type Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-15  6:37   ` Chanwoo Choi
  2014-04-16 10:27   ` Lee Jones
  2014-04-14  9:17 ` [PATCH v5 7/9] mfd: max77836: Add MAX77836 support to max14577 driver Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  10 siblings, 2 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

This patch prepares for adding support for MAX77836 device to existing
max14577 driver by adding MAX14577 prefix to defines of interrupts.

This is only a rename-like patch, new code is not added.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mfd/max14577.c               | 24 ++++++++++++------------
 include/linux/mfd/max14577-private.h | 28 ++++++++++++++--------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 0e07ed74ab41..6f39dec9dfdf 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -66,20 +66,20 @@ static const struct regmap_config max14577_muic_regmap_config = {
 
 static const struct regmap_irq max14577_irqs[] = {
 	/* INT1 interrupts */
-	{ .reg_offset = 0, .mask = INT1_ADC_MASK, },
-	{ .reg_offset = 0, .mask = INT1_ADCLOW_MASK, },
-	{ .reg_offset = 0, .mask = INT1_ADCERR_MASK, },
+	{ .reg_offset = 0, .mask = MAX14577_INT1_ADC_MASK, },
+	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCLOW_MASK, },
+	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCERR_MASK, },
 	/* INT2 interrupts */
-	{ .reg_offset = 1, .mask = INT2_CHGTYP_MASK, },
-	{ .reg_offset = 1, .mask = INT2_CHGDETRUN_MASK, },
-	{ .reg_offset = 1, .mask = INT2_DCDTMR_MASK, },
-	{ .reg_offset = 1, .mask = INT2_DBCHG_MASK, },
-	{ .reg_offset = 1, .mask = INT2_VBVOLT_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGTYP_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGDETRUN_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_DCDTMR_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_DBCHG_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_VBVOLT_MASK, },
 	/* INT3 interrupts */
-	{ .reg_offset = 2, .mask = INT3_EOC_MASK, },
-	{ .reg_offset = 2, .mask = INT3_CGMBC_MASK, },
-	{ .reg_offset = 2, .mask = INT3_OVP_MASK, },
-	{ .reg_offset = 2, .mask = INT3_MBCCHGERR_MASK, },
+	{ .reg_offset = 2, .mask = MAX14577_INT3_EOC_MASK, },
+	{ .reg_offset = 2, .mask = MAX14577_INT3_CGMBC_MASK, },
+	{ .reg_offset = 2, .mask = MAX14577_INT3_OVP_MASK, },
+	{ .reg_offset = 2, .mask = MAX14577_INT3_MBCCHGERR_MASK, },
 };
 
 static const struct regmap_irq_chip max14577_irq_chip = {
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index 1ce6f2952cc9..989183d232cd 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -79,20 +79,20 @@ enum max14577_muic_charger_type {
 };
 
 /* MAX14577 interrupts */
-#define INT1_ADC_MASK			(0x1 << 0)
-#define INT1_ADCLOW_MASK		(0x1 << 1)
-#define INT1_ADCERR_MASK		(0x1 << 2)
-
-#define INT2_CHGTYP_MASK		(0x1 << 0)
-#define INT2_CHGDETRUN_MASK		(0x1 << 1)
-#define INT2_DCDTMR_MASK		(0x1 << 2)
-#define INT2_DBCHG_MASK			(0x1 << 3)
-#define INT2_VBVOLT_MASK		(0x1 << 4)
-
-#define INT3_EOC_MASK			(0x1 << 0)
-#define INT3_CGMBC_MASK			(0x1 << 1)
-#define INT3_OVP_MASK			(0x1 << 2)
-#define INT3_MBCCHGERR_MASK		(0x1 << 3)
+#define MAX14577_INT1_ADC_MASK		BIT(0)
+#define MAX14577_INT1_ADCLOW_MASK	BIT(1)
+#define MAX14577_INT1_ADCERR_MASK	BIT(2)
+
+#define MAX14577_INT2_CHGTYP_MASK	BIT(0)
+#define MAX14577_INT2_CHGDETRUN_MASK	BIT(1)
+#define MAX14577_INT2_DCDTMR_MASK	BIT(2)
+#define MAX14577_INT2_DBCHG_MASK	BIT(3)
+#define MAX14577_INT2_VBVOLT_MASK	BIT(4)
+
+#define MAX14577_INT3_EOC_MASK		BIT(0)
+#define MAX14577_INT3_CGMBC_MASK	BIT(1)
+#define MAX14577_INT3_OVP_MASK		BIT(2)
+#define MAX14577_INT3_MBCCHGERR_MASK	BIT(3)
 
 /* MAX14577 DEVICE ID register */
 #define DEVID_VENDORID_SHIFT		0
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 7/9] mfd: max77836: Add MAX77836 support to max14577 driver
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2014-04-14  9:17 ` [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 8/9] extcon: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

Add Maxim 77836 support to max14577 driver. The chipsets have same MUIC
component so the extcon, charger and regulators are almost the same. The
MAX77836 however has also PMIC and Fuel Gauge.

The MAX77836 uses three I2C slave addresses and has additional interrupts
(related to PMIC and Fuel Gauge). It has also Interrupt Source register,
just like MAX77686 and MAX77693.

The MAX77836 PMIC's TOPSYS and INTSRC interrupts are reported in the
PMIC block. The PMIC block has different I2C slave address and uses own
regmap so another regmap_irq_chip is needed.

Since we have two regmap_irq_chip, use shared interrupts on MAX77836.

This patch adds additional defines and functions to the max14577 MFD core
driver so the driver will handle both chipsets. Also this patch replaces
"0x1 << N" with BIT(N) in defines for register masks.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/Kconfig                  |   6 +-
 drivers/mfd/max14577.c               | 217 +++++++++++++++++++++++++++++++++--
 include/linux/mfd/max14577-private.h | 145 +++++++++++++++++------
 include/linux/mfd/max14577.h         |   7 +-
 4 files changed, 330 insertions(+), 45 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 33834120d057..5bdefe72625e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -331,15 +331,15 @@ config MFD_88PM860X
 	  battery-charger under the corresponding menus.
 
 config MFD_MAX14577
-	bool "Maxim Semiconductor MAX14577 MUIC + Charger Support"
+	bool "Maxim Semiconductor MAX14577/77836 MUIC + Charger Support"
 	depends on I2C=y
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
 	select IRQ_DOMAIN
 	help
-	  Say yes here to add support for Maxim Semiconductor MAX14577.
-	  This is a Micro-USB IC with Charger controls on chip.
+	  Say yes here to add support for Maxim Semiconductor MAX14577 and
+	  MAX77836 Micro-USB ICs with battery charger.
 	  This driver provides common support for accessing the device;
 	  additional drivers must be enabled in order to use the functionality
 	  of the device.
diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 6f39dec9dfdf..20e3b2d81bf0 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -1,7 +1,7 @@
 /*
- * max14577.c - mfd core driver for the Maxim 14577
+ * max14577.c - mfd core driver for the Maxim 14577/77836
  *
- * Copyright (C) 2013 Samsung Electrnoics
+ * Copyright (C) 2014 Samsung Electrnoics
  * Chanwoo Choi <cw00.choi@samsung.com>
  * Krzysztof Kozlowski <k.kozlowski@samsung.com>
  *
@@ -38,11 +38,34 @@ static struct mfd_cell max14577_devs[] = {
 	{ .name = "max14577-charger", },
 };
 
+static struct mfd_cell max77836_devs[] = {
+	{
+		.name = "max77836-muic",
+		.of_compatible = "maxim,max77836-muic",
+	},
+	{
+		.name = "max77836-regulator",
+		.of_compatible = "maxim,max77836-regulator",
+	},
+	{
+		.name = "max77836-charger",
+		.of_compatible = "maxim,max77836-charger",
+	},
+	{
+		.name = "max77836-battery",
+		.of_compatible = "maxim,max77836-battery",
+	},
+};
+
 static struct of_device_id max14577_dt_match[] = {
 	{
 		.compatible = "maxim,max14577",
 		.data = (void *)MAXIM_DEVICE_TYPE_MAX14577,
 	},
+	{
+		.compatible = "maxim,max77836",
+		.data = (void *)MAXIM_DEVICE_TYPE_MAX77836,
+	},
 	{},
 };
 
@@ -57,6 +80,26 @@ static bool max14577_muic_volatile_reg(struct device *dev, unsigned int reg)
 	return false;
 }
 
+static bool max77836_muic_volatile_reg(struct device *dev, unsigned int reg)
+{
+	/* Any max14577 volatile registers are also max77836 volatile. */
+	if (max14577_muic_volatile_reg(dev, reg))
+		return true;
+
+	switch (reg) {
+	case MAX77836_FG_REG_VCELL_MSB ... MAX77836_FG_REG_SOC_LSB:
+	case MAX77836_FG_REG_CRATE_MSB ... MAX77836_FG_REG_CRATE_LSB:
+	case MAX77836_FG_REG_STATUS_H ... MAX77836_FG_REG_STATUS_L:
+	case MAX77836_PMIC_REG_INTSRC:
+	case MAX77836_PMIC_REG_TOPSYS_INT:
+	case MAX77836_PMIC_REG_TOPSYS_STAT:
+		return true;
+	default:
+		break;
+	}
+	return false;
+}
+
 static const struct regmap_config max14577_muic_regmap_config = {
 	.reg_bits	= 8,
 	.val_bits	= 8,
@@ -64,6 +107,13 @@ static const struct regmap_config max14577_muic_regmap_config = {
 	.max_register	= MAX14577_REG_END,
 };
 
+static const struct regmap_config max77836_pmic_regmap_config = {
+	.reg_bits	= 8,
+	.val_bits	= 8,
+	.volatile_reg	= max77836_muic_volatile_reg,
+	.max_register	= MAX77836_PMIC_REG_END,
+};
+
 static const struct regmap_irq max14577_irqs[] = {
 	/* INT1 interrupts */
 	{ .reg_offset = 0, .mask = MAX14577_INT1_ADC_MASK, },
@@ -86,12 +136,56 @@ static const struct regmap_irq_chip max14577_irq_chip = {
 	.name			= "max14577",
 	.status_base		= MAX14577_REG_INT1,
 	.mask_base		= MAX14577_REG_INTMASK1,
-	.mask_invert		= 1,
+	.mask_invert		= true,
 	.num_regs		= 3,
 	.irqs			= max14577_irqs,
 	.num_irqs		= ARRAY_SIZE(max14577_irqs),
 };
 
+static const struct regmap_irq max77836_muic_irqs[] = {
+	/* INT1 interrupts */
+	{ .reg_offset = 0, .mask = MAX14577_INT1_ADC_MASK, },
+	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCLOW_MASK, },
+	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCERR_MASK, },
+	/* INT2 interrupts */
+	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGTYP_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGDETRUN_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_DCDTMR_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_DBCHG_MASK, },
+	{ .reg_offset = 1, .mask = MAX14577_INT2_VBVOLT_MASK, },
+	{ .reg_offset = 1, .mask = MAX77836_INT2_VIDRM_MASK, },
+	/* INT3 interrupts */
+	{ .reg_offset = 2, .mask = MAX14577_INT3_EOC_MASK, },
+	{ .reg_offset = 2, .mask = MAX14577_INT3_CGMBC_MASK, },
+	{ .reg_offset = 2, .mask = MAX14577_INT3_OVP_MASK, },
+	{ .reg_offset = 2, .mask = MAX14577_INT3_MBCCHGERR_MASK, },
+};
+
+static const struct regmap_irq_chip max77836_muic_irq_chip = {
+	.name			= "max77836-muic",
+	.status_base		= MAX14577_REG_INT1,
+	.mask_base		= MAX14577_REG_INTMASK1,
+	.mask_invert		= true,
+	.num_regs		= 3,
+	.irqs			= max77836_muic_irqs,
+	.num_irqs		= ARRAY_SIZE(max77836_muic_irqs),
+};
+
+static const struct regmap_irq max77836_pmic_irqs[] = {
+	{ .reg_offset = 0, .mask = MAX77836_TOPSYS_INT_T120C_MASK, },
+	{ .reg_offset = 0, .mask = MAX77836_TOPSYS_INT_T140C_MASK, },
+};
+
+static const struct regmap_irq_chip max77836_pmic_irq_chip = {
+	.name			= "max77836-pmic",
+	.status_base		= MAX77836_PMIC_REG_TOPSYS_INT,
+	.mask_base		= MAX77836_PMIC_REG_TOPSYS_INT_MASK,
+	.mask_invert		= false,
+	.num_regs		= 1,
+	.irqs			= max77836_pmic_irqs,
+	.num_irqs		= ARRAY_SIZE(max77836_pmic_irqs),
+};
+
 static void max14577_print_dev_type(struct max14577 *max14577)
 {
 	u8 reg_data, vendor_id, device_id;
@@ -114,6 +208,81 @@ static void max14577_print_dev_type(struct max14577 *max14577)
 			max14577->dev_type, device_id, vendor_id);
 }
 
+/*
+ * Max77836 specific initialization code for driver probe.
+ * Adds new I2C dummy device, regmap and regmap IRQ chip.
+ * Unmasks Interrupt Source register.
+ *
+ * On success returns 0.
+ * On failure returns errno and reverts any changes done so far (e.g. remove
+ * I2C dummy device), except masking the INT SRC register.
+ */
+static int max77836_init(struct max14577 *max14577)
+{
+	int ret;
+	u8 intsrc_mask;
+
+	max14577->i2c_pmic = i2c_new_dummy(max14577->i2c->adapter,
+			I2C_ADDR_PMIC);
+	if (!max14577->i2c_pmic) {
+		dev_err(max14577->dev, "Failed to register PMIC I2C device\n");
+		return -ENODEV;
+	}
+	i2c_set_clientdata(max14577->i2c_pmic, max14577);
+
+	max14577->regmap_pmic = devm_regmap_init_i2c(max14577->i2c_pmic,
+			&max77836_pmic_regmap_config);
+	if (IS_ERR(max14577->regmap_pmic)) {
+		ret = PTR_ERR(max14577->regmap_pmic);
+		dev_err(max14577->dev, "Failed to allocate PMIC register map: %d\n",
+				ret);
+		goto err;
+	}
+
+	/* Un-mask MAX77836 Interrupt Source register */
+	ret = max14577_read_reg(max14577->regmap_pmic,
+			MAX77836_PMIC_REG_INTSRC_MASK, &intsrc_mask);
+	if (ret < 0) {
+		dev_err(max14577->dev, "Failed to read PMIC register\n");
+		goto err;
+	}
+
+	intsrc_mask &= ~(MAX77836_INTSRC_MASK_TOP_INT_MASK);
+	intsrc_mask &= ~(MAX77836_INTSRC_MASK_MUIC_CHG_INT_MASK);
+	ret = max14577_write_reg(max14577->regmap_pmic,
+			MAX77836_PMIC_REG_INTSRC_MASK, intsrc_mask);
+	if (ret < 0) {
+		dev_err(max14577->dev, "Failed to write PMIC register\n");
+		goto err;
+	}
+
+	ret = regmap_add_irq_chip(max14577->regmap_pmic, max14577->irq,
+			IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED,
+			0, &max77836_pmic_irq_chip,
+			&max14577->irq_data_pmic);
+	if (ret != 0) {
+		dev_err(max14577->dev, "Failed to request PMIC IRQ %d: %d\n",
+				max14577->irq, ret);
+		goto err;
+	}
+
+	return 0;
+
+err:
+	i2c_unregister_device(max14577->i2c_pmic);
+
+	return ret;
+}
+
+/*
+ * Max77836 specific de-initialization code for driver remove.
+ */
+static void max77836_remove(struct max14577 *max14577)
+{
+	regmap_del_irq_chip(max14577->irq, max14577->irq_data_pmic);
+	i2c_unregister_device(max14577->i2c_pmic);
+}
+
 static int max14577_i2c_probe(struct i2c_client *i2c,
 			      const struct i2c_device_id *id)
 {
@@ -121,6 +290,10 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 	struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev);
 	struct device_node *np = i2c->dev.of_node;
 	int ret = 0;
+	const struct regmap_irq_chip *irq_chip;
+	struct mfd_cell *mfd_devs;
+	unsigned int mfd_devs_size;
+	int irq_flags;
 
 	if (np) {
 		pdata = devm_kzalloc(&i2c->dev, sizeof(*pdata), GFP_KERNEL);
@@ -164,9 +337,24 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 
 	max14577_print_dev_type(max14577);
 
+	switch (max14577->dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		irq_chip = &max77836_muic_irq_chip;
+		mfd_devs = max77836_devs;
+		mfd_devs_size = ARRAY_SIZE(max77836_devs);
+		irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED;
+		break;
+	case MAXIM_DEVICE_TYPE_MAX14577:
+	default:
+		irq_chip = &max14577_irq_chip;
+		mfd_devs = max14577_devs;
+		mfd_devs_size = ARRAY_SIZE(max14577_devs);
+		irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;
+		break;
+	}
+
 	ret = regmap_add_irq_chip(max14577->regmap, max14577->irq,
-				  IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 0,
-				  &max14577_irq_chip,
+				  irq_flags, 0, irq_chip,
 				  &max14577->irq_data);
 	if (ret != 0) {
 		dev_err(&i2c->dev, "Failed to request IRQ %d: %d\n",
@@ -174,8 +362,15 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	ret = mfd_add_devices(max14577->dev, -1, max14577_devs,
-			ARRAY_SIZE(max14577_devs), NULL, 0,
+	/* Max77836 specific initialization code (additional regmap) */
+	if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836) {
+		ret = max77836_init(max14577);
+		if (ret < 0)
+			goto err_max77836;
+	}
+
+	ret = mfd_add_devices(max14577->dev, -1, mfd_devs,
+			mfd_devs_size, NULL, 0,
 			regmap_irq_get_domain(max14577->irq_data));
 	if (ret < 0)
 		goto err_mfd;
@@ -185,6 +380,9 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 	return 0;
 
 err_mfd:
+	if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
+		max77836_remove(max14577);
+err_max77836:
 	regmap_del_irq_chip(max14577->irq, max14577->irq_data);
 
 	return ret;
@@ -196,12 +394,15 @@ static int max14577_i2c_remove(struct i2c_client *i2c)
 
 	mfd_remove_devices(max14577->dev);
 	regmap_del_irq_chip(max14577->irq, max14577->irq_data);
+	if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836)
+		max77836_remove(max14577);
 
 	return 0;
 }
 
 static const struct i2c_device_id max14577_i2c_id[] = {
 	{ "max14577", MAXIM_DEVICE_TYPE_MAX14577, },
+	{ "max77836", MAXIM_DEVICE_TYPE_MAX77836, },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
@@ -274,5 +475,5 @@ static void __exit max14577_i2c_exit(void)
 module_exit(max14577_i2c_exit);
 
 MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>, Krzysztof Kozlowski <k.kozlowski@samsung.com>");
-MODULE_DESCRIPTION("MAXIM 14577 multi-function core driver");
+MODULE_DESCRIPTION("Maxim 14577/77836 multi-function core driver");
 MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index 989183d232cd..e301bd19b067 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -1,7 +1,7 @@
 /*
- * max14577-private.h - Common API for the Maxim 14577 internal sub chip
+ * max14577-private.h - Common API for the Maxim 14577/77836 internal sub chip
  *
- * Copyright (C) 2013 Samsung Electrnoics
+ * Copyright (C) 2014 Samsung Electrnoics
  * Chanwoo Choi <cw00.choi@samsung.com>
  * Krzysztof Kozlowski <k.kozlowski@samsung.com>
  *
@@ -22,9 +22,14 @@
 #include <linux/i2c.h>
 #include <linux/regmap.h>
 
+#define I2C_ADDR_PMIC	(0x46 >> 1)
+#define I2C_ADDR_MUIC	(0x4A >> 1)
+#define I2C_ADDR_FG	(0x6C >> 1)
+
 enum maxim_device_type {
 	MAXIM_DEVICE_TYPE_UNKNOWN	= 0,
 	MAXIM_DEVICE_TYPE_MAX14577,
+	MAXIM_DEVICE_TYPE_MAX77836,
 
 	MAXIM_DEVICE_TYPE_NUM,
 };
@@ -88,6 +93,7 @@ enum max14577_muic_charger_type {
 #define MAX14577_INT2_DCDTMR_MASK	BIT(2)
 #define MAX14577_INT2_DBCHG_MASK	BIT(3)
 #define MAX14577_INT2_VBVOLT_MASK	BIT(4)
+#define MAX77836_INT2_VIDRM_MASK	BIT(5)
 
 #define MAX14577_INT3_EOC_MASK		BIT(0)
 #define MAX14577_INT3_CGMBC_MASK	BIT(1)
@@ -104,9 +110,11 @@ enum max14577_muic_charger_type {
 #define STATUS1_ADC_SHIFT		0
 #define STATUS1_ADCLOW_SHIFT		5
 #define STATUS1_ADCERR_SHIFT		6
+#define MAX77836_STATUS1_ADC1K_SHIFT	7
 #define STATUS1_ADC_MASK		(0x1f << STATUS1_ADC_SHIFT)
-#define STATUS1_ADCLOW_MASK		(0x1 << STATUS1_ADCLOW_SHIFT)
-#define STATUS1_ADCERR_MASK		(0x1 << STATUS1_ADCERR_SHIFT)
+#define STATUS1_ADCLOW_MASK		BIT(STATUS1_ADCLOW_SHIFT)
+#define STATUS1_ADCERR_MASK		BIT(STATUS1_ADCERR_SHIFT)
+#define MAX77836_STATUS1_ADC1K_MASK	BIT(MAX77836_STATUS1_ADC1K_SHIFT)
 
 /* MAX14577 STATUS2 register */
 #define STATUS2_CHGTYP_SHIFT		0
@@ -114,11 +122,13 @@ enum max14577_muic_charger_type {
 #define STATUS2_DCDTMR_SHIFT		4
 #define STATUS2_DBCHG_SHIFT		5
 #define STATUS2_VBVOLT_SHIFT		6
+#define MAX77836_STATUS2_VIDRM_SHIFT	7
 #define STATUS2_CHGTYP_MASK		(0x7 << STATUS2_CHGTYP_SHIFT)
-#define STATUS2_CHGDETRUN_MASK		(0x1 << STATUS2_CHGDETRUN_SHIFT)
-#define STATUS2_DCDTMR_MASK		(0x1 << STATUS2_DCDTMR_SHIFT)
-#define STATUS2_DBCHG_MASK		(0x1 << STATUS2_DBCHG_SHIFT)
-#define STATUS2_VBVOLT_MASK		(0x1 << STATUS2_VBVOLT_SHIFT)
+#define STATUS2_CHGDETRUN_MASK		BIT(STATUS2_CHGDETRUN_SHIFT)
+#define STATUS2_DCDTMR_MASK		BIT(STATUS2_DCDTMR_SHIFT)
+#define STATUS2_DBCHG_MASK		BIT(STATUS2_DBCHG_SHIFT)
+#define STATUS2_VBVOLT_MASK		BIT(STATUS2_VBVOLT_SHIFT)
+#define MAX77836_STATUS2_VIDRM_MASK	BIT(MAX77836_STATUS2_VIDRM_SHIFT)
 
 /* MAX14577 CONTROL1 register */
 #define COMN1SW_SHIFT			0
@@ -127,8 +137,8 @@ enum max14577_muic_charger_type {
 #define IDBEN_SHIFT			7
 #define COMN1SW_MASK			(0x7 << COMN1SW_SHIFT)
 #define COMP2SW_MASK			(0x7 << COMP2SW_SHIFT)
-#define MICEN_MASK			(0x1 << MICEN_SHIFT)
-#define IDBEN_MASK			(0x1 << IDBEN_SHIFT)
+#define MICEN_MASK			BIT(MICEN_SHIFT)
+#define IDBEN_MASK			BIT(IDBEN_SHIFT)
 #define CLEAR_IDBEN_MICEN_MASK		(COMN1SW_MASK | COMP2SW_MASK)
 #define CTRL1_SW_USB			((1 << COMP2SW_SHIFT) \
 						| (1 << COMN1SW_SHIFT))
@@ -148,14 +158,14 @@ enum max14577_muic_charger_type {
 #define CTRL2_ACCDET_SHIFT		(5)
 #define CTRL2_USBCPINT_SHIFT		(6)
 #define CTRL2_RCPS_SHIFT		(7)
-#define CTRL2_LOWPWR_MASK		(0x1 << CTRL2_LOWPWR_SHIFT)
-#define CTRL2_ADCEN_MASK		(0x1 << CTRL2_ADCEN_SHIFT)
-#define CTRL2_CPEN_MASK			(0x1 << CTRL2_CPEN_SHIFT)
-#define CTRL2_SFOUTASRT_MASK		(0x1 << CTRL2_SFOUTASRT_SHIFT)
-#define CTRL2_SFOUTORD_MASK		(0x1 << CTRL2_SFOUTORD_SHIFT)
-#define CTRL2_ACCDET_MASK		(0x1 << CTRL2_ACCDET_SHIFT)
-#define CTRL2_USBCPINT_MASK		(0x1 << CTRL2_USBCPINT_SHIFT)
-#define CTRL2_RCPS_MASK			(0x1 << CTR2_RCPS_SHIFT)
+#define CTRL2_LOWPWR_MASK		BIT(CTRL2_LOWPWR_SHIFT)
+#define CTRL2_ADCEN_MASK		BIT(CTRL2_ADCEN_SHIFT)
+#define CTRL2_CPEN_MASK			BIT(CTRL2_CPEN_SHIFT)
+#define CTRL2_SFOUTASRT_MASK		BIT(CTRL2_SFOUTASRT_SHIFT)
+#define CTRL2_SFOUTORD_MASK		BIT(CTRL2_SFOUTORD_SHIFT)
+#define CTRL2_ACCDET_MASK		BIT(CTRL2_ACCDET_SHIFT)
+#define CTRL2_USBCPINT_MASK		BIT(CTRL2_USBCPINT_SHIFT)
+#define CTRL2_RCPS_MASK			BIT(CTRL2_RCPS_SHIFT)
 
 #define CTRL2_CPEN1_LOWPWR0 ((1 << CTRL2_CPEN_SHIFT) | \
 				(0 << CTRL2_LOWPWR_SHIFT))
@@ -203,14 +213,14 @@ enum max14577_charger_reg {
 #define CDETCTRL1_DBEXIT_SHIFT		5
 #define CDETCTRL1_DBIDLE_SHIFT		6
 #define CDETCTRL1_CDPDET_SHIFT		7
-#define CDETCTRL1_CHGDETEN_MASK		(0x1 << CDETCTRL1_CHGDETEN_SHIFT)
-#define CDETCTRL1_CHGTYPMAN_MASK	(0x1 << CDETCTRL1_CHGTYPMAN_SHIFT)
-#define CDETCTRL1_DCDEN_MASK		(0x1 << CDETCTRL1_DCDEN_SHIFT)
-#define CDETCTRL1_DCD2SCT_MASK		(0x1 << CDETCTRL1_DCD2SCT_SHIFT)
-#define CDETCTRL1_DCHKTM_MASK		(0x1 << CDETCTRL1_DCHKTM_SHIFT)
-#define CDETCTRL1_DBEXIT_MASK		(0x1 << CDETCTRL1_DBEXIT_SHIFT)
-#define CDETCTRL1_DBIDLE_MASK		(0x1 << CDETCTRL1_DBIDLE_SHIFT)
-#define CDETCTRL1_CDPDET_MASK		(0x1 << CDETCTRL1_CDPDET_SHIFT)
+#define CDETCTRL1_CHGDETEN_MASK		BIT(CDETCTRL1_CHGDETEN_SHIFT)
+#define CDETCTRL1_CHGTYPMAN_MASK	BIT(CDETCTRL1_CHGTYPMAN_SHIFT)
+#define CDETCTRL1_DCDEN_MASK		BIT(CDETCTRL1_DCDEN_SHIFT)
+#define CDETCTRL1_DCD2SCT_MASK		BIT(CDETCTRL1_DCD2SCT_SHIFT)
+#define CDETCTRL1_DCHKTM_MASK		BIT(CDETCTRL1_DCHKTM_SHIFT)
+#define CDETCTRL1_DBEXIT_MASK		BIT(CDETCTRL1_DBEXIT_SHIFT)
+#define CDETCTRL1_DBIDLE_MASK		BIT(CDETCTRL1_DBIDLE_SHIFT)
+#define CDETCTRL1_CDPDET_MASK		BIT(CDETCTRL1_CDPDET_SHIFT)
 
 /* MAX14577 CHGCTRL1 register */
 #define CHGCTRL1_TCHW_SHIFT		4
@@ -218,9 +228,9 @@ enum max14577_charger_reg {
 
 /* MAX14577 CHGCTRL2 register */
 #define CHGCTRL2_MBCHOSTEN_SHIFT	6
-#define CHGCTRL2_MBCHOSTEN_MASK		(0x1 << CHGCTRL2_MBCHOSTEN_SHIFT)
+#define CHGCTRL2_MBCHOSTEN_MASK		BIT(CHGCTRL2_MBCHOSTEN_SHIFT)
 #define CHGCTRL2_VCHGR_RC_SHIFT		7
-#define CHGCTRL2_VCHGR_RC_MASK		(0x1 << CHGCTRL2_VCHGR_RC_SHIFT)
+#define CHGCTRL2_VCHGR_RC_MASK		BIT(CHGCTRL2_VCHGR_RC_SHIFT)
 
 /* MAX14577 CHGCTRL3 register */
 #define CHGCTRL3_MBCCVWRC_SHIFT		0
@@ -230,7 +240,7 @@ enum max14577_charger_reg {
 #define CHGCTRL4_MBCICHWRCH_SHIFT	0
 #define CHGCTRL4_MBCICHWRCH_MASK	(0xf << CHGCTRL4_MBCICHWRCH_SHIFT)
 #define CHGCTRL4_MBCICHWRCL_SHIFT	4
-#define CHGCTRL4_MBCICHWRCL_MASK	(0x1 << CHGCTRL4_MBCICHWRCL_SHIFT)
+#define CHGCTRL4_MBCICHWRCL_MASK	BIT(CHGCTRL4_MBCICHWRCL_SHIFT)
 
 /* MAX14577 CHGCTRL5 register */
 #define CHGCTRL5_EOCS_SHIFT		0
@@ -238,7 +248,7 @@ enum max14577_charger_reg {
 
 /* MAX14577 CHGCTRL6 register */
 #define CHGCTRL6_AUTOSTOP_SHIFT		5
-#define CHGCTRL6_AUTOSTOP_MASK		(0x1 << CHGCTRL6_AUTOSTOP_SHIFT)
+#define CHGCTRL6_AUTOSTOP_MASK		BIT(CHGCTRL6_AUTOSTOP_SHIFT)
 
 /* MAX14577 CHGCTRL7 register */
 #define CHGCTRL7_OTPCGHCVS_SHIFT	0
@@ -253,6 +263,70 @@ enum max14577_charger_reg {
 /* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
 #define MAX14577_REGULATOR_SAFEOUT_VOLTAGE		4900000
 
+/* Slave addr = 0x46: PMIC */
+enum max77836_pmic_reg {
+	MAX77836_PMIC_REG_PMIC_ID		= 0x20,
+	MAX77836_PMIC_REG_PMIC_REV		= 0x21,
+	MAX77836_PMIC_REG_INTSRC		= 0x22,
+	MAX77836_PMIC_REG_INTSRC_MASK		= 0x23,
+	MAX77836_PMIC_REG_TOPSYS_INT		= 0x24,
+	MAX77836_PMIC_REG_TOPSYS_INT_MASK	= 0x26,
+	MAX77836_PMIC_REG_TOPSYS_STAT		= 0x28,
+	MAX77836_PMIC_REG_MRSTB_CNTL		= 0x2A,
+	MAX77836_PMIC_REG_LSCNFG		= 0x2B,
+
+	MAX77836_LDO_REG_CNFG1_LDO1		= 0x51,
+	MAX77836_LDO_REG_CNFG2_LDO1		= 0x52,
+	MAX77836_LDO_REG_CNFG1_LDO2		= 0x53,
+	MAX77836_LDO_REG_CNFG2_LDO2		= 0x54,
+	MAX77836_LDO_REG_CNFG_LDO_BIAS		= 0x55,
+
+	MAX77836_COMP_REG_COMP1			= 0x60,
+
+	MAX77836_PMIC_REG_END,
+};
+
+#define MAX77836_INTSRC_MASK_TOP_INT_SHIFT	1
+#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_SHIFT	3
+#define MAX77836_INTSRC_MASK_TOP_INT_MASK	BIT(MAX77836_INTSRC_MASK_TOP_INT_SHIFT)
+#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_MASK	BIT(MAX77836_INTSRC_MASK_MUIC_CHG_INT_SHIFT)
+
+/* MAX77836 PMIC interrupts */
+#define MAX77836_TOPSYS_INT_T120C_SHIFT		0
+#define MAX77836_TOPSYS_INT_T140C_SHIFT		1
+#define MAX77836_TOPSYS_INT_T120C_MASK		BIT(MAX77836_TOPSYS_INT_T120C_SHIFT)
+#define MAX77836_TOPSYS_INT_T140C_MASK		BIT(MAX77836_TOPSYS_INT_T140C_SHIFT)
+
+/* Slave addr = 0x6C: Fuel-Gauge/Battery */
+enum max77836_fg_reg {
+	MAX77836_FG_REG_VCELL_MSB	= 0x02,
+	MAX77836_FG_REG_VCELL_LSB	= 0x03,
+	MAX77836_FG_REG_SOC_MSB		= 0x04,
+	MAX77836_FG_REG_SOC_LSB		= 0x05,
+	MAX77836_FG_REG_MODE_H		= 0x06,
+	MAX77836_FG_REG_MODE_L		= 0x07,
+	MAX77836_FG_REG_VERSION_MSB	= 0x08,
+	MAX77836_FG_REG_VERSION_LSB	= 0x09,
+	MAX77836_FG_REG_HIBRT_H		= 0x0A,
+	MAX77836_FG_REG_HIBRT_L		= 0x0B,
+	MAX77836_FG_REG_CONFIG_H	= 0x0C,
+	MAX77836_FG_REG_CONFIG_L	= 0x0D,
+	MAX77836_FG_REG_VALRT_MIN	= 0x14,
+	MAX77836_FG_REG_VALRT_MAX	= 0x15,
+	MAX77836_FG_REG_CRATE_MSB	= 0x16,
+	MAX77836_FG_REG_CRATE_LSB	= 0x17,
+	MAX77836_FG_REG_VRESET		= 0x18,
+	MAX77836_FG_REG_FGID		= 0x19,
+	MAX77836_FG_REG_STATUS_H	= 0x1A,
+	MAX77836_FG_REG_STATUS_L	= 0x1B,
+	/*
+	 * TODO: TABLE registers
+	 * TODO: CMD register
+	 */
+
+	MAX77836_FG_REG_END,
+};
+
 enum max14577_irq {
 	/* INT1 */
 	MAX14577_IRQ_INT1_ADC,
@@ -272,17 +346,24 @@ enum max14577_irq {
 	MAX14577_IRQ_INT3_OVP,
 	MAX14577_IRQ_INT3_MBCCHGERR,
 
+	/* TOPSYS_INT, only MAX77836 */
+	MAX77836_IRQ_TOPSYS_T140C,
+	MAX77836_IRQ_TOPSYS_T120C,
+
 	MAX14577_IRQ_NUM,
 };
 
 struct max14577 {
 	struct device *dev;
 	struct i2c_client *i2c; /* Slave addr = 0x4A */
+	struct i2c_client *i2c_pmic; /* Slave addr = 0x46 */
 	enum maxim_device_type dev_type;
 
-	struct regmap *regmap;
+	struct regmap *regmap; /* For MUIC and Charger */
+	struct regmap *regmap_pmic;
 
-	struct regmap_irq_chip_data *irq_data;
+	struct regmap_irq_chip_data *irq_data; /* For MUIC and Charger */
+	struct regmap_irq_chip_data *irq_data_pmic;
 	int irq;
 };
 
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index 736d39c3ec0d..08b449159fd1 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -1,7 +1,7 @@
 /*
- * max14577.h - Driver for the Maxim 14577
+ * max14577.h - Driver for the Maxim 14577/77836
  *
- * Copyright (C) 2013 Samsung Electrnoics
+ * Copyright (C) 2014 Samsung Electrnoics
  * Chanwoo Choi <cw00.choi@samsung.com>
  * Krzysztof Kozlowski <k.kozlowski@samsung.com>
  *
@@ -20,6 +20,9 @@
  * MAX14577 has MUIC, Charger devices.
  * The devices share the same I2C bus and interrupt line
  * included in this mfd driver.
+ *
+ * MAX77836 has additional PMIC and Fuel-Gauge on different I2C slave
+ * addresses.
  */
 
 #ifndef __MAX14577_H__
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 8/9] extcon: max14577: Add support for MAX77836
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2014-04-14  9:17 ` [PATCH v5 7/9] mfd: max77836: Add MAX77836 support to max14577 driver Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-14  9:17 ` [PATCH v5 9/9] regulator: max14577: Add support for MAX77836 regulators Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

Add support for MAX77836 chipset to the max14577 extcon driver. The
MAX77836 MUIC has additional interrupts (VIDRM, ADC1K) so IRQ handling
is split up into two functions: max14577_parse_irq() and
max77836_parse_irq().

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/Kconfig               |   4 +-
 drivers/extcon/extcon-max14577.c     | 109 +++++++++++++++++++++++++++++------
 drivers/mfd/max14577.c               |   1 +
 include/linux/mfd/max14577-private.h |   3 +
 4 files changed, 96 insertions(+), 21 deletions(-)

diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index be56e8ac95e6..aebde489c291 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -28,13 +28,13 @@ config EXTCON_ADC_JACK
 	  Say Y here to enable extcon device driver based on ADC values.
 
 config EXTCON_MAX14577
-	tristate "MAX14577 EXTCON Support"
+	tristate "MAX14577/77836 EXTCON Support"
 	depends on MFD_MAX14577
 	select IRQ_DOMAIN
 	select REGMAP_I2C
 	help
 	  If you say yes here you get support for the MUIC device of
-	  Maxim MAX14577 PMIC. The MAX14577 MUIC is a USB port accessory
+	  Maxim MAX14577/77836. The MAX14577/77836 MUIC is a USB port accessory
 	  detector and switch.
 
 config EXTCON_MAX77693
diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 1513013a92f1..c76734a70171 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -1,8 +1,9 @@
 /*
- * extcon-max14577.c - MAX14577 extcon driver to support MAX14577 MUIC
+ * extcon-max14577.c - MAX14577/77836 extcon driver to support MUIC
  *
- * Copyright (C) 2013 Samsung Electrnoics
+ * Copyright (C) 2013,2014 Samsung Electrnoics
  * Chanwoo Choi <cw00.choi@samsung.com>
+ * Krzysztof Kozlowski <k.kozlowski@samsung.com>
  *
  * 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
@@ -62,6 +63,19 @@ static struct max14577_muic_irq max14577_muic_irqs[] = {
 	{ MAX14577_IRQ_INT2_VBVOLT,	"muic-VBVOLT" },
 };
 
+static struct max14577_muic_irq max77836_muic_irqs[] = {
+	{ MAX14577_IRQ_INT1_ADC,	"muic-ADC" },
+	{ MAX14577_IRQ_INT1_ADCLOW,	"muic-ADCLOW" },
+	{ MAX14577_IRQ_INT1_ADCERR,	"muic-ADCError" },
+	{ MAX77836_IRQ_INT1_ADC1K,	"muic-ADC1K" },
+	{ MAX14577_IRQ_INT2_CHGTYP,	"muic-CHGTYP" },
+	{ MAX14577_IRQ_INT2_CHGDETRUN,	"muic-CHGDETRUN" },
+	{ MAX14577_IRQ_INT2_DCDTMR,	"muic-DCDTMR" },
+	{ MAX14577_IRQ_INT2_DBCHG,	"muic-DBCHG" },
+	{ MAX14577_IRQ_INT2_VBVOLT,	"muic-VBVOLT" },
+	{ MAX77836_IRQ_INT2_VIDRM,	"muic-VIDRM" },
+};
+
 struct max14577_muic_info {
 	struct device *dev;
 	struct max14577 *max14577;
@@ -529,21 +543,12 @@ static void max14577_muic_irq_work(struct work_struct *work)
 	return;
 }
 
-static irqreturn_t max14577_muic_irq_handler(int irq, void *data)
+/*
+ * Sets irq_adc or irq_chg in max14577_muic_info and returns 1.
+ * Returns 0 if irq_type does not match registered IRQ for this device type.
+ */
+static int max14577_parse_irq(struct max14577_muic_info *info, int irq_type)
 {
-	struct max14577_muic_info *info = data;
-	int i, irq_type = -1;
-
-	/*
-	 * We may be called multiple times for different nested IRQ-s.
-	 * Including changes in INT1_ADC and INT2_CGHTYP at once.
-	 * However we only need to know whether it was ADC, charger
-	 * or both interrupts so decode IRQ and turn on proper flags.
-	 */
-	for (i = 0; i < info->muic_irqs_num; i++)
-		if (irq == info->muic_irqs[i].virq)
-			irq_type = info->muic_irqs[i].irq;
-
 	switch (irq_type) {
 	case MAX14577_IRQ_INT1_ADC:
 	case MAX14577_IRQ_INT1_ADCLOW:
@@ -551,7 +556,7 @@ static irqreturn_t max14577_muic_irq_handler(int irq, void *data)
 		/* Handle all of accessory except for
 		   type of charger accessory */
 		info->irq_adc = true;
-		break;
+		return 1;
 	case MAX14577_IRQ_INT2_CHGTYP:
 	case MAX14577_IRQ_INT2_CHGDETRUN:
 	case MAX14577_IRQ_INT2_DCDTMR:
@@ -559,8 +564,62 @@ static irqreturn_t max14577_muic_irq_handler(int irq, void *data)
 	case MAX14577_IRQ_INT2_VBVOLT:
 		/* Handle charger accessory */
 		info->irq_chg = true;
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+/*
+ * Sets irq_adc or irq_chg in max14577_muic_info and returns 1.
+ * Returns 0 if irq_type does not match registered IRQ for this device type.
+ */
+static int max77836_parse_irq(struct max14577_muic_info *info, int irq_type)
+{
+	/* First check common max14577 interrupts */
+	if (max14577_parse_irq(info, irq_type))
+		return 1;
+
+	switch (irq_type) {
+	case MAX77836_IRQ_INT1_ADC1K:
+		info->irq_adc = true;
+		return 1;
+	case MAX77836_IRQ_INT2_VIDRM:
+		/* Handle charger accessory */
+		info->irq_chg = true;
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+static irqreturn_t max14577_muic_irq_handler(int irq, void *data)
+{
+	struct max14577_muic_info *info = data;
+	int i, irq_type = -1;
+	bool irq_parsed;
+
+	/*
+	 * We may be called multiple times for different nested IRQ-s.
+	 * Including changes in INT1_ADC and INT2_CGHTYP at once.
+	 * However we only need to know whether it was ADC, charger
+	 * or both interrupts so decode IRQ and turn on proper flags.
+	 */
+	for (i = 0; i < info->muic_irqs_num; i++)
+		if (irq == info->muic_irqs[i].virq)
+			irq_type = info->muic_irqs[i].irq;
+
+	switch (info->max14577->dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		irq_parsed = max77836_parse_irq(info, irq_type);
 		break;
+	case MAXIM_DEVICE_TYPE_MAX14577:
 	default:
+		irq_parsed = max14577_parse_irq(info, irq_type);
+		break;
+	}
+
+	if (!irq_parsed) {
 		dev_err(info->dev, "muic interrupt: irq %d occurred, skipped\n",
 				irq_type);
 		return IRQ_HANDLED;
@@ -646,6 +705,10 @@ static int max14577_muic_probe(struct platform_device *pdev)
 	INIT_WORK(&info->irq_work, max14577_muic_irq_work);
 
 	switch (max14577->dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		info->muic_irqs = max77836_muic_irqs;
+		info->muic_irqs_num = ARRAY_SIZE(max77836_muic_irqs);
+		break;
 	case MAXIM_DEVICE_TYPE_MAX14577:
 	default:
 		info->muic_irqs = max14577_muic_irqs;
@@ -744,6 +807,13 @@ static int max14577_muic_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct platform_device_id max14577_muic_id[] = {
+	{ "max14577-muic", MAXIM_DEVICE_TYPE_MAX14577, },
+	{ "max77836-muic", MAXIM_DEVICE_TYPE_MAX77836, },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, max14577_muic_id);
+
 static struct platform_driver max14577_muic_driver = {
 	.driver		= {
 		.name	= "max14577-muic",
@@ -751,11 +821,12 @@ static struct platform_driver max14577_muic_driver = {
 	},
 	.probe		= max14577_muic_probe,
 	.remove		= max14577_muic_remove,
+	.id_table	= max14577_muic_id,
 };
 
 module_platform_driver(max14577_muic_driver);
 
-MODULE_DESCRIPTION("MAXIM 14577 Extcon driver");
-MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
+MODULE_DESCRIPTION("Maxim 14577/77836 Extcon driver");
+MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>, Krzysztof Kozlowski <k.kozlowski@samsung.com>");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:extcon-max14577");
diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 20e3b2d81bf0..484d372a4892 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -147,6 +147,7 @@ static const struct regmap_irq max77836_muic_irqs[] = {
 	{ .reg_offset = 0, .mask = MAX14577_INT1_ADC_MASK, },
 	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCLOW_MASK, },
 	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCERR_MASK, },
+	{ .reg_offset = 0, .mask = MAX77836_INT1_ADC1K_MASK, },
 	/* INT2 interrupts */
 	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGTYP_MASK, },
 	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGDETRUN_MASK, },
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index e301bd19b067..a557ae27d8a8 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -87,6 +87,7 @@ enum max14577_muic_charger_type {
 #define MAX14577_INT1_ADC_MASK		BIT(0)
 #define MAX14577_INT1_ADCLOW_MASK	BIT(1)
 #define MAX14577_INT1_ADCERR_MASK	BIT(2)
+#define MAX77836_INT1_ADC1K_MASK	BIT(3)
 
 #define MAX14577_INT2_CHGTYP_MASK	BIT(0)
 #define MAX14577_INT2_CHGDETRUN_MASK	BIT(1)
@@ -332,6 +333,7 @@ enum max14577_irq {
 	MAX14577_IRQ_INT1_ADC,
 	MAX14577_IRQ_INT1_ADCLOW,
 	MAX14577_IRQ_INT1_ADCERR,
+	MAX77836_IRQ_INT1_ADC1K,
 
 	/* INT2 */
 	MAX14577_IRQ_INT2_CHGTYP,
@@ -339,6 +341,7 @@ enum max14577_irq {
 	MAX14577_IRQ_INT2_DCDTMR,
 	MAX14577_IRQ_INT2_DBCHG,
 	MAX14577_IRQ_INT2_VBVOLT,
+	MAX77836_IRQ_INT2_VIDRM,
 
 	/* INT3 */
 	MAX14577_IRQ_INT3_EOC,
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v5 9/9] regulator: max14577: Add support for MAX77836 regulators
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2014-04-14  9:17 ` [PATCH v5 8/9] extcon: max14577: Add support for MAX77836 Krzysztof Kozlowski
@ 2014-04-14  9:17 ` Krzysztof Kozlowski
  2014-04-15  6:50 ` [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Chanwoo Choi
  2014-04-16 10:28 ` Lee Jones
  10 siblings, 0 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-14  9:17 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Liam Girdwood, Mark Brown, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

Add support for MAX77836 chipset and its additional two LDO regulators.
These LDO regulators are controlled by the PMIC block with additional
regmap (different I2C slave address).

The MAX77836 charger and safeout regulators are almost identical to
MAX14577. The registers layout is the same, except values for charger's
current. The patch adds simple mapping between device type and supported
current by the charger regulator.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mark Brown <broonie@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/regulator/Kconfig            |   7 +-
 drivers/regulator/max14577.c         | 277 ++++++++++++++++++++++++++++++-----
 include/linux/mfd/max14577-private.h |  32 ++++
 include/linux/mfd/max14577.h         |  12 +-
 4 files changed, 289 insertions(+), 39 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 903eb37f047a..f0cc9e6dac3a 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -266,11 +266,12 @@ config REGULATOR_LP8788
 	  This driver supports LP8788 voltage regulator chip.
 
 config REGULATOR_MAX14577
-	tristate "Maxim 14577 regulator"
+	tristate "Maxim 14577/77836 regulator"
 	depends on MFD_MAX14577
 	help
-	  This driver controls a Maxim 14577 regulator via I2C bus.
-	  The regulators include safeout LDO and current regulator 'CHARGER'.
+	  This driver controls a Maxim MAX14577/77836 regulator via I2C bus.
+	  The MAX14577 regulators include safeout LDO and charger current
+	  regulator. The MAX77836 has two additional LDOs.
 
 config REGULATOR_MAX1586
 	tristate "Maxim 1586/1587 voltage regulator"
diff --git a/drivers/regulator/max14577.c b/drivers/regulator/max14577.c
index ed60baaeceec..5d9c605cf534 100644
--- a/drivers/regulator/max14577.c
+++ b/drivers/regulator/max14577.c
@@ -1,5 +1,5 @@
 /*
- * max14577.c - Regulator driver for the Maxim 14577
+ * max14577.c - Regulator driver for the Maxim 14577/77836
  *
  * Copyright (C) 2013,2014 Samsung Electronics
  * Krzysztof Kozlowski <k.kozlowski@samsung.com>
@@ -22,6 +22,42 @@
 #include <linux/mfd/max14577-private.h>
 #include <linux/regulator/of_regulator.h>
 
+/*
+ * Valid limits of current for max14577 and max77836 chargers.
+ * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
+ * register for given chipset.
+ */
+struct maxim_charger_current {
+	/* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */
+	unsigned int min;
+	/*
+	 * Minimal current when high setting is active,
+	 * set in CHGCTRL4/MBCICHWRCH, uA
+	 */
+	unsigned int high_start;
+	/* Value of one step in high setting, uA */
+	unsigned int high_step;
+	/* Maximum current of high setting, uA */
+	unsigned int max;
+};
+
+/* Table of valid charger currents for different Maxim chipsets */
+static const struct maxim_charger_current maxim_charger_currents[] = {
+	[MAXIM_DEVICE_TYPE_UNKNOWN] = { 0, 0, 0, 0 },
+	[MAXIM_DEVICE_TYPE_MAX14577] = {
+		.min		= MAX14577_REGULATOR_CURRENT_LIMIT_MIN,
+		.high_start	= MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START,
+		.high_step	= MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP,
+		.max		= MAX14577_REGULATOR_CURRENT_LIMIT_MAX,
+	},
+	[MAXIM_DEVICE_TYPE_MAX77836] = {
+		.min		= MAX77836_REGULATOR_CURRENT_LIMIT_MIN,
+		.high_start	= MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START,
+		.high_step	= MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP,
+		.max		= MAX77836_REGULATOR_CURRENT_LIMIT_MAX,
+	},
+};
+
 static int max14577_reg_is_enabled(struct regulator_dev *rdev)
 {
 	int rid = rdev_get_id(rdev);
@@ -47,6 +83,9 @@ static int max14577_reg_get_current_limit(struct regulator_dev *rdev)
 {
 	u8 reg_data;
 	struct regmap *rmap = rdev->regmap;
+	struct max14577 *max14577 = rdev_get_drvdata(rdev);
+	const struct maxim_charger_current *limits =
+		&maxim_charger_currents[max14577->dev_type];
 
 	if (rdev_get_id(rdev) != MAX14577_CHARGER)
 		return -EINVAL;
@@ -54,12 +93,11 @@ static int max14577_reg_get_current_limit(struct regulator_dev *rdev)
 	max14577_read_reg(rmap, MAX14577_CHG_REG_CHG_CTRL4, &reg_data);
 
 	if ((reg_data & CHGCTRL4_MBCICHWRCL_MASK) == 0)
-		return MAX14577_REGULATOR_CURRENT_LIMIT_MIN;
+		return limits->min;
 
 	reg_data = ((reg_data & CHGCTRL4_MBCICHWRCH_MASK) >>
 			CHGCTRL4_MBCICHWRCH_SHIFT);
-	return MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START +
-		reg_data * MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP;
+	return limits->high_start + reg_data * limits->high_step;
 }
 
 static int max14577_reg_set_current_limit(struct regulator_dev *rdev,
@@ -67,33 +105,39 @@ static int max14577_reg_set_current_limit(struct regulator_dev *rdev,
 {
 	int i, current_bits = 0xf;
 	u8 reg_data;
+	struct max14577 *max14577 = rdev_get_drvdata(rdev);
+	const struct maxim_charger_current *limits =
+		&maxim_charger_currents[max14577->dev_type];
 
 	if (rdev_get_id(rdev) != MAX14577_CHARGER)
 		return -EINVAL;
 
-	if (min_uA > MAX14577_REGULATOR_CURRENT_LIMIT_MAX ||
-			max_uA < MAX14577_REGULATOR_CURRENT_LIMIT_MIN)
+	if (min_uA > limits->max || max_uA < limits->min)
 		return -EINVAL;
 
-	if (max_uA < MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START) {
-		/* Less than 200 mA, so set 90mA (turn only Low Bit off) */
+	if (max_uA < limits->high_start) {
+		/*
+		 * Less than high_start,
+		 * so set the minimal current (turn only Low Bit off)
+		 */
 		u8 reg_data = 0x0 << CHGCTRL4_MBCICHWRCL_SHIFT;
 		return max14577_update_reg(rdev->regmap,
 				MAX14577_CHG_REG_CHG_CTRL4,
 				CHGCTRL4_MBCICHWRCL_MASK, reg_data);
 	}
 
-	/* max_uA is in range: <LIMIT_HIGH_START, inifinite>, so search for
-	 * valid current starting from LIMIT_MAX. */
-	for (i = MAX14577_REGULATOR_CURRENT_LIMIT_MAX;
-			i >= MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START;
-			i -= MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP) {
+	/*
+	 * max_uA is in range: <high_start, inifinite>, so search for
+	 * valid current starting from maximum current.
+	 */
+	for (i = limits->max; i >= limits->high_start; i -= limits->high_step) {
 		if (i <= max_uA)
 			break;
 		current_bits--;
 	}
 	BUG_ON(current_bits < 0); /* Cannot happen */
-	/* Turn Low Bit on (use range 200mA-950 mA) */
+
+	/* Turn Low Bit on (use range high_start-max)... */
 	reg_data = 0x1 << CHGCTRL4_MBCICHWRCL_SHIFT;
 	/* and set proper High Bits */
 	reg_data |= current_bits << CHGCTRL4_MBCICHWRCH_SHIFT;
@@ -118,7 +162,7 @@ static struct regulator_ops max14577_charger_ops = {
 	.set_current_limit	= max14577_reg_set_current_limit,
 };
 
-static const struct regulator_desc supported_regulators[] = {
+static const struct regulator_desc max14577_supported_regulators[] = {
 	[MAX14577_SAFEOUT] = {
 		.name		= "SAFEOUT",
 		.id		= MAX14577_SAFEOUT,
@@ -141,16 +185,88 @@ static const struct regulator_desc supported_regulators[] = {
 	},
 };
 
+static struct regulator_ops max77836_ldo_ops = {
+	.is_enabled		= regulator_is_enabled_regmap,
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.list_voltage		= regulator_list_voltage_linear,
+	.map_voltage		= regulator_map_voltage_linear,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	/* TODO: add .set_suspend_mode */
+};
+
+static const struct regulator_desc max77836_supported_regulators[] = {
+	[MAX14577_SAFEOUT] = {
+		.name		= "SAFEOUT",
+		.id		= MAX14577_SAFEOUT,
+		.ops		= &max14577_safeout_ops,
+		.type		= REGULATOR_VOLTAGE,
+		.owner		= THIS_MODULE,
+		.n_voltages	= 1,
+		.min_uV		= MAX14577_REGULATOR_SAFEOUT_VOLTAGE,
+		.enable_reg	= MAX14577_REG_CONTROL2,
+		.enable_mask	= CTRL2_SFOUTORD_MASK,
+	},
+	[MAX14577_CHARGER] = {
+		.name		= "CHARGER",
+		.id		= MAX14577_CHARGER,
+		.ops		= &max14577_charger_ops,
+		.type		= REGULATOR_CURRENT,
+		.owner		= THIS_MODULE,
+		.enable_reg	= MAX14577_CHG_REG_CHG_CTRL2,
+		.enable_mask	= CHGCTRL2_MBCHOSTEN_MASK,
+	},
+	[MAX77836_LDO1] = {
+		.name		= "LDO1",
+		.id		= MAX77836_LDO1,
+		.ops		= &max77836_ldo_ops,
+		.type		= REGULATOR_VOLTAGE,
+		.owner		= THIS_MODULE,
+		.n_voltages	= MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM,
+		.min_uV		= MAX77836_REGULATOR_LDO_VOLTAGE_MIN,
+		.uV_step	= MAX77836_REGULATOR_LDO_VOLTAGE_STEP,
+		.enable_reg	= MAX77836_LDO_REG_CNFG1_LDO1,
+		.enable_mask	= MAX77836_CNFG1_LDO_PWRMD_MASK,
+		.vsel_reg	= MAX77836_LDO_REG_CNFG1_LDO1,
+		.vsel_mask	= MAX77836_CNFG1_LDO_TV_MASK,
+	},
+	[MAX77836_LDO2] = {
+		.name		= "LDO2",
+		.id		= MAX77836_LDO2,
+		.ops		= &max77836_ldo_ops,
+		.type		= REGULATOR_VOLTAGE,
+		.owner		= THIS_MODULE,
+		.n_voltages	= MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM,
+		.min_uV		= MAX77836_REGULATOR_LDO_VOLTAGE_MIN,
+		.uV_step	= MAX77836_REGULATOR_LDO_VOLTAGE_STEP,
+		.enable_reg	= MAX77836_LDO_REG_CNFG1_LDO2,
+		.enable_mask	= MAX77836_CNFG1_LDO_PWRMD_MASK,
+		.vsel_reg	= MAX77836_LDO_REG_CNFG1_LDO2,
+		.vsel_mask	= MAX77836_CNFG1_LDO_TV_MASK,
+	},
+};
+
 #ifdef CONFIG_OF
 static struct of_regulator_match max14577_regulator_matches[] = {
 	{ .name	= "SAFEOUT", },
 	{ .name = "CHARGER", },
 };
 
-static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev)
+static struct of_regulator_match max77836_regulator_matches[] = {
+	{ .name	= "SAFEOUT", },
+	{ .name = "CHARGER", },
+	{ .name = "LDO1", },
+	{ .name = "LDO2", },
+};
+
+static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev,
+		enum maxim_device_type dev_type)
 {
 	int ret;
 	struct device_node *np;
+	struct of_regulator_match *regulator_matches;
+	unsigned int regulator_matches_size;
 
 	np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
 	if (!np) {
@@ -158,8 +274,19 @@ static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	ret = of_regulator_match(&pdev->dev, np, max14577_regulator_matches,
-			MAX14577_REG_MAX);
+	switch (dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		regulator_matches = max77836_regulator_matches;
+		regulator_matches_size = ARRAY_SIZE(max77836_regulator_matches);
+		break;
+	case MAXIM_DEVICE_TYPE_MAX14577:
+	default:
+		regulator_matches = max14577_regulator_matches;
+		regulator_matches_size = ARRAY_SIZE(max14577_regulator_matches);
+	}
+
+	ret = of_regulator_match(&pdev->dev, np, regulator_matches,
+			regulator_matches_size);
 	if (ret < 0)
 		dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret);
 	else
@@ -170,31 +297,74 @@ static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev)
 	return ret;
 }
 
-static inline struct regulator_init_data *match_init_data(int index)
+static inline struct regulator_init_data *match_init_data(int index,
+		enum maxim_device_type dev_type)
 {
-	return max14577_regulator_matches[index].init_data;
+	switch (dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		return max77836_regulator_matches[index].init_data;
+
+	case MAXIM_DEVICE_TYPE_MAX14577:
+	default:
+		return max14577_regulator_matches[index].init_data;
+	}
 }
 
-static inline struct device_node *match_of_node(int index)
+static inline struct device_node *match_of_node(int index,
+		enum maxim_device_type dev_type)
 {
-	return max14577_regulator_matches[index].of_node;
+	switch (dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		return max77836_regulator_matches[index].of_node;
+
+	case MAXIM_DEVICE_TYPE_MAX14577:
+	default:
+		return max14577_regulator_matches[index].of_node;
+	}
 }
 #else /* CONFIG_OF */
-static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev)
+static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev,
+		enum maxim_device_type dev_type)
 {
 	return 0;
 }
-static inline struct regulator_init_data *match_init_data(int index)
+static inline struct regulator_init_data *match_init_data(int index,
+		enum maxim_device_type dev_type)
 {
 	return NULL;
 }
 
-static inline struct device_node *match_of_node(int index)
+static inline struct device_node *match_of_node(int index,
+		enum maxim_device_type dev_type)
 {
 	return NULL;
 }
 #endif /* CONFIG_OF */
 
+/**
+ * Registers for regulators of max77836 use different I2C slave addresses so
+ * different regmaps must be used for them.
+ *
+ * Returns proper regmap for accessing regulator passed by id.
+ */
+static struct regmap *max14577_get_regmap(struct max14577 *max14577,
+		int reg_id)
+{
+	switch (max14577->dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		switch (reg_id) {
+		case MAX77836_SAFEOUT ... MAX77836_CHARGER:
+			return max14577->regmap;
+		default:
+			/* MAX77836_LDO1 ... MAX77836_LDO2 */
+			return max14577->regmap_pmic;
+		}
+
+	case MAXIM_DEVICE_TYPE_MAX14577:
+	default:
+		return max14577->regmap;
+	}
+}
 
 static int max14577_regulator_probe(struct platform_device *pdev)
 {
@@ -202,15 +372,29 @@ static int max14577_regulator_probe(struct platform_device *pdev)
 	struct max14577_platform_data *pdata = dev_get_platdata(max14577->dev);
 	int i, ret;
 	struct regulator_config config = {};
+	const struct regulator_desc *supported_regulators;
+	unsigned int supported_regulators_size;
+	enum maxim_device_type dev_type = max14577->dev_type;
 
-	ret = max14577_regulator_dt_parse_pdata(pdev);
+	ret = max14577_regulator_dt_parse_pdata(pdev, dev_type);
 	if (ret)
 		return ret;
 
+	switch (dev_type) {
+	case MAXIM_DEVICE_TYPE_MAX77836:
+		supported_regulators = max77836_supported_regulators;
+		supported_regulators_size = ARRAY_SIZE(max77836_supported_regulators);
+		break;
+	case MAXIM_DEVICE_TYPE_MAX14577:
+	default:
+		supported_regulators = max14577_supported_regulators;
+		supported_regulators_size = ARRAY_SIZE(max14577_supported_regulators);
+	}
+
 	config.dev = &pdev->dev;
-	config.regmap = max14577->regmap;
+	config.driver_data = max14577;
 
-	for (i = 0; i < ARRAY_SIZE(supported_regulators); i++) {
+	for (i = 0; i < supported_regulators_size; i++) {
 		struct regulator_dev *regulator;
 		/*
 		 * Index of supported_regulators[] is also the id and must
@@ -220,17 +404,19 @@ static int max14577_regulator_probe(struct platform_device *pdev)
 			config.init_data = pdata->regulators[i].initdata;
 			config.of_node = pdata->regulators[i].of_node;
 		} else {
-			config.init_data = match_init_data(i);
-			config.of_node = match_of_node(i);
+			config.init_data = match_init_data(i, dev_type);
+			config.of_node = match_of_node(i, dev_type);
 		}
+		config.regmap = max14577_get_regmap(max14577,
+				supported_regulators[i].id);
 
 		regulator = devm_regulator_register(&pdev->dev,
 				&supported_regulators[i], &config);
 		if (IS_ERR(regulator)) {
 			ret = PTR_ERR(regulator);
 			dev_err(&pdev->dev,
-					"Regulator init failed for ID %d with error: %d\n",
-					i, ret);
+					"Regulator init failed for %d/%s with error: %d\n",
+					i, supported_regulators[i].name, ret);
 			return ret;
 		}
 	}
@@ -238,20 +424,41 @@ static int max14577_regulator_probe(struct platform_device *pdev)
 	return ret;
 }
 
+static const struct platform_device_id max14577_regulator_id[] = {
+	{ "max14577-regulator", MAXIM_DEVICE_TYPE_MAX14577, },
+	{ "max77836-regulator", MAXIM_DEVICE_TYPE_MAX77836, },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, max14577_regulator_id);
+
 static struct platform_driver max14577_regulator_driver = {
 	.driver = {
 		   .owner = THIS_MODULE,
 		   .name = "max14577-regulator",
 		   },
-	.probe	= max14577_regulator_probe,
+	.probe		= max14577_regulator_probe,
+	.id_table	= max14577_regulator_id,
 };
 
 static int __init max14577_regulator_init(void)
 {
+	/* Check for valid values for charger */
 	BUILD_BUG_ON(MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START +
 			MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP * 0xf !=
 			MAX14577_REGULATOR_CURRENT_LIMIT_MAX);
-	BUILD_BUG_ON(ARRAY_SIZE(supported_regulators) != MAX14577_REG_MAX);
+	BUILD_BUG_ON(MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START +
+			MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP * 0xf !=
+			MAX77836_REGULATOR_CURRENT_LIMIT_MAX);
+	/* Valid charger current values must be provided for each chipset */
+	BUILD_BUG_ON(ARRAY_SIZE(maxim_charger_currents) != MAXIM_DEVICE_TYPE_NUM);
+
+	BUILD_BUG_ON(ARRAY_SIZE(max14577_supported_regulators) != MAX14577_REGULATOR_NUM);
+	BUILD_BUG_ON(ARRAY_SIZE(max77836_supported_regulators) != MAX77836_REGULATOR_NUM);
+
+	BUILD_BUG_ON(MAX77836_REGULATOR_LDO_VOLTAGE_MIN +
+			(MAX77836_REGULATOR_LDO_VOLTAGE_STEP *
+			  (MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM - 1)) !=
+			MAX77836_REGULATOR_LDO_VOLTAGE_MAX);
 
 	return platform_driver_register(&max14577_regulator_driver);
 }
@@ -264,6 +471,6 @@ static void __exit max14577_regulator_exit(void)
 module_exit(max14577_regulator_exit);
 
 MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski@samsung.com>");
-MODULE_DESCRIPTION("MAXIM 14577 regulator driver");
+MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:max14577-regulator");
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index a557ae27d8a8..499253604026 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -261,9 +261,21 @@ enum max14577_charger_reg {
 #define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP	 50000
 #define MAX14577_REGULATOR_CURRENT_LIMIT_MAX		950000
 
+/* MAX77836 regulator current limits (as in CHGCTRL4 register), uA */
+#define MAX77836_REGULATOR_CURRENT_LIMIT_MIN		 45000
+#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START	100000
+#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP	 25000
+#define MAX77836_REGULATOR_CURRENT_LIMIT_MAX		475000
+
 /* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
 #define MAX14577_REGULATOR_SAFEOUT_VOLTAGE		4900000
 
+/* MAX77836 regulator LDOx voltage, uV */
+#define MAX77836_REGULATOR_LDO_VOLTAGE_MIN		800000
+#define MAX77836_REGULATOR_LDO_VOLTAGE_MAX		3950000
+#define MAX77836_REGULATOR_LDO_VOLTAGE_STEP		50000
+#define MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM	64
+
 /* Slave addr = 0x46: PMIC */
 enum max77836_pmic_reg {
 	MAX77836_PMIC_REG_PMIC_ID		= 0x20,
@@ -298,6 +310,26 @@ enum max77836_pmic_reg {
 #define MAX77836_TOPSYS_INT_T120C_MASK		BIT(MAX77836_TOPSYS_INT_T120C_SHIFT)
 #define MAX77836_TOPSYS_INT_T140C_MASK		BIT(MAX77836_TOPSYS_INT_T140C_SHIFT)
 
+/* LDO1/LDO2 CONFIG1 register */
+#define MAX77836_CNFG1_LDO_PWRMD_SHIFT		6
+#define MAX77836_CNFG1_LDO_TV_SHIFT		0
+#define MAX77836_CNFG1_LDO_PWRMD_MASK		(0x3 << MAX77836_CNFG1_LDO_PWRMD_SHIFT)
+#define MAX77836_CNFG1_LDO_TV_MASK		(0x3f << MAX77836_CNFG1_LDO_TV_SHIFT)
+
+/* LDO1/LDO2 CONFIG2 register */
+#define MAX77836_CNFG2_LDO_OVCLMPEN_SHIFT	7
+#define MAX77836_CNFG2_LDO_ALPMEN_SHIFT		6
+#define MAX77836_CNFG2_LDO_COMP_SHIFT		4
+#define MAX77836_CNFG2_LDO_POK_SHIFT		3
+#define MAX77836_CNFG2_LDO_ADE_SHIFT		1
+#define MAX77836_CNFG2_LDO_SS_SHIFT		0
+#define MAX77836_CNFG2_LDO_OVCLMPEN_MASK	BIT(MAX77836_CNFG2_LDO_OVCLMPEN_SHIFT)
+#define MAX77836_CNFG2_LDO_ALPMEN_MASK		BIT(MAX77836_CNFG2_LDO_ALPMEN_SHIFT)
+#define MAX77836_CNFG2_LDO_COMP_MASK		(0x3 << MAX77836_CNFG2_LDO_COMP_SHIFT)
+#define MAX77836_CNFG2_LDO_POK_MASK		BIT(MAX77836_CNFG2_LDO_POK_SHIFT)
+#define MAX77836_CNFG2_LDO_ADE_MASK		BIT(MAX77836_CNFG2_LDO_ADE_SHIFT)
+#define MAX77836_CNFG2_LDO_SS_MASK		BIT(MAX77836_CNFG2_LDO_SS_SHIFT)
+
 /* Slave addr = 0x6C: Fuel-Gauge/Battery */
 enum max77836_fg_reg {
 	MAX77836_FG_REG_VCELL_MSB	= 0x02,
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index 08b449159fd1..c83fbed1c7b6 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -35,7 +35,17 @@ enum max14577_regulators {
 	MAX14577_SAFEOUT = 0,
 	MAX14577_CHARGER,
 
-	MAX14577_REG_MAX,
+	MAX14577_REGULATOR_NUM,
+};
+
+/* MAX77836 regulator IDs */
+enum max77836_regulators {
+	MAX77836_SAFEOUT = 0,
+	MAX77836_CHARGER,
+	MAX77836_LDO1,
+	MAX77836_LDO2,
+
+	MAX77836_REGULATOR_NUM,
 };
 
 struct max14577_regulator_platform_data {
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
  2014-04-14  9:17 ` [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config Krzysztof Kozlowski
@ 2014-04-15  6:36   ` Chanwoo Choi
  2014-04-16 10:22   ` Lee Jones
  1 sibling, 0 replies; 27+ messages in thread
From: Chanwoo Choi @ 2014-04-15  6:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

Hi Krzysztof,

On 04/14/2014 06:17 PM, Krzysztof Kozlowski wrote:
> Add muic prefix to regmap config to differentiate between another regmap
> config for MAX77836 PMIC node. Additionally remove unused
> symbols: MAX14577_REG_INVALID and max14577_irq_source.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mfd/max14577.c               | 9 +++++----
>  include/linux/mfd/max14577-private.h | 4 +---
>  2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
> index 5f13cefe8def..d180fae8e317 100644
> --- a/drivers/mfd/max14577.c
> +++ b/drivers/mfd/max14577.c
> @@ -37,7 +37,7 @@ static struct mfd_cell max14577_devs[] = {
>  	{ .name = "max14577-charger", },
>  };
>  
> -static bool max14577_volatile_reg(struct device *dev, unsigned int reg)
> +static bool max14577_muic_volatile_reg(struct device *dev, unsigned int reg)
>  {
>  	switch (reg) {
>  	case MAX14577_REG_INT1 ... MAX14577_REG_STATUS3:
> @@ -48,10 +48,10 @@ static bool max14577_volatile_reg(struct device *dev, unsigned int reg)
>  	return false;
>  }
>  
> -static const struct regmap_config max14577_regmap_config = {
> +static const struct regmap_config max14577_muic_regmap_config = {
>  	.reg_bits	= 8,
>  	.val_bits	= 8,
> -	.volatile_reg	= max14577_volatile_reg,
> +	.volatile_reg	= max14577_muic_volatile_reg,
>  	.max_register	= MAX14577_REG_END,
>  };
>  
> @@ -113,7 +113,8 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
>  	max14577->i2c = i2c;
>  	max14577->irq = i2c->irq;
>  
> -	max14577->regmap = devm_regmap_init_i2c(i2c, &max14577_regmap_config);
> +	max14577->regmap = devm_regmap_init_i2c(i2c,
> +			&max14577_muic_regmap_config);
>  	if (IS_ERR(max14577->regmap)) {
>  		ret = PTR_ERR(max14577->regmap);
>  		dev_err(max14577->dev, "Failed to allocate register map: %d\n",
> diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
> index c9b332fb0d5d..97b78d94f92f 100644
> --- a/include/linux/mfd/max14577-private.h
> +++ b/include/linux/mfd/max14577-private.h
> @@ -22,9 +22,7 @@
>  #include <linux/i2c.h>
>  #include <linux/regmap.h>
>  
> -#define MAX14577_REG_INVALID		(0xff)
> -
> -/* Slave addr = 0x4A: Interrupt */
> +/* Slave addr = 0x4A: MUIC and Charger */
>  enum max14577_reg {
>  	MAX14577_REG_DEVICEID		= 0x00,
>  	MAX14577_REG_INT1		= 0x01,
> 

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>

Cheers,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
  2014-04-14  9:17 ` [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines Krzysztof Kozlowski
@ 2014-04-15  6:37   ` Chanwoo Choi
  2014-04-16 10:27   ` Lee Jones
  1 sibling, 0 replies; 27+ messages in thread
From: Chanwoo Choi @ 2014-04-15  6:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

Hi Krzysztof,

On 04/14/2014 06:17 PM, Krzysztof Kozlowski wrote:
> This patch prepares for adding support for MAX77836 device to existing
> max14577 driver by adding MAX14577 prefix to defines of interrupts.
> 
> This is only a rename-like patch, new code is not added.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mfd/max14577.c               | 24 ++++++++++++------------
>  include/linux/mfd/max14577-private.h | 28 ++++++++++++++--------------
>  2 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
> index 0e07ed74ab41..6f39dec9dfdf 100644
> --- a/drivers/mfd/max14577.c
> +++ b/drivers/mfd/max14577.c
> @@ -66,20 +66,20 @@ static const struct regmap_config max14577_muic_regmap_config = {
>  
>  static const struct regmap_irq max14577_irqs[] = {
>  	/* INT1 interrupts */
> -	{ .reg_offset = 0, .mask = INT1_ADC_MASK, },
> -	{ .reg_offset = 0, .mask = INT1_ADCLOW_MASK, },
> -	{ .reg_offset = 0, .mask = INT1_ADCERR_MASK, },
> +	{ .reg_offset = 0, .mask = MAX14577_INT1_ADC_MASK, },
> +	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCLOW_MASK, },
> +	{ .reg_offset = 0, .mask = MAX14577_INT1_ADCERR_MASK, },
>  	/* INT2 interrupts */
> -	{ .reg_offset = 1, .mask = INT2_CHGTYP_MASK, },
> -	{ .reg_offset = 1, .mask = INT2_CHGDETRUN_MASK, },
> -	{ .reg_offset = 1, .mask = INT2_DCDTMR_MASK, },
> -	{ .reg_offset = 1, .mask = INT2_DBCHG_MASK, },
> -	{ .reg_offset = 1, .mask = INT2_VBVOLT_MASK, },
> +	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGTYP_MASK, },
> +	{ .reg_offset = 1, .mask = MAX14577_INT2_CHGDETRUN_MASK, },
> +	{ .reg_offset = 1, .mask = MAX14577_INT2_DCDTMR_MASK, },
> +	{ .reg_offset = 1, .mask = MAX14577_INT2_DBCHG_MASK, },
> +	{ .reg_offset = 1, .mask = MAX14577_INT2_VBVOLT_MASK, },
>  	/* INT3 interrupts */
> -	{ .reg_offset = 2, .mask = INT3_EOC_MASK, },
> -	{ .reg_offset = 2, .mask = INT3_CGMBC_MASK, },
> -	{ .reg_offset = 2, .mask = INT3_OVP_MASK, },
> -	{ .reg_offset = 2, .mask = INT3_MBCCHGERR_MASK, },
> +	{ .reg_offset = 2, .mask = MAX14577_INT3_EOC_MASK, },
> +	{ .reg_offset = 2, .mask = MAX14577_INT3_CGMBC_MASK, },
> +	{ .reg_offset = 2, .mask = MAX14577_INT3_OVP_MASK, },
> +	{ .reg_offset = 2, .mask = MAX14577_INT3_MBCCHGERR_MASK, },
>  };
>  
>  static const struct regmap_irq_chip max14577_irq_chip = {
> diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
> index 1ce6f2952cc9..989183d232cd 100644
> --- a/include/linux/mfd/max14577-private.h
> +++ b/include/linux/mfd/max14577-private.h
> @@ -79,20 +79,20 @@ enum max14577_muic_charger_type {
>  };
>  
>  /* MAX14577 interrupts */
> -#define INT1_ADC_MASK			(0x1 << 0)
> -#define INT1_ADCLOW_MASK		(0x1 << 1)
> -#define INT1_ADCERR_MASK		(0x1 << 2)
> -
> -#define INT2_CHGTYP_MASK		(0x1 << 0)
> -#define INT2_CHGDETRUN_MASK		(0x1 << 1)
> -#define INT2_DCDTMR_MASK		(0x1 << 2)
> -#define INT2_DBCHG_MASK			(0x1 << 3)
> -#define INT2_VBVOLT_MASK		(0x1 << 4)
> -
> -#define INT3_EOC_MASK			(0x1 << 0)
> -#define INT3_CGMBC_MASK			(0x1 << 1)
> -#define INT3_OVP_MASK			(0x1 << 2)
> -#define INT3_MBCCHGERR_MASK		(0x1 << 3)
> +#define MAX14577_INT1_ADC_MASK		BIT(0)
> +#define MAX14577_INT1_ADCLOW_MASK	BIT(1)
> +#define MAX14577_INT1_ADCERR_MASK	BIT(2)
> +
> +#define MAX14577_INT2_CHGTYP_MASK	BIT(0)
> +#define MAX14577_INT2_CHGDETRUN_MASK	BIT(1)
> +#define MAX14577_INT2_DCDTMR_MASK	BIT(2)
> +#define MAX14577_INT2_DBCHG_MASK	BIT(3)
> +#define MAX14577_INT2_VBVOLT_MASK	BIT(4)
> +
> +#define MAX14577_INT3_EOC_MASK		BIT(0)
> +#define MAX14577_INT3_CGMBC_MASK	BIT(1)
> +#define MAX14577_INT3_OVP_MASK		BIT(2)
> +#define MAX14577_INT3_MBCCHGERR_MASK	BIT(3)
>  
>  /* MAX14577 DEVICE ID register */
>  #define DEVID_VENDORID_SHIFT		0
> 

Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>

Cheers,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (8 preceding siblings ...)
  2014-04-14  9:17 ` [PATCH v5 9/9] regulator: max14577: Add support for MAX77836 regulators Krzysztof Kozlowski
@ 2014-04-15  6:50 ` Chanwoo Choi
  2014-04-16 10:28 ` Lee Jones
  10 siblings, 0 replies; 27+ messages in thread
From: Chanwoo Choi @ 2014-04-15  6:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Samuel Ortiz, Lee Jones, Liam Girdwood, Mark Brown,
	linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

Dear all,

I tested this patchset about mfd/extcon/regulator on 3.15-rc1.

How about applying this patchset on some git repository?
I need the opinion of mfd/regulator maintainers
because this patchset include mfd/extcon/regulator patches.

But, following new patches hasn't acked. The two patches must need ack message.
[PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
[PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines

Best Regards,
Chanwoo Choi

On 04/14/2014 06:17 PM, Krzysztof Kozlowski wrote:
> Hi,
> 
> 
> This is first part of fifth version of patchset adding support for
> MAX77836 device to the max14577 driver.
> 
> I decided to split the patchset into smaller parts. I hope this would
> help in getting necessary review/acks from maintainers.
> 
> The first part introduces changes in max14577 driver and adds support
> for MAX77836 in MFD, extcon and regulator drivers. Most of these
> patches already have required acks from maintainers.
> Full v4 patchset can be found here:
> http://thread.gmane.org/gmane.linux.kernel/1654267
> 
> 
> Changes since v4
> ================
> 1. Updated Kconfig entries mentioning MAX77836.
> 2. Removed rename-like patches:
>    [PATCH v4 02/16] mfd: max14577: Rename and add MAX14577 symbols
>    [PATCH v4 03/16] mfd: max14577: Rename state container to maxim_core
> 3. Added new patches (not yet reviewed):
>    [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
>    [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
> 4. Rebased on 3.15-rc1.
> 
> Changes since v3
> ================
> 1. Applied minor fixes (pointed by Lee Jones).
> 2. Added one ACK (Lee Jones) and Review-by (Tomasz Figa).
> 3. Patch 14/charger: Minor change in parsing EOC value from DTS.
> 4. Rebased on next-20140224.
> 
> Changes since v2
> ================
> 1. Added ACK-s.
> 2. Applied minor checkpatch fixes (pointed by Lee Jones).
> 3. Rebased on next-20140217.
> 
> Changes since v1
> ================
> 1. Added ACK-s, reviews and tested-by tags.
> 2. Removed applied patches (they were merged to the linux-next tree).
> 3. Applied comments from review (Lee Jones) to 5/15 (detection of device type)
>    and 8/15 (add max77836 support to max14577).
> 4. Rebased on next tree.
> 5. Added patch 13 and 14 (pointed by Jenny Tc):
>    - regulator/mfd: max14577: Export symbols for calculating charger current
>    - charger: max14577: Configure battery-dependent settings from DTS
> 6. Updated bindings documentation with new charger bindings.
> Previous thread:
>  - [PATCH 00/18] mfd: max14577: Add support for MAX77836
>    http://thread.gmane.org/gmane.linux.kernel/1636654/focus=1636674
> 
> 
> Description
> ===========
> The MAX77836 is almost the same as MAX14577. Basically it is an extended
> version of MAX14577. The chipsets have same MUIC component so the extcon,
> charger and regulators require only little adjustments. More changes were
> needed in the charger (because it uses lower charging current) and regulator
> drivers (because mentioned different charing current and additional
> regulators). The MAX77836 has also PMIC and Fuel Gauge (which is the same
> as MAX17040/17048 Fuel Gauge).
> 
> The MAX77836 uses three I2C slave addresses and has additional interrupts
> (related to PMIC and Fuel Gauge). It has also Interrupt Source register,
> just like MAX77686 and MAX77693.
> 
> 
> Best regards,
> Krzysztof Kozlowski
> 
> 
> Chanwoo Choi (1):
>   extcon: max14577: Change extcon name instead of static name according
>     to device type
> 
> Krzysztof Kozlowski (8):
>   mfd: max14577: Add muic prefix to regmap config
>   mfd: max14577: Add detection of device type
>   extcon: max14577: Add max14577 prefix to muic_irqs
>   extcon: max14577: Choose muic_irqs according to device type
>   mfd: max14577: Add MAX14577 prefix to IRQ defines
>   mfd: max77836: Add MAX77836 support to max14577 driver
>   extcon: max14577: Add support for MAX77836
>   regulator: max14577: Add support for MAX77836 regulators
> 
>  drivers/extcon/Kconfig               |   4 +-
>  drivers/extcon/extcon-max14577.c     | 174 +++++++++++++------
>  drivers/mfd/Kconfig                  |   6 +-
>  drivers/mfd/max14577.c               | 315 ++++++++++++++++++++++++++++++-----
>  drivers/regulator/Kconfig            |   7 +-
>  drivers/regulator/max14577.c         | 277 ++++++++++++++++++++++++++----
>  include/linux/mfd/max14577-private.h | 222 ++++++++++++++++++------
>  include/linux/mfd/max14577.h         |  19 ++-
>  8 files changed, 836 insertions(+), 188 deletions(-)
> 


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
  2014-04-14  9:17 ` [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config Krzysztof Kozlowski
  2014-04-15  6:36   ` Chanwoo Choi
@ 2014-04-16 10:22   ` Lee Jones
  1 sibling, 0 replies; 27+ messages in thread
From: Lee Jones @ 2014-04-16 10:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

> Add muic prefix to regmap config to differentiate between another regmap
> config for MAX77836 PMIC node. Additionally remove unused
> symbols: MAX14577_REG_INVALID and max14577_irq_source.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mfd/max14577.c               | 9 +++++----
>  include/linux/mfd/max14577-private.h | 4 +---
>  2 files changed, 6 insertions(+), 7 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
  2014-04-14  9:17 ` [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines Krzysztof Kozlowski
  2014-04-15  6:37   ` Chanwoo Choi
@ 2014-04-16 10:27   ` Lee Jones
  1 sibling, 0 replies; 27+ messages in thread
From: Lee Jones @ 2014-04-16 10:27 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On Mon, 14 Apr 2014, Krzysztof Kozlowski wrote:

> This patch prepares for adding support for MAX77836 device to existing
> max14577 driver by adding MAX14577 prefix to defines of interrupts.
> 
> This is only a rename-like patch, new code is not added.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mfd/max14577.c               | 24 ++++++++++++------------
>  include/linux/mfd/max14577-private.h | 28 ++++++++++++++--------------
>  2 files changed, 26 insertions(+), 26 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
                   ` (9 preceding siblings ...)
  2014-04-15  6:50 ` [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Chanwoo Choi
@ 2014-04-16 10:28 ` Lee Jones
  2014-04-16 10:44   ` Krzysztof Kozlowski
  10 siblings, 1 reply; 27+ messages in thread
From: Lee Jones @ 2014-04-16 10:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

> This is first part of fifth version of patchset adding support for
> MAX77836 device to the max14577 driver.
> 
> I decided to split the patchset into smaller parts. I hope this would
> help in getting necessary review/acks from maintainers.
> 
> The first part introduces changes in max14577 driver and adds support
> for MAX77836 in MFD, extcon and regulator drivers. Most of these
> patches already have required acks from maintainers.
> Full v4 patchset can be found here:
> http://thread.gmane.org/gmane.linux.kernel/1654267

So what's the plan for this driver now? What's missing? Do you have
all the Acks you need? If so, I'm happy to apply this patch-set and
supply a pull-request to the other maintainers.

> Changes since v4
> ================
> 1. Updated Kconfig entries mentioning MAX77836.
> 2. Removed rename-like patches:
>    [PATCH v4 02/16] mfd: max14577: Rename and add MAX14577 symbols
>    [PATCH v4 03/16] mfd: max14577: Rename state container to maxim_core
> 3. Added new patches (not yet reviewed):
>    [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
>    [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
> 4. Rebased on 3.15-rc1.
> 
> Changes since v3
> ================
> 1. Applied minor fixes (pointed by Lee Jones).
> 2. Added one ACK (Lee Jones) and Review-by (Tomasz Figa).
> 3. Patch 14/charger: Minor change in parsing EOC value from DTS.
> 4. Rebased on next-20140224.
> 
> Changes since v2
> ================
> 1. Added ACK-s.
> 2. Applied minor checkpatch fixes (pointed by Lee Jones).
> 3. Rebased on next-20140217.
> 
> Changes since v1
> ================
> 1. Added ACK-s, reviews and tested-by tags.
> 2. Removed applied patches (they were merged to the linux-next tree).
> 3. Applied comments from review (Lee Jones) to 5/15 (detection of device type)
>    and 8/15 (add max77836 support to max14577).
> 4. Rebased on next tree.
> 5. Added patch 13 and 14 (pointed by Jenny Tc):
>    - regulator/mfd: max14577: Export symbols for calculating charger current
>    - charger: max14577: Configure battery-dependent settings from DTS
> 6. Updated bindings documentation with new charger bindings.
> Previous thread:
>  - [PATCH 00/18] mfd: max14577: Add support for MAX77836
>    http://thread.gmane.org/gmane.linux.kernel/1636654/focus=1636674
> 
> 
> Description
> ===========
> The MAX77836 is almost the same as MAX14577. Basically it is an extended
> version of MAX14577. The chipsets have same MUIC component so the extcon,
> charger and regulators require only little adjustments. More changes were
> needed in the charger (because it uses lower charging current) and regulator
> drivers (because mentioned different charing current and additional
> regulators). The MAX77836 has also PMIC and Fuel Gauge (which is the same
> as MAX17040/17048 Fuel Gauge).
> 
> The MAX77836 uses three I2C slave addresses and has additional interrupts
> (related to PMIC and Fuel Gauge). It has also Interrupt Source register,
> just like MAX77686 and MAX77693.
> 
> 
> Best regards,
> Krzysztof Kozlowski
> 
> 
> Chanwoo Choi (1):
>   extcon: max14577: Change extcon name instead of static name according
>     to device type
> 
> Krzysztof Kozlowski (8):
>   mfd: max14577: Add muic prefix to regmap config
>   mfd: max14577: Add detection of device type
>   extcon: max14577: Add max14577 prefix to muic_irqs
>   extcon: max14577: Choose muic_irqs according to device type
>   mfd: max14577: Add MAX14577 prefix to IRQ defines
>   mfd: max77836: Add MAX77836 support to max14577 driver
>   extcon: max14577: Add support for MAX77836
>   regulator: max14577: Add support for MAX77836 regulators
> 
>  drivers/extcon/Kconfig               |   4 +-
>  drivers/extcon/extcon-max14577.c     | 174 +++++++++++++------
>  drivers/mfd/Kconfig                  |   6 +-
>  drivers/mfd/max14577.c               | 315 ++++++++++++++++++++++++++++++-----
>  drivers/regulator/Kconfig            |   7 +-
>  drivers/regulator/max14577.c         | 277 ++++++++++++++++++++++++++----
>  include/linux/mfd/max14577-private.h | 222 ++++++++++++++++++------
>  include/linux/mfd/max14577.h         |  19 ++-
>  8 files changed, 836 insertions(+), 188 deletions(-)
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 10:28 ` Lee Jones
@ 2014-04-16 10:44   ` Krzysztof Kozlowski
  2014-04-16 10:51     ` Chanwoo Choi
  2014-04-16 11:08     ` Lee Jones
  0 siblings, 2 replies; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-16 10:44 UTC (permalink / raw)
  To: Lee Jones
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On śro, 2014-04-16 at 11:28 +0100, Lee Jones wrote:
> > This is first part of fifth version of patchset adding support for
> > MAX77836 device to the max14577 driver.
> > 
> > I decided to split the patchset into smaller parts. I hope this would
> > help in getting necessary review/acks from maintainers.
> > 
> > The first part introduces changes in max14577 driver and adds support
> > for MAX77836 in MFD, extcon and regulator drivers. Most of these
> > patches already have required acks from maintainers.
> > Full v4 patchset can be found here:
> > http://thread.gmane.org/gmane.linux.kernel/1654267
> 
> So what's the plan for this driver now? What's missing? Do you have
> all the Acks you need? If so, I'm happy to apply this patch-set and
> supply a pull-request to the other maintainers.

Next patches (part 2):
1. charger: max14577: Add support for MAX77836 charger
2. power: max17040: Add ID for MAX77836 Fuel Gauge block
3. regulator/mfd: max14577: Export symbols for calculating charger 
   current
4. charger: max14577: Configure battery-dependent settings from DTS
5. Documentation: mfd: max14577: Add device tree bindings document
6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s

They are quite independent from each other so I think it would be the
best if you could prepare an immutable branch with first part of
patches.

Best regards,
Krzysztof

> 
> > Changes since v4
> > ================
> > 1. Updated Kconfig entries mentioning MAX77836.
> > 2. Removed rename-like patches:
> >    [PATCH v4 02/16] mfd: max14577: Rename and add MAX14577 symbols
> >    [PATCH v4 03/16] mfd: max14577: Rename state container to maxim_core
> > 3. Added new patches (not yet reviewed):
> >    [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
> >    [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
> > 4. Rebased on 3.15-rc1.
> > 
> > Changes since v3
> > ================
> > 1. Applied minor fixes (pointed by Lee Jones).
> > 2. Added one ACK (Lee Jones) and Review-by (Tomasz Figa).
> > 3. Patch 14/charger: Minor change in parsing EOC value from DTS.
> > 4. Rebased on next-20140224.
> > 
> > Changes since v2
> > ================
> > 1. Added ACK-s.
> > 2. Applied minor checkpatch fixes (pointed by Lee Jones).
> > 3. Rebased on next-20140217.
> > 
> > Changes since v1
> > ================
> > 1. Added ACK-s, reviews and tested-by tags.
> > 2. Removed applied patches (they were merged to the linux-next tree).
> > 3. Applied comments from review (Lee Jones) to 5/15 (detection of device type)
> >    and 8/15 (add max77836 support to max14577).
> > 4. Rebased on next tree.
> > 5. Added patch 13 and 14 (pointed by Jenny Tc):
> >    - regulator/mfd: max14577: Export symbols for calculating charger current
> >    - charger: max14577: Configure battery-dependent settings from DTS
> > 6. Updated bindings documentation with new charger bindings.
> > Previous thread:
> >  - [PATCH 00/18] mfd: max14577: Add support for MAX77836
> >    http://thread.gmane.org/gmane.linux.kernel/1636654/focus=1636674
> > 
> > 
> > Description
> > ===========
> > The MAX77836 is almost the same as MAX14577. Basically it is an extended
> > version of MAX14577. The chipsets have same MUIC component so the extcon,
> > charger and regulators require only little adjustments. More changes were
> > needed in the charger (because it uses lower charging current) and regulator
> > drivers (because mentioned different charing current and additional
> > regulators). The MAX77836 has also PMIC and Fuel Gauge (which is the same
> > as MAX17040/17048 Fuel Gauge).
> > 
> > The MAX77836 uses three I2C slave addresses and has additional interrupts
> > (related to PMIC and Fuel Gauge). It has also Interrupt Source register,
> > just like MAX77686 and MAX77693.
> > 
> > 
> > Best regards,
> > Krzysztof Kozlowski
> > 
> > 
> > Chanwoo Choi (1):
> >   extcon: max14577: Change extcon name instead of static name according
> >     to device type
> > 
> > Krzysztof Kozlowski (8):
> >   mfd: max14577: Add muic prefix to regmap config
> >   mfd: max14577: Add detection of device type
> >   extcon: max14577: Add max14577 prefix to muic_irqs
> >   extcon: max14577: Choose muic_irqs according to device type
> >   mfd: max14577: Add MAX14577 prefix to IRQ defines
> >   mfd: max77836: Add MAX77836 support to max14577 driver
> >   extcon: max14577: Add support for MAX77836
> >   regulator: max14577: Add support for MAX77836 regulators
> > 
> >  drivers/extcon/Kconfig               |   4 +-
> >  drivers/extcon/extcon-max14577.c     | 174 +++++++++++++------
> >  drivers/mfd/Kconfig                  |   6 +-
> >  drivers/mfd/max14577.c               | 315 ++++++++++++++++++++++++++++++-----
> >  drivers/regulator/Kconfig            |   7 +-
> >  drivers/regulator/max14577.c         | 277 ++++++++++++++++++++++++++----
> >  include/linux/mfd/max14577-private.h | 222 ++++++++++++++++++------
> >  include/linux/mfd/max14577.h         |  19 ++-
> >  8 files changed, 836 insertions(+), 188 deletions(-)
> > 
> 


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 10:44   ` Krzysztof Kozlowski
@ 2014-04-16 10:51     ` Chanwoo Choi
  2014-04-16 11:02       ` Krzysztof Kozlowski
  2014-04-16 11:08     ` Lee Jones
  1 sibling, 1 reply; 27+ messages in thread
From: Chanwoo Choi @ 2014-04-16 10:51 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, MyungJoo Ham, Samuel Ortiz, Liam Girdwood, Mark Brown,
	linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

Hi Krzysztof,

On 04/16/2014 07:44 PM, Krzysztof Kozlowski wrote:
> On śro, 2014-04-16 at 11:28 +0100, Lee Jones wrote:
>>> This is first part of fifth version of patchset adding support for
>>> MAX77836 device to the max14577 driver.
>>>
>>> I decided to split the patchset into smaller parts. I hope this would
>>> help in getting necessary review/acks from maintainers.
>>>
>>> The first part introduces changes in max14577 driver and adds support
>>> for MAX77836 in MFD, extcon and regulator drivers. Most of these
>>> patches already have required acks from maintainers.
>>> Full v4 patchset can be found here:
>>> http://thread.gmane.org/gmane.linux.kernel/1654267
>>
>> So what's the plan for this driver now? What's missing? Do you have
>> all the Acks you need? If so, I'm happy to apply this patch-set and
>> supply a pull-request to the other maintainers.
> 
> Next patches (part 2):
> 1. charger: max14577: Add support for MAX77836 charger
> 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> 3. regulator/mfd: max14577: Export symbols for calculating charger 
>    current
> 4. charger: max14577: Configure battery-dependent settings from DTS
> 5. Documentation: mfd: max14577: Add device tree bindings document
> 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> 
> They are quite independent from each other so I think it would be the
> best if you could prepare an immutable branch with first part of
> patches.

I have to modify all extcon device drivers for some reason,
If your patchset including extcon patch apply other git repository,
this patchset may have potential merge conflict.

If you possible, following patchset would divide two patchset for each mfd/extcon
to remove potential merge conflict in 3.15 merge window.
- [PATCH v5 0/9] mfd: max14577: Add support for MAX77836

Thanks,
Chanwoo Choi

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 10:51     ` Chanwoo Choi
@ 2014-04-16 11:02       ` Krzysztof Kozlowski
  2014-04-16 11:36         ` Chanwoo Choi
  0 siblings, 1 reply; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-16 11:02 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Lee Jones, MyungJoo Ham, Samuel Ortiz, Liam Girdwood, Mark Brown,
	linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On śro, 2014-04-16 at 19:51 +0900, Chanwoo Choi wrote:
> Hi Krzysztof,
> 
> On 04/16/2014 07:44 PM, Krzysztof Kozlowski wrote:
> > On śro, 2014-04-16 at 11:28 +0100, Lee Jones wrote:
> >>> This is first part of fifth version of patchset adding support for
> >>> MAX77836 device to the max14577 driver.
> >>>
> >>> I decided to split the patchset into smaller parts. I hope this would
> >>> help in getting necessary review/acks from maintainers.
> >>>
> >>> The first part introduces changes in max14577 driver and adds support
> >>> for MAX77836 in MFD, extcon and regulator drivers. Most of these
> >>> patches already have required acks from maintainers.
> >>> Full v4 patchset can be found here:
> >>> http://thread.gmane.org/gmane.linux.kernel/1654267
> >>
> >> So what's the plan for this driver now? What's missing? Do you have
> >> all the Acks you need? If so, I'm happy to apply this patch-set and
> >> supply a pull-request to the other maintainers.
> > 
> > Next patches (part 2):
> > 1. charger: max14577: Add support for MAX77836 charger
> > 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> > 3. regulator/mfd: max14577: Export symbols for calculating charger 
> >    current
> > 4. charger: max14577: Configure battery-dependent settings from DTS
> > 5. Documentation: mfd: max14577: Add device tree bindings document
> > 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> > 
> > They are quite independent from each other so I think it would be the
> > best if you could prepare an immutable branch with first part of
> > patches.
> 
> I have to modify all extcon device drivers for some reason,
> If your patchset including extcon patch apply other git repository,
> this patchset may have potential merge conflict.
> 
> If you possible, following patchset would divide two patchset for each mfd/extcon
> to remove potential merge conflict in 3.15 merge window.
> - [PATCH v5 0/9] mfd: max14577: Add support for MAX77836

I think we can resolve this after preparing by Lee the immutable branch
with this patches. You could pull it so your changes to extcon-max14577
would be on newest version.

It would be difficult to split this part1 patchset into two patchsets
because the changes in extcon driver depend on changes in headers for
IRQ-s. Only the patch:
 - [PATCH v5 8/9] extcon: max14577: Add support for MAX77836
could be easily taken out and split.

Best regards,
Krzysztof




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 10:44   ` Krzysztof Kozlowski
  2014-04-16 10:51     ` Chanwoo Choi
@ 2014-04-16 11:08     ` Lee Jones
  2014-04-16 11:13       ` Krzysztof Kozlowski
  1 sibling, 1 reply; 27+ messages in thread
From: Lee Jones @ 2014-04-16 11:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On Wed, 16 Apr 2014, Krzysztof Kozlowski wrote:

> On śro, 2014-04-16 at 11:28 +0100, Lee Jones wrote:
> > > This is first part of fifth version of patchset adding support for
> > > MAX77836 device to the max14577 driver.
> > > 
> > > I decided to split the patchset into smaller parts. I hope this would
> > > help in getting necessary review/acks from maintainers.
> > > 
> > > The first part introduces changes in max14577 driver and adds support
> > > for MAX77836 in MFD, extcon and regulator drivers. Most of these
> > > patches already have required acks from maintainers.
> > > Full v4 patchset can be found here:
> > > http://thread.gmane.org/gmane.linux.kernel/1654267
> > 
> > So what's the plan for this driver now? What's missing? Do you have
> > all the Acks you need? If so, I'm happy to apply this patch-set and
> > supply a pull-request to the other maintainers.
> 
> Next patches (part 2):
> 1. charger: max14577: Add support for MAX77836 charger
> 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> 3. regulator/mfd: max14577: Export symbols for calculating charger 
>    current
> 4. charger: max14577: Configure battery-dependent settings from DTS
> 5. Documentation: mfd: max14577: Add device tree bindings document
> 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> 
> They are quite independent from each other so I think it would be the
> best if you could prepare an immutable branch with first part of
> patches.

I'm only concerned with the patches in this set at the moment.

Do all of the patches in _this_ set have all of the required Acks, or
are you still waiting on some maintainers?

> > > Changes since v4
> > > ================
> > > 1. Updated Kconfig entries mentioning MAX77836.
> > > 2. Removed rename-like patches:
> > >    [PATCH v4 02/16] mfd: max14577: Rename and add MAX14577 symbols
> > >    [PATCH v4 03/16] mfd: max14577: Rename state container to maxim_core
> > > 3. Added new patches (not yet reviewed):
> > >    [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config
> > >    [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines
> > > 4. Rebased on 3.15-rc1.
> > > 
> > > Changes since v3
> > > ================
> > > 1. Applied minor fixes (pointed by Lee Jones).
> > > 2. Added one ACK (Lee Jones) and Review-by (Tomasz Figa).
> > > 3. Patch 14/charger: Minor change in parsing EOC value from DTS.
> > > 4. Rebased on next-20140224.
> > > 
> > > Changes since v2
> > > ================
> > > 1. Added ACK-s.
> > > 2. Applied minor checkpatch fixes (pointed by Lee Jones).
> > > 3. Rebased on next-20140217.
> > > 
> > > Changes since v1
> > > ================
> > > 1. Added ACK-s, reviews and tested-by tags.
> > > 2. Removed applied patches (they were merged to the linux-next tree).
> > > 3. Applied comments from review (Lee Jones) to 5/15 (detection of device type)
> > >    and 8/15 (add max77836 support to max14577).
> > > 4. Rebased on next tree.
> > > 5. Added patch 13 and 14 (pointed by Jenny Tc):
> > >    - regulator/mfd: max14577: Export symbols for calculating charger current
> > >    - charger: max14577: Configure battery-dependent settings from DTS
> > > 6. Updated bindings documentation with new charger bindings.
> > > Previous thread:
> > >  - [PATCH 00/18] mfd: max14577: Add support for MAX77836
> > >    http://thread.gmane.org/gmane.linux.kernel/1636654/focus=1636674
> > > 
> > > 
> > > Description
> > > ===========
> > > The MAX77836 is almost the same as MAX14577. Basically it is an extended
> > > version of MAX14577. The chipsets have same MUIC component so the extcon,
> > > charger and regulators require only little adjustments. More changes were
> > > needed in the charger (because it uses lower charging current) and regulator
> > > drivers (because mentioned different charing current and additional
> > > regulators). The MAX77836 has also PMIC and Fuel Gauge (which is the same
> > > as MAX17040/17048 Fuel Gauge).
> > > 
> > > The MAX77836 uses three I2C slave addresses and has additional interrupts
> > > (related to PMIC and Fuel Gauge). It has also Interrupt Source register,
> > > just like MAX77686 and MAX77693.
> > > 
> > > 
> > > Best regards,
> > > Krzysztof Kozlowski
> > > 
> > > 
> > > Chanwoo Choi (1):
> > >   extcon: max14577: Change extcon name instead of static name according
> > >     to device type
> > > 
> > > Krzysztof Kozlowski (8):
> > >   mfd: max14577: Add muic prefix to regmap config
> > >   mfd: max14577: Add detection of device type
> > >   extcon: max14577: Add max14577 prefix to muic_irqs
> > >   extcon: max14577: Choose muic_irqs according to device type
> > >   mfd: max14577: Add MAX14577 prefix to IRQ defines
> > >   mfd: max77836: Add MAX77836 support to max14577 driver
> > >   extcon: max14577: Add support for MAX77836
> > >   regulator: max14577: Add support for MAX77836 regulators
> > > 
> > >  drivers/extcon/Kconfig               |   4 +-
> > >  drivers/extcon/extcon-max14577.c     | 174 +++++++++++++------
> > >  drivers/mfd/Kconfig                  |   6 +-
> > >  drivers/mfd/max14577.c               | 315 ++++++++++++++++++++++++++++++-----
> > >  drivers/regulator/Kconfig            |   7 +-
> > >  drivers/regulator/max14577.c         | 277 ++++++++++++++++++++++++++----
> > >  include/linux/mfd/max14577-private.h | 222 ++++++++++++++++++------
> > >  include/linux/mfd/max14577.h         |  19 ++-
> > >  8 files changed, 836 insertions(+), 188 deletions(-)
> > > 
> > 
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 11:08     ` Lee Jones
@ 2014-04-16 11:13       ` Krzysztof Kozlowski
  2014-04-16 12:18         ` Lee Jones
  0 siblings, 1 reply; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-16 11:13 UTC (permalink / raw)
  To: Lee Jones
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On śro, 2014-04-16 at 12:08 +0100, Lee Jones wrote:
> On Wed, 16 Apr 2014, Krzysztof Kozlowski wrote:
> 
> > On śro, 2014-04-16 at 11:28 +0100, Lee Jones wrote:
> > > > This is first part of fifth version of patchset adding support for
> > > > MAX77836 device to the max14577 driver.
> > > > 
> > > > I decided to split the patchset into smaller parts. I hope this would
> > > > help in getting necessary review/acks from maintainers.
> > > > 
> > > > The first part introduces changes in max14577 driver and adds support
> > > > for MAX77836 in MFD, extcon and regulator drivers. Most of these
> > > > patches already have required acks from maintainers.
> > > > Full v4 patchset can be found here:
> > > > http://thread.gmane.org/gmane.linux.kernel/1654267
> > > 
> > > So what's the plan for this driver now? What's missing? Do you have
> > > all the Acks you need? If so, I'm happy to apply this patch-set and
> > > supply a pull-request to the other maintainers.
> > 
> > Next patches (part 2):
> > 1. charger: max14577: Add support for MAX77836 charger
> > 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> > 3. regulator/mfd: max14577: Export symbols for calculating charger 
> >    current
> > 4. charger: max14577: Configure battery-dependent settings from DTS
> > 5. Documentation: mfd: max14577: Add device tree bindings document
> > 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> > 
> > They are quite independent from each other so I think it would be the
> > best if you could prepare an immutable branch with first part of
> > patches.
> 
> I'm only concerned with the patches in this set at the moment.
> 
> Do all of the patches in _this_ set have all of the required Acks, or
> are you still waiting on some maintainers?

I have all necessary Acks for this patchset.
One exception: patch 9/9 (regulator) was only reviewed by Mark Brown,
not acked:
https://lkml.org/lkml/2014/1/28/252




^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 11:02       ` Krzysztof Kozlowski
@ 2014-04-16 11:36         ` Chanwoo Choi
  2014-04-16 12:17           ` Lee Jones
  0 siblings, 1 reply; 27+ messages in thread
From: Chanwoo Choi @ 2014-04-16 11:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, MyungJoo Ham, Samuel Ortiz, Liam Girdwood, Mark Brown,
	linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On 04/16/2014 08:02 PM, Krzysztof Kozlowski wrote:
> On śro, 2014-04-16 at 19:51 +0900, Chanwoo Choi wrote:
>> Hi Krzysztof,
>>
>> On 04/16/2014 07:44 PM, Krzysztof Kozlowski wrote:
>>> On śro, 2014-04-16 at 11:28 +0100, Lee Jones wrote:
>>>>> This is first part of fifth version of patchset adding support for
>>>>> MAX77836 device to the max14577 driver.
>>>>>
>>>>> I decided to split the patchset into smaller parts. I hope this would
>>>>> help in getting necessary review/acks from maintainers.
>>>>>
>>>>> The first part introduces changes in max14577 driver and adds support
>>>>> for MAX77836 in MFD, extcon and regulator drivers. Most of these
>>>>> patches already have required acks from maintainers.
>>>>> Full v4 patchset can be found here:
>>>>> http://thread.gmane.org/gmane.linux.kernel/1654267
>>>>
>>>> So what's the plan for this driver now? What's missing? Do you have
>>>> all the Acks you need? If so, I'm happy to apply this patch-set and
>>>> supply a pull-request to the other maintainers.
>>>
>>> Next patches (part 2):
>>> 1. charger: max14577: Add support for MAX77836 charger
>>> 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
>>> 3. regulator/mfd: max14577: Export symbols for calculating charger 
>>>    current
>>> 4. charger: max14577: Configure battery-dependent settings from DTS
>>> 5. Documentation: mfd: max14577: Add device tree bindings document
>>> 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
>>>
>>> They are quite independent from each other so I think it would be the
>>> best if you could prepare an immutable branch with first part of
>>> patches.
>>
>> I have to modify all extcon device drivers for some reason,
>> If your patchset including extcon patch apply other git repository,
>> this patchset may have potential merge conflict.
>>
>> If you possible, following patchset would divide two patchset for each mfd/extcon
>> to remove potential merge conflict in 3.15 merge window.
>> - [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
> 
> I think we can resolve this after preparing by Lee the immutable branch
> with this patches. You could pull it so your changes to extcon-max14577
> would be on newest version.

I'm reluctant for your suggestion.
IMO, If Lee agree, I'd like to apply this patchset on extcon git
after getting ack for all patchset from maintainer.
And you would send your patchset (part 2) after 3.15 merge window.

Thanks,
Chanwoo Choi


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 11:36         ` Chanwoo Choi
@ 2014-04-16 12:17           ` Lee Jones
  2014-04-16 14:21             ` Chanwoo Choi
  0 siblings, 1 reply; 27+ messages in thread
From: Lee Jones @ 2014-04-16 12:17 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: Krzysztof Kozlowski, MyungJoo Ham, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

> >>>>> This is first part of fifth version of patchset adding support for
> >>>>> MAX77836 device to the max14577 driver.
> >>>>>
> >>>>> I decided to split the patchset into smaller parts. I hope this would
> >>>>> help in getting necessary review/acks from maintainers.
> >>>>>
> >>>>> The first part introduces changes in max14577 driver and adds support
> >>>>> for MAX77836 in MFD, extcon and regulator drivers. Most of these
> >>>>> patches already have required acks from maintainers.
> >>>>> Full v4 patchset can be found here:
> >>>>> http://thread.gmane.org/gmane.linux.kernel/1654267
> >>>>
> >>>> So what's the plan for this driver now? What's missing? Do you have
> >>>> all the Acks you need? If so, I'm happy to apply this patch-set and
> >>>> supply a pull-request to the other maintainers.
> >>>
> >>> Next patches (part 2):
> >>> 1. charger: max14577: Add support for MAX77836 charger
> >>> 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> >>> 3. regulator/mfd: max14577: Export symbols for calculating charger 
> >>>    current
> >>> 4. charger: max14577: Configure battery-dependent settings from DTS
> >>> 5. Documentation: mfd: max14577: Add device tree bindings document
> >>> 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> >>>
> >>> They are quite independent from each other so I think it would be the
> >>> best if you could prepare an immutable branch with first part of
> >>> patches.
> >>
> >> I have to modify all extcon device drivers for some reason,
> >> If your patchset including extcon patch apply other git repository,
> >> this patchset may have potential merge conflict.
> >>
> >> If you possible, following patchset would divide two patchset for each mfd/extcon
> >> to remove potential merge conflict in 3.15 merge window.
> >> - [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
> > 
> > I think we can resolve this after preparing by Lee the immutable branch
> > with this patches. You could pull it so your changes to extcon-max14577
> > would be on newest version.
> 
> I'm reluctant for your suggestion.

Do you know what the suggestion is?

> IMO, If Lee agree, I'd like to apply this patchset on extcon git
> after getting ack for all patchset from maintainer.

This won't work. It _will_ cause conflicts when Extcon and MFD are
merged. The only way to solve this is to create an immutable branch.

> And you would send your patchset (part 2) after 3.15 merge window.

This is an unreasonable and avoidable request. There are 3 months
until the next merge-window.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 11:13       ` Krzysztof Kozlowski
@ 2014-04-16 12:18         ` Lee Jones
  2014-04-23 11:52           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 27+ messages in thread
From: Lee Jones @ 2014-04-16 12:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

> > > > > This is first part of fifth version of patchset adding support for
> > > > > MAX77836 device to the max14577 driver.
> > > > > 
> > > > > I decided to split the patchset into smaller parts. I hope this would
> > > > > help in getting necessary review/acks from maintainers.
> > > > > 
> > > > > The first part introduces changes in max14577 driver and adds support
> > > > > for MAX77836 in MFD, extcon and regulator drivers. Most of these
> > > > > patches already have required acks from maintainers.
> > > > > Full v4 patchset can be found here:
> > > > > http://thread.gmane.org/gmane.linux.kernel/1654267
> > > > 
> > > > So what's the plan for this driver now? What's missing? Do you have
> > > > all the Acks you need? If so, I'm happy to apply this patch-set and
> > > > supply a pull-request to the other maintainers.
> > > 
> > > Next patches (part 2):
> > > 1. charger: max14577: Add support for MAX77836 charger
> > > 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> > > 3. regulator/mfd: max14577: Export symbols for calculating charger 
> > >    current
> > > 4. charger: max14577: Configure battery-dependent settings from DTS
> > > 5. Documentation: mfd: max14577: Add device tree bindings document
> > > 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> > > 
> > > They are quite independent from each other so I think it would be the
> > > best if you could prepare an immutable branch with first part of
> > > patches.
> > 
> > I'm only concerned with the patches in this set at the moment.
> > 
> > Do all of the patches in _this_ set have all of the required Acks, or
> > are you still waiting on some maintainers?
> 
> I have all necessary Acks for this patchset.
> One exception: patch 9/9 (regulator) was only reviewed by Mark Brown,
> not acked:
> https://lkml.org/lkml/2014/1/28/252

That's okay. Still counts. :)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 12:17           ` Lee Jones
@ 2014-04-16 14:21             ` Chanwoo Choi
  0 siblings, 0 replies; 27+ messages in thread
From: Chanwoo Choi @ 2014-04-16 14:21 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chanwoo Choi, Krzysztof Kozlowski, MyungJoo Ham, Samuel Ortiz,
	Liam Girdwood, Mark Brown, linux-kernel, Kyungmin Park,
	Marek Szyprowski, Bartlomiej Zolnierkiewicz

On Wed, Apr 16, 2014 at 9:17 PM, Lee Jones <lee.jones@linaro.org> wrote:
>> >>>>> This is first part of fifth version of patchset adding support for
>> >>>>> MAX77836 device to the max14577 driver.
>> >>>>>
>> >>>>> I decided to split the patchset into smaller parts. I hope this would
>> >>>>> help in getting necessary review/acks from maintainers.
>> >>>>>
>> >>>>> The first part introduces changes in max14577 driver and adds support
>> >>>>> for MAX77836 in MFD, extcon and regulator drivers. Most of these
>> >>>>> patches already have required acks from maintainers.
>> >>>>> Full v4 patchset can be found here:
>> >>>>> http://thread.gmane.org/gmane.linux.kernel/1654267
>> >>>>
>> >>>> So what's the plan for this driver now? What's missing? Do you have
>> >>>> all the Acks you need? If so, I'm happy to apply this patch-set and
>> >>>> supply a pull-request to the other maintainers.
>> >>>
>> >>> Next patches (part 2):
>> >>> 1. charger: max14577: Add support for MAX77836 charger
>> >>> 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
>> >>> 3. regulator/mfd: max14577: Export symbols for calculating charger
>> >>>    current
>> >>> 4. charger: max14577: Configure battery-dependent settings from DTS
>> >>> 5. Documentation: mfd: max14577: Add device tree bindings document
>> >>> 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
>> >>>
>> >>> They are quite independent from each other so I think it would be the
>> >>> best if you could prepare an immutable branch with first part of
>> >>> patches.
>> >>
>> >> I have to modify all extcon device drivers for some reason,
>> >> If your patchset including extcon patch apply other git repository,
>> >> this patchset may have potential merge conflict.
>> >>
>> >> If you possible, following patchset would divide two patchset for each mfd/extcon
>> >> to remove potential merge conflict in 3.15 merge window.
>> >> - [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
>> >
>> > I think we can resolve this after preparing by Lee the immutable branch
>> > with this patches. You could pull it so your changes to extcon-max14577
>> > would be on newest version.
>>
>> I'm reluctant for your suggestion.
>
> Do you know what the suggestion is?
>
>> IMO, If Lee agree, I'd like to apply this patchset on extcon git
>> after getting ack for all patchset from maintainer.
>
> This won't work. It _will_ cause conflicts when Extcon and MFD are
> merged. The only way to solve this is to create an immutable branch.

OK,
If you make some branch for this patchset, I'll pull it on extcon branch.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-16 12:18         ` Lee Jones
@ 2014-04-23 11:52           ` Krzysztof Kozlowski
  2014-04-23 13:04             ` Lee Jones
  0 siblings, 1 reply; 27+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-23 11:52 UTC (permalink / raw)
  To: Lee Jones
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On śro, 2014-04-16 at 13:18 +0100, Lee Jones wrote:
> > > > > > This is first part of fifth version of patchset adding support for
> > > > > > MAX77836 device to the max14577 driver.
> > > > > > 
> > > > > > I decided to split the patchset into smaller parts. I hope this would
> > > > > > help in getting necessary review/acks from maintainers.
> > > > > > 
> > > > > > The first part introduces changes in max14577 driver and adds support
> > > > > > for MAX77836 in MFD, extcon and regulator drivers. Most of these
> > > > > > patches already have required acks from maintainers.
> > > > > > Full v4 patchset can be found here:
> > > > > > http://thread.gmane.org/gmane.linux.kernel/1654267
> > > > > 
> > > > > So what's the plan for this driver now? What's missing? Do you have
> > > > > all the Acks you need? If so, I'm happy to apply this patch-set and
> > > > > supply a pull-request to the other maintainers.
> > > > 
> > > > Next patches (part 2):
> > > > 1. charger: max14577: Add support for MAX77836 charger
> > > > 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> > > > 3. regulator/mfd: max14577: Export symbols for calculating charger 
> > > >    current
> > > > 4. charger: max14577: Configure battery-dependent settings from DTS
> > > > 5. Documentation: mfd: max14577: Add device tree bindings document
> > > > 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> > > > 
> > > > They are quite independent from each other so I think it would be the
> > > > best if you could prepare an immutable branch with first part of
> > > > patches.
> > > 
> > > I'm only concerned with the patches in this set at the moment.
> > > 
> > > Do all of the patches in _this_ set have all of the required Acks, or
> > > are you still waiting on some maintainers?
> > 
> > I have all necessary Acks for this patchset.
> > One exception: patch 9/9 (regulator) was only reviewed by Mark Brown,
> > not acked:
> > https://lkml.org/lkml/2014/1/28/252
> 
> That's okay. Still counts. :)

Hi Lee,

If there are no more issues can you apply this patchset and prepare an
immutable branch with them?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v5 0/9] mfd: max14577: Add support for MAX77836
  2014-04-23 11:52           ` Krzysztof Kozlowski
@ 2014-04-23 13:04             ` Lee Jones
  0 siblings, 0 replies; 27+ messages in thread
From: Lee Jones @ 2014-04-23 13:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Liam Girdwood,
	Mark Brown, linux-kernel, Kyungmin Park, Marek Szyprowski,
	Bartlomiej Zolnierkiewicz

On Wed, 23 Apr 2014, Krzysztof Kozlowski wrote:

> On śro, 2014-04-16 at 13:18 +0100, Lee Jones wrote:
> > > > > > > This is first part of fifth version of patchset adding support for
> > > > > > > MAX77836 device to the max14577 driver.
> > > > > > > 
> > > > > > > I decided to split the patchset into smaller parts. I hope this would
> > > > > > > help in getting necessary review/acks from maintainers.
> > > > > > > 
> > > > > > > The first part introduces changes in max14577 driver and adds support
> > > > > > > for MAX77836 in MFD, extcon and regulator drivers. Most of these
> > > > > > > patches already have required acks from maintainers.
> > > > > > > Full v4 patchset can be found here:
> > > > > > > http://thread.gmane.org/gmane.linux.kernel/1654267
> > > > > > 
> > > > > > So what's the plan for this driver now? What's missing? Do you have
> > > > > > all the Acks you need? If so, I'm happy to apply this patch-set and
> > > > > > supply a pull-request to the other maintainers.
> > > > > 
> > > > > Next patches (part 2):
> > > > > 1. charger: max14577: Add support for MAX77836 charger
> > > > > 2. power: max17040: Add ID for MAX77836 Fuel Gauge block
> > > > > 3. regulator/mfd: max14577: Export symbols for calculating charger 
> > > > >    current
> > > > > 4. charger: max14577: Configure battery-dependent settings from DTS
> > > > > 5. Documentation: mfd: max14577: Add device tree bindings document
> > > > > 6. regulator: max14577: Implement SUSPEND mode for MAX77836 LDO-s
> > > > > 
> > > > > They are quite independent from each other so I think it would be the
> > > > > best if you could prepare an immutable branch with first part of
> > > > > patches.
> > > > 
> > > > I'm only concerned with the patches in this set at the moment.
> > > > 
> > > > Do all of the patches in _this_ set have all of the required Acks, or
> > > > are you still waiting on some maintainers?
> > > 
> > > I have all necessary Acks for this patchset.
> > > One exception: patch 9/9 (regulator) was only reviewed by Mark Brown,
> > > not acked:
> > > https://lkml.org/lkml/2014/1/28/252
> > 
> > That's okay. Still counts. :)
> 
> If there are no more issues can you apply this patchset and prepare an
> immutable branch with them?

Yep, it's on my TODO list for today.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2014-04-23 13:04 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-14  9:17 [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Krzysztof Kozlowski
2014-04-14  9:17 ` [PATCH v5 1/9] extcon: max14577: Change extcon name instead of static name according to device type Krzysztof Kozlowski
2014-04-14  9:17 ` [PATCH v5 2/9] mfd: max14577: Add muic prefix to regmap config Krzysztof Kozlowski
2014-04-15  6:36   ` Chanwoo Choi
2014-04-16 10:22   ` Lee Jones
2014-04-14  9:17 ` [PATCH v5 3/9] mfd: max14577: Add detection of device type Krzysztof Kozlowski
2014-04-14  9:17 ` [PATCH v5 4/9] extcon: max14577: Add max14577 prefix to muic_irqs Krzysztof Kozlowski
2014-04-14  9:17 ` [PATCH v5 5/9] extcon: max14577: Choose muic_irqs according to device type Krzysztof Kozlowski
2014-04-14  9:17 ` [PATCH v5 6/9] mfd: max14577: Add MAX14577 prefix to IRQ defines Krzysztof Kozlowski
2014-04-15  6:37   ` Chanwoo Choi
2014-04-16 10:27   ` Lee Jones
2014-04-14  9:17 ` [PATCH v5 7/9] mfd: max77836: Add MAX77836 support to max14577 driver Krzysztof Kozlowski
2014-04-14  9:17 ` [PATCH v5 8/9] extcon: max14577: Add support for MAX77836 Krzysztof Kozlowski
2014-04-14  9:17 ` [PATCH v5 9/9] regulator: max14577: Add support for MAX77836 regulators Krzysztof Kozlowski
2014-04-15  6:50 ` [PATCH v5 0/9] mfd: max14577: Add support for MAX77836 Chanwoo Choi
2014-04-16 10:28 ` Lee Jones
2014-04-16 10:44   ` Krzysztof Kozlowski
2014-04-16 10:51     ` Chanwoo Choi
2014-04-16 11:02       ` Krzysztof Kozlowski
2014-04-16 11:36         ` Chanwoo Choi
2014-04-16 12:17           ` Lee Jones
2014-04-16 14:21             ` Chanwoo Choi
2014-04-16 11:08     ` Lee Jones
2014-04-16 11:13       ` Krzysztof Kozlowski
2014-04-16 12:18         ` Lee Jones
2014-04-23 11:52           ` Krzysztof Kozlowski
2014-04-23 13:04             ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).