linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693
@ 2015-04-29 10:58 Krzysztof Kozlowski
  2015-04-29 10:58 ` [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members Krzysztof Kozlowski
                   ` (8 more replies)
  0 siblings, 9 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

Hi,


The patchset merges max77843 regulator driver into max77693.
I am asking for review and acks from multiple subsystems.


Rationale
=========
The recently added max77843 regulator driver is very similar to
its older brother: the max77693. Both devices provide two safeouts
and a charger.

The main difference is in charger's output capabilities and related
registry values.

With some code additions the max77693 regulator driver can support both
chipsets. This reduces overall code duplication and is a first step
toward integrating other drivers for these devices.


Patchset description
====================
Patches 1-3 do various cleanup.
Patch 4 prepare max77694 regulator driver for supporting different
devices.
Patch 5 switch max77693 drivers to common state container.
Patch 6 updates max77843 drivers to common state container.
Patches 7-8 do final cleanup before merging.
Patches 9-10 do the merge of max77843 regulator into max77693.


Dependencies
============
The patchset is rebased on current regulator tree:
v4.1-rc1-8-ge2a4e9538fe6. It touches all currently merged max77843
drivers: extcon, mfd, input and regulator (charger driver was not yet
merged).


Best regards,
Krzysztof


Krzysztof Kozlowski (10):
  mfd/extcon: max77693: Remove unused extern declarations and
    max77693_dev members
  mfd: max77693: Store I2C device type as enum and add default unknown
  regulator: max77693: Use core code for charger's is_enabled
  regulator: max77693: Support different register configurations
  max77693: Move state container to common header
  max77843: Switch to common max77693 state container
  mfd/extcon: max77693: Rename defines to allow inclusion with max77843
  mfd/extcon: max77843: Rename defines to allow inclusion with max77693
  regulator: max77693: Add support for MAX77843 device
  regulator: Remove the max77843 driver

 drivers/extcon/extcon-max77693.c     |  83 +++++++-------
 drivers/extcon/extcon-max77843.c     |  76 ++++++++-----
 drivers/input/misc/max77693-haptic.c |   1 +
 drivers/input/misc/max77843-haptic.c |   3 +-
 drivers/mfd/max77693.c               |  31 ++---
 drivers/mfd/max77843.c               |  20 ++--
 drivers/power/max77693_charger.c     |   1 +
 drivers/regulator/Kconfig            |  16 +--
 drivers/regulator/Makefile           |   1 -
 drivers/regulator/max77693.c         | 174 ++++++++++++++++++++++------
 drivers/regulator/max77843.c         | 215 -----------------------------------
 include/linux/mfd/max77693-common.h  |  49 ++++++++
 include/linux/mfd/max77693-private.h | 134 +++++++++-------------
 include/linux/mfd/max77843-private.h | 174 +++++++++++++---------------
 14 files changed, 443 insertions(+), 535 deletions(-)
 delete mode 100644 drivers/regulator/max77843.c
 create mode 100644 include/linux/mfd/max77693-common.h

-- 
2.1.4


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

* [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-05-04  6:45   ` Chanwoo Choi
  2015-05-05  8:24   ` Lee Jones
  2015-04-29 10:58 ` [PATCH 02/10] mfd: max77693: Store I2C device type as enum and add default unknown Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

Clean up the max77693 private header file by removing:
1. Left-overs from previous way of interrupt handling (driver uses
   regmap_irq_chip).
2. Unused members of struct 'max77693_dev' related to interrupts in
   extcon driver.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/extcon/extcon-max77693.c     | 4 ----
 include/linux/mfd/max77693-private.h | 8 --------
 2 files changed, 12 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a66bec8f6252..760e1e2cc1ce 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1218,10 +1218,6 @@ static int max77693_muic_probe(struct platform_device *pdev)
 			irq_src = MUIC_INT3;
 			break;
 		}
-
-		if (irq_src < MAX77693_IRQ_GROUP_NR)
-			info->max77693->irq_masks_cur[irq_src]
-				= init_data[i].data;
 	}
 
 	if (pdata && pdata->muic_data) {
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 51633ea6f910..ad67b8235a8d 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -547,18 +547,10 @@ struct max77693_dev {
 	struct regmap_irq_chip_data *irq_data_muic;
 
 	int irq;
-	int irq_gpio;
-	struct mutex irqlock;
-	int irq_masks_cur[MAX77693_IRQ_GROUP_NR];
-	int irq_masks_cache[MAX77693_IRQ_GROUP_NR];
 };
 
 enum max77693_types {
 	TYPE_MAX77693,
 };
 
-extern int max77693_irq_init(struct max77693_dev *max77686);
-extern void max77693_irq_exit(struct max77693_dev *max77686);
-extern int max77693_irq_resume(struct max77693_dev *max77686);
-
 #endif /*  __LINUX_MFD_MAX77693_PRIV_H */
-- 
2.1.4

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

* [PATCH 02/10] mfd: max77693: Store I2C device type as enum and add default unknown
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
  2015-04-29 10:58 ` [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-04-29 10:58 ` [PATCH 03/10] regulator: max77693: Use core code for charger's is_enabled Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

Store the device type (obtained from i2c_device_id) as an enum and add a
default type of unknown to distinguish from case when this is not set
at all.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 include/linux/mfd/max77693-private.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index ad67b8235a8d..e3c0afff38d3 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -529,13 +529,18 @@ enum max77693_irq_muic {
 	MAX77693_MUIC_IRQ_NR,
 };
 
+enum max77693_types {
+	TYPE_MAX77693_UNKNOWN,
+	TYPE_MAX77693,
+};
+
 struct max77693_dev {
 	struct device *dev;
 	struct i2c_client *i2c;		/* 0xCC , PMIC, Charger, Flash LED */
 	struct i2c_client *muic;	/* 0x4A , MUIC */
 	struct i2c_client *haptic;	/* 0x90 , Haptic */
 
-	int type;
+	enum max77693_types type;
 
 	struct regmap *regmap;
 	struct regmap *regmap_muic;
@@ -549,8 +554,4 @@ struct max77693_dev {
 	int irq;
 };
 
-enum max77693_types {
-	TYPE_MAX77693,
-};
-
 #endif /*  __LINUX_MFD_MAX77693_PRIV_H */
-- 
2.1.4


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

* [PATCH 03/10] regulator: max77693: Use core code for charger's is_enabled
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
  2015-04-29 10:58 ` [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members Krzysztof Kozlowski
  2015-04-29 10:58 ` [PATCH 02/10] mfd: max77693: Store I2C device type as enum and add default unknown Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-04-29 11:03   ` Mark Brown
  2015-04-29 10:58 ` [PATCH 04/10] regulator: max77693: Support different register configurations Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

The custom implementation of 'regulator_ops.is_enabled' callback for
charger regulator is exactly the same as regulator_is_enabled_regmap()
with 'enable_val' set.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/regulator/max77693.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index 9665a488e2f1..38722c8311a5 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -35,20 +35,6 @@
 
 #define CHGIN_ILIM_STEP_20mA			20000
 
-/* CHARGER regulator ops */
-/* CHARGER regulator uses two bits for enabling */
-static int max77693_chg_is_enabled(struct regulator_dev *rdev)
-{
-	int ret;
-	unsigned int val;
-
-	ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
-	if (ret)
-		return ret;
-
-	return (val & rdev->desc->enable_mask) == rdev->desc->enable_mask;
-}
-
 /*
  * CHARGER regulator - Min : 20mA, Max : 2580mA, step : 20mA
  * 0x00, 0x01, 0x2, 0x03	= 60 mA
@@ -118,7 +104,7 @@ static struct regulator_ops max77693_safeout_ops = {
 };
 
 static struct regulator_ops max77693_charger_ops = {
-	.is_enabled		= max77693_chg_is_enabled,
+	.is_enabled		= regulator_is_enabled_regmap,
 	.enable			= regulator_enable_regmap,
 	.disable		= regulator_disable_regmap,
 	.get_current_limit	= max77693_chg_get_current_limit,
@@ -155,6 +141,7 @@ static const struct regulator_desc regulators[] = {
 		.enable_reg = MAX77693_CHG_REG_CHG_CNFG_00,
 		.enable_mask = CHG_CNFG_00_CHG_MASK |
 				CHG_CNFG_00_BUCK_MASK,
+		.enable_val = CHG_CNFG_00_CHG_MASK | CHG_CNFG_00_BUCK_MASK,
 	},
 };
 
-- 
2.1.4

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

* [PATCH 04/10] regulator: max77693: Support different register configurations
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2015-04-29 10:58 ` [PATCH 03/10] regulator: max77693: Use core code for charger's is_enabled Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-04-29 17:41   ` Mark Brown
  2015-04-29 10:58 ` [PATCH 05/10] max77693: Move state container to common header Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

Add support for different configurations of charger's registers so the
same driver could be used on other devices (e.g. MAX77843).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/regulator/max77693.c | 39 +++++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index 38722c8311a5..236851ab575a 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -33,7 +33,13 @@
 #include <linux/regulator/of_regulator.h>
 #include <linux/regmap.h>
 
-#define CHGIN_ILIM_STEP_20mA			20000
+/* Charger regulator differences between MAX77693 and MAX77843 */
+struct chg_reg_data {
+	unsigned int linear_reg;
+	unsigned int linear_mask;
+	unsigned int uA_step;
+	unsigned int min_sel;
+};
 
 /*
  * CHARGER regulator - Min : 20mA, Max : 2580mA, step : 20mA
@@ -42,25 +48,26 @@
  */
 static int max77693_chg_get_current_limit(struct regulator_dev *rdev)
 {
+	const struct chg_reg_data *reg_data = rdev_get_drvdata(rdev);
 	unsigned int chg_min_uA = rdev->constraints->min_uA;
 	unsigned int chg_max_uA = rdev->constraints->max_uA;
 	unsigned int reg, sel;
 	unsigned int val;
 	int ret;
 
-	ret = regmap_read(rdev->regmap, MAX77693_CHG_REG_CHG_CNFG_09, &reg);
+	ret = regmap_read(rdev->regmap, reg_data->linear_reg, &reg);
 	if (ret < 0)
 		return ret;
 
-	sel = reg & CHG_CNFG_09_CHGIN_ILIM_MASK;
+	sel = reg & reg_data->linear_mask;
 
 	/* the first four codes for charger current are all 60mA */
-	if (sel <= 3)
+	if (sel <= reg_data->min_sel)
 		sel = 0;
 	else
-		sel -= 3;
+		sel -= reg_data->min_sel;
 
-	val = chg_min_uA + CHGIN_ILIM_STEP_20mA * sel;
+	val = chg_min_uA + reg_data->uA_step * sel;
 	if (val > chg_max_uA)
 		return -EINVAL;
 
@@ -70,20 +77,20 @@ static int max77693_chg_get_current_limit(struct regulator_dev *rdev)
 static int max77693_chg_set_current_limit(struct regulator_dev *rdev,
 						int min_uA, int max_uA)
 {
+	const struct chg_reg_data *reg_data = rdev_get_drvdata(rdev);
 	unsigned int chg_min_uA = rdev->constraints->min_uA;
 	int sel = 0;
 
-	while (chg_min_uA + CHGIN_ILIM_STEP_20mA * sel < min_uA)
+	while (chg_min_uA + reg_data->uA_step * sel < min_uA)
 		sel++;
 
-	if (chg_min_uA + CHGIN_ILIM_STEP_20mA * sel > max_uA)
+	if (chg_min_uA + reg_data->uA_step * sel > max_uA)
 		return -EINVAL;
 
 	/* the first four codes for charger current are all 60mA */
-	sel += 3;
+	sel += reg_data->min_sel;
 
-	return regmap_write(rdev->regmap,
-				MAX77693_CHG_REG_CHG_CNFG_09, sel);
+	return regmap_write(rdev->regmap, reg_data->linear_reg, sel);
 }
 /* end of CHARGER regulator ops */
 
@@ -145,6 +152,13 @@ static const struct regulator_desc regulators[] = {
 	},
 };
 
+static const struct chg_reg_data max77693_chg_reg_data = {
+	.linear_reg	= MAX77693_CHG_REG_CHG_CNFG_09,
+	.linear_mask	= CHG_CNFG_09_CHGIN_ILIM_MASK,
+	.uA_step	= 20000,
+	.min_sel	= 3,
+};
+
 static int max77693_pmic_probe(struct platform_device *pdev)
 {
 	struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent);
@@ -153,6 +167,7 @@ static int max77693_pmic_probe(struct platform_device *pdev)
 
 	config.dev = iodev->dev;
 	config.regmap = iodev->regmap;
+	config.driver_data = (void *)&max77693_chg_reg_data;
 
 	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
 		struct regulator_dev *rdev;
@@ -170,7 +185,7 @@ static int max77693_pmic_probe(struct platform_device *pdev)
 }
 
 static const struct platform_device_id max77693_pmic_id[] = {
-	{"max77693-pmic", 0},
+	{ "max77693-pmic", TYPE_MAX77693 },
 	{},
 };
 
-- 
2.1.4

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

* [PATCH 05/10] max77693: Move state container to common header
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2015-04-29 10:58 ` [PATCH 04/10] regulator: max77693: Support different register configurations Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-05-23 15:11   ` Sebastian Reichel
  2015-05-27  9:17   ` Lee Jones
  2015-04-29 10:58 ` [PATCH 06/10] max77843: Switch to common max77693 state container Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

This prepares for merging some of the drivers between max77693 and
max77843 so the child MFD driver can be attached to any parent MFD main
driver.

Move the state container to common header file. Additionally add
consistent 'i2c' prefixes to its members (of 'struct i2c_client' type).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/extcon/extcon-max77693.c     |  3 ++-
 drivers/input/misc/max77693-haptic.c |  1 +
 drivers/mfd/max77693.c               | 31 +++++++++++++------------
 drivers/power/max77693_charger.c     |  1 +
 drivers/regulator/max77693.c         |  1 +
 include/linux/mfd/max77693-common.h  | 44 ++++++++++++++++++++++++++++++++++++
 include/linux/mfd/max77693-private.h | 25 --------------------
 7 files changed, 65 insertions(+), 41 deletions(-)
 create mode 100644 include/linux/mfd/max77693-common.h

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 760e1e2cc1ce..5bbf15a2d3d7 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -25,6 +25,7 @@
 #include <linux/platform_device.h>
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77693-common.h>
 #include <linux/extcon.h>
 #include <linux/regmap.h>
 #include <linux/irqdomain.h>
@@ -1112,7 +1113,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
 		dev_dbg(&pdev->dev, "allocate register map\n");
 	} else {
 		info->max77693->regmap_muic = devm_regmap_init_i2c(
-						info->max77693->muic,
+						info->max77693->i2c_muic,
 						&max77693_muic_regmap_config);
 		if (IS_ERR(info->max77693->regmap_muic)) {
 			ret = PTR_ERR(info->max77693->regmap_muic);
diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c
index 39e930c10ebb..69a4e401fe24 100644
--- a/drivers/input/misc/max77693-haptic.c
+++ b/drivers/input/misc/max77693-haptic.c
@@ -25,6 +25,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77693-common.h>
 
 #define MAX_MAGNITUDE_SHIFT	16
 
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index cb14afa97e6f..07fdf35bb9a1 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -34,6 +34,7 @@
 #include <linux/mfd/core.h>
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77693-common.h>
 #include <linux/regulator/machine.h>
 #include <linux/regmap.h>
 
@@ -193,22 +194,22 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
 	} else
 		dev_info(max77693->dev, "device ID: 0x%x\n", reg_data);
 
-	max77693->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
-	if (!max77693->muic) {
+	max77693->i2c_muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
+	if (!max77693->i2c_muic) {
 		dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n");
 		return -ENODEV;
 	}
-	i2c_set_clientdata(max77693->muic, max77693);
+	i2c_set_clientdata(max77693->i2c_muic, max77693);
 
-	max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
-	if (!max77693->haptic) {
+	max77693->i2c_haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
+	if (!max77693->i2c_haptic) {
 		dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n");
 		ret = -ENODEV;
 		goto err_i2c_haptic;
 	}
-	i2c_set_clientdata(max77693->haptic, max77693);
+	i2c_set_clientdata(max77693->i2c_haptic, max77693);
 
-	max77693->regmap_haptic = devm_regmap_init_i2c(max77693->haptic,
+	max77693->regmap_haptic = devm_regmap_init_i2c(max77693->i2c_haptic,
 					&max77693_regmap_haptic_config);
 	if (IS_ERR(max77693->regmap_haptic)) {
 		ret = PTR_ERR(max77693->regmap_haptic);
@@ -222,7 +223,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
 	 * instance of MUIC device when irq of max77693 is initialized
 	 * before call max77693-muic probe() function.
 	 */
-	max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic,
+	max77693->regmap_muic = devm_regmap_init_i2c(max77693->i2c_muic,
 					 &max77693_regmap_muic_config);
 	if (IS_ERR(max77693->regmap_muic)) {
 		ret = PTR_ERR(max77693->regmap_muic);
@@ -255,7 +256,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
 				IRQF_ONESHOT | IRQF_SHARED |
 				IRQF_TRIGGER_FALLING, 0,
 				&max77693_charger_irq_chip,
-				&max77693->irq_data_charger);
+				&max77693->irq_data_chg);
 	if (ret) {
 		dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
 		goto err_irq_charger;
@@ -296,15 +297,15 @@ err_mfd:
 err_intsrc:
 	regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
 err_irq_muic:
-	regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
+	regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
 err_irq_charger:
 	regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
 err_irq_topsys:
 	regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
 err_regmap:
-	i2c_unregister_device(max77693->haptic);
+	i2c_unregister_device(max77693->i2c_haptic);
 err_i2c_haptic:
-	i2c_unregister_device(max77693->muic);
+	i2c_unregister_device(max77693->i2c_muic);
 	return ret;
 }
 
@@ -315,12 +316,12 @@ static int max77693_i2c_remove(struct i2c_client *i2c)
 	mfd_remove_devices(max77693->dev);
 
 	regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
-	regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
+	regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
 	regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
 	regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
 
-	i2c_unregister_device(max77693->muic);
-	i2c_unregister_device(max77693->haptic);
+	i2c_unregister_device(max77693->i2c_muic);
+	i2c_unregister_device(max77693->i2c_haptic);
 
 	return 0;
 }
diff --git a/drivers/power/max77693_charger.c b/drivers/power/max77693_charger.c
index 754879eb59f6..eb68d0572799 100644
--- a/drivers/power/max77693_charger.c
+++ b/drivers/power/max77693_charger.c
@@ -21,6 +21,7 @@
 #include <linux/regmap.h>
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77693-common.h>
 
 #define MAX77693_CHARGER_NAME				"max77693-charger"
 static const char *max77693_charger_model		= "MAX77693";
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index 236851ab575a..5b30dc42679c 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -30,6 +30,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77693-common.h>
 #include <linux/regulator/of_regulator.h>
 #include <linux/regmap.h>
 
diff --git a/include/linux/mfd/max77693-common.h b/include/linux/mfd/max77693-common.h
new file mode 100644
index 000000000000..7da4cc38e982
--- /dev/null
+++ b/include/linux/mfd/max77693-common.h
@@ -0,0 +1,44 @@
+/*
+ * Common data shared between Maxim 77693 and 77843 drivers
+ *
+ * Copyright (C) 2015 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __LINUX_MFD_MAX77693_COMMON_H
+#define __LINUX_MFD_MAX77693_COMMON_H
+
+enum max77693_types {
+	TYPE_MAX77693_UNKNOWN,
+	TYPE_MAX77693,
+};
+
+/*
+ * Shared also with max77843.
+ */
+struct max77693_dev {
+	struct device *dev;
+	struct i2c_client *i2c;		/* 0xCC , PMIC, Charger, Flash LED */
+	struct i2c_client *i2c_muic;	/* 0x4A , MUIC */
+	struct i2c_client *i2c_haptic;	/* MAX77693: 0x90 , Haptic */
+
+	enum max77693_types type;
+
+	struct regmap *regmap;
+	struct regmap *regmap_muic;
+	struct regmap *regmap_haptic;	/* Only MAX77693 */
+
+	struct regmap_irq_chip_data *irq_data_led;
+	struct regmap_irq_chip_data *irq_data_topsys;
+	struct regmap_irq_chip_data *irq_data_chg; /* Only MAX77693 */
+	struct regmap_irq_chip_data *irq_data_muic;
+
+	int irq;
+};
+
+
+#endif /*  __LINUX_MFD_MAX77693_COMMON_H */
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index e3c0afff38d3..8c4143c0c651 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -529,29 +529,4 @@ enum max77693_irq_muic {
 	MAX77693_MUIC_IRQ_NR,
 };
 
-enum max77693_types {
-	TYPE_MAX77693_UNKNOWN,
-	TYPE_MAX77693,
-};
-
-struct max77693_dev {
-	struct device *dev;
-	struct i2c_client *i2c;		/* 0xCC , PMIC, Charger, Flash LED */
-	struct i2c_client *muic;	/* 0x4A , MUIC */
-	struct i2c_client *haptic;	/* 0x90 , Haptic */
-
-	enum max77693_types type;
-
-	struct regmap *regmap;
-	struct regmap *regmap_muic;
-	struct regmap *regmap_haptic;
-
-	struct regmap_irq_chip_data *irq_data_led;
-	struct regmap_irq_chip_data *irq_data_topsys;
-	struct regmap_irq_chip_data *irq_data_charger;
-	struct regmap_irq_chip_data *irq_data_muic;
-
-	int irq;
-};
-
 #endif /*  __LINUX_MFD_MAX77693_PRIV_H */
-- 
2.1.4


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

* [PATCH 06/10] max77843: Switch to common max77693 state container
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2015-04-29 10:58 ` [PATCH 05/10] max77693: Move state container to common header Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-04-29 10:58 ` [PATCH 07/10] mfd/extcon: max77693: Rename defines to allow inclusion with max77843 Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

Switch to the same definition of state container as in MAX77693 drivers.
This will allow usage of one regulator driver in both devices: MAX77693
and MAX77843.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/extcon/extcon-max77843.c     | 17 +++++++++--------
 drivers/input/misc/max77843-haptic.c |  3 ++-
 drivers/mfd/max77843.c               | 20 +++++++++++---------
 drivers/regulator/max77843.c         |  6 ++++--
 include/linux/mfd/max77693-common.h  |  5 +++++
 include/linux/mfd/max77843-private.h | 20 --------------------
 6 files changed, 31 insertions(+), 40 deletions(-)

diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index 8db6a926ea07..fec26128ecfc 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -16,6 +16,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/mfd/max77843-private.h>
+#include <linux/mfd/max77693-common.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/workqueue.h>
@@ -32,7 +33,7 @@ enum max77843_muic_status {
 
 struct max77843_muic_info {
 	struct device *dev;
-	struct max77843 *max77843;
+	struct max77693_dev *max77843;
 	struct extcon_dev *edev;
 
 	struct mutex mutex;
@@ -218,7 +219,7 @@ static const struct regmap_irq_chip max77843_muic_irq_chip = {
 static int max77843_muic_set_path(struct max77843_muic_info *info,
 		u8 val, bool attached)
 {
-	struct max77843 *max77843 = info->max77843;
+	struct max77693_dev *max77843 = info->max77843;
 	int ret = 0;
 	unsigned int ctrl1, ctrl2;
 
@@ -564,7 +565,7 @@ static void max77843_muic_irq_work(struct work_struct *work)
 {
 	struct max77843_muic_info *info = container_of(work,
 			struct max77843_muic_info, irq_work);
-	struct max77843 *max77843 = info->max77843;
+	struct max77693_dev *max77843 = info->max77843;
 	int ret = 0;
 
 	mutex_lock(&info->mutex);
@@ -640,7 +641,7 @@ static void max77843_muic_detect_cable_wq(struct work_struct *work)
 {
 	struct max77843_muic_info *info = container_of(to_delayed_work(work),
 			struct max77843_muic_info, wq_detcable);
-	struct max77843 *max77843 = info->max77843;
+	struct max77693_dev *max77843 = info->max77843;
 	int chg_type, adc, ret;
 	bool attached;
 
@@ -681,7 +682,7 @@ err_cable_wq:
 static int max77843_muic_set_debounce_time(struct max77843_muic_info *info,
 		enum max77843_muic_adc_debounce_time time)
 {
-	struct max77843 *max77843 = info->max77843;
+	struct max77693_dev *max77843 = info->max77843;
 	int ret;
 
 	switch (time) {
@@ -706,7 +707,7 @@ static int max77843_muic_set_debounce_time(struct max77843_muic_info *info,
 	return 0;
 }
 
-static int max77843_init_muic_regmap(struct max77843 *max77843)
+static int max77843_init_muic_regmap(struct max77693_dev *max77843)
 {
 	int ret;
 
@@ -745,7 +746,7 @@ err_muic_i2c:
 
 static int max77843_muic_probe(struct platform_device *pdev)
 {
-	struct max77843 *max77843 = dev_get_drvdata(pdev->dev.parent);
+	struct max77693_dev *max77843 = dev_get_drvdata(pdev->dev.parent);
 	struct max77843_muic_info *info;
 	unsigned int id;
 	int i, ret;
@@ -846,7 +847,7 @@ err_muic_irq:
 static int max77843_muic_remove(struct platform_device *pdev)
 {
 	struct max77843_muic_info *info = platform_get_drvdata(pdev);
-	struct max77843 *max77843 = info->max77843;
+	struct max77693_dev *max77843 = info->max77843;
 
 	cancel_work_sync(&info->irq_work);
 	regmap_del_irq_chip(max77843->irq, max77843->irq_data_muic);
diff --git a/drivers/input/misc/max77843-haptic.c b/drivers/input/misc/max77843-haptic.c
index dccbb465a055..92583dcc808b 100644
--- a/drivers/input/misc/max77843-haptic.c
+++ b/drivers/input/misc/max77843-haptic.c
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/mfd/max77843-private.h>
+#include <linux/mfd/max77693-common.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/pwm.h>
@@ -243,7 +244,7 @@ static void max77843_haptic_close(struct input_dev *dev)
 
 static int max77843_haptic_probe(struct platform_device *pdev)
 {
-	struct max77843 *max77843 = dev_get_drvdata(pdev->dev.parent);
+	struct max77693_dev *max77843 = dev_get_drvdata(pdev->dev.parent);
 	struct max77843_haptic *haptic;
 	int error;
 
diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
index a354ac677ec7..d4ce1303edf7 100644
--- a/drivers/mfd/max77843.c
+++ b/drivers/mfd/max77843.c
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/max77843-private.h>
+#include <linux/mfd/max77693-common.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 
@@ -71,7 +72,7 @@ static const struct regmap_irq_chip max77843_irq_chip = {
 };
 
 /* Charger and Charger regulator use same regmap. */
-static int max77843_chg_init(struct max77843 *max77843)
+static int max77843_chg_init(struct max77693_dev *max77843)
 {
 	int ret;
 
@@ -101,7 +102,7 @@ err_chg_i2c:
 static int max77843_probe(struct i2c_client *i2c,
 			  const struct i2c_device_id *id)
 {
-	struct max77843 *max77843;
+	struct max77693_dev *max77843;
 	unsigned int reg_data;
 	int ret;
 
@@ -113,6 +114,7 @@ static int max77843_probe(struct i2c_client *i2c,
 	max77843->dev = &i2c->dev;
 	max77843->i2c = i2c;
 	max77843->irq = i2c->irq;
+	max77843->type = id->driver_data;
 
 	max77843->regmap = devm_regmap_init_i2c(i2c,
 			&max77843_regmap_config);
@@ -123,7 +125,7 @@ static int max77843_probe(struct i2c_client *i2c,
 
 	ret = regmap_add_irq_chip(max77843->regmap, max77843->irq,
 			IRQF_TRIGGER_LOW | IRQF_ONESHOT | IRQF_SHARED,
-			0, &max77843_irq_chip, &max77843->irq_data);
+			0, &max77843_irq_chip, &max77843->irq_data_topsys);
 	if (ret) {
 		dev_err(&i2c->dev, "Failed to add TOPSYS IRQ chip\n");
 		return ret;
@@ -164,18 +166,18 @@ static int max77843_probe(struct i2c_client *i2c,
 	return 0;
 
 err_pmic_id:
-	regmap_del_irq_chip(max77843->irq, max77843->irq_data);
+	regmap_del_irq_chip(max77843->irq, max77843->irq_data_topsys);
 
 	return ret;
 }
 
 static int max77843_remove(struct i2c_client *i2c)
 {
-	struct max77843 *max77843 = i2c_get_clientdata(i2c);
+	struct max77693_dev *max77843 = i2c_get_clientdata(i2c);
 
 	mfd_remove_devices(max77843->dev);
 
-	regmap_del_irq_chip(max77843->irq, max77843->irq_data);
+	regmap_del_irq_chip(max77843->irq, max77843->irq_data_topsys);
 
 	i2c_unregister_device(max77843->i2c_chg);
 
@@ -188,7 +190,7 @@ static const struct of_device_id max77843_dt_match[] = {
 };
 
 static const struct i2c_device_id max77843_id[] = {
-	{ "max77843", },
+	{ "max77843", TYPE_MAX77843, },
 	{ },
 };
 MODULE_DEVICE_TABLE(i2c, max77843_id);
@@ -196,7 +198,7 @@ MODULE_DEVICE_TABLE(i2c, max77843_id);
 static int __maybe_unused max77843_suspend(struct device *dev)
 {
 	struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
-	struct max77843 *max77843 = i2c_get_clientdata(i2c);
+	struct max77693_dev *max77843 = i2c_get_clientdata(i2c);
 
 	disable_irq(max77843->irq);
 	if (device_may_wakeup(dev))
@@ -208,7 +210,7 @@ static int __maybe_unused max77843_suspend(struct device *dev)
 static int __maybe_unused max77843_resume(struct device *dev)
 {
 	struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
-	struct max77843 *max77843 = i2c_get_clientdata(i2c);
+	struct max77693_dev *max77843 = i2c_get_clientdata(i2c);
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(max77843->irq);
diff --git a/drivers/regulator/max77843.c b/drivers/regulator/max77843.c
index e4e7687ccd7e..ca8d22de2ab0 100644
--- a/drivers/regulator/max77843.c
+++ b/drivers/regulator/max77843.c
@@ -16,6 +16,7 @@
 #include <linux/regulator/driver.h>
 #include <linux/regulator/machine.h>
 #include <linux/mfd/max77843-private.h>
+#include <linux/mfd/max77693-common.h>
 #include <linux/regulator/of_regulator.h>
 
 enum max77843_regulator_type {
@@ -144,7 +145,8 @@ static const struct regulator_desc max77843_supported_regulators[] = {
 	},
 };
 
-static struct regmap *max77843_get_regmap(struct max77843 *max77843, int reg_id)
+static struct regmap *max77843_get_regmap(struct max77693_dev *max77843,
+					  int reg_id)
 {
 	switch (reg_id) {
 	case MAX77843_SAFEOUT1:
@@ -159,7 +161,7 @@ static struct regmap *max77843_get_regmap(struct max77843 *max77843, int reg_id)
 
 static int max77843_regulator_probe(struct platform_device *pdev)
 {
-	struct max77843 *max77843 = dev_get_drvdata(pdev->dev.parent);
+	struct max77693_dev *max77843 = dev_get_drvdata(pdev->dev.parent);
 	struct regulator_config config = {};
 	int i;
 
diff --git a/include/linux/mfd/max77693-common.h b/include/linux/mfd/max77693-common.h
index 7da4cc38e982..095b121aa725 100644
--- a/include/linux/mfd/max77693-common.h
+++ b/include/linux/mfd/max77693-common.h
@@ -15,6 +15,9 @@
 enum max77693_types {
 	TYPE_MAX77693_UNKNOWN,
 	TYPE_MAX77693,
+	TYPE_MAX77843,
+
+	TYPE_MAX77693_NUM,
 };
 
 /*
@@ -25,12 +28,14 @@ struct max77693_dev {
 	struct i2c_client *i2c;		/* 0xCC , PMIC, Charger, Flash LED */
 	struct i2c_client *i2c_muic;	/* 0x4A , MUIC */
 	struct i2c_client *i2c_haptic;	/* MAX77693: 0x90 , Haptic */
+	struct i2c_client *i2c_chg;	/* MAX77843: 0xD2, Charger */
 
 	enum max77693_types type;
 
 	struct regmap *regmap;
 	struct regmap *regmap_muic;
 	struct regmap *regmap_haptic;	/* Only MAX77693 */
+	struct regmap *regmap_chg;	/* Only MAX77843 */
 
 	struct regmap_irq_chip_data *irq_data_led;
 	struct regmap_irq_chip_data *irq_data_topsys;
diff --git a/include/linux/mfd/max77843-private.h b/include/linux/mfd/max77843-private.h
index 7178ace8379e..0121d9440340 100644
--- a/include/linux/mfd/max77843-private.h
+++ b/include/linux/mfd/max77843-private.h
@@ -431,24 +431,4 @@ enum max77843_irq_muic {
 #define MAX77843_REG_SAFEOUTCTRL_SAFEOUT2_MASK \
 		(0x3 << SAFEOUTCTRL_SAFEOUT2_SHIFT)
 
-struct max77843 {
-	struct device *dev;
-
-	struct i2c_client *i2c;
-	struct i2c_client *i2c_chg;
-	struct i2c_client *i2c_fuel;
-	struct i2c_client *i2c_muic;
-
-	struct regmap *regmap;
-	struct regmap *regmap_chg;
-	struct regmap *regmap_fuel;
-	struct regmap *regmap_muic;
-
-	struct regmap_irq_chip_data *irq_data;
-	struct regmap_irq_chip_data *irq_data_chg;
-	struct regmap_irq_chip_data *irq_data_fuel;
-	struct regmap_irq_chip_data *irq_data_muic;
-
-	int irq;
-};
 #endif /* __MAX77843_H__ */
-- 
2.1.4

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

* [PATCH 07/10] mfd/extcon: max77693: Rename defines to allow inclusion with max77843
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2015-04-29 10:58 ` [PATCH 06/10] max77843: Switch to common max77693 state container Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-04-29 13:12   ` Lee Jones
  2015-04-29 10:58 ` [PATCH 08/10] mfd/extcon: max77843: Rename defines to allow inclusion with max77693 Krzysztof Kozlowski
  2015-04-29 10:58 ` [PATCH 09/10] regulator: max77693: Add support for MAX77843 device Krzysztof Kozlowski
  8 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

Add MAX77693 prefix to some of the defines used in max77693 extcon
driver so the max77693-private.h can be included simultaneously with
max77843-private.h.

Additionally use BIT() macro in header.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/extcon/extcon-max77693.c     |  76 +++++++++++++-------------
 include/linux/mfd/max77693-private.h | 102 +++++++++++++++++------------------
 2 files changed, 91 insertions(+), 87 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 5bbf15a2d3d7..fa6c2161a138 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -43,7 +43,7 @@ static struct max77693_reg_data default_init_data[] = {
 	{
 		/* STATUS2 - [3]ChgDetRun */
 		.addr = MAX77693_MUIC_REG_STATUS2,
-		.data = STATUS2_CHGDETRUN_MASK,
+		.data = MAX77693_STATUS2_CHGDETRUN_MASK,
 	}, {
 		/* INTMASK1 - Unmask [3]ADC1KM,[0]ADCM */
 		.addr = MAX77693_MUIC_REG_INTMASK1,
@@ -263,7 +263,7 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
 		 */
 		ret = regmap_write(info->max77693->regmap_muic,
 				  MAX77693_MUIC_REG_CTRL3,
-				  time << CONTROL3_ADCDBSET_SHIFT);
+				  time << MAX77693_CONTROL3_ADCDBSET_SHIFT);
 		if (ret) {
 			dev_err(info->dev, "failed to set ADC debounce time\n");
 			return ret;
@@ -296,7 +296,7 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
 	if (attached)
 		ctrl1 = val;
 	else
-		ctrl1 = CONTROL1_SW_OPEN;
+		ctrl1 = MAX77693_CONTROL1_SW_OPEN;
 
 	ret = regmap_update_bits(info->max77693->regmap_muic,
 			MAX77693_MUIC_REG_CTRL1, COMP_SW_MASK, ctrl1);
@@ -306,13 +306,14 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
 	}
 
 	if (attached)
-		ctrl2 |= CONTROL2_CPEN_MASK;	/* LowPwr=0, CPEn=1 */
+		ctrl2 |= MAX77693_CONTROL2_CPEN_MASK;	/* LowPwr=0, CPEn=1 */
 	else
-		ctrl2 |= CONTROL2_LOWPWR_MASK;	/* LowPwr=1, CPEn=0 */
+		ctrl2 |= MAX77693_CONTROL2_LOWPWR_MASK;	/* LowPwr=1, CPEn=0 */
 
 	ret = regmap_update_bits(info->max77693->regmap_muic,
 			MAX77693_MUIC_REG_CTRL2,
-			CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK, ctrl2);
+			MAX77693_CONTROL2_LOWPWR_MASK | MAX77693_CONTROL2_CPEN_MASK,
+			ctrl2);
 	if (ret < 0) {
 		dev_err(info->dev, "failed to update MUIC register\n");
 		return ret;
@@ -354,8 +355,8 @@ static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
 		 * Read ADC value to check cable type and decide cable state
 		 * according to cable type
 		 */
-		adc = info->status[0] & STATUS1_ADC_MASK;
-		adc >>= STATUS1_ADC_SHIFT;
+		adc = info->status[0] & MAX77693_STATUS1_ADC_MASK;
+		adc >>= MAX77693_STATUS1_ADC_SHIFT;
 
 		/*
 		 * Check current cable state/cable type and store cable type
@@ -378,8 +379,8 @@ static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
 		 * Read ADC value to check cable type and decide cable state
 		 * according to cable type
 		 */
-		adc = info->status[0] & STATUS1_ADC_MASK;
-		adc >>= STATUS1_ADC_SHIFT;
+		adc = info->status[0] & MAX77693_STATUS1_ADC_MASK;
+		adc >>= MAX77693_STATUS1_ADC_SHIFT;
 
 		/*
 		 * Check current cable state/cable type and store cable type
@@ -394,13 +395,13 @@ static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
 		} else {
 			*attached = true;
 
-			adclow = info->status[0] & STATUS1_ADCLOW_MASK;
-			adclow >>= STATUS1_ADCLOW_SHIFT;
-			adc1k = info->status[0] & STATUS1_ADC1K_MASK;
-			adc1k >>= STATUS1_ADC1K_SHIFT;
+			adclow = info->status[0] & MAX77693_STATUS1_ADCLOW_MASK;
+			adclow >>= MAX77693_STATUS1_ADCLOW_SHIFT;
+			adc1k = info->status[0] & MAX77693_STATUS1_ADC1K_MASK;
+			adc1k >>= MAX77693_STATUS1_ADC1K_SHIFT;
 
-			vbvolt = info->status[1] & STATUS2_VBVOLT_MASK;
-			vbvolt >>= STATUS2_VBVOLT_SHIFT;
+			vbvolt = info->status[1] & MAX77693_STATUS2_VBVOLT_MASK;
+			vbvolt >>= MAX77693_STATUS2_VBVOLT_SHIFT;
 
 			/**
 			 * [0x1|VBVolt|ADCLow|ADC1K]
@@ -425,8 +426,8 @@ static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
 		 * Read charger type to check cable type and decide cable state
 		 * according to type of charger cable.
 		 */
-		chg_type = info->status[1] & STATUS2_CHGTYP_MASK;
-		chg_type >>= STATUS2_CHGTYP_SHIFT;
+		chg_type = info->status[1] & MAX77693_STATUS2_CHGTYP_MASK;
+		chg_type >>= MAX77693_STATUS2_CHGTYP_SHIFT;
 
 		if (chg_type == MAX77693_CHARGER_TYPE_NONE) {
 			*attached = false;
@@ -450,10 +451,10 @@ static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
 		 * Read ADC value to check cable type and decide cable state
 		 * according to cable type
 		 */
-		adc = info->status[0] & STATUS1_ADC_MASK;
-		adc >>= STATUS1_ADC_SHIFT;
-		chg_type = info->status[1] & STATUS2_CHGTYP_MASK;
-		chg_type >>= STATUS2_CHGTYP_SHIFT;
+		adc = info->status[0] & MAX77693_STATUS1_ADC_MASK;
+		adc >>= MAX77693_STATUS1_ADC_SHIFT;
+		chg_type = info->status[1] & MAX77693_STATUS2_CHGTYP_MASK;
+		chg_type >>= MAX77693_STATUS2_CHGTYP_SHIFT;
 
 		if (adc == MAX77693_MUIC_ADC_OPEN
 				&& chg_type == MAX77693_CHARGER_TYPE_NONE)
@@ -465,8 +466,8 @@ static int max77693_muic_get_cable_type(struct max77693_muic_info *info,
 		 * Read vbvolt field, if vbvolt is 1,
 		 * this cable is used for charging.
 		 */
-		vbvolt = info->status[1] & STATUS2_VBVOLT_MASK;
-		vbvolt >>= STATUS2_VBVOLT_SHIFT;
+		vbvolt = info->status[1] & MAX77693_STATUS2_VBVOLT_MASK;
+		vbvolt >>= MAX77693_STATUS2_VBVOLT_SHIFT;
 
 		cable_type = vbvolt;
 		break;
@@ -548,7 +549,8 @@ static int max77693_muic_dock_handler(struct max77693_muic_info *info,
 	}
 
 	/* Dock-Car/Desk/Audio, PATH:AUDIO */
-	ret = max77693_muic_set_path(info, CONTROL1_SW_AUDIO, attached);
+	ret = max77693_muic_set_path(info, MAX77693_CONTROL1_SW_AUDIO,
+					attached);
 	if (ret < 0)
 		return ret;
 	extcon_set_cable_state(info->edev, dock_name, attached);
@@ -613,14 +615,16 @@ static int max77693_muic_adc_ground_handler(struct max77693_muic_info *info)
 	case MAX77693_MUIC_GND_USB_HOST:
 	case MAX77693_MUIC_GND_USB_HOST_VB:
 		/* USB_HOST, PATH: AP_USB */
-		ret = max77693_muic_set_path(info, CONTROL1_SW_USB, attached);
+		ret = max77693_muic_set_path(info, MAX77693_CONTROL1_SW_USB,
+						attached);
 		if (ret < 0)
 			return ret;
 		extcon_set_cable_state(info->edev, "USB-Host", attached);
 		break;
 	case MAX77693_MUIC_GND_AV_CABLE_LOAD:
 		/* Audio Video Cable with load, PATH:AUDIO */
-		ret = max77693_muic_set_path(info, CONTROL1_SW_AUDIO, attached);
+		ret = max77693_muic_set_path(info, MAX77693_CONTROL1_SW_AUDIO,
+						attached);
 		if (ret < 0)
 			return ret;
 		extcon_set_cable_state(info->edev,
@@ -645,7 +649,7 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info,
 {
 	char cable_name[32];
 	int ret = 0;
-	u8 path = CONTROL1_SW_OPEN;
+	u8 path = MAX77693_CONTROL1_SW_OPEN;
 
 	dev_info(info->dev,
 		"external connector is %s (adc:0x%02x)\n",
@@ -655,22 +659,22 @@ static int max77693_muic_jig_handler(struct max77693_muic_info *info,
 	case MAX77693_MUIC_ADC_FACTORY_MODE_USB_OFF:	/* ADC_JIG_USB_OFF */
 		/* PATH:AP_USB */
 		strcpy(cable_name, "JIG-USB-OFF");
-		path = CONTROL1_SW_USB;
+		path = MAX77693_CONTROL1_SW_USB;
 		break;
 	case MAX77693_MUIC_ADC_FACTORY_MODE_USB_ON:	/* ADC_JIG_USB_ON */
 		/* PATH:AP_USB */
 		strcpy(cable_name, "JIG-USB-ON");
-		path = CONTROL1_SW_USB;
+		path = MAX77693_CONTROL1_SW_USB;
 		break;
 	case MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF:	/* ADC_JIG_UART_OFF */
 		/* PATH:AP_UART */
 		strcpy(cable_name, "JIG-UART-OFF");
-		path = CONTROL1_SW_UART;
+		path = MAX77693_CONTROL1_SW_UART;
 		break;
 	case MAX77693_MUIC_ADC_FACTORY_MODE_UART_ON:	/* ADC_JIG_UART_ON */
 		/* PATH:AP_UART */
 		strcpy(cable_name, "JIG-UART-ON");
-		path = CONTROL1_SW_UART;
+		path = MAX77693_CONTROL1_SW_UART;
 		break;
 	default:
 		dev_err(info->dev, "failed to detect %s jig cable\n",
@@ -1232,12 +1236,12 @@ static int max77693_muic_probe(struct platform_device *pdev)
 		if (muic_pdata->path_uart)
 			info->path_uart = muic_pdata->path_uart;
 		else
-			info->path_uart = CONTROL1_SW_UART;
+			info->path_uart = MAX77693_CONTROL1_SW_UART;
 
 		if (muic_pdata->path_usb)
 			info->path_usb = muic_pdata->path_usb;
 		else
-			info->path_usb = CONTROL1_SW_USB;
+			info->path_usb = MAX77693_CONTROL1_SW_USB;
 
 		/*
 		 * Default delay time for detecting cable state
@@ -1249,8 +1253,8 @@ static int max77693_muic_probe(struct platform_device *pdev)
 		else
 			delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
 	} else {
-		info->path_usb = CONTROL1_SW_USB;
-		info->path_uart = CONTROL1_SW_UART;
+		info->path_usb = MAX77693_CONTROL1_SW_USB;
+		info->path_uart = MAX77693_CONTROL1_SW_UART;
 		delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
 	}
 
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 8c4143c0c651..7201c0b61bd5 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -310,30 +310,30 @@ enum max77693_muic_reg {
 #define INTMASK2_CHGTYP_MASK		(1 << INTMASK2_CHGTYP_SHIFT)
 
 /* MAX77693 MUIC - STATUS1~3 Register */
-#define STATUS1_ADC_SHIFT		(0)
-#define STATUS1_ADCLOW_SHIFT		(5)
-#define STATUS1_ADCERR_SHIFT		(6)
-#define 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_ADC1K_MASK		(0x1 << STATUS1_ADC1K_SHIFT)
-
-#define STATUS2_CHGTYP_SHIFT		(0)
-#define STATUS2_CHGDETRUN_SHIFT		(3)
-#define STATUS2_DCDTMR_SHIFT		(4)
-#define STATUS2_DXOVP_SHIFT		(5)
-#define STATUS2_VBVOLT_SHIFT		(6)
-#define 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_DXOVP_MASK		(0x1 << STATUS2_DXOVP_SHIFT)
-#define STATUS2_VBVOLT_MASK		(0x1 << STATUS2_VBVOLT_SHIFT)
-#define STATUS2_VIDRM_MASK		(0x1 << STATUS2_VIDRM_SHIFT)
-
-#define STATUS3_OVP_SHIFT		(2)
-#define STATUS3_OVP_MASK		(0x1 << STATUS3_OVP_SHIFT)
+#define MAX77693_STATUS1_ADC_SHIFT		(0)
+#define MAX77693_STATUS1_ADCLOW_SHIFT		(5)
+#define MAX77693_STATUS1_ADCERR_SHIFT		(6)
+#define MAX77693_STATUS1_ADC1K_SHIFT		(7)
+#define MAX77693_STATUS1_ADC_MASK		(0x1f << MAX77693_STATUS1_ADC_SHIFT)
+#define MAX77693_STATUS1_ADCLOW_MASK		BIT(MAX77693_STATUS1_ADCLOW_SHIFT)
+#define MAX77693_STATUS1_ADCERR_MASK		BIT(MAX77693_STATUS1_ADCERR_SHIFT)
+#define MAX77693_STATUS1_ADC1K_MASK		BIT(MAX77693_STATUS1_ADC1K_SHIFT)
+
+#define MAX77693_STATUS2_CHGTYP_SHIFT		(0)
+#define MAX77693_STATUS2_CHGDETRUN_SHIFT	(3)
+#define MAX77693_STATUS2_DCDTMR_SHIFT		(4)
+#define MAX77693_STATUS2_DXOVP_SHIFT		(5)
+#define MAX77693_STATUS2_VBVOLT_SHIFT		(6)
+#define MAX77693_STATUS2_VIDRM_SHIFT		(7)
+#define MAX77693_STATUS2_CHGTYP_MASK		(0x7 << MAX77693_STATUS2_CHGTYP_SHIFT)
+#define MAX77693_STATUS2_CHGDETRUN_MASK		BIT(MAX77693_STATUS2_CHGDETRUN_SHIFT)
+#define MAX77693_STATUS2_DCDTMR_MASK		BIT(MAX77693_STATUS2_DCDTMR_SHIFT)
+#define MAX77693_STATUS2_DXOVP_MASK		BIT(MAX77693_STATUS2_DXOVP_SHIFT)
+#define MAX77693_STATUS2_VBVOLT_MASK		BIT(MAX77693_STATUS2_VBVOLT_SHIFT)
+#define MAX77693_STATUS2_VIDRM_MASK		BIT(MAX77693_STATUS2_VIDRM_SHIFT)
+
+#define MAX77693_STATUS3_OVP_SHIFT		(2)
+#define MAX77693_STATUS3_OVP_MASK		BIT(MAX77693_STATUS3_OVP_SHIFT)
 
 /* MAX77693 CDETCTRL1~2 register */
 #define CDETCTRL1_CHGDETEN_SHIFT	(0)
@@ -362,38 +362,38 @@ enum max77693_muic_reg {
 #define COMN1SW_MASK			(0x7 << COMN1SW_SHIFT)
 #define COMP2SW_MASK			(0x7 << COMP2SW_SHIFT)
 #define COMP_SW_MASK			(COMP2SW_MASK | COMN1SW_MASK)
-#define CONTROL1_SW_USB			((1 << COMP2SW_SHIFT) \
+#define MAX77693_CONTROL1_SW_USB	((1 << COMP2SW_SHIFT) \
 						| (1 << COMN1SW_SHIFT))
-#define CONTROL1_SW_AUDIO		((2 << COMP2SW_SHIFT) \
+#define MAX77693_CONTROL1_SW_AUDIO	((2 << COMP2SW_SHIFT) \
 						| (2 << COMN1SW_SHIFT))
-#define CONTROL1_SW_UART		((3 << COMP2SW_SHIFT) \
+#define MAX77693_CONTROL1_SW_UART	((3 << COMP2SW_SHIFT) \
 						| (3 << COMN1SW_SHIFT))
-#define CONTROL1_SW_OPEN		((0 << COMP2SW_SHIFT) \
+#define MAX77693_CONTROL1_SW_OPEN	((0 << COMP2SW_SHIFT) \
 						| (0 << COMN1SW_SHIFT))
 
-#define CONTROL2_LOWPWR_SHIFT		(0)
-#define CONTROL2_ADCEN_SHIFT		(1)
-#define CONTROL2_CPEN_SHIFT		(2)
-#define CONTROL2_SFOUTASRT_SHIFT	(3)
-#define CONTROL2_SFOUTORD_SHIFT		(4)
-#define CONTROL2_ACCDET_SHIFT		(5)
-#define CONTROL2_USBCPINT_SHIFT		(6)
-#define CONTROL2_RCPS_SHIFT		(7)
-#define CONTROL2_LOWPWR_MASK		(0x1 << CONTROL2_LOWPWR_SHIFT)
-#define CONTROL2_ADCEN_MASK		(0x1 << CONTROL2_ADCEN_SHIFT)
-#define CONTROL2_CPEN_MASK		(0x1 << CONTROL2_CPEN_SHIFT)
-#define CONTROL2_SFOUTASRT_MASK		(0x1 << CONTROL2_SFOUTASRT_SHIFT)
-#define CONTROL2_SFOUTORD_MASK		(0x1 << CONTROL2_SFOUTORD_SHIFT)
-#define CONTROL2_ACCDET_MASK		(0x1 << CONTROL2_ACCDET_SHIFT)
-#define CONTROL2_USBCPINT_MASK		(0x1 << CONTROL2_USBCPINT_SHIFT)
-#define CONTROL2_RCPS_MASK		(0x1 << CONTROL2_RCPS_SHIFT)
-
-#define CONTROL3_JIGSET_SHIFT		(0)
-#define CONTROL3_BTLDSET_SHIFT		(2)
-#define CONTROL3_ADCDBSET_SHIFT		(4)
-#define CONTROL3_JIGSET_MASK		(0x3 << CONTROL3_JIGSET_SHIFT)
-#define CONTROL3_BTLDSET_MASK		(0x3 << CONTROL3_BTLDSET_SHIFT)
-#define CONTROL3_ADCDBSET_MASK		(0x3 << CONTROL3_ADCDBSET_SHIFT)
+#define MAX77693_CONTROL2_LOWPWR_SHIFT		(0)
+#define MAX77693_CONTROL2_ADCEN_SHIFT		(1)
+#define MAX77693_CONTROL2_CPEN_SHIFT		(2)
+#define MAX77693_CONTROL2_SFOUTASRT_SHIFT	(3)
+#define MAX77693_CONTROL2_SFOUTORD_SHIFT	(4)
+#define MAX77693_CONTROL2_ACCDET_SHIFT		(5)
+#define MAX77693_CONTROL2_USBCPINT_SHIFT	(6)
+#define MAX77693_CONTROL2_RCPS_SHIFT		(7)
+#define MAX77693_CONTROL2_LOWPWR_MASK		BIT(MAX77693_CONTROL2_LOWPWR_SHIFT)
+#define MAX77693_CONTROL2_ADCEN_MASK		BIT(MAX77693_CONTROL2_ADCEN_SHIFT)
+#define MAX77693_CONTROL2_CPEN_MASK		BIT(MAX77693_CONTROL2_CPEN_SHIFT)
+#define MAX77693_CONTROL2_SFOUTASRT_MASK	BIT(MAX77693_CONTROL2_SFOUTASRT_SHIFT)
+#define MAX77693_CONTROL2_SFOUTORD_MASK		BIT(MAX77693_CONTROL2_SFOUTORD_SHIFT)
+#define MAX77693_CONTROL2_ACCDET_MASK		BIT(MAX77693_CONTROL2_ACCDET_SHIFT)
+#define MAX77693_CONTROL2_USBCPINT_MASK		BIT(MAX77693_CONTROL2_USBCPINT_SHIFT)
+#define MAX77693_CONTROL2_RCPS_MASK		BIT(MAX77693_CONTROL2_RCPS_SHIFT)
+
+#define MAX77693_CONTROL3_JIGSET_SHIFT		(0)
+#define MAX77693_CONTROL3_BTLDSET_SHIFT		(2)
+#define MAX77693_CONTROL3_ADCDBSET_SHIFT	(4)
+#define MAX77693_CONTROL3_JIGSET_MASK		(0x3 << MAX77693_CONTROL3_JIGSET_SHIFT)
+#define MAX77693_CONTROL3_BTLDSET_MASK		(0x3 << MAX77693_CONTROL3_BTLDSET_SHIFT)
+#define MAX77693_CONTROL3_ADCDBSET_MASK		(0x3 << MAX77693_CONTROL3_ADCDBSET_SHIFT)
 
 /* Slave addr = 0x90: Haptic */
 enum max77693_haptic_reg {
-- 
2.1.4


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

* [PATCH 08/10] mfd/extcon: max77843: Rename defines to allow inclusion with max77693
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2015-04-29 10:58 ` [PATCH 07/10] mfd/extcon: max77693: Rename defines to allow inclusion with max77843 Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-04-29 13:11   ` Lee Jones
  2015-04-29 10:58 ` [PATCH 09/10] regulator: max77693: Add support for MAX77843 device Krzysztof Kozlowski
  8 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

Add MAX77843_MUIC prefix to some of the defines used in max77843 extcon
driver so the max77693-private.h can be included simultaneously with
max77843-private.h.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/extcon/extcon-max77843.c     |  59 ++++++++++----
 include/linux/mfd/max77843-private.h | 154 +++++++++++++++++------------------
 2 files changed, 118 insertions(+), 95 deletions(-)

diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index fec26128ecfc..614f1996c51b 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -226,11 +226,11 @@ static int max77843_muic_set_path(struct max77843_muic_info *info,
 	if (attached)
 		ctrl1 = val;
 	else
-		ctrl1 = CONTROL1_SW_OPEN;
+		ctrl1 = MAX77843_MUIC_CONTROL1_SW_OPEN;
 
 	ret = regmap_update_bits(max77843->regmap_muic,
 			MAX77843_MUIC_REG_CONTROL1,
-			CONTROL1_COM_SW, ctrl1);
+			MAX77843_MUIC_CONTROL1_COM_SW, ctrl1);
 	if (ret < 0) {
 		dev_err(info->dev, "Cannot switch MUIC port\n");
 		return ret;
@@ -264,7 +264,7 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
 
 	adc = info->status[MAX77843_MUIC_STATUS1] &
 			MAX77843_MUIC_STATUS1_ADC_MASK;
-	adc >>= STATUS1_ADC_SHIFT;
+	adc >>= MAX77843_MUIC_STATUS1_ADC_SHIFT;
 
 	switch (group) {
 	case MAX77843_CABLE_GROUP_ADC:
@@ -330,7 +330,7 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
 			/* Get VBVolt register bit */
 			gnd_type |= (info->status[MAX77843_MUIC_STATUS2] &
 					MAX77843_MUIC_STATUS2_VBVOLT_MASK);
-			gnd_type >>= STATUS2_VBVOLT_SHIFT;
+			gnd_type >>= MAX77843_MUIC_STATUS2_VBVOLT_SHIFT;
 
 			/* Offset of GND cable */
 			gnd_type |= MAX77843_MUIC_GND_USB_HOST;
@@ -359,7 +359,9 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
 	switch (gnd_cable_type) {
 	case MAX77843_MUIC_GND_USB_HOST:
 	case MAX77843_MUIC_GND_USB_HOST_VB:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_USB,
+					     attached);
 		if (ret < 0)
 			return ret;
 
@@ -367,7 +369,9 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
 		break;
 	case MAX77843_MUIC_GND_MHL_VB:
 	case MAX77843_MUIC_GND_MHL:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_OPEN,
+					     attached);
 		if (ret < 0)
 			return ret;
 
@@ -392,25 +396,33 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info,
 
 	switch (cable_type) {
 	case MAX77843_MUIC_ADC_FACTORY_MODE_USB_OFF:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_USB,
+					     attached);
 		if (ret < 0)
 			return ret;
 		extcon_set_cable_state(info->edev, "JIG-USB-OFF", attached);
 		break;
 	case MAX77843_MUIC_ADC_FACTORY_MODE_USB_ON:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_USB,
+					     attached);
 		if (ret < 0)
 			return ret;
 		extcon_set_cable_state(info->edev, "JIG-USB-ON", attached);
 		break;
 	case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_UART, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_UART,
+					     attached);
 		if (ret < 0)
 			return ret;
 		extcon_set_cable_state(info->edev, "JIG-UART-OFF", attached);
 		break;
 	default:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_OPEN,
+					     attached);
 		if (ret < 0)
 			return ret;
 		break;
@@ -502,14 +514,18 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
 
 	switch (chg_type) {
 	case MAX77843_MUIC_CHG_USB:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_USB,
+					     attached);
 		if (ret < 0)
 			return ret;
 
 		extcon_set_cable_state(info->edev, "USB", attached);
 		break;
 	case MAX77843_MUIC_CHG_DOWNSTREAM:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_OPEN,
+					     attached);
 		if (ret < 0)
 			return ret;
 
@@ -517,21 +533,27 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
 				"CHARGER-DOWNSTREAM", attached);
 		break;
 	case MAX77843_MUIC_CHG_DEDICATED:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_OPEN,
+					     attached);
 		if (ret < 0)
 			return ret;
 
 		extcon_set_cable_state(info->edev, "TA", attached);
 		break;
 	case MAX77843_MUIC_CHG_SPECIAL_500MA:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_OPEN,
+					     attached);
 		if (ret < 0)
 			return ret;
 
 		extcon_set_cable_state(info->edev, "SLOW-CHAREGER", attached);
 		break;
 	case MAX77843_MUIC_CHG_SPECIAL_1A:
-		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
+		ret = max77843_muic_set_path(info,
+					     MAX77843_MUIC_CONTROL1_SW_OPEN,
+					     attached);
 		if (ret < 0)
 			return ret;
 
@@ -554,7 +576,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
 			"failed to detect %s accessory (chg_type:0x%x)\n",
 			attached ? "attached" : "detached", chg_type);
 
-		max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
+		max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_OPEN,
+				       attached);
 		return -EINVAL;
 	}
 
@@ -693,7 +716,7 @@ static int max77843_muic_set_debounce_time(struct max77843_muic_info *info,
 		ret = regmap_update_bits(max77843->regmap_muic,
 				MAX77843_MUIC_REG_CONTROL4,
 				MAX77843_MUIC_CONTROL4_ADCDBSET_MASK,
-				time << CONTROL4_ADCDBSET_SHIFT);
+				time << MAX77843_MUIC_CONTROL4_ADCDBSET_SHIFT);
 		if (ret < 0) {
 			dev_err(info->dev, "Cannot write MUIC regmap\n");
 			return ret;
@@ -794,7 +817,7 @@ static int max77843_muic_probe(struct platform_device *pdev)
 	max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS);
 
 	/* Set initial path for UART */
-	max77843_muic_set_path(info, CONTROL1_SW_UART, true);
+	max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true);
 
 	/* Check revision number of MUIC device */
 	ret = regmap_read(max77843->regmap_muic, MAX77843_MUIC_REG_ID, &id);
diff --git a/include/linux/mfd/max77843-private.h b/include/linux/mfd/max77843-private.h
index 0121d9440340..c19303b0ccfd 100644
--- a/include/linux/mfd/max77843-private.h
+++ b/include/linux/mfd/max77843-private.h
@@ -318,62 +318,62 @@ enum max77843_irq_muic {
 	MAX77843_INTSRCMASK_SYS_MASK | MAX77843_INTSRCMASK_CHGR_MASK)
 
 /* MAX77843 STATUS register*/
-#define STATUS1_ADC_SHIFT			0
-#define STATUS1_ADCERROR_SHIFT			6
-#define STATUS1_ADC1K_SHIFT			7
-#define STATUS2_CHGTYP_SHIFT			0
-#define STATUS2_CHGDETRUN_SHIFT			3
-#define STATUS2_DCDTMR_SHIFT			4
-#define STATUS2_DXOVP_SHIFT			5
-#define STATUS2_VBVOLT_SHIFT			6
-#define STATUS3_VBADC_SHIFT			0
-#define STATUS3_VDNMON_SHIFT			4
-#define STATUS3_DNRES_SHIFT			5
-#define STATUS3_MPNACK_SHIFT			6
-
-#define MAX77843_MUIC_STATUS1_ADC_MASK		(0x1f << STATUS1_ADC_SHIFT)
-#define MAX77843_MUIC_STATUS1_ADCERROR_MASK	BIT(STATUS1_ADCERROR_SHIFT)
-#define MAX77843_MUIC_STATUS1_ADC1K_MASK	BIT(STATUS1_ADC1K_SHIFT)
-#define MAX77843_MUIC_STATUS2_CHGTYP_MASK	(0x7 << STATUS2_CHGTYP_SHIFT)
-#define MAX77843_MUIC_STATUS2_CHGDETRUN_MASK	BIT(STATUS2_CHGDETRUN_SHIFT)
-#define MAX77843_MUIC_STATUS2_DCDTMR_MASK	BIT(STATUS2_DCDTMR_SHIFT)
-#define MAX77843_MUIC_STATUS2_DXOVP_MASK	BIT(STATUS2_DXOVP_SHIFT)
-#define MAX77843_MUIC_STATUS2_VBVOLT_MASK	BIT(STATUS2_VBVOLT_SHIFT)
-#define MAX77843_MUIC_STATUS3_VBADC_MASK	(0xf << STATUS3_VBADC_SHIFT)
-#define MAX77843_MUIC_STATUS3_VDNMON_MASK	BIT(STATUS3_VDNMON_SHIFT)
-#define MAX77843_MUIC_STATUS3_DNRES_MASK	BIT(STATUS3_DNRES_SHIFT)
-#define MAX77843_MUIC_STATUS3_MPNACK_MASK	BIT(STATUS3_MPNACK_SHIFT)
+#define MAX77843_MUIC_STATUS1_ADC_SHIFT		0
+#define MAX77843_MUIC_STATUS1_ADCERROR_SHIFT	6
+#define MAX77843_MUIC_STATUS1_ADC1K_SHIFT	7
+#define MAX77843_MUIC_STATUS2_CHGTYP_SHIFT	0
+#define MAX77843_MUIC_STATUS2_CHGDETRUN_SHIFT	3
+#define MAX77843_MUIC_STATUS2_DCDTMR_SHIFT	4
+#define MAX77843_MUIC_STATUS2_DXOVP_SHIFT	5
+#define MAX77843_MUIC_STATUS2_VBVOLT_SHIFT	6
+#define MAX77843_MUIC_STATUS3_VBADC_SHIFT	0
+#define MAX77843_MUIC_STATUS3_VDNMON_SHIFT	4
+#define MAX77843_MUIC_STATUS3_DNRES_SHIFT	5
+#define MAX77843_MUIC_STATUS3_MPNACK_SHIFT	6
+
+#define MAX77843_MUIC_STATUS1_ADC_MASK		(0x1f << MAX77843_MUIC_STATUS1_ADC_SHIFT)
+#define MAX77843_MUIC_STATUS1_ADCERROR_MASK	BIT(MAX77843_MUIC_STATUS1_ADCERROR_SHIFT)
+#define MAX77843_MUIC_STATUS1_ADC1K_MASK	BIT(MAX77843_MUIC_STATUS1_ADC1K_SHIFT)
+#define MAX77843_MUIC_STATUS2_CHGTYP_MASK	(0x7 << MAX77843_MUIC_STATUS2_CHGTYP_SHIFT)
+#define MAX77843_MUIC_STATUS2_CHGDETRUN_MASK	BIT(MAX77843_MUIC_STATUS2_CHGDETRUN_SHIFT)
+#define MAX77843_MUIC_STATUS2_DCDTMR_MASK	BIT(MAX77843_MUIC_STATUS2_DCDTMR_SHIFT)
+#define MAX77843_MUIC_STATUS2_DXOVP_MASK	BIT(MAX77843_MUIC_STATUS2_DXOVP_SHIFT)
+#define MAX77843_MUIC_STATUS2_VBVOLT_MASK	BIT(MAX77843_MUIC_STATUS2_VBVOLT_SHIFT)
+#define MAX77843_MUIC_STATUS3_VBADC_MASK	(0xf << MAX77843_MUIC_STATUS3_VBADC_SHIFT)
+#define MAX77843_MUIC_STATUS3_VDNMON_MASK	BIT(MAX77843_MUIC_STATUS3_VDNMON_SHIFT)
+#define MAX77843_MUIC_STATUS3_DNRES_MASK	BIT(MAX77843_MUIC_STATUS3_DNRES_SHIFT)
+#define MAX77843_MUIC_STATUS3_MPNACK_MASK	BIT(MAX77843_MUIC_STATUS3_MPNACK_SHIFT)
 
 /* MAX77843 CONTROL register */
-#define CONTROL1_COMP1SW_SHIFT			0
-#define CONTROL1_COMP2SW_SHIFT			3
-#define CONTROL1_IDBEN_SHIFT			7
-#define CONTROL2_LOWPWR_SHIFT			0
-#define CONTROL2_ADCEN_SHIFT			1
-#define CONTROL2_CPEN_SHIFT			2
-#define CONTROL2_ACC_DET_SHIFT			5
-#define CONTROL2_USBCPINT_SHIFT			6
-#define CONTROL2_RCPS_SHIFT			7
-#define CONTROL3_JIGSET_SHIFT			0
-#define CONTROL4_ADCDBSET_SHIFT			0
-#define CONTROL4_USBAUTO_SHIFT			4
-#define CONTROL4_FCTAUTO_SHIFT			5
-#define CONTROL4_ADCMODE_SHIFT			6
-
-#define MAX77843_MUIC_CONTROL1_COMP1SW_MASK	(0x7 << CONTROL1_COMP1SW_SHIFT)
-#define MAX77843_MUIC_CONTROL1_COMP2SW_MASK	(0x7 << CONTROL1_COMP2SW_SHIFT)
-#define MAX77843_MUIC_CONTROL1_IDBEN_MASK	BIT(CONTROL1_IDBEN_SHIFT)
-#define MAX77843_MUIC_CONTROL2_LOWPWR_MASK	BIT(CONTROL2_LOWPWR_SHIFT)
-#define MAX77843_MUIC_CONTROL2_ADCEN_MASK	BIT(CONTROL2_ADCEN_SHIFT)
-#define MAX77843_MUIC_CONTROL2_CPEN_MASK	BIT(CONTROL2_CPEN_SHIFT)
-#define MAX77843_MUIC_CONTROL2_ACC_DET_MASK	BIT(CONTROL2_ACC_DET_SHIFT)
-#define MAX77843_MUIC_CONTROL2_USBCPINT_MASK	BIT(CONTROL2_USBCPINT_SHIFT)
-#define MAX77843_MUIC_CONTROL2_RCPS_MASK	BIT(CONTROL2_RCPS_SHIFT)
-#define MAX77843_MUIC_CONTROL3_JIGSET_MASK	(0x3 << CONTROL3_JIGSET_SHIFT)
-#define MAX77843_MUIC_CONTROL4_ADCDBSET_MASK	(0x3 << CONTROL4_ADCDBSET_SHIFT)
-#define MAX77843_MUIC_CONTROL4_USBAUTO_MASK	BIT(CONTROL4_USBAUTO_SHIFT)
-#define MAX77843_MUIC_CONTROL4_FCTAUTO_MASK	BIT(CONTROL4_FCTAUTO_SHIFT)
-#define MAX77843_MUIC_CONTROL4_ADCMODE_MASK	(0x3 << CONTROL4_ADCMODE_SHIFT)
+#define MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT	0
+#define MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT	3
+#define MAX77843_MUIC_CONTROL1_IDBEN_SHIFT	7
+#define MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT	0
+#define MAX77843_MUIC_CONTROL2_ADCEN_SHIFT	1
+#define MAX77843_MUIC_CONTROL2_CPEN_SHIFT	2
+#define MAX77843_MUIC_CONTROL2_ACC_DET_SHIFT	5
+#define MAX77843_MUIC_CONTROL2_USBCPINT_SHIFT	6
+#define MAX77843_MUIC_CONTROL2_RCPS_SHIFT	7
+#define MAX77843_MUIC_CONTROL3_JIGSET_SHIFT	0
+#define MAX77843_MUIC_CONTROL4_ADCDBSET_SHIFT	0
+#define MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT	4
+#define MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT	5
+#define MAX77843_MUIC_CONTROL4_ADCMODE_SHIFT	6
+
+#define MAX77843_MUIC_CONTROL1_COMP1SW_MASK	(0x7 << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT)
+#define MAX77843_MUIC_CONTROL1_COMP2SW_MASK	(0x7 << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT)
+#define MAX77843_MUIC_CONTROL1_IDBEN_MASK	BIT(MAX77843_MUIC_CONTROL1_IDBEN_SHIFT)
+#define MAX77843_MUIC_CONTROL2_LOWPWR_MASK	BIT(MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT)
+#define MAX77843_MUIC_CONTROL2_ADCEN_MASK	BIT(MAX77843_MUIC_CONTROL2_ADCEN_SHIFT)
+#define MAX77843_MUIC_CONTROL2_CPEN_MASK	BIT(MAX77843_MUIC_CONTROL2_CPEN_SHIFT)
+#define MAX77843_MUIC_CONTROL2_ACC_DET_MASK	BIT(MAX77843_MUIC_CONTROL2_ACC_DET_SHIFT)
+#define MAX77843_MUIC_CONTROL2_USBCPINT_MASK	BIT(MAX77843_MUIC_CONTROL2_USBCPINT_SHIFT)
+#define MAX77843_MUIC_CONTROL2_RCPS_MASK	BIT(MAX77843_MUIC_CONTROL2_RCPS_SHIFT)
+#define MAX77843_MUIC_CONTROL3_JIGSET_MASK	(0x3 << MAX77843_MUIC_CONTROL3_JIGSET_SHIFT)
+#define MAX77843_MUIC_CONTROL4_ADCDBSET_MASK	(0x3 << MAX77843_MUIC_CONTROL4_ADCDBSET_SHIFT)
+#define MAX77843_MUIC_CONTROL4_USBAUTO_MASK	BIT(MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT)
+#define MAX77843_MUIC_CONTROL4_FCTAUTO_MASK	BIT(MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT)
+#define MAX77843_MUIC_CONTROL4_ADCMODE_MASK	(0x3 << MAX77843_MUIC_CONTROL4_ADCMODE_SHIFT)
 
 /* MAX77843 switch port */
 #define COM_OPEN				0
@@ -383,38 +383,38 @@ enum max77843_irq_muic {
 #define COM_AUX_USB				4
 #define COM_AUX_UART				5
 
-#define CONTROL1_COM_SW \
+#define MAX77843_MUIC_CONTROL1_COM_SW \
 	((MAX77843_MUIC_CONTROL1_COMP1SW_MASK | \
 	 MAX77843_MUIC_CONTROL1_COMP2SW_MASK))
 
-#define CONTROL1_SW_OPEN \
-	((COM_OPEN << CONTROL1_COMP1SW_SHIFT | \
-	 COM_OPEN << CONTROL1_COMP2SW_SHIFT))
-#define CONTROL1_SW_USB \
-	((COM_USB << CONTROL1_COMP1SW_SHIFT | \
-	 COM_USB << CONTROL1_COMP2SW_SHIFT))
-#define CONTROL1_SW_AUDIO \
-	((COM_AUDIO << CONTROL1_COMP1SW_SHIFT | \
-	 COM_AUDIO << CONTROL1_COMP2SW_SHIFT))
-#define CONTROL1_SW_UART \
-	((COM_UART << CONTROL1_COMP1SW_SHIFT | \
-	 COM_UART << CONTROL1_COMP2SW_SHIFT))
-#define CONTROL1_SW_AUX_USB \
-	((COM_AUX_USB << CONTROL1_COMP1SW_SHIFT | \
-	 COM_AUX_USB << CONTROL1_COMP2SW_SHIFT))
-#define CONTROL1_SW_AUX_UART \
-	((COM_AUX_UART << CONTROL1_COMP1SW_SHIFT | \
-	 COM_AUX_UART << CONTROL1_COMP2SW_SHIFT))
+#define MAX77843_MUIC_CONTROL1_SW_OPEN \
+	((COM_OPEN << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
+	 COM_OPEN << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
+#define MAX77843_MUIC_CONTROL1_SW_USB \
+	((COM_USB << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
+	 COM_USB << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
+#define MAX77843_MUIC_CONTROL1_SW_AUDIO \
+	((COM_AUDIO << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
+	 COM_AUDIO << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
+#define MAX77843_MUIC_CONTROL1_SW_UART \
+	((COM_UART << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
+	 COM_UART << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
+#define MAX77843_MUIC_CONTROL1_SW_AUX_USB \
+	((COM_AUX_USB << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
+	 COM_AUX_USB << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
+#define MAX77843_MUIC_CONTROL1_SW_AUX_UART \
+	((COM_AUX_UART << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
+	 COM_AUX_UART << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
 
 #define MAX77843_DISABLE			0
 #define MAX77843_ENABLE				1
 
 #define CONTROL4_AUTO_DISABLE \
-	((MAX77843_DISABLE << CONTROL4_USBAUTO_SHIFT) | \
-	(MAX77843_DISABLE << CONTROL4_FCTAUTO_SHIFT))
+	((MAX77843_DISABLE << MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT) | \
+	(MAX77843_DISABLE << MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT))
 #define CONTROL4_AUTO_ENABLE \
-	((MAX77843_ENABLE << CONTROL4_USBAUTO_SHIFT) | \
-	(MAX77843_ENABLE << CONTROL4_FCTAUTO_SHIFT))
+	((MAX77843_ENABLE << MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT) | \
+	(MAX77843_ENABLE << MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT))
 
 /* MAX77843 SAFEOUT LDO Control register */
 #define SAFEOUTCTRL_SAFEOUT1_SHIFT		0
-- 
2.1.4


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

* [PATCH 09/10] regulator: max77693: Add support for MAX77843 device
  2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2015-04-29 10:58 ` [PATCH 08/10] mfd/extcon: max77843: Rename defines to allow inclusion with max77693 Krzysztof Kozlowski
@ 2015-04-29 10:58 ` Krzysztof Kozlowski
  2015-04-29 17:58   ` Mark Brown
  8 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-29 10:58 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, Mark Brown, linux-kernel,
	linux-input, linux-pm
  Cc: Krzysztof Kozlowski

The charger and safeout part of MAX77843 is almost the same as MAX77693.
>From regulator point of view the only differences are the constraints
and register values related to these constraints. Now the max77693
regulator driver can be used for MAX77843.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
---
 drivers/regulator/Kconfig    |   8 +--
 drivers/regulator/max77693.c | 125 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 117 insertions(+), 16 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index a6f116aa5235..7bf6365eb0d3 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -397,13 +397,13 @@ config REGULATOR_MAX77686
 	  Exynos-4 chips to control VARM and VINT voltages.
 
 config REGULATOR_MAX77693
-	tristate "Maxim MAX77693 regulator"
-	depends on MFD_MAX77693
+	tristate "Maxim 77693/77843 regulator"
+	depends on (MFD_MAX77693 || MFD_MAX77843)
 	help
-	  This driver controls a Maxim 77693 regulator via I2C bus.
+	  This driver controls a Maxim 77693/77843 regulators via I2C bus.
 	  The regulators include two LDOs, 'SAFEOUT1', 'SAFEOUT2'
 	  and one current regulator 'CHARGER'. This is suitable for
-	  Exynos-4x12 chips.
+	  Exynos-4x12 (MAX77693) or Exynos5433 (MAX77843) SoC chips.
 
 config REGULATOR_MAX77802
 	tristate "Maxim 77802 regulator"
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index 5b30dc42679c..918745d1c5e4 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -1,8 +1,9 @@
 /*
- * max77693.c - Regulator driver for the Maxim 77693
+ * max77693.c - Regulator driver for the Maxim 77693 and 77843
  *
- * Copyright (C) 2013 Samsung Electronics
+ * Copyright (C) 2013-2015 Samsung Electronics
  * Jonghwa Lee <jonghwa3.lee@samsung.com>
+ * Krzysztof Kozlowski <k.kozlowski.k@gmail.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
@@ -30,11 +31,24 @@
 #include <linux/regulator/machine.h>
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77843-private.h>
 #include <linux/mfd/max77693-common.h>
 #include <linux/regulator/of_regulator.h>
 #include <linux/regmap.h>
 
-/* Charger regulator differences between MAX77693 and MAX77843 */
+/*
+ * ID for MAX77843 regulators.
+ * There is no need for such for MAX77693.
+ */
+enum max77843_regulator_type {
+	MAX77843_SAFEOUT1 = 0,
+	MAX77843_SAFEOUT2,
+	MAX77843_CHARGER,
+
+	MAX77843_NUM,
+};
+
+/* Register differences between chargers: MAX77693 and MAX77843 */
 struct chg_reg_data {
 	unsigned int linear_reg;
 	unsigned int linear_mask;
@@ -43,9 +57,14 @@ struct chg_reg_data {
 };
 
 /*
- * CHARGER regulator - Min : 20mA, Max : 2580mA, step : 20mA
+ * MAX77693 CHARGER regulator - Min : 20mA, Max : 2580mA, step : 20mA
  * 0x00, 0x01, 0x2, 0x03	= 60 mA
  * 0x04 ~ 0x7E			= (60 + (X - 3) * 20) mA
+ * Actually for MAX77693 the driver manipulates the maximum input current,
+ * not the fast charge current (output). This should be fixed.
+ *
+ * On MAX77843 the calculation formula is the same (except values).
+ * Fortunately it properly manipulates the fast charge current.
  */
 static int max77693_chg_get_current_limit(struct regulator_dev *rdev)
 {
@@ -95,6 +114,26 @@ static int max77693_chg_set_current_limit(struct regulator_dev *rdev,
 }
 /* end of CHARGER regulator ops */
 
+/* Returns regmap suitable for given regulator on chosen device */
+static struct regmap *max77693_get_regmap(enum max77693_types type,
+					  struct max77693_dev *max77693,
+					  int reg_id)
+{
+	if (type == TYPE_MAX77693)
+		return max77693->regmap;
+
+	/* Else: TYPE_MAX77843 */
+	switch (reg_id) {
+	case MAX77843_SAFEOUT1:
+	case MAX77843_SAFEOUT2:
+		return max77693->regmap;
+	case MAX77843_CHARGER:
+		return max77693->regmap_chg;
+	default:
+		return max77693->regmap;
+	}
+}
+
 static const unsigned int max77693_safeout_table[] = {
 	4850000,
 	4900000,
@@ -119,7 +158,7 @@ static struct regulator_ops max77693_charger_ops = {
 	.set_current_limit	= max77693_chg_set_current_limit,
 };
 
-#define regulator_desc_esafeout(_num)	{			\
+#define max77693_regulator_desc_esafeout(_num)	{		\
 	.name		= "ESAFEOUT"#_num,			\
 	.id		= MAX77693_ESAFEOUT##_num,		\
 	.of_match	= of_match_ptr("ESAFEOUT"#_num),	\
@@ -135,9 +174,9 @@ static struct regulator_ops max77693_charger_ops = {
 	.enable_mask	= SAFEOUT_CTRL_ENSAFEOUT##_num##_MASK ,	\
 }
 
-static const struct regulator_desc regulators[] = {
-	regulator_desc_esafeout(1),
-	regulator_desc_esafeout(2),
+static const struct regulator_desc max77693_supported_regulators[] = {
+	max77693_regulator_desc_esafeout(1),
+	max77693_regulator_desc_esafeout(2),
 	{
 		.name = "CHARGER",
 		.id = MAX77693_CHARGER,
@@ -160,19 +199,79 @@ static const struct chg_reg_data max77693_chg_reg_data = {
 	.min_sel	= 3,
 };
 
+#define	max77843_regulator_desc_esafeout(num)	{			\
+	.name		= "SAFEOUT" # num,				\
+	.id		= MAX77843_SAFEOUT ## num,			\
+	.ops		= &max77693_safeout_ops,			\
+	.of_match	= of_match_ptr("SAFEOUT" # num),		\
+	.regulators_node = of_match_ptr("regulators"),			\
+	.type		= REGULATOR_VOLTAGE,				\
+	.owner		= THIS_MODULE,					\
+	.n_voltages	= ARRAY_SIZE(max77693_safeout_table),		\
+	.volt_table	= max77693_safeout_table,			\
+	.enable_reg	= MAX77843_SYS_REG_SAFEOUTCTRL,			\
+	.enable_mask	= MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT ## num,	\
+	.vsel_reg	= MAX77843_SYS_REG_SAFEOUTCTRL,			\
+	.vsel_mask	= MAX77843_REG_SAFEOUTCTRL_SAFEOUT ## num ## _MASK, \
+}
+
+static const struct regulator_desc max77843_supported_regulators[] = {
+	[MAX77843_SAFEOUT1] = max77843_regulator_desc_esafeout(1),
+	[MAX77843_SAFEOUT2] = max77843_regulator_desc_esafeout(2),
+	[MAX77843_CHARGER] = {
+		.name		= "CHARGER",
+		.id		= MAX77843_CHARGER,
+		.ops		= &max77693_charger_ops,
+		.of_match	= of_match_ptr("CHARGER"),
+		.regulators_node = of_match_ptr("regulators"),
+		.type		= REGULATOR_CURRENT,
+		.owner		= THIS_MODULE,
+		.enable_reg	= MAX77843_CHG_REG_CHG_CNFG_00,
+		.enable_mask	= MAX77843_CHG_MASK,
+		.enable_val	= MAX77843_CHG_MASK,
+	},
+};
+
+static const struct chg_reg_data max77843_chg_reg_data = {
+	.linear_reg	= MAX77843_CHG_REG_CHG_CNFG_02,
+	.linear_mask	= MAX77843_CHG_FAST_CHG_CURRENT_MASK,
+	.uA_step	= MAX77843_CHG_FAST_CHG_CURRENT_STEP,
+	.min_sel	= 2,
+};
+
 static int max77693_pmic_probe(struct platform_device *pdev)
 {
+	enum max77693_types type = platform_get_device_id(pdev)->driver_data;
 	struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent);
+	const struct regulator_desc *regulators;
+	unsigned int regulators_size;
 	int i;
 	struct regulator_config config = { };
 
 	config.dev = iodev->dev;
-	config.regmap = iodev->regmap;
-	config.driver_data = (void *)&max77693_chg_reg_data;
 
-	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
+	switch (type) {
+	case TYPE_MAX77693:
+		regulators = max77693_supported_regulators;
+		regulators_size = ARRAY_SIZE(max77693_supported_regulators);
+		config.driver_data = (void *)&max77693_chg_reg_data;
+		break;
+	case TYPE_MAX77843:
+		regulators = max77843_supported_regulators;
+		regulators_size = ARRAY_SIZE(max77843_supported_regulators);
+		config.driver_data = (void *)&max77843_chg_reg_data;
+		break;
+	default:
+		dev_err(&pdev->dev, "Unsupported device type: %u\n", type);
+		return -ENODEV;
+	}
+
+	for (i = 0; i < regulators_size; i++) {
 		struct regulator_dev *rdev;
 
+		config.regmap = max77693_get_regmap(type, iodev,
+						    regulators[i].id);
+
 		rdev = devm_regulator_register(&pdev->dev,
 						&regulators[i], &config);
 		if (IS_ERR(rdev)) {
@@ -187,6 +286,7 @@ static int max77693_pmic_probe(struct platform_device *pdev)
 
 static const struct platform_device_id max77693_pmic_id[] = {
 	{ "max77693-pmic", TYPE_MAX77693 },
+	{ "max77843-regulator", TYPE_MAX77843 },
 	{},
 };
 
@@ -202,6 +302,7 @@ static struct platform_driver max77693_pmic_driver = {
 
 module_platform_driver(max77693_pmic_driver);
 
-MODULE_DESCRIPTION("MAXIM MAX77693 regulator driver");
+MODULE_DESCRIPTION("MAXIM 77693/77843 regulator driver");
 MODULE_AUTHOR("Jonghwa Lee <jonghwa3.lee@samsung.com>");
+MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski.k@gmail.com>");
 MODULE_LICENSE("GPL");
-- 
2.1.4


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

* Re: [PATCH 03/10] regulator: max77693: Use core code for charger's is_enabled
  2015-04-29 10:58 ` [PATCH 03/10] regulator: max77693: Use core code for charger's is_enabled Krzysztof Kozlowski
@ 2015-04-29 11:03   ` Mark Brown
  2015-04-29 11:08     ` Krzysztof Kozłowski
  0 siblings, 1 reply; 24+ messages in thread
From: Mark Brown @ 2015-04-29 11:03 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, linux-kernel, linux-input,
	linux-pm

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

On Wed, Apr 29, 2015 at 07:58:28PM +0900, Krzysztof Kozlowski wrote:
> The custom implementation of 'regulator_ops.is_enabled' callback for
> charger regulator is exactly the same as regulator_is_enabled_regmap()
> with 'enable_val' set.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 03/10] regulator: max77693: Use core code for charger's is_enabled
  2015-04-29 11:03   ` Mark Brown
@ 2015-04-29 11:08     ` Krzysztof Kozłowski
  0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozłowski @ 2015-04-29 11:08 UTC (permalink / raw)
  To: Mark Brown
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, linux-kernel, linux-input,
	linux-pm

2015-04-29 20:03 GMT+09:00 Mark Brown <broonie@kernel.org>:
> On Wed, Apr 29, 2015 at 07:58:28PM +0900, Krzysztof Kozlowski wrote:
>> The custom implementation of 'regulator_ops.is_enabled' callback for
>> charger regulator is exactly the same as regulator_is_enabled_regmap()
>> with 'enable_val' set.
>
> Applied, thanks.

Woo! That was fast... Thank you!

Best regards,
Krzysztof

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

* Re: [PATCH 08/10] mfd/extcon: max77843: Rename defines to allow inclusion with max77693
  2015-04-29 10:58 ` [PATCH 08/10] mfd/extcon: max77843: Rename defines to allow inclusion with max77693 Krzysztof Kozlowski
@ 2015-04-29 13:11   ` Lee Jones
  0 siblings, 0 replies; 24+ messages in thread
From: Lee Jones @ 2015-04-29 13:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

On Wed, 29 Apr 2015, Krzysztof Kozlowski wrote:

> Add MAX77843_MUIC prefix to some of the defines used in max77843 extcon
> driver so the max77693-private.h can be included simultaneously with
> max77843-private.h.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> ---
>  drivers/extcon/extcon-max77843.c     |  59 ++++++++++----
>  include/linux/mfd/max77843-private.h | 154 +++++++++++++++++------------------

For the MFD changes:

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

>  2 files changed, 118 insertions(+), 95 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
> index fec26128ecfc..614f1996c51b 100644
> --- a/drivers/extcon/extcon-max77843.c
> +++ b/drivers/extcon/extcon-max77843.c
> @@ -226,11 +226,11 @@ static int max77843_muic_set_path(struct max77843_muic_info *info,
>  	if (attached)
>  		ctrl1 = val;
>  	else
> -		ctrl1 = CONTROL1_SW_OPEN;
> +		ctrl1 = MAX77843_MUIC_CONTROL1_SW_OPEN;
>  
>  	ret = regmap_update_bits(max77843->regmap_muic,
>  			MAX77843_MUIC_REG_CONTROL1,
> -			CONTROL1_COM_SW, ctrl1);
> +			MAX77843_MUIC_CONTROL1_COM_SW, ctrl1);
>  	if (ret < 0) {
>  		dev_err(info->dev, "Cannot switch MUIC port\n");
>  		return ret;
> @@ -264,7 +264,7 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
>  
>  	adc = info->status[MAX77843_MUIC_STATUS1] &
>  			MAX77843_MUIC_STATUS1_ADC_MASK;
> -	adc >>= STATUS1_ADC_SHIFT;
> +	adc >>= MAX77843_MUIC_STATUS1_ADC_SHIFT;
>  
>  	switch (group) {
>  	case MAX77843_CABLE_GROUP_ADC:
> @@ -330,7 +330,7 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
>  			/* Get VBVolt register bit */
>  			gnd_type |= (info->status[MAX77843_MUIC_STATUS2] &
>  					MAX77843_MUIC_STATUS2_VBVOLT_MASK);
> -			gnd_type >>= STATUS2_VBVOLT_SHIFT;
> +			gnd_type >>= MAX77843_MUIC_STATUS2_VBVOLT_SHIFT;
>  
>  			/* Offset of GND cable */
>  			gnd_type |= MAX77843_MUIC_GND_USB_HOST;
> @@ -359,7 +359,9 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
>  	switch (gnd_cable_type) {
>  	case MAX77843_MUIC_GND_USB_HOST:
>  	case MAX77843_MUIC_GND_USB_HOST_VB:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_USB,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  
> @@ -367,7 +369,9 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
>  		break;
>  	case MAX77843_MUIC_GND_MHL_VB:
>  	case MAX77843_MUIC_GND_MHL:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_OPEN,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  
> @@ -392,25 +396,33 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info,
>  
>  	switch (cable_type) {
>  	case MAX77843_MUIC_ADC_FACTORY_MODE_USB_OFF:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_USB,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  		extcon_set_cable_state(info->edev, "JIG-USB-OFF", attached);
>  		break;
>  	case MAX77843_MUIC_ADC_FACTORY_MODE_USB_ON:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_USB,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  		extcon_set_cable_state(info->edev, "JIG-USB-ON", attached);
>  		break;
>  	case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_UART, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_UART,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  		extcon_set_cable_state(info->edev, "JIG-UART-OFF", attached);
>  		break;
>  	default:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_OPEN,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  		break;
> @@ -502,14 +514,18 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
>  
>  	switch (chg_type) {
>  	case MAX77843_MUIC_CHG_USB:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_USB,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  
>  		extcon_set_cable_state(info->edev, "USB", attached);
>  		break;
>  	case MAX77843_MUIC_CHG_DOWNSTREAM:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_OPEN,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  
> @@ -517,21 +533,27 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
>  				"CHARGER-DOWNSTREAM", attached);
>  		break;
>  	case MAX77843_MUIC_CHG_DEDICATED:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_OPEN,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  
>  		extcon_set_cable_state(info->edev, "TA", attached);
>  		break;
>  	case MAX77843_MUIC_CHG_SPECIAL_500MA:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_OPEN,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  
>  		extcon_set_cable_state(info->edev, "SLOW-CHAREGER", attached);
>  		break;
>  	case MAX77843_MUIC_CHG_SPECIAL_1A:
> -		ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
> +		ret = max77843_muic_set_path(info,
> +					     MAX77843_MUIC_CONTROL1_SW_OPEN,
> +					     attached);
>  		if (ret < 0)
>  			return ret;
>  
> @@ -554,7 +576,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
>  			"failed to detect %s accessory (chg_type:0x%x)\n",
>  			attached ? "attached" : "detached", chg_type);
>  
> -		max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached);
> +		max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_OPEN,
> +				       attached);
>  		return -EINVAL;
>  	}
>  
> @@ -693,7 +716,7 @@ static int max77843_muic_set_debounce_time(struct max77843_muic_info *info,
>  		ret = regmap_update_bits(max77843->regmap_muic,
>  				MAX77843_MUIC_REG_CONTROL4,
>  				MAX77843_MUIC_CONTROL4_ADCDBSET_MASK,
> -				time << CONTROL4_ADCDBSET_SHIFT);
> +				time << MAX77843_MUIC_CONTROL4_ADCDBSET_SHIFT);
>  		if (ret < 0) {
>  			dev_err(info->dev, "Cannot write MUIC regmap\n");
>  			return ret;
> @@ -794,7 +817,7 @@ static int max77843_muic_probe(struct platform_device *pdev)
>  	max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS);
>  
>  	/* Set initial path for UART */
> -	max77843_muic_set_path(info, CONTROL1_SW_UART, true);
> +	max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true);
>  
>  	/* Check revision number of MUIC device */
>  	ret = regmap_read(max77843->regmap_muic, MAX77843_MUIC_REG_ID, &id);
> diff --git a/include/linux/mfd/max77843-private.h b/include/linux/mfd/max77843-private.h
> index 0121d9440340..c19303b0ccfd 100644
> --- a/include/linux/mfd/max77843-private.h
> +++ b/include/linux/mfd/max77843-private.h
> @@ -318,62 +318,62 @@ enum max77843_irq_muic {
>  	MAX77843_INTSRCMASK_SYS_MASK | MAX77843_INTSRCMASK_CHGR_MASK)
>  
>  /* MAX77843 STATUS register*/
> -#define STATUS1_ADC_SHIFT			0
> -#define STATUS1_ADCERROR_SHIFT			6
> -#define STATUS1_ADC1K_SHIFT			7
> -#define STATUS2_CHGTYP_SHIFT			0
> -#define STATUS2_CHGDETRUN_SHIFT			3
> -#define STATUS2_DCDTMR_SHIFT			4
> -#define STATUS2_DXOVP_SHIFT			5
> -#define STATUS2_VBVOLT_SHIFT			6
> -#define STATUS3_VBADC_SHIFT			0
> -#define STATUS3_VDNMON_SHIFT			4
> -#define STATUS3_DNRES_SHIFT			5
> -#define STATUS3_MPNACK_SHIFT			6
> -
> -#define MAX77843_MUIC_STATUS1_ADC_MASK		(0x1f << STATUS1_ADC_SHIFT)
> -#define MAX77843_MUIC_STATUS1_ADCERROR_MASK	BIT(STATUS1_ADCERROR_SHIFT)
> -#define MAX77843_MUIC_STATUS1_ADC1K_MASK	BIT(STATUS1_ADC1K_SHIFT)
> -#define MAX77843_MUIC_STATUS2_CHGTYP_MASK	(0x7 << STATUS2_CHGTYP_SHIFT)
> -#define MAX77843_MUIC_STATUS2_CHGDETRUN_MASK	BIT(STATUS2_CHGDETRUN_SHIFT)
> -#define MAX77843_MUIC_STATUS2_DCDTMR_MASK	BIT(STATUS2_DCDTMR_SHIFT)
> -#define MAX77843_MUIC_STATUS2_DXOVP_MASK	BIT(STATUS2_DXOVP_SHIFT)
> -#define MAX77843_MUIC_STATUS2_VBVOLT_MASK	BIT(STATUS2_VBVOLT_SHIFT)
> -#define MAX77843_MUIC_STATUS3_VBADC_MASK	(0xf << STATUS3_VBADC_SHIFT)
> -#define MAX77843_MUIC_STATUS3_VDNMON_MASK	BIT(STATUS3_VDNMON_SHIFT)
> -#define MAX77843_MUIC_STATUS3_DNRES_MASK	BIT(STATUS3_DNRES_SHIFT)
> -#define MAX77843_MUIC_STATUS3_MPNACK_MASK	BIT(STATUS3_MPNACK_SHIFT)
> +#define MAX77843_MUIC_STATUS1_ADC_SHIFT		0
> +#define MAX77843_MUIC_STATUS1_ADCERROR_SHIFT	6
> +#define MAX77843_MUIC_STATUS1_ADC1K_SHIFT	7
> +#define MAX77843_MUIC_STATUS2_CHGTYP_SHIFT	0
> +#define MAX77843_MUIC_STATUS2_CHGDETRUN_SHIFT	3
> +#define MAX77843_MUIC_STATUS2_DCDTMR_SHIFT	4
> +#define MAX77843_MUIC_STATUS2_DXOVP_SHIFT	5
> +#define MAX77843_MUIC_STATUS2_VBVOLT_SHIFT	6
> +#define MAX77843_MUIC_STATUS3_VBADC_SHIFT	0
> +#define MAX77843_MUIC_STATUS3_VDNMON_SHIFT	4
> +#define MAX77843_MUIC_STATUS3_DNRES_SHIFT	5
> +#define MAX77843_MUIC_STATUS3_MPNACK_SHIFT	6
> +
> +#define MAX77843_MUIC_STATUS1_ADC_MASK		(0x1f << MAX77843_MUIC_STATUS1_ADC_SHIFT)
> +#define MAX77843_MUIC_STATUS1_ADCERROR_MASK	BIT(MAX77843_MUIC_STATUS1_ADCERROR_SHIFT)
> +#define MAX77843_MUIC_STATUS1_ADC1K_MASK	BIT(MAX77843_MUIC_STATUS1_ADC1K_SHIFT)
> +#define MAX77843_MUIC_STATUS2_CHGTYP_MASK	(0x7 << MAX77843_MUIC_STATUS2_CHGTYP_SHIFT)
> +#define MAX77843_MUIC_STATUS2_CHGDETRUN_MASK	BIT(MAX77843_MUIC_STATUS2_CHGDETRUN_SHIFT)
> +#define MAX77843_MUIC_STATUS2_DCDTMR_MASK	BIT(MAX77843_MUIC_STATUS2_DCDTMR_SHIFT)
> +#define MAX77843_MUIC_STATUS2_DXOVP_MASK	BIT(MAX77843_MUIC_STATUS2_DXOVP_SHIFT)
> +#define MAX77843_MUIC_STATUS2_VBVOLT_MASK	BIT(MAX77843_MUIC_STATUS2_VBVOLT_SHIFT)
> +#define MAX77843_MUIC_STATUS3_VBADC_MASK	(0xf << MAX77843_MUIC_STATUS3_VBADC_SHIFT)
> +#define MAX77843_MUIC_STATUS3_VDNMON_MASK	BIT(MAX77843_MUIC_STATUS3_VDNMON_SHIFT)
> +#define MAX77843_MUIC_STATUS3_DNRES_MASK	BIT(MAX77843_MUIC_STATUS3_DNRES_SHIFT)
> +#define MAX77843_MUIC_STATUS3_MPNACK_MASK	BIT(MAX77843_MUIC_STATUS3_MPNACK_SHIFT)
>  
>  /* MAX77843 CONTROL register */
> -#define CONTROL1_COMP1SW_SHIFT			0
> -#define CONTROL1_COMP2SW_SHIFT			3
> -#define CONTROL1_IDBEN_SHIFT			7
> -#define CONTROL2_LOWPWR_SHIFT			0
> -#define CONTROL2_ADCEN_SHIFT			1
> -#define CONTROL2_CPEN_SHIFT			2
> -#define CONTROL2_ACC_DET_SHIFT			5
> -#define CONTROL2_USBCPINT_SHIFT			6
> -#define CONTROL2_RCPS_SHIFT			7
> -#define CONTROL3_JIGSET_SHIFT			0
> -#define CONTROL4_ADCDBSET_SHIFT			0
> -#define CONTROL4_USBAUTO_SHIFT			4
> -#define CONTROL4_FCTAUTO_SHIFT			5
> -#define CONTROL4_ADCMODE_SHIFT			6
> -
> -#define MAX77843_MUIC_CONTROL1_COMP1SW_MASK	(0x7 << CONTROL1_COMP1SW_SHIFT)
> -#define MAX77843_MUIC_CONTROL1_COMP2SW_MASK	(0x7 << CONTROL1_COMP2SW_SHIFT)
> -#define MAX77843_MUIC_CONTROL1_IDBEN_MASK	BIT(CONTROL1_IDBEN_SHIFT)
> -#define MAX77843_MUIC_CONTROL2_LOWPWR_MASK	BIT(CONTROL2_LOWPWR_SHIFT)
> -#define MAX77843_MUIC_CONTROL2_ADCEN_MASK	BIT(CONTROL2_ADCEN_SHIFT)
> -#define MAX77843_MUIC_CONTROL2_CPEN_MASK	BIT(CONTROL2_CPEN_SHIFT)
> -#define MAX77843_MUIC_CONTROL2_ACC_DET_MASK	BIT(CONTROL2_ACC_DET_SHIFT)
> -#define MAX77843_MUIC_CONTROL2_USBCPINT_MASK	BIT(CONTROL2_USBCPINT_SHIFT)
> -#define MAX77843_MUIC_CONTROL2_RCPS_MASK	BIT(CONTROL2_RCPS_SHIFT)
> -#define MAX77843_MUIC_CONTROL3_JIGSET_MASK	(0x3 << CONTROL3_JIGSET_SHIFT)
> -#define MAX77843_MUIC_CONTROL4_ADCDBSET_MASK	(0x3 << CONTROL4_ADCDBSET_SHIFT)
> -#define MAX77843_MUIC_CONTROL4_USBAUTO_MASK	BIT(CONTROL4_USBAUTO_SHIFT)
> -#define MAX77843_MUIC_CONTROL4_FCTAUTO_MASK	BIT(CONTROL4_FCTAUTO_SHIFT)
> -#define MAX77843_MUIC_CONTROL4_ADCMODE_MASK	(0x3 << CONTROL4_ADCMODE_SHIFT)
> +#define MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT	0
> +#define MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT	3
> +#define MAX77843_MUIC_CONTROL1_IDBEN_SHIFT	7
> +#define MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT	0
> +#define MAX77843_MUIC_CONTROL2_ADCEN_SHIFT	1
> +#define MAX77843_MUIC_CONTROL2_CPEN_SHIFT	2
> +#define MAX77843_MUIC_CONTROL2_ACC_DET_SHIFT	5
> +#define MAX77843_MUIC_CONTROL2_USBCPINT_SHIFT	6
> +#define MAX77843_MUIC_CONTROL2_RCPS_SHIFT	7
> +#define MAX77843_MUIC_CONTROL3_JIGSET_SHIFT	0
> +#define MAX77843_MUIC_CONTROL4_ADCDBSET_SHIFT	0
> +#define MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT	4
> +#define MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT	5
> +#define MAX77843_MUIC_CONTROL4_ADCMODE_SHIFT	6
> +
> +#define MAX77843_MUIC_CONTROL1_COMP1SW_MASK	(0x7 << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT)
> +#define MAX77843_MUIC_CONTROL1_COMP2SW_MASK	(0x7 << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT)
> +#define MAX77843_MUIC_CONTROL1_IDBEN_MASK	BIT(MAX77843_MUIC_CONTROL1_IDBEN_SHIFT)
> +#define MAX77843_MUIC_CONTROL2_LOWPWR_MASK	BIT(MAX77843_MUIC_CONTROL2_LOWPWR_SHIFT)
> +#define MAX77843_MUIC_CONTROL2_ADCEN_MASK	BIT(MAX77843_MUIC_CONTROL2_ADCEN_SHIFT)
> +#define MAX77843_MUIC_CONTROL2_CPEN_MASK	BIT(MAX77843_MUIC_CONTROL2_CPEN_SHIFT)
> +#define MAX77843_MUIC_CONTROL2_ACC_DET_MASK	BIT(MAX77843_MUIC_CONTROL2_ACC_DET_SHIFT)
> +#define MAX77843_MUIC_CONTROL2_USBCPINT_MASK	BIT(MAX77843_MUIC_CONTROL2_USBCPINT_SHIFT)
> +#define MAX77843_MUIC_CONTROL2_RCPS_MASK	BIT(MAX77843_MUIC_CONTROL2_RCPS_SHIFT)
> +#define MAX77843_MUIC_CONTROL3_JIGSET_MASK	(0x3 << MAX77843_MUIC_CONTROL3_JIGSET_SHIFT)
> +#define MAX77843_MUIC_CONTROL4_ADCDBSET_MASK	(0x3 << MAX77843_MUIC_CONTROL4_ADCDBSET_SHIFT)
> +#define MAX77843_MUIC_CONTROL4_USBAUTO_MASK	BIT(MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT)
> +#define MAX77843_MUIC_CONTROL4_FCTAUTO_MASK	BIT(MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT)
> +#define MAX77843_MUIC_CONTROL4_ADCMODE_MASK	(0x3 << MAX77843_MUIC_CONTROL4_ADCMODE_SHIFT)
>  
>  /* MAX77843 switch port */
>  #define COM_OPEN				0
> @@ -383,38 +383,38 @@ enum max77843_irq_muic {
>  #define COM_AUX_USB				4
>  #define COM_AUX_UART				5
>  
> -#define CONTROL1_COM_SW \
> +#define MAX77843_MUIC_CONTROL1_COM_SW \
>  	((MAX77843_MUIC_CONTROL1_COMP1SW_MASK | \
>  	 MAX77843_MUIC_CONTROL1_COMP2SW_MASK))
>  
> -#define CONTROL1_SW_OPEN \
> -	((COM_OPEN << CONTROL1_COMP1SW_SHIFT | \
> -	 COM_OPEN << CONTROL1_COMP2SW_SHIFT))
> -#define CONTROL1_SW_USB \
> -	((COM_USB << CONTROL1_COMP1SW_SHIFT | \
> -	 COM_USB << CONTROL1_COMP2SW_SHIFT))
> -#define CONTROL1_SW_AUDIO \
> -	((COM_AUDIO << CONTROL1_COMP1SW_SHIFT | \
> -	 COM_AUDIO << CONTROL1_COMP2SW_SHIFT))
> -#define CONTROL1_SW_UART \
> -	((COM_UART << CONTROL1_COMP1SW_SHIFT | \
> -	 COM_UART << CONTROL1_COMP2SW_SHIFT))
> -#define CONTROL1_SW_AUX_USB \
> -	((COM_AUX_USB << CONTROL1_COMP1SW_SHIFT | \
> -	 COM_AUX_USB << CONTROL1_COMP2SW_SHIFT))
> -#define CONTROL1_SW_AUX_UART \
> -	((COM_AUX_UART << CONTROL1_COMP1SW_SHIFT | \
> -	 COM_AUX_UART << CONTROL1_COMP2SW_SHIFT))
> +#define MAX77843_MUIC_CONTROL1_SW_OPEN \
> +	((COM_OPEN << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
> +	 COM_OPEN << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
> +#define MAX77843_MUIC_CONTROL1_SW_USB \
> +	((COM_USB << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
> +	 COM_USB << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
> +#define MAX77843_MUIC_CONTROL1_SW_AUDIO \
> +	((COM_AUDIO << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
> +	 COM_AUDIO << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
> +#define MAX77843_MUIC_CONTROL1_SW_UART \
> +	((COM_UART << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
> +	 COM_UART << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
> +#define MAX77843_MUIC_CONTROL1_SW_AUX_USB \
> +	((COM_AUX_USB << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
> +	 COM_AUX_USB << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
> +#define MAX77843_MUIC_CONTROL1_SW_AUX_UART \
> +	((COM_AUX_UART << MAX77843_MUIC_CONTROL1_COMP1SW_SHIFT | \
> +	 COM_AUX_UART << MAX77843_MUIC_CONTROL1_COMP2SW_SHIFT))
>  
>  #define MAX77843_DISABLE			0
>  #define MAX77843_ENABLE				1
>  
>  #define CONTROL4_AUTO_DISABLE \
> -	((MAX77843_DISABLE << CONTROL4_USBAUTO_SHIFT) | \
> -	(MAX77843_DISABLE << CONTROL4_FCTAUTO_SHIFT))
> +	((MAX77843_DISABLE << MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT) | \
> +	(MAX77843_DISABLE << MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT))
>  #define CONTROL4_AUTO_ENABLE \
> -	((MAX77843_ENABLE << CONTROL4_USBAUTO_SHIFT) | \
> -	(MAX77843_ENABLE << CONTROL4_FCTAUTO_SHIFT))
> +	((MAX77843_ENABLE << MAX77843_MUIC_CONTROL4_USBAUTO_SHIFT) | \
> +	(MAX77843_ENABLE << MAX77843_MUIC_CONTROL4_FCTAUTO_SHIFT))
>  
>  /* MAX77843 SAFEOUT LDO Control register */
>  #define SAFEOUTCTRL_SAFEOUT1_SHIFT		0

-- 
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] 24+ messages in thread

* Re: [PATCH 07/10] mfd/extcon: max77693: Rename defines to allow inclusion with max77843
  2015-04-29 10:58 ` [PATCH 07/10] mfd/extcon: max77693: Rename defines to allow inclusion with max77843 Krzysztof Kozlowski
@ 2015-04-29 13:12   ` Lee Jones
  2015-04-29 13:23     ` Krzysztof Kozłowski
  0 siblings, 1 reply; 24+ messages in thread
From: Lee Jones @ 2015-04-29 13:12 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

On Wed, 29 Apr 2015, Krzysztof Kozlowski wrote:

> Add MAX77693 prefix to some of the defines used in max77693 extcon
> driver so the max77693-private.h can be included simultaneously with
> max77843-private.h.
> 
> Additionally use BIT() macro in header.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> ---
>  drivers/extcon/extcon-max77693.c     |  76 +++++++++++++-------------
>  include/linux/mfd/max77693-private.h | 102 +++++++++++++++++------------------
>  2 files changed, 91 insertions(+), 87 deletions(-)

[...]

> diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
> index 8c4143c0c651..7201c0b61bd5 100644
> --- a/include/linux/mfd/max77693-private.h
> +++ b/include/linux/mfd/max77693-private.h
> @@ -310,30 +310,30 @@ enum max77693_muic_reg {
>  #define INTMASK2_CHGTYP_MASK		(1 << INTMASK2_CHGTYP_SHIFT)
>  
>  /* MAX77693 MUIC - STATUS1~3 Register */
> -#define STATUS1_ADC_SHIFT		(0)
> -#define STATUS1_ADCLOW_SHIFT		(5)
> -#define STATUS1_ADCERR_SHIFT		(6)
> -#define 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_ADC1K_MASK		(0x1 << STATUS1_ADC1K_SHIFT)
> -
> -#define STATUS2_CHGTYP_SHIFT		(0)
> -#define STATUS2_CHGDETRUN_SHIFT		(3)
> -#define STATUS2_DCDTMR_SHIFT		(4)
> -#define STATUS2_DXOVP_SHIFT		(5)
> -#define STATUS2_VBVOLT_SHIFT		(6)
> -#define 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_DXOVP_MASK		(0x1 << STATUS2_DXOVP_SHIFT)
> -#define STATUS2_VBVOLT_MASK		(0x1 << STATUS2_VBVOLT_SHIFT)
> -#define STATUS2_VIDRM_MASK		(0x1 << STATUS2_VIDRM_SHIFT)
> -
> -#define STATUS3_OVP_SHIFT		(2)
> -#define STATUS3_OVP_MASK		(0x1 << STATUS3_OVP_SHIFT)
> +#define MAX77693_STATUS1_ADC_SHIFT		(0)
> +#define MAX77693_STATUS1_ADCLOW_SHIFT		(5)
> +#define MAX77693_STATUS1_ADCERR_SHIFT		(6)
> +#define MAX77693_STATUS1_ADC1K_SHIFT		(7)
> +#define MAX77693_STATUS1_ADC_MASK		(0x1f << MAX77693_STATUS1_ADC_SHIFT)
> +#define MAX77693_STATUS1_ADCLOW_MASK		BIT(MAX77693_STATUS1_ADCLOW_SHIFT)
> +#define MAX77693_STATUS1_ADCERR_MASK		BIT(MAX77693_STATUS1_ADCERR_SHIFT)
> +#define MAX77693_STATUS1_ADC1K_MASK		BIT(MAX77693_STATUS1_ADC1K_SHIFT)
> +
> +#define MAX77693_STATUS2_CHGTYP_SHIFT		(0)
> +#define MAX77693_STATUS2_CHGDETRUN_SHIFT	(3)
> +#define MAX77693_STATUS2_DCDTMR_SHIFT		(4)
> +#define MAX77693_STATUS2_DXOVP_SHIFT		(5)
> +#define MAX77693_STATUS2_VBVOLT_SHIFT		(6)
> +#define MAX77693_STATUS2_VIDRM_SHIFT		(7)
> +#define MAX77693_STATUS2_CHGTYP_MASK		(0x7 << MAX77693_STATUS2_CHGTYP_SHIFT)
> +#define MAX77693_STATUS2_CHGDETRUN_MASK		BIT(MAX77693_STATUS2_CHGDETRUN_SHIFT)
> +#define MAX77693_STATUS2_DCDTMR_MASK		BIT(MAX77693_STATUS2_DCDTMR_SHIFT)
> +#define MAX77693_STATUS2_DXOVP_MASK		BIT(MAX77693_STATUS2_DXOVP_SHIFT)
> +#define MAX77693_STATUS2_VBVOLT_MASK		BIT(MAX77693_STATUS2_VBVOLT_SHIFT)
> +#define MAX77693_STATUS2_VIDRM_MASK		BIT(MAX77693_STATUS2_VIDRM_SHIFT)
> +
> +#define MAX77693_STATUS3_OVP_SHIFT		(2)
> +#define MAX77693_STATUS3_OVP_MASK		BIT(MAX77693_STATUS3_OVP_SHIFT)
>  
>  /* MAX77693 CDETCTRL1~2 register */
>  #define CDETCTRL1_CHGDETEN_SHIFT	(0)
> @@ -362,38 +362,38 @@ enum max77693_muic_reg {
>  #define COMN1SW_MASK			(0x7 << COMN1SW_SHIFT)
>  #define COMP2SW_MASK			(0x7 << COMP2SW_SHIFT)
>  #define COMP_SW_MASK			(COMP2SW_MASK | COMN1SW_MASK)
> -#define CONTROL1_SW_USB			((1 << COMP2SW_SHIFT) \
> +#define MAX77693_CONTROL1_SW_USB	((1 << COMP2SW_SHIFT) \
>  						| (1 << COMN1SW_SHIFT))
> -#define CONTROL1_SW_AUDIO		((2 << COMP2SW_SHIFT) \
> +#define MAX77693_CONTROL1_SW_AUDIO	((2 << COMP2SW_SHIFT) \
>  						| (2 << COMN1SW_SHIFT))
> -#define CONTROL1_SW_UART		((3 << COMP2SW_SHIFT) \
> +#define MAX77693_CONTROL1_SW_UART	((3 << COMP2SW_SHIFT) \
>  						| (3 << COMN1SW_SHIFT))
> -#define CONTROL1_SW_OPEN		((0 << COMP2SW_SHIFT) \
> +#define MAX77693_CONTROL1_SW_OPEN	((0 << COMP2SW_SHIFT) \
>  						| (0 << COMN1SW_SHIFT))
>  
> -#define CONTROL2_LOWPWR_SHIFT		(0)
> -#define CONTROL2_ADCEN_SHIFT		(1)
> -#define CONTROL2_CPEN_SHIFT		(2)
> -#define CONTROL2_SFOUTASRT_SHIFT	(3)
> -#define CONTROL2_SFOUTORD_SHIFT		(4)
> -#define CONTROL2_ACCDET_SHIFT		(5)
> -#define CONTROL2_USBCPINT_SHIFT		(6)
> -#define CONTROL2_RCPS_SHIFT		(7)
> -#define CONTROL2_LOWPWR_MASK		(0x1 << CONTROL2_LOWPWR_SHIFT)
> -#define CONTROL2_ADCEN_MASK		(0x1 << CONTROL2_ADCEN_SHIFT)
> -#define CONTROL2_CPEN_MASK		(0x1 << CONTROL2_CPEN_SHIFT)
> -#define CONTROL2_SFOUTASRT_MASK		(0x1 << CONTROL2_SFOUTASRT_SHIFT)
> -#define CONTROL2_SFOUTORD_MASK		(0x1 << CONTROL2_SFOUTORD_SHIFT)
> -#define CONTROL2_ACCDET_MASK		(0x1 << CONTROL2_ACCDET_SHIFT)
> -#define CONTROL2_USBCPINT_MASK		(0x1 << CONTROL2_USBCPINT_SHIFT)
> -#define CONTROL2_RCPS_MASK		(0x1 << CONTROL2_RCPS_SHIFT)
> -
> -#define CONTROL3_JIGSET_SHIFT		(0)
> -#define CONTROL3_BTLDSET_SHIFT		(2)
> -#define CONTROL3_ADCDBSET_SHIFT		(4)
> -#define CONTROL3_JIGSET_MASK		(0x3 << CONTROL3_JIGSET_SHIFT)
> -#define CONTROL3_BTLDSET_MASK		(0x3 << CONTROL3_BTLDSET_SHIFT)
> -#define CONTROL3_ADCDBSET_MASK		(0x3 << CONTROL3_ADCDBSET_SHIFT)
> +#define MAX77693_CONTROL2_LOWPWR_SHIFT		(0)
> +#define MAX77693_CONTROL2_ADCEN_SHIFT		(1)
> +#define MAX77693_CONTROL2_CPEN_SHIFT		(2)
> +#define MAX77693_CONTROL2_SFOUTASRT_SHIFT	(3)
> +#define MAX77693_CONTROL2_SFOUTORD_SHIFT	(4)
> +#define MAX77693_CONTROL2_ACCDET_SHIFT		(5)
> +#define MAX77693_CONTROL2_USBCPINT_SHIFT	(6)
> +#define MAX77693_CONTROL2_RCPS_SHIFT		(7)

Why the need for the added () all of the sudden?

> +#define MAX77693_CONTROL2_LOWPWR_MASK		BIT(MAX77693_CONTROL2_LOWPWR_SHIFT)
> +#define MAX77693_CONTROL2_ADCEN_MASK		BIT(MAX77693_CONTROL2_ADCEN_SHIFT)
> +#define MAX77693_CONTROL2_CPEN_MASK		BIT(MAX77693_CONTROL2_CPEN_SHIFT)
> +#define MAX77693_CONTROL2_SFOUTASRT_MASK	BIT(MAX77693_CONTROL2_SFOUTASRT_SHIFT)
> +#define MAX77693_CONTROL2_SFOUTORD_MASK		BIT(MAX77693_CONTROL2_SFOUTORD_SHIFT)
> +#define MAX77693_CONTROL2_ACCDET_MASK		BIT(MAX77693_CONTROL2_ACCDET_SHIFT)
> +#define MAX77693_CONTROL2_USBCPINT_MASK		BIT(MAX77693_CONTROL2_USBCPINT_SHIFT)
> +#define MAX77693_CONTROL2_RCPS_MASK		BIT(MAX77693_CONTROL2_RCPS_SHIFT)
> +
> +#define MAX77693_CONTROL3_JIGSET_SHIFT		(0)
> +#define MAX77693_CONTROL3_BTLDSET_SHIFT		(2)
> +#define MAX77693_CONTROL3_ADCDBSET_SHIFT	(4)
> +#define MAX77693_CONTROL3_JIGSET_MASK		(0x3 << MAX77693_CONTROL3_JIGSET_SHIFT)
> +#define MAX77693_CONTROL3_BTLDSET_MASK		(0x3 << MAX77693_CONTROL3_BTLDSET_SHIFT)
> +#define MAX77693_CONTROL3_ADCDBSET_MASK		(0x3 << MAX77693_CONTROL3_ADCDBSET_SHIFT)
>  
>  /* Slave addr = 0x90: Haptic */
>  enum max77693_haptic_reg {

-- 
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] 24+ messages in thread

* Re: [PATCH 07/10] mfd/extcon: max77693: Rename defines to allow inclusion with max77843
  2015-04-29 13:12   ` Lee Jones
@ 2015-04-29 13:23     ` Krzysztof Kozłowski
  0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozłowski @ 2015-04-29 13:23 UTC (permalink / raw)
  To: Lee Jones
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

2015-04-29 22:12 GMT+09:00 Lee Jones <lee.jones@linaro.org>:
> On Wed, 29 Apr 2015, Krzysztof Kozlowski wrote:
>
>> Add MAX77693 prefix to some of the defines used in max77693 extcon
>> driver so the max77693-private.h can be included simultaneously with
>> max77843-private.h.
>>
>> Additionally use BIT() macro in header.
>>
>> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
>> ---
>>  drivers/extcon/extcon-max77693.c     |  76 +++++++++++++-------------
>>  include/linux/mfd/max77693-private.h | 102 +++++++++++++++++------------------
>>  2 files changed, 91 insertions(+), 87 deletions(-)
>
> [...]
>
>> diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
>> index 8c4143c0c651..7201c0b61bd5 100644
>> --- a/include/linux/mfd/max77693-private.h
>> +++ b/include/linux/mfd/max77693-private.h
>> @@ -310,30 +310,30 @@ enum max77693_muic_reg {
>>  #define INTMASK2_CHGTYP_MASK         (1 << INTMASK2_CHGTYP_SHIFT)
>>
>>  /* MAX77693 MUIC - STATUS1~3 Register */
>> -#define STATUS1_ADC_SHIFT            (0)
>> -#define STATUS1_ADCLOW_SHIFT         (5)
>> -#define STATUS1_ADCERR_SHIFT         (6)
>> -#define 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_ADC1K_MASK           (0x1 << STATUS1_ADC1K_SHIFT)
>> -
>> -#define STATUS2_CHGTYP_SHIFT         (0)
>> -#define STATUS2_CHGDETRUN_SHIFT              (3)
>> -#define STATUS2_DCDTMR_SHIFT         (4)
>> -#define STATUS2_DXOVP_SHIFT          (5)
>> -#define STATUS2_VBVOLT_SHIFT         (6)
>> -#define 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_DXOVP_MASK           (0x1 << STATUS2_DXOVP_SHIFT)
>> -#define STATUS2_VBVOLT_MASK          (0x1 << STATUS2_VBVOLT_SHIFT)
>> -#define STATUS2_VIDRM_MASK           (0x1 << STATUS2_VIDRM_SHIFT)
>> -
>> -#define STATUS3_OVP_SHIFT            (2)
>> -#define STATUS3_OVP_MASK             (0x1 << STATUS3_OVP_SHIFT)
>> +#define MAX77693_STATUS1_ADC_SHIFT           (0)
>> +#define MAX77693_STATUS1_ADCLOW_SHIFT                (5)
>> +#define MAX77693_STATUS1_ADCERR_SHIFT                (6)
>> +#define MAX77693_STATUS1_ADC1K_SHIFT         (7)
>> +#define MAX77693_STATUS1_ADC_MASK            (0x1f << MAX77693_STATUS1_ADC_SHIFT)
>> +#define MAX77693_STATUS1_ADCLOW_MASK         BIT(MAX77693_STATUS1_ADCLOW_SHIFT)
>> +#define MAX77693_STATUS1_ADCERR_MASK         BIT(MAX77693_STATUS1_ADCERR_SHIFT)
>> +#define MAX77693_STATUS1_ADC1K_MASK          BIT(MAX77693_STATUS1_ADC1K_SHIFT)
>> +
>> +#define MAX77693_STATUS2_CHGTYP_SHIFT                (0)
>> +#define MAX77693_STATUS2_CHGDETRUN_SHIFT     (3)
>> +#define MAX77693_STATUS2_DCDTMR_SHIFT                (4)
>> +#define MAX77693_STATUS2_DXOVP_SHIFT         (5)
>> +#define MAX77693_STATUS2_VBVOLT_SHIFT                (6)
>> +#define MAX77693_STATUS2_VIDRM_SHIFT         (7)
>> +#define MAX77693_STATUS2_CHGTYP_MASK         (0x7 << MAX77693_STATUS2_CHGTYP_SHIFT)
>> +#define MAX77693_STATUS2_CHGDETRUN_MASK              BIT(MAX77693_STATUS2_CHGDETRUN_SHIFT)
>> +#define MAX77693_STATUS2_DCDTMR_MASK         BIT(MAX77693_STATUS2_DCDTMR_SHIFT)
>> +#define MAX77693_STATUS2_DXOVP_MASK          BIT(MAX77693_STATUS2_DXOVP_SHIFT)
>> +#define MAX77693_STATUS2_VBVOLT_MASK         BIT(MAX77693_STATUS2_VBVOLT_SHIFT)
>> +#define MAX77693_STATUS2_VIDRM_MASK          BIT(MAX77693_STATUS2_VIDRM_SHIFT)
>> +
>> +#define MAX77693_STATUS3_OVP_SHIFT           (2)
>> +#define MAX77693_STATUS3_OVP_MASK            BIT(MAX77693_STATUS3_OVP_SHIFT)
>>
>>  /* MAX77693 CDETCTRL1~2 register */
>>  #define CDETCTRL1_CHGDETEN_SHIFT     (0)
>> @@ -362,38 +362,38 @@ enum max77693_muic_reg {
>>  #define COMN1SW_MASK                 (0x7 << COMN1SW_SHIFT)
>>  #define COMP2SW_MASK                 (0x7 << COMP2SW_SHIFT)
>>  #define COMP_SW_MASK                 (COMP2SW_MASK | COMN1SW_MASK)
>> -#define CONTROL1_SW_USB                      ((1 << COMP2SW_SHIFT) \
>> +#define MAX77693_CONTROL1_SW_USB     ((1 << COMP2SW_SHIFT) \
>>                                               | (1 << COMN1SW_SHIFT))
>> -#define CONTROL1_SW_AUDIO            ((2 << COMP2SW_SHIFT) \
>> +#define MAX77693_CONTROL1_SW_AUDIO   ((2 << COMP2SW_SHIFT) \
>>                                               | (2 << COMN1SW_SHIFT))
>> -#define CONTROL1_SW_UART             ((3 << COMP2SW_SHIFT) \
>> +#define MAX77693_CONTROL1_SW_UART    ((3 << COMP2SW_SHIFT) \
>>                                               | (3 << COMN1SW_SHIFT))
>> -#define CONTROL1_SW_OPEN             ((0 << COMP2SW_SHIFT) \
>> +#define MAX77693_CONTROL1_SW_OPEN    ((0 << COMP2SW_SHIFT) \
>>                                               | (0 << COMN1SW_SHIFT))
>>
>> -#define CONTROL2_LOWPWR_SHIFT                (0)
>> -#define CONTROL2_ADCEN_SHIFT         (1)
>> -#define CONTROL2_CPEN_SHIFT          (2)
>> -#define CONTROL2_SFOUTASRT_SHIFT     (3)
>> -#define CONTROL2_SFOUTORD_SHIFT              (4)
>> -#define CONTROL2_ACCDET_SHIFT                (5)
>> -#define CONTROL2_USBCPINT_SHIFT              (6)
>> -#define CONTROL2_RCPS_SHIFT          (7)
>> -#define CONTROL2_LOWPWR_MASK         (0x1 << CONTROL2_LOWPWR_SHIFT)
>> -#define CONTROL2_ADCEN_MASK          (0x1 << CONTROL2_ADCEN_SHIFT)
>> -#define CONTROL2_CPEN_MASK           (0x1 << CONTROL2_CPEN_SHIFT)
>> -#define CONTROL2_SFOUTASRT_MASK              (0x1 << CONTROL2_SFOUTASRT_SHIFT)
>> -#define CONTROL2_SFOUTORD_MASK               (0x1 << CONTROL2_SFOUTORD_SHIFT)
>> -#define CONTROL2_ACCDET_MASK         (0x1 << CONTROL2_ACCDET_SHIFT)
>> -#define CONTROL2_USBCPINT_MASK               (0x1 << CONTROL2_USBCPINT_SHIFT)
>> -#define CONTROL2_RCPS_MASK           (0x1 << CONTROL2_RCPS_SHIFT)
>> -
>> -#define CONTROL3_JIGSET_SHIFT                (0)
>> -#define CONTROL3_BTLDSET_SHIFT               (2)
>> -#define CONTROL3_ADCDBSET_SHIFT              (4)
>> -#define CONTROL3_JIGSET_MASK         (0x3 << CONTROL3_JIGSET_SHIFT)
>> -#define CONTROL3_BTLDSET_MASK                (0x3 << CONTROL3_BTLDSET_SHIFT)
>> -#define CONTROL3_ADCDBSET_MASK               (0x3 << CONTROL3_ADCDBSET_SHIFT)
>> +#define MAX77693_CONTROL2_LOWPWR_SHIFT               (0)
>> +#define MAX77693_CONTROL2_ADCEN_SHIFT                (1)
>> +#define MAX77693_CONTROL2_CPEN_SHIFT         (2)
>> +#define MAX77693_CONTROL2_SFOUTASRT_SHIFT    (3)
>> +#define MAX77693_CONTROL2_SFOUTORD_SHIFT     (4)
>> +#define MAX77693_CONTROL2_ACCDET_SHIFT               (5)
>> +#define MAX77693_CONTROL2_USBCPINT_SHIFT     (6)
>> +#define MAX77693_CONTROL2_RCPS_SHIFT         (7)
>
> Why the need for the added () all of the sudden?

I did not add them, they existed before. I wanted to do in the patch
only renaming but I may fix it up.

Best regards,
Krzysztof

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

* Re: [PATCH 04/10] regulator: max77693: Support different register configurations
  2015-04-29 10:58 ` [PATCH 04/10] regulator: max77693: Support different register configurations Krzysztof Kozlowski
@ 2015-04-29 17:41   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2015-04-29 17:41 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, linux-kernel, linux-input,
	linux-pm

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

On Wed, Apr 29, 2015 at 07:58:29PM +0900, Krzysztof Kozlowski wrote:
> Add support for different configurations of charger's registers so the
> same driver could be used on other devices (e.g. MAX77843).

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 09/10] regulator: max77693: Add support for MAX77843 device
  2015-04-29 10:58 ` [PATCH 09/10] regulator: max77693: Add support for MAX77843 device Krzysztof Kozlowski
@ 2015-04-29 17:58   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2015-04-29 17:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Liam Girdwood, linux-kernel, linux-input,
	linux-pm

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

On Wed, Apr 29, 2015 at 07:58:34PM +0900, Krzysztof Kozlowski wrote:

> The charger and safeout part of MAX77843 is almost the same as MAX77693.
> From regulator point of view the only differences are the constraints
> and register values related to these constraints. Now the max77693
> regulator driver can be used for MAX77843.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members
  2015-04-29 10:58 ` [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members Krzysztof Kozlowski
@ 2015-05-04  6:45   ` Chanwoo Choi
  2015-05-04  6:49     ` Krzysztof Kozłowski
  2015-05-05  8:24   ` Lee Jones
  1 sibling, 1 reply; 24+ messages in thread
From: Chanwoo Choi @ 2015-05-04  6:45 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

On 04/29/2015 07:58 PM, Krzysztof Kozlowski wrote:
> Clean up the max77693 private header file by removing:
> 1. Left-overs from previous way of interrupt handling (driver uses
>    regmap_irq_chip).
> 2. Unused members of struct 'max77693_dev' related to interrupts in
>    extcon driver.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> ---
>  drivers/extcon/extcon-max77693.c     | 4 ----
>  include/linux/mfd/max77693-private.h | 8 --------
>  2 files changed, 12 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
> index a66bec8f6252..760e1e2cc1ce 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -1218,10 +1218,6 @@ static int max77693_muic_probe(struct platform_device *pdev)
>  			irq_src = MUIC_INT3;
>  			break;
>  		}
> -
> -		if (irq_src < MAX77693_IRQ_GROUP_NR)
> -			info->max77693->irq_masks_cur[irq_src]
> -				= init_data[i].data;
>  	}

When removing the unused statement, I think you better to remove it as following:
because 'enum max77693_irq_source irq_src' is not used.

 	for (i = 0; i < num_init_data; i++) {
-		enum max77693_irq_source irq_src
-				= MAX77693_IRQ_GROUP_NR;
-
 		regmap_write(info->max77693->regmap_muic,
 				init_data[i].addr,
 				init_data[i].data);
-
-		switch (init_data[i].addr) {
-		case MAX77693_MUIC_REG_INTMASK1:
-			irq_src = MUIC_INT1;
-			break;
-		case MAX77693_MUIC_REG_INTMASK2:
-			irq_src = MUIC_INT2;
-			break;
-		case MAX77693_MUIC_REG_INTMASK3:
-			irq_src = MUIC_INT3;
-			break;
-		}
-
-		if (irq_src < MAX77693_IRQ_GROUP_NR)
-			info->max77693->irq_masks_cur[irq_src]
-				= init_data[i].data;
 	}
 
[snip]

Except for upper comment, Looks good to me.

Thanks,
Chanwoo Choi

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

* Re: [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members
  2015-05-04  6:45   ` Chanwoo Choi
@ 2015-05-04  6:49     ` Krzysztof Kozłowski
  2015-05-04  6:54       ` Chanwoo Choi
  0 siblings, 1 reply; 24+ messages in thread
From: Krzysztof Kozłowski @ 2015-05-04  6:49 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

2015-05-04 15:45 GMT+09:00 Chanwoo Choi <cw00.choi@samsung.com>:
> On 04/29/2015 07:58 PM, Krzysztof Kozlowski wrote:
>> Clean up the max77693 private header file by removing:
>> 1. Left-overs from previous way of interrupt handling (driver uses
>>    regmap_irq_chip).
>> 2. Unused members of struct 'max77693_dev' related to interrupts in
>>    extcon driver.
>>
>> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
>> ---
>>  drivers/extcon/extcon-max77693.c     | 4 ----
>>  include/linux/mfd/max77693-private.h | 8 --------
>>  2 files changed, 12 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
>> index a66bec8f6252..760e1e2cc1ce 100644
>> --- a/drivers/extcon/extcon-max77693.c
>> +++ b/drivers/extcon/extcon-max77693.c
>> @@ -1218,10 +1218,6 @@ static int max77693_muic_probe(struct platform_device *pdev)
>>                       irq_src = MUIC_INT3;
>>                       break;
>>               }
>> -
>> -             if (irq_src < MAX77693_IRQ_GROUP_NR)
>> -                     info->max77693->irq_masks_cur[irq_src]
>> -                             = init_data[i].data;
>>       }
>
> When removing the unused statement, I think you better to remove it as following:
> because 'enum max77693_irq_source irq_src' is not used.

Yes, you're right. Actually some time ago I removed all of this:
extcon: max77693: Remove left-over code after switching to regmap irq chip
http://lkml.iu.edu/hypermail/linux/kernel/1410.2/03403.html

>
>         for (i = 0; i < num_init_data; i++) {
> -               enum max77693_irq_source irq_src
> -                               = MAX77693_IRQ_GROUP_NR;
> -
>                 regmap_write(info->max77693->regmap_muic,
>                                 init_data[i].addr,
>                                 init_data[i].data);
> -
> -               switch (init_data[i].addr) {
> -               case MAX77693_MUIC_REG_INTMASK1:
> -                       irq_src = MUIC_INT1;
> -                       break;
> -               case MAX77693_MUIC_REG_INTMASK2:
> -                       irq_src = MUIC_INT2;
> -                       break;
> -               case MAX77693_MUIC_REG_INTMASK3:
> -                       irq_src = MUIC_INT3;
> -                       break;
> -               }
> -
> -               if (irq_src < MAX77693_IRQ_GROUP_NR)
> -                       info->max77693->irq_masks_cur[irq_src]
> -                               = init_data[i].data;
>         }
>
> [snip]
>
> Except for upper comment, Looks good to me.

Okay, I'll do as you suggested and add your ack (in case it will go
through some other tree).

Thanks!
Krzysztof

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

* Re: [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members
  2015-05-04  6:49     ` Krzysztof Kozłowski
@ 2015-05-04  6:54       ` Chanwoo Choi
  2015-05-04  7:01         ` Krzysztof Kozłowski
  0 siblings, 1 reply; 24+ messages in thread
From: Chanwoo Choi @ 2015-05-04  6:54 UTC (permalink / raw)
  To: Krzysztof Kozłowski
  Cc: MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

On 05/04/2015 03:49 PM, Krzysztof Kozłowski wrote:
> 2015-05-04 15:45 GMT+09:00 Chanwoo Choi <cw00.choi@samsung.com>:
>> On 04/29/2015 07:58 PM, Krzysztof Kozlowski wrote:
>>> Clean up the max77693 private header file by removing:
>>> 1. Left-overs from previous way of interrupt handling (driver uses
>>>    regmap_irq_chip).
>>> 2. Unused members of struct 'max77693_dev' related to interrupts in
>>>    extcon driver.
>>>
>>> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
>>> ---
>>>  drivers/extcon/extcon-max77693.c     | 4 ----
>>>  include/linux/mfd/max77693-private.h | 8 --------
>>>  2 files changed, 12 deletions(-)
>>>
>>> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
>>> index a66bec8f6252..760e1e2cc1ce 100644
>>> --- a/drivers/extcon/extcon-max77693.c
>>> +++ b/drivers/extcon/extcon-max77693.c
>>> @@ -1218,10 +1218,6 @@ static int max77693_muic_probe(struct platform_device *pdev)
>>>                       irq_src = MUIC_INT3;
>>>                       break;
>>>               }
>>> -
>>> -             if (irq_src < MAX77693_IRQ_GROUP_NR)
>>> -                     info->max77693->irq_masks_cur[irq_src]
>>> -                             = init_data[i].data;
>>>       }
>>
>> When removing the unused statement, I think you better to remove it as following:
>> because 'enum max77693_irq_source irq_src' is not used.
> 
> Yes, you're right. Actually some time ago I removed all of this:
> extcon: max77693: Remove left-over code after switching to regmap irq chip
> http://lkml.iu.edu/hypermail/linux/kernel/1410.2/03403.html
> 
>>
>>         for (i = 0; i < num_init_data; i++) {
>> -               enum max77693_irq_source irq_src
>> -                               = MAX77693_IRQ_GROUP_NR;
>> -
>>                 regmap_write(info->max77693->regmap_muic,
>>                                 init_data[i].addr,
>>                                 init_data[i].data);
>> -
>> -               switch (init_data[i].addr) {
>> -               case MAX77693_MUIC_REG_INTMASK1:
>> -                       irq_src = MUIC_INT1;
>> -                       break;
>> -               case MAX77693_MUIC_REG_INTMASK2:
>> -                       irq_src = MUIC_INT2;
>> -                       break;
>> -               case MAX77693_MUIC_REG_INTMASK3:
>> -                       irq_src = MUIC_INT3;
>> -                       break;
>> -               }
>> -
>> -               if (irq_src < MAX77693_IRQ_GROUP_NR)
>> -                       info->max77693->irq_masks_cur[irq_src]
>> -                               = init_data[i].data;
>>         }
>>
>> [snip]
>>
>> Except for upper comment, Looks good to me.
> 
> Okay, I'll do as you suggested and add your ack (in case it will go
> through some other tree).

I'm wondering the merge confilct if this patch will be merged on other tree.
Because extcon-max77693.c was already modified on extcon-next branch.

So, If the base commit of this patch is different, there are potential merge conflict.

Thanks,
Chanwoo Choi

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members
  2015-05-04  6:54       ` Chanwoo Choi
@ 2015-05-04  7:01         ` Krzysztof Kozłowski
  0 siblings, 0 replies; 24+ messages in thread
From: Krzysztof Kozłowski @ 2015-05-04  7:01 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz, Lee Jones,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

2015-05-04 15:54 GMT+09:00 Chanwoo Choi <cw00.choi@samsung.com>:
> On 05/04/2015 03:49 PM, Krzysztof Kozłowski wrote:
>> 2015-05-04 15:45 GMT+09:00 Chanwoo Choi <cw00.choi@samsung.com>:
>>> On 04/29/2015 07:58 PM, Krzysztof Kozlowski wrote:
>>>> Clean up the max77693 private header file by removing:
>>>> 1. Left-overs from previous way of interrupt handling (driver uses
>>>>    regmap_irq_chip).
>>>> 2. Unused members of struct 'max77693_dev' related to interrupts in
>>>>    extcon driver.
>>>>
>>>> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
>>>> ---
>>>>  drivers/extcon/extcon-max77693.c     | 4 ----
>>>>  include/linux/mfd/max77693-private.h | 8 --------
>>>>  2 files changed, 12 deletions(-)
>>>>
>>>> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
>>>> index a66bec8f6252..760e1e2cc1ce 100644
>>>> --- a/drivers/extcon/extcon-max77693.c
>>>> +++ b/drivers/extcon/extcon-max77693.c
>>>> @@ -1218,10 +1218,6 @@ static int max77693_muic_probe(struct platform_device *pdev)
>>>>                       irq_src = MUIC_INT3;
>>>>                       break;
>>>>               }
>>>> -
>>>> -             if (irq_src < MAX77693_IRQ_GROUP_NR)
>>>> -                     info->max77693->irq_masks_cur[irq_src]
>>>> -                             = init_data[i].data;
>>>>       }
>>>
>>> When removing the unused statement, I think you better to remove it as following:
>>> because 'enum max77693_irq_source irq_src' is not used.
>>
>> Yes, you're right. Actually some time ago I removed all of this:
>> extcon: max77693: Remove left-over code after switching to regmap irq chip
>> http://lkml.iu.edu/hypermail/linux/kernel/1410.2/03403.html
>>
>>>
>>>         for (i = 0; i < num_init_data; i++) {
>>> -               enum max77693_irq_source irq_src
>>> -                               = MAX77693_IRQ_GROUP_NR;
>>> -
>>>                 regmap_write(info->max77693->regmap_muic,
>>>                                 init_data[i].addr,
>>>                                 init_data[i].data);
>>> -
>>> -               switch (init_data[i].addr) {
>>> -               case MAX77693_MUIC_REG_INTMASK1:
>>> -                       irq_src = MUIC_INT1;
>>> -                       break;
>>> -               case MAX77693_MUIC_REG_INTMASK2:
>>> -                       irq_src = MUIC_INT2;
>>> -                       break;
>>> -               case MAX77693_MUIC_REG_INTMASK3:
>>> -                       irq_src = MUIC_INT3;
>>> -                       break;
>>> -               }
>>> -
>>> -               if (irq_src < MAX77693_IRQ_GROUP_NR)
>>> -                       info->max77693->irq_masks_cur[irq_src]
>>> -                               = init_data[i].data;
>>>         }
>>>
>>> [snip]
>>>
>>> Except for upper comment, Looks good to me.
>>
>> Okay, I'll do as you suggested and add your ack (in case it will go
>> through some other tree).
>
> I'm wondering the merge confilct if this patch will be merged on other tree.
> Because extcon-max77693.c was already modified on extcon-next branch.
>
> So, If the base commit of this patch is different, there are potential merge conflict.

Right, we can solve it by an immutable branch shared between trees. I
suspect that getting acks for whole patchset will take some time, so
the cleanups (few first patches) can be picked at beginning by
someone. Then, if needed, the maintainer can provide the branch for
other. Fortunately currently I don't see many conflicts between this
patch and extcon-next.

Best regards,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members
  2015-04-29 10:58 ` [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members Krzysztof Kozlowski
  2015-05-04  6:45   ` Chanwoo Choi
@ 2015-05-05  8:24   ` Lee Jones
  1 sibling, 0 replies; 24+ messages in thread
From: Lee Jones @ 2015-05-05  8:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

On Wed, 29 Apr 2015, Krzysztof Kozlowski wrote:

> Clean up the max77693 private header file by removing:
> 1. Left-overs from previous way of interrupt handling (driver uses
>    regmap_irq_chip).
> 2. Unused members of struct 'max77693_dev' related to interrupts in
>    extcon driver.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> ---
>  drivers/extcon/extcon-max77693.c     | 4 ----
>  include/linux/mfd/max77693-private.h | 8 --------

For the MFD changes:
  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] 24+ messages in thread

* Re: [PATCH 05/10] max77693: Move state container to common header
  2015-04-29 10:58 ` [PATCH 05/10] max77693: Move state container to common header Krzysztof Kozlowski
@ 2015-05-23 15:11   ` Sebastian Reichel
  2015-05-27  9:17   ` Lee Jones
  1 sibling, 0 replies; 24+ messages in thread
From: Sebastian Reichel @ 2015-05-23 15:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Lee Jones, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]

Hi,

On Wed, Apr 29, 2015 at 07:58:30PM +0900, Krzysztof Kozlowski wrote:
> This prepares for merging some of the drivers between max77693 and
> max77843 so the child MFD driver can be attached to any parent MFD main
> driver.
> 
> Move the state container to common header file. Additionally add
> consistent 'i2c' prefixes to its members (of 'struct i2c_client' type).
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> ---
>  drivers/extcon/extcon-max77693.c     |  3 ++-
>  drivers/input/misc/max77693-haptic.c |  1 +
>  drivers/mfd/max77693.c               | 31 +++++++++++++------------
>  drivers/power/max77693_charger.c     |  1 +
>  drivers/regulator/max77693.c         |  1 +
>  include/linux/mfd/max77693-common.h  | 44 ++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/max77693-private.h | 25 --------------------
>  7 files changed, 65 insertions(+), 41 deletions(-)
>  create mode 100644 include/linux/mfd/max77693-common.h
> 
> [...]
>
> diff --git a/drivers/power/max77693_charger.c b/drivers/power/max77693_charger.c
> index 754879eb59f6..eb68d0572799 100644
> --- a/drivers/power/max77693_charger.c
> +++ b/drivers/power/max77693_charger.c
> @@ -21,6 +21,7 @@
>  #include <linux/regmap.h>
>  #include <linux/mfd/max77693.h>
>  #include <linux/mfd/max77693-private.h>
> +#include <linux/mfd/max77693-common.h>
>  
>  #define MAX77693_CHARGER_NAME				"max77693-charger"
>  static const char *max77693_charger_model		= "MAX77693";
> [...]

Acked-By: Sebastian Reichel <sre@kernel.org>

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 05/10] max77693: Move state container to common header
  2015-04-29 10:58 ` [PATCH 05/10] max77693: Move state container to common header Krzysztof Kozlowski
  2015-05-23 15:11   ` Sebastian Reichel
@ 2015-05-27  9:17   ` Lee Jones
  1 sibling, 0 replies; 24+ messages in thread
From: Lee Jones @ 2015-05-27  9:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chanwoo Choi, MyungJoo Ham, Dmitry Torokhov, Samuel Ortiz,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Liam Girdwood, Mark Brown, linux-kernel, linux-input, linux-pm

On Wed, 29 Apr 2015, Krzysztof Kozlowski wrote:

> This prepares for merging some of the drivers between max77693 and
> max77843 so the child MFD driver can be attached to any parent MFD main
> driver.
> 
> Move the state container to common header file. Additionally add
> consistent 'i2c' prefixes to its members (of 'struct i2c_client' type).
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> ---
>  drivers/extcon/extcon-max77693.c     |  3 ++-
>  drivers/input/misc/max77693-haptic.c |  1 +
>  drivers/mfd/max77693.c               | 31 +++++++++++++------------
>  drivers/power/max77693_charger.c     |  1 +
>  drivers/regulator/max77693.c         |  1 +
>  include/linux/mfd/max77693-common.h  | 44 ++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/max77693-private.h | 25 --------------------

For the MFD changes:
  Acked-by: Lee Jones <lee.jones@linaro.org>

How do you want this patch to be handled?

>  7 files changed, 65 insertions(+), 41 deletions(-)
>  create mode 100644 include/linux/mfd/max77693-common.h
> 
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
> index 760e1e2cc1ce..5bbf15a2d3d7 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -25,6 +25,7 @@
>  #include <linux/platform_device.h>
>  #include <linux/mfd/max77693.h>
>  #include <linux/mfd/max77693-private.h>
> +#include <linux/mfd/max77693-common.h>
>  #include <linux/extcon.h>
>  #include <linux/regmap.h>
>  #include <linux/irqdomain.h>
> @@ -1112,7 +1113,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
>  		dev_dbg(&pdev->dev, "allocate register map\n");
>  	} else {
>  		info->max77693->regmap_muic = devm_regmap_init_i2c(
> -						info->max77693->muic,
> +						info->max77693->i2c_muic,
>  						&max77693_muic_regmap_config);
>  		if (IS_ERR(info->max77693->regmap_muic)) {
>  			ret = PTR_ERR(info->max77693->regmap_muic);
> diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c
> index 39e930c10ebb..69a4e401fe24 100644
> --- a/drivers/input/misc/max77693-haptic.c
> +++ b/drivers/input/misc/max77693-haptic.c
> @@ -25,6 +25,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/mfd/max77693.h>
>  #include <linux/mfd/max77693-private.h>
> +#include <linux/mfd/max77693-common.h>
>  
>  #define MAX_MAGNITUDE_SHIFT	16
>  
> diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
> index cb14afa97e6f..07fdf35bb9a1 100644
> --- a/drivers/mfd/max77693.c
> +++ b/drivers/mfd/max77693.c
> @@ -34,6 +34,7 @@
>  #include <linux/mfd/core.h>
>  #include <linux/mfd/max77693.h>
>  #include <linux/mfd/max77693-private.h>
> +#include <linux/mfd/max77693-common.h>
>  #include <linux/regulator/machine.h>
>  #include <linux/regmap.h>
>  
> @@ -193,22 +194,22 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
>  	} else
>  		dev_info(max77693->dev, "device ID: 0x%x\n", reg_data);
>  
> -	max77693->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
> -	if (!max77693->muic) {
> +	max77693->i2c_muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
> +	if (!max77693->i2c_muic) {
>  		dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n");
>  		return -ENODEV;
>  	}
> -	i2c_set_clientdata(max77693->muic, max77693);
> +	i2c_set_clientdata(max77693->i2c_muic, max77693);
>  
> -	max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
> -	if (!max77693->haptic) {
> +	max77693->i2c_haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
> +	if (!max77693->i2c_haptic) {
>  		dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n");
>  		ret = -ENODEV;
>  		goto err_i2c_haptic;
>  	}
> -	i2c_set_clientdata(max77693->haptic, max77693);
> +	i2c_set_clientdata(max77693->i2c_haptic, max77693);
>  
> -	max77693->regmap_haptic = devm_regmap_init_i2c(max77693->haptic,
> +	max77693->regmap_haptic = devm_regmap_init_i2c(max77693->i2c_haptic,
>  					&max77693_regmap_haptic_config);
>  	if (IS_ERR(max77693->regmap_haptic)) {
>  		ret = PTR_ERR(max77693->regmap_haptic);
> @@ -222,7 +223,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
>  	 * instance of MUIC device when irq of max77693 is initialized
>  	 * before call max77693-muic probe() function.
>  	 */
> -	max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic,
> +	max77693->regmap_muic = devm_regmap_init_i2c(max77693->i2c_muic,
>  					 &max77693_regmap_muic_config);
>  	if (IS_ERR(max77693->regmap_muic)) {
>  		ret = PTR_ERR(max77693->regmap_muic);
> @@ -255,7 +256,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
>  				IRQF_ONESHOT | IRQF_SHARED |
>  				IRQF_TRIGGER_FALLING, 0,
>  				&max77693_charger_irq_chip,
> -				&max77693->irq_data_charger);
> +				&max77693->irq_data_chg);
>  	if (ret) {
>  		dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
>  		goto err_irq_charger;
> @@ -296,15 +297,15 @@ err_mfd:
>  err_intsrc:
>  	regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
>  err_irq_muic:
> -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
> +	regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
>  err_irq_charger:
>  	regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
>  err_irq_topsys:
>  	regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
>  err_regmap:
> -	i2c_unregister_device(max77693->haptic);
> +	i2c_unregister_device(max77693->i2c_haptic);
>  err_i2c_haptic:
> -	i2c_unregister_device(max77693->muic);
> +	i2c_unregister_device(max77693->i2c_muic);
>  	return ret;
>  }
>  
> @@ -315,12 +316,12 @@ static int max77693_i2c_remove(struct i2c_client *i2c)
>  	mfd_remove_devices(max77693->dev);
>  
>  	regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
> -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
> +	regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
>  	regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
>  	regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
>  
> -	i2c_unregister_device(max77693->muic);
> -	i2c_unregister_device(max77693->haptic);
> +	i2c_unregister_device(max77693->i2c_muic);
> +	i2c_unregister_device(max77693->i2c_haptic);
>  
>  	return 0;
>  }
> diff --git a/drivers/power/max77693_charger.c b/drivers/power/max77693_charger.c
> index 754879eb59f6..eb68d0572799 100644
> --- a/drivers/power/max77693_charger.c
> +++ b/drivers/power/max77693_charger.c
> @@ -21,6 +21,7 @@
>  #include <linux/regmap.h>
>  #include <linux/mfd/max77693.h>
>  #include <linux/mfd/max77693-private.h>
> +#include <linux/mfd/max77693-common.h>
>  
>  #define MAX77693_CHARGER_NAME				"max77693-charger"
>  static const char *max77693_charger_model		= "MAX77693";
> diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
> index 236851ab575a..5b30dc42679c 100644
> --- a/drivers/regulator/max77693.c
> +++ b/drivers/regulator/max77693.c
> @@ -30,6 +30,7 @@
>  #include <linux/regulator/machine.h>
>  #include <linux/mfd/max77693.h>
>  #include <linux/mfd/max77693-private.h>
> +#include <linux/mfd/max77693-common.h>
>  #include <linux/regulator/of_regulator.h>
>  #include <linux/regmap.h>
>  
> diff --git a/include/linux/mfd/max77693-common.h b/include/linux/mfd/max77693-common.h
> new file mode 100644
> index 000000000000..7da4cc38e982
> --- /dev/null
> +++ b/include/linux/mfd/max77693-common.h
> @@ -0,0 +1,44 @@
> +/*
> + * Common data shared between Maxim 77693 and 77843 drivers
> + *
> + * Copyright (C) 2015 Samsung Electronics
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#ifndef __LINUX_MFD_MAX77693_COMMON_H
> +#define __LINUX_MFD_MAX77693_COMMON_H
> +
> +enum max77693_types {
> +	TYPE_MAX77693_UNKNOWN,
> +	TYPE_MAX77693,
> +};
> +
> +/*
> + * Shared also with max77843.
> + */
> +struct max77693_dev {
> +	struct device *dev;
> +	struct i2c_client *i2c;		/* 0xCC , PMIC, Charger, Flash LED */
> +	struct i2c_client *i2c_muic;	/* 0x4A , MUIC */
> +	struct i2c_client *i2c_haptic;	/* MAX77693: 0x90 , Haptic */
> +
> +	enum max77693_types type;
> +
> +	struct regmap *regmap;
> +	struct regmap *regmap_muic;
> +	struct regmap *regmap_haptic;	/* Only MAX77693 */
> +
> +	struct regmap_irq_chip_data *irq_data_led;
> +	struct regmap_irq_chip_data *irq_data_topsys;
> +	struct regmap_irq_chip_data *irq_data_chg; /* Only MAX77693 */
> +	struct regmap_irq_chip_data *irq_data_muic;
> +
> +	int irq;
> +};
> +
> +
> +#endif /*  __LINUX_MFD_MAX77693_COMMON_H */
> diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
> index e3c0afff38d3..8c4143c0c651 100644
> --- a/include/linux/mfd/max77693-private.h
> +++ b/include/linux/mfd/max77693-private.h
> @@ -529,29 +529,4 @@ enum max77693_irq_muic {
>  	MAX77693_MUIC_IRQ_NR,
>  };
>  
> -enum max77693_types {
> -	TYPE_MAX77693_UNKNOWN,
> -	TYPE_MAX77693,
> -};
> -
> -struct max77693_dev {
> -	struct device *dev;
> -	struct i2c_client *i2c;		/* 0xCC , PMIC, Charger, Flash LED */
> -	struct i2c_client *muic;	/* 0x4A , MUIC */
> -	struct i2c_client *haptic;	/* 0x90 , Haptic */
> -
> -	enum max77693_types type;
> -
> -	struct regmap *regmap;
> -	struct regmap *regmap_muic;
> -	struct regmap *regmap_haptic;
> -
> -	struct regmap_irq_chip_data *irq_data_led;
> -	struct regmap_irq_chip_data *irq_data_topsys;
> -	struct regmap_irq_chip_data *irq_data_charger;
> -	struct regmap_irq_chip_data *irq_data_muic;
> -
> -	int irq;
> -};
> -
>  #endif /*  __LINUX_MFD_MAX77693_PRIV_H */

-- 
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] 24+ messages in thread

end of thread, other threads:[~2015-05-27  9:17 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-29 10:58 [PATCH 00/10] regulator/power/mfd/input/extcon: Merge max77843 into max77693 Krzysztof Kozlowski
2015-04-29 10:58 ` [PATCH 01/10] mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members Krzysztof Kozlowski
2015-05-04  6:45   ` Chanwoo Choi
2015-05-04  6:49     ` Krzysztof Kozłowski
2015-05-04  6:54       ` Chanwoo Choi
2015-05-04  7:01         ` Krzysztof Kozłowski
2015-05-05  8:24   ` Lee Jones
2015-04-29 10:58 ` [PATCH 02/10] mfd: max77693: Store I2C device type as enum and add default unknown Krzysztof Kozlowski
2015-04-29 10:58 ` [PATCH 03/10] regulator: max77693: Use core code for charger's is_enabled Krzysztof Kozlowski
2015-04-29 11:03   ` Mark Brown
2015-04-29 11:08     ` Krzysztof Kozłowski
2015-04-29 10:58 ` [PATCH 04/10] regulator: max77693: Support different register configurations Krzysztof Kozlowski
2015-04-29 17:41   ` Mark Brown
2015-04-29 10:58 ` [PATCH 05/10] max77693: Move state container to common header Krzysztof Kozlowski
2015-05-23 15:11   ` Sebastian Reichel
2015-05-27  9:17   ` Lee Jones
2015-04-29 10:58 ` [PATCH 06/10] max77843: Switch to common max77693 state container Krzysztof Kozlowski
2015-04-29 10:58 ` [PATCH 07/10] mfd/extcon: max77693: Rename defines to allow inclusion with max77843 Krzysztof Kozlowski
2015-04-29 13:12   ` Lee Jones
2015-04-29 13:23     ` Krzysztof Kozłowski
2015-04-29 10:58 ` [PATCH 08/10] mfd/extcon: max77843: Rename defines to allow inclusion with max77693 Krzysztof Kozlowski
2015-04-29 13:11   ` Lee Jones
2015-04-29 10:58 ` [PATCH 09/10] regulator: max77693: Add support for MAX77843 device Krzysztof Kozlowski
2015-04-29 17:58   ` Mark Brown

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).