All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mfd: sec: reorder params in API for regmap consistency
@ 2013-11-08 15:05 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-08 15:05 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Sangbeom Kim, Liam Girdwood, Mark Brown, linux-kernel,
	linux-arm-kernel, linux-samsung-soc
  Cc: Krzysztof Kozlowski, Kyungmin Park

The last two parameters of certain register access functions were in
different order than regmap API. This was confusing and error-prone.

Reorder parameters for register access API to match regmap API:
 - sec_bulk_read() reorder count and buf,
 - sec_bulk_write() reorder count and buf,
 - sec_reg_update() reorder val and mask.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mfd/sec-core.c           |    6 +++---
 drivers/regulator/s5m8767.c      |   26 +++++++++++++-------------
 include/linux/mfd/samsung/core.h |    6 +++---
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index f530e4b..039814e 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -84,7 +84,7 @@ int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)
 }
 EXPORT_SYMBOL_GPL(sec_reg_read);
 
-int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
+int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count)
 {
 	return regmap_bulk_read(sec_pmic->regmap, reg, buf, count);
 }
@@ -96,13 +96,13 @@ int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value)
 }
 EXPORT_SYMBOL_GPL(sec_reg_write);
 
-int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
+int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count)
 {
 	return regmap_raw_write(sec_pmic->regmap, reg, buf, count);
 }
 EXPORT_SYMBOL_GPL(sec_bulk_write);
 
-int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask)
+int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 mask, u8 val)
 {
 	return regmap_update_bits(sec_pmic->regmap, reg, mask, val);
 }
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index c24448b..ac10db4 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -243,7 +243,7 @@ static int s5m8767_reg_enable(struct regulator_dev *rdev)
 	if (ret)
 		return ret;
 
-	return sec_reg_update(s5m8767->iodev, reg, enable_ctrl, mask);
+	return sec_reg_update(s5m8767->iodev, reg, mask, enable_ctrl);
 }
 
 static int s5m8767_reg_disable(struct regulator_dev *rdev)
@@ -256,7 +256,7 @@ static int s5m8767_reg_disable(struct regulator_dev *rdev)
 	if (ret)
 		return ret;
 
-	return sec_reg_update(s5m8767->iodev, reg, ~mask, mask);
+	return sec_reg_update(s5m8767->iodev, reg, mask, ~mask);
 }
 
 static int s5m8767_get_vsel_reg(int reg_id, struct s5m8767_info *s5m8767)
@@ -820,14 +820,14 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 	if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
 	   pdata->buck4_gpiodvs) {
 		sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK2CTRL,
-				(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1),
-				1 << 1);
+				1 << 1,
+				(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
 		sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK3CTRL,
-				(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1),
-				1 << 1);
+				1 << 1,
+				(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
 		sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK4CTRL,
-				(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1),
-				1 << 1);
+				1 << 1,
+				(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
 	}
 
 	/* Initialize GPIO DVS registers */
@@ -862,19 +862,19 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 		switch (s5m8767->ramp_delay) {
 		case 5:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0x40, 0xf0);
+					0xf0, 0x40);
 			break;
 		case 10:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0x90, 0xf0);
+					0xf0, 0x90);
 			break;
 		case 25:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0xd0, 0xf0);
+					0xf0, 0xd0);
 			break;
 		case 50:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0xe0, 0xf0);
+					0xf0, 0xe0);
 			break;
 		case 100:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
@@ -882,7 +882,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 			break;
 		default:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0x90, 0xf0);
+					0xf0, 0x90);
 		}
 	}
 
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 378ae8a..b04509e 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -58,10 +58,10 @@ void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
 int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
 
 extern int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest);
-extern int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
+extern int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count);
 extern int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value);
-extern int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
-extern int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask);
+extern int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count);
+extern int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 mask, u8 val);
 
 struct sec_platform_data {
 	struct sec_regulator_data	*regulators;
-- 
1.7.9.5


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

* [PATCH 1/2] mfd: sec: reorder params in API for regmap consistency
@ 2013-11-08 15:05 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-08 15:05 UTC (permalink / raw)
  To: linux-arm-kernel

The last two parameters of certain register access functions were in
different order than regmap API. This was confusing and error-prone.

Reorder parameters for register access API to match regmap API:
 - sec_bulk_read() reorder count and buf,
 - sec_bulk_write() reorder count and buf,
 - sec_reg_update() reorder val and mask.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mfd/sec-core.c           |    6 +++---
 drivers/regulator/s5m8767.c      |   26 +++++++++++++-------------
 include/linux/mfd/samsung/core.h |    6 +++---
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index f530e4b..039814e 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -84,7 +84,7 @@ int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)
 }
 EXPORT_SYMBOL_GPL(sec_reg_read);
 
-int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
+int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count)
 {
 	return regmap_bulk_read(sec_pmic->regmap, reg, buf, count);
 }
@@ -96,13 +96,13 @@ int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value)
 }
 EXPORT_SYMBOL_GPL(sec_reg_write);
 
-int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
+int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count)
 {
 	return regmap_raw_write(sec_pmic->regmap, reg, buf, count);
 }
 EXPORT_SYMBOL_GPL(sec_bulk_write);
 
-int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask)
+int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 mask, u8 val)
 {
 	return regmap_update_bits(sec_pmic->regmap, reg, mask, val);
 }
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index c24448b..ac10db4 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -243,7 +243,7 @@ static int s5m8767_reg_enable(struct regulator_dev *rdev)
 	if (ret)
 		return ret;
 
-	return sec_reg_update(s5m8767->iodev, reg, enable_ctrl, mask);
+	return sec_reg_update(s5m8767->iodev, reg, mask, enable_ctrl);
 }
 
 static int s5m8767_reg_disable(struct regulator_dev *rdev)
@@ -256,7 +256,7 @@ static int s5m8767_reg_disable(struct regulator_dev *rdev)
 	if (ret)
 		return ret;
 
-	return sec_reg_update(s5m8767->iodev, reg, ~mask, mask);
+	return sec_reg_update(s5m8767->iodev, reg, mask, ~mask);
 }
 
 static int s5m8767_get_vsel_reg(int reg_id, struct s5m8767_info *s5m8767)
@@ -820,14 +820,14 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 	if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
 	   pdata->buck4_gpiodvs) {
 		sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK2CTRL,
-				(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1),
-				1 << 1);
+				1 << 1,
+				(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
 		sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK3CTRL,
-				(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1),
-				1 << 1);
+				1 << 1,
+				(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
 		sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK4CTRL,
-				(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1),
-				1 << 1);
+				1 << 1,
+				(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
 	}
 
 	/* Initialize GPIO DVS registers */
@@ -862,19 +862,19 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 		switch (s5m8767->ramp_delay) {
 		case 5:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0x40, 0xf0);
+					0xf0, 0x40);
 			break;
 		case 10:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0x90, 0xf0);
+					0xf0, 0x90);
 			break;
 		case 25:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0xd0, 0xf0);
+					0xf0, 0xd0);
 			break;
 		case 50:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0xe0, 0xf0);
+					0xf0, 0xe0);
 			break;
 		case 100:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
@@ -882,7 +882,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 			break;
 		default:
 			sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
-					0x90, 0xf0);
+					0xf0, 0x90);
 		}
 	}
 
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 378ae8a..b04509e 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -58,10 +58,10 @@ void sec_irq_exit(struct sec_pmic_dev *sec_pmic);
 int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
 
 extern int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest);
-extern int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
+extern int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count);
 extern int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value);
-extern int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf);
-extern int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask);
+extern int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 *buf, int count);
+extern int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 mask, u8 val);
 
 struct sec_platform_data {
 	struct sec_regulator_data	*regulators;
-- 
1.7.9.5

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

* [PATCH 2/2] mfd: max77693: reorder params in API for regmap consistency
  2013-11-08 15:05 ` Krzysztof Kozlowski
@ 2013-11-08 15:05   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-08 15:05 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Sangbeom Kim, Liam Girdwood, Mark Brown, linux-kernel,
	linux-arm-kernel, linux-samsung-soc
  Cc: Krzysztof Kozlowski, Kyungmin Park

The last two parameters of certain register access functions were in
different order than regmap API. This was confusing and error-prone.

Reorder parameters for register access API to match regmap API:
 - max77693_bulk_read() reorder count and buf,
 - max77693_bulk_write() reorder count and buf,
 - max77693_update_reg() reorder val and mask.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/extcon/extcon-max77693.c     |   14 +++++++-------
 drivers/mfd/max77693-irq.c           |    2 +-
 drivers/mfd/max77693.c               |    6 +++---
 include/linux/mfd/max77693-private.h |   10 +++++-----
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index da268fb..602d948 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -257,8 +257,8 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
 	case ADC_DEBOUNCE_TIME_38_62MS:
 		ret = max77693_update_reg(info->max77693->regmap_muic,
 					  MAX77693_MUIC_REG_CTRL3,
-					  time << CONTROL3_ADCDBSET_SHIFT,
-					  CONTROL3_ADCDBSET_MASK);
+					  CONTROL3_ADCDBSET_MASK,
+					  time << CONTROL3_ADCDBSET_SHIFT);
 		if (ret) {
 			dev_err(info->dev, "failed to set ADC debounce time\n");
 			return ret;
@@ -294,7 +294,7 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
 		ctrl1 = CONTROL1_SW_OPEN;
 
 	ret = max77693_update_reg(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_CTRL1, ctrl1, COMP_SW_MASK);
+			MAX77693_MUIC_REG_CTRL1, COMP_SW_MASK, ctrl1);
 	if (ret < 0) {
 		dev_err(info->dev, "failed to update MUIC register\n");
 		return ret;
@@ -306,8 +306,8 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
 		ctrl2 |= CONTROL2_LOWPWR_MASK;	/* LowPwr=1, CPEn=0 */
 
 	ret = max77693_update_reg(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_CTRL2, ctrl2,
-			CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK);
+			MAX77693_MUIC_REG_CTRL2,
+			CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK, ctrl2);
 	if (ret < 0) {
 		dev_err(info->dev, "failed to update MUIC register\n");
 		return ret;
@@ -970,7 +970,7 @@ static void max77693_muic_irq_work(struct work_struct *work)
 			irq_type = muic_irqs[i].irq;
 
 	ret = max77693_bulk_read(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_STATUS1, 2, info->status);
+			MAX77693_MUIC_REG_STATUS1, info->status, 2);
 	if (ret) {
 		dev_err(info->dev, "failed to read MUIC register\n");
 		mutex_unlock(&info->mutex);
@@ -1043,7 +1043,7 @@ static int max77693_muic_detect_accessory(struct max77693_muic_info *info)
 
 	/* Read STATUSx register to detect accessory */
 	ret = max77693_bulk_read(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_STATUS1, 2, info->status);
+			MAX77693_MUIC_REG_STATUS1, info->status, 2);
 	if (ret) {
 		dev_err(info->dev, "failed to read MUIC register\n");
 		mutex_unlock(&info->mutex);
diff --git a/drivers/mfd/max77693-irq.c b/drivers/mfd/max77693-irq.c
index 1029d01..8718927 100644
--- a/drivers/mfd/max77693-irq.c
+++ b/drivers/mfd/max77693-irq.c
@@ -207,7 +207,7 @@ static irqreturn_t max77693_irq_thread(int irq, void *data)
 	if (irq_src & MAX77693_IRQSRC_MUIC)
 		/* MUIC INT1 ~ INT3 */
 		max77693_bulk_read(max77693->regmap_muic, MAX77693_MUIC_REG_INT1,
-			MAX77693_NUM_IRQ_MUIC_REGS, &irq_reg[MUIC_INT1]);
+			&irq_reg[MUIC_INT1], MAX77693_NUM_IRQ_MUIC_REGS);
 
 	/* Apply masking */
 	for (i = 0; i < MAX77693_IRQ_GROUP_NR; i++) {
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index c04723e..54f1a7f 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -60,7 +60,7 @@ int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest)
 }
 EXPORT_SYMBOL_GPL(max77693_read_reg);
 
-int max77693_bulk_read(struct regmap *map, u8 reg, int count, u8 *buf)
+int max77693_bulk_read(struct regmap *map, u8 reg, u8 *buf, int count)
 {
 	int ret;
 
@@ -80,7 +80,7 @@ int max77693_write_reg(struct regmap *map, u8 reg, u8 value)
 }
 EXPORT_SYMBOL_GPL(max77693_write_reg);
 
-int max77693_bulk_write(struct regmap *map, u8 reg, int count, u8 *buf)
+int max77693_bulk_write(struct regmap *map, u8 reg, u8 *buf, int count)
 {
 	int ret;
 
@@ -90,7 +90,7 @@ int max77693_bulk_write(struct regmap *map, u8 reg, int count, u8 *buf)
 }
 EXPORT_SYMBOL_GPL(max77693_bulk_write);
 
-int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask)
+int max77693_update_reg(struct regmap *map, u8 reg, u8 mask, u8 val)
 {
 	int ret;
 
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 244fb0d..40fd954 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -334,12 +334,12 @@ enum max77693_types {
 };
 
 extern int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest);
-extern int max77693_bulk_read(struct regmap *map, u8 reg, int count,
-				u8 *buf);
+extern int max77693_bulk_read(struct regmap *map, u8 reg, u8 *buf,
+				int count);
 extern int max77693_write_reg(struct regmap *map, u8 reg, u8 value);
-extern int max77693_bulk_write(struct regmap *map, u8 reg, int count,
-				u8 *buf);
-extern int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask);
+extern int max77693_bulk_write(struct regmap *map, u8 reg, u8 *buf,
+				int count);
+extern int max77693_update_reg(struct regmap *map, u8 reg, u8 mask, u8 val);
 
 extern int max77693_irq_init(struct max77693_dev *max77686);
 extern void max77693_irq_exit(struct max77693_dev *max77686);
-- 
1.7.9.5


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

* [PATCH 2/2] mfd: max77693: reorder params in API for regmap consistency
@ 2013-11-08 15:05   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-08 15:05 UTC (permalink / raw)
  To: linux-arm-kernel

The last two parameters of certain register access functions were in
different order than regmap API. This was confusing and error-prone.

Reorder parameters for register access API to match regmap API:
 - max77693_bulk_read() reorder count and buf,
 - max77693_bulk_write() reorder count and buf,
 - max77693_update_reg() reorder val and mask.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/extcon/extcon-max77693.c     |   14 +++++++-------
 drivers/mfd/max77693-irq.c           |    2 +-
 drivers/mfd/max77693.c               |    6 +++---
 include/linux/mfd/max77693-private.h |   10 +++++-----
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index da268fb..602d948 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -257,8 +257,8 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
 	case ADC_DEBOUNCE_TIME_38_62MS:
 		ret = max77693_update_reg(info->max77693->regmap_muic,
 					  MAX77693_MUIC_REG_CTRL3,
-					  time << CONTROL3_ADCDBSET_SHIFT,
-					  CONTROL3_ADCDBSET_MASK);
+					  CONTROL3_ADCDBSET_MASK,
+					  time << CONTROL3_ADCDBSET_SHIFT);
 		if (ret) {
 			dev_err(info->dev, "failed to set ADC debounce time\n");
 			return ret;
@@ -294,7 +294,7 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
 		ctrl1 = CONTROL1_SW_OPEN;
 
 	ret = max77693_update_reg(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_CTRL1, ctrl1, COMP_SW_MASK);
+			MAX77693_MUIC_REG_CTRL1, COMP_SW_MASK, ctrl1);
 	if (ret < 0) {
 		dev_err(info->dev, "failed to update MUIC register\n");
 		return ret;
@@ -306,8 +306,8 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
 		ctrl2 |= CONTROL2_LOWPWR_MASK;	/* LowPwr=1, CPEn=0 */
 
 	ret = max77693_update_reg(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_CTRL2, ctrl2,
-			CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK);
+			MAX77693_MUIC_REG_CTRL2,
+			CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK, ctrl2);
 	if (ret < 0) {
 		dev_err(info->dev, "failed to update MUIC register\n");
 		return ret;
@@ -970,7 +970,7 @@ static void max77693_muic_irq_work(struct work_struct *work)
 			irq_type = muic_irqs[i].irq;
 
 	ret = max77693_bulk_read(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_STATUS1, 2, info->status);
+			MAX77693_MUIC_REG_STATUS1, info->status, 2);
 	if (ret) {
 		dev_err(info->dev, "failed to read MUIC register\n");
 		mutex_unlock(&info->mutex);
@@ -1043,7 +1043,7 @@ static int max77693_muic_detect_accessory(struct max77693_muic_info *info)
 
 	/* Read STATUSx register to detect accessory */
 	ret = max77693_bulk_read(info->max77693->regmap_muic,
-			MAX77693_MUIC_REG_STATUS1, 2, info->status);
+			MAX77693_MUIC_REG_STATUS1, info->status, 2);
 	if (ret) {
 		dev_err(info->dev, "failed to read MUIC register\n");
 		mutex_unlock(&info->mutex);
diff --git a/drivers/mfd/max77693-irq.c b/drivers/mfd/max77693-irq.c
index 1029d01..8718927 100644
--- a/drivers/mfd/max77693-irq.c
+++ b/drivers/mfd/max77693-irq.c
@@ -207,7 +207,7 @@ static irqreturn_t max77693_irq_thread(int irq, void *data)
 	if (irq_src & MAX77693_IRQSRC_MUIC)
 		/* MUIC INT1 ~ INT3 */
 		max77693_bulk_read(max77693->regmap_muic, MAX77693_MUIC_REG_INT1,
-			MAX77693_NUM_IRQ_MUIC_REGS, &irq_reg[MUIC_INT1]);
+			&irq_reg[MUIC_INT1], MAX77693_NUM_IRQ_MUIC_REGS);
 
 	/* Apply masking */
 	for (i = 0; i < MAX77693_IRQ_GROUP_NR; i++) {
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index c04723e..54f1a7f 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -60,7 +60,7 @@ int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest)
 }
 EXPORT_SYMBOL_GPL(max77693_read_reg);
 
-int max77693_bulk_read(struct regmap *map, u8 reg, int count, u8 *buf)
+int max77693_bulk_read(struct regmap *map, u8 reg, u8 *buf, int count)
 {
 	int ret;
 
@@ -80,7 +80,7 @@ int max77693_write_reg(struct regmap *map, u8 reg, u8 value)
 }
 EXPORT_SYMBOL_GPL(max77693_write_reg);
 
-int max77693_bulk_write(struct regmap *map, u8 reg, int count, u8 *buf)
+int max77693_bulk_write(struct regmap *map, u8 reg, u8 *buf, int count)
 {
 	int ret;
 
@@ -90,7 +90,7 @@ int max77693_bulk_write(struct regmap *map, u8 reg, int count, u8 *buf)
 }
 EXPORT_SYMBOL_GPL(max77693_bulk_write);
 
-int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask)
+int max77693_update_reg(struct regmap *map, u8 reg, u8 mask, u8 val)
 {
 	int ret;
 
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
index 244fb0d..40fd954 100644
--- a/include/linux/mfd/max77693-private.h
+++ b/include/linux/mfd/max77693-private.h
@@ -334,12 +334,12 @@ enum max77693_types {
 };
 
 extern int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest);
-extern int max77693_bulk_read(struct regmap *map, u8 reg, int count,
-				u8 *buf);
+extern int max77693_bulk_read(struct regmap *map, u8 reg, u8 *buf,
+				int count);
 extern int max77693_write_reg(struct regmap *map, u8 reg, u8 value);
-extern int max77693_bulk_write(struct regmap *map, u8 reg, int count,
-				u8 *buf);
-extern int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask);
+extern int max77693_bulk_write(struct regmap *map, u8 reg, u8 *buf,
+				int count);
+extern int max77693_update_reg(struct regmap *map, u8 reg, u8 mask, u8 val);
 
 extern int max77693_irq_init(struct max77693_dev *max77686);
 extern void max77693_irq_exit(struct max77693_dev *max77686);
-- 
1.7.9.5

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

* Re: [PATCH 1/2] mfd: sec: reorder params in API for regmap consistency
  2013-11-08 15:05 ` Krzysztof Kozlowski
@ 2013-11-08 15:52   ` Lee Jones
  -1 siblings, 0 replies; 12+ messages in thread
From: Lee Jones @ 2013-11-08 15:52 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Sangbeom Kim,
	Liam Girdwood, Mark Brown, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, Kyungmin Park

On Fri, 08 Nov 2013, Krzysztof Kozlowski wrote:

> The last two parameters of certain register access functions were in
> different order than regmap API. This was confusing and error-prone.
> 
> Reorder parameters for register access API to match regmap API:
>  - sec_bulk_read() reorder count and buf,
>  - sec_bulk_write() reorder count and buf,
>  - sec_reg_update() reorder val and mask.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mfd/sec-core.c           |    6 +++---
>  drivers/regulator/s5m8767.c      |   26 +++++++++++++-------------
>  include/linux/mfd/samsung/core.h |    6 +++---
>  3 files changed, 19 insertions(+), 19 deletions(-)

Seems to make sense.

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

* [PATCH 1/2] mfd: sec: reorder params in API for regmap consistency
@ 2013-11-08 15:52   ` Lee Jones
  0 siblings, 0 replies; 12+ messages in thread
From: Lee Jones @ 2013-11-08 15:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 08 Nov 2013, Krzysztof Kozlowski wrote:

> The last two parameters of certain register access functions were in
> different order than regmap API. This was confusing and error-prone.
> 
> Reorder parameters for register access API to match regmap API:
>  - sec_bulk_read() reorder count and buf,
>  - sec_bulk_write() reorder count and buf,
>  - sec_reg_update() reorder val and mask.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mfd/sec-core.c           |    6 +++---
>  drivers/regulator/s5m8767.c      |   26 +++++++++++++-------------
>  include/linux/mfd/samsung/core.h |    6 +++---
>  3 files changed, 19 insertions(+), 19 deletions(-)

Seems to make sense.

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

* Re: [PATCH 2/2] mfd: max77693: reorder params in API for regmap consistency
  2013-11-08 15:05   ` Krzysztof Kozlowski
@ 2013-11-08 15:54     ` Lee Jones
  -1 siblings, 0 replies; 12+ messages in thread
From: Lee Jones @ 2013-11-08 15:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: MyungJoo Ham, Chanwoo Choi, Samuel Ortiz, Sangbeom Kim,
	Liam Girdwood, Mark Brown, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, Kyungmin Park

On Fri, 08 Nov 2013, Krzysztof Kozlowski wrote:

> The last two parameters of certain register access functions were in
> different order than regmap API. This was confusing and error-prone.
> 
> Reorder parameters for register access API to match regmap API:
>  - max77693_bulk_read() reorder count and buf,
>  - max77693_bulk_write() reorder count and buf,
>  - max77693_update_reg() reorder val and mask.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/extcon/extcon-max77693.c     |   14 +++++++-------
>  drivers/mfd/max77693-irq.c           |    2 +-
>  drivers/mfd/max77693.c               |    6 +++---
>  include/linux/mfd/max77693-private.h |   10 +++++-----
>  4 files changed, 16 insertions(+), 16 deletions(-)

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

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

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

* [PATCH 2/2] mfd: max77693: reorder params in API for regmap consistency
@ 2013-11-08 15:54     ` Lee Jones
  0 siblings, 0 replies; 12+ messages in thread
From: Lee Jones @ 2013-11-08 15:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 08 Nov 2013, Krzysztof Kozlowski wrote:

> The last two parameters of certain register access functions were in
> different order than regmap API. This was confusing and error-prone.
> 
> Reorder parameters for register access API to match regmap API:
>  - max77693_bulk_read() reorder count and buf,
>  - max77693_bulk_write() reorder count and buf,
>  - max77693_update_reg() reorder val and mask.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/extcon/extcon-max77693.c     |   14 +++++++-------
>  drivers/mfd/max77693-irq.c           |    2 +-
>  drivers/mfd/max77693.c               |    6 +++---
>  include/linux/mfd/max77693-private.h |   10 +++++-----
>  4 files changed, 16 insertions(+), 16 deletions(-)

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

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

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

* [PATCH] regulator: s5m8767: Disable OVCB in probe
  2013-11-08 15:05 ` Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  (?)
@ 2013-11-12 13:41 ` Krzysztof Kozlowski
  2013-11-12 15:41   ` Lee Jones
  2013-11-13 13:50   ` Mark Brown
  -1 siblings, 2 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2013-11-12 13:41 UTC (permalink / raw)
  To: Sangbeom Kim, Liam Girdwood, Mark Brown, Samuel Ortiz, Lee Jones,
	linux-kernel
  Cc: Krzysztof Kozlowski, Kyungmin Park

According to SW Guide the Over-Voltage Clamp may malfunction at VBatt
5.25V and 110'C temperature. This may result in overshooting or
undershooting LDO's voltage outputs.
Disable the Over-Voltage Clamp in probe by updating proper bit in all
LDO registers.

The patch uses sec_bulk_read/write() API with reordered buf and count
parameters so it depends on:
  "mfd: sec: reorder params in API for regmap consistency"
  http://www.spinics.net/lists/kernel/msg1632519.html

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/regulator/s5m8767.c         |   26 ++++++++++++++++++++++++++
 include/linux/mfd/samsung/s5m8767.h |    1 +
 2 files changed, 27 insertions(+)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index ac10db4..7c6fb97 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -478,6 +478,26 @@ static struct regulator_desc regulators[] = {
 	s5m8767_regulator_desc(BUCK9),
 };
 
+/*
+ * Disables Over-Voltage Clamp for all LDO-s.
+ */
+static int s5m8767_reg_disable_ldo_ovcb(struct s5m8767_info *s5m8767)
+{
+	u8 data[28];
+	int i, ret;
+
+	ret = sec_bulk_read(s5m8767->iodev, S5M8767_REG_LDO1, data,
+			ARRAY_SIZE(data));
+	if (ret)
+		return ret;
+
+	for (i = 0; i < ARRAY_SIZE(data); i++)
+		data[i] |= (1 << S5M8767_REG_LDO_SHIFT);
+
+	return sec_bulk_write(s5m8767->iodev, S5M8767_REG_LDO1, data,
+			ARRAY_SIZE(data));
+}
+
 #ifdef CONFIG_OF
 static int s5m8767_pmic_dt_parse_dvs_gpio(struct sec_pmic_dev *iodev,
 			struct sec_platform_data *pdata,
@@ -886,6 +906,12 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 		}
 	}
 
+	/*
+	 * Disable Over-Voltage Clamp,
+	 * possible malfunction at VBatt 5.25V and 110'C temperature
+	 */
+	s5m8767_reg_disable_ldo_ovcb(s5m8767);
+
 	for (i = 0; i < pdata->num_regulators; i++) {
 		const struct sec_voltage_desc *desc;
 		int id = pdata->regulators[i].id;
diff --git a/include/linux/mfd/samsung/s5m8767.h b/include/linux/mfd/samsung/s5m8767.h
index 306a95f..d6c09a0 100644
--- a/include/linux/mfd/samsung/s5m8767.h
+++ b/include/linux/mfd/samsung/s5m8767.h
@@ -184,5 +184,6 @@ enum s5m8767_regulators {
 };
 
 #define S5M8767_ENCTRL_SHIFT  6
+#define S5M8767_REG_LDO_SHIFT	7
 
 #endif /* __LINUX_MFD_S5M8767_H */
-- 
1.7.9.5


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

* Re: [PATCH] regulator: s5m8767: Disable OVCB in probe
  2013-11-12 13:41 ` [PATCH] regulator: s5m8767: Disable OVCB in probe Krzysztof Kozlowski
@ 2013-11-12 15:41   ` Lee Jones
  2013-11-13 13:50   ` Mark Brown
  1 sibling, 0 replies; 12+ messages in thread
From: Lee Jones @ 2013-11-12 15:41 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Liam Girdwood, Mark Brown, Samuel Ortiz,
	linux-kernel, Kyungmin Park

On Tue, 12 Nov 2013, Krzysztof Kozlowski wrote:

> According to SW Guide the Over-Voltage Clamp may malfunction at VBatt
> 5.25V and 110'C temperature. This may result in overshooting or
> undershooting LDO's voltage outputs.
> Disable the Over-Voltage Clamp in probe by updating proper bit in all
> LDO registers.
> 
> The patch uses sec_bulk_read/write() API with reordered buf and count
> parameters so it depends on:
>   "mfd: sec: reorder params in API for regmap consistency"
>   http://www.spinics.net/lists/kernel/msg1632519.html
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/regulator/s5m8767.c         |   26 ++++++++++++++++++++++++++
>  include/linux/mfd/samsung/s5m8767.h |    1 +
>  2 files changed, 27 insertions(+)

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

* Re: [PATCH] regulator: s5m8767: Disable OVCB in probe
  2013-11-12 13:41 ` [PATCH] regulator: s5m8767: Disable OVCB in probe Krzysztof Kozlowski
  2013-11-12 15:41   ` Lee Jones
@ 2013-11-13 13:50   ` Mark Brown
  2013-11-14  1:29     ` Kyungmin Park
  1 sibling, 1 reply; 12+ messages in thread
From: Mark Brown @ 2013-11-13 13:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sangbeom Kim, Liam Girdwood, Samuel Ortiz, Lee Jones,
	linux-kernel, Kyungmin Park

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

On Tue, Nov 12, 2013 at 02:41:55PM +0100, Krzysztof Kozlowski wrote:
> According to SW Guide the Over-Voltage Clamp may malfunction at VBatt
> 5.25V and 110'C temperature. This may result in overshooting or
> undershooting LDO's voltage outputs.
> Disable the Over-Voltage Clamp in probe by updating proper bit in all
> LDO registers.

Is there no way to detect these conditions at runtime?  The temperature
condition in particular seems very high and hence relatively unlikely to
hold most of the time, disabling the overvoltage protection all the time
seems like an uncertain tradeoff.

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

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

* Re: [PATCH] regulator: s5m8767: Disable OVCB in probe
  2013-11-13 13:50   ` Mark Brown
@ 2013-11-14  1:29     ` Kyungmin Park
  0 siblings, 0 replies; 12+ messages in thread
From: Kyungmin Park @ 2013-11-14  1:29 UTC (permalink / raw)
  To: Mark Brown
  Cc: Krzysztof Kozlowski, Sangbeom Kim, Liam Girdwood, Samuel Ortiz,
	Lee Jones, linux-kernel

On Wed, Nov 13, 2013 at 10:50 PM, Mark Brown <broonie@kernel.org> wrote:
> On Tue, Nov 12, 2013 at 02:41:55PM +0100, Krzysztof Kozlowski wrote:
>> According to SW Guide the Over-Voltage Clamp may malfunction at VBatt
>> 5.25V and 110'C temperature. This may result in overshooting or
>> undershooting LDO's voltage outputs.
>> Disable the Over-Voltage Clamp in probe by updating proper bit in all
>> LDO registers.
>
> Is there no way to detect these conditions at runtime?  The temperature
> condition in particular seems very high and hence relatively unlikely to
> hold most of the time, disabling the overvoltage protection all the time
> seems like an uncertain tradeoff.

It's hard to do at runtime. right it's rare case. but some condition
(as above) is meet, and no code as workaround. it's mal-function.
that's the guide to avoid this mal-functions.

Thank you,
Kyungmin Park

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

end of thread, other threads:[~2013-11-14  1:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-08 15:05 [PATCH 1/2] mfd: sec: reorder params in API for regmap consistency Krzysztof Kozlowski
2013-11-08 15:05 ` Krzysztof Kozlowski
2013-11-08 15:05 ` [PATCH 2/2] mfd: max77693: " Krzysztof Kozlowski
2013-11-08 15:05   ` Krzysztof Kozlowski
2013-11-08 15:54   ` Lee Jones
2013-11-08 15:54     ` Lee Jones
2013-11-08 15:52 ` [PATCH 1/2] mfd: sec: " Lee Jones
2013-11-08 15:52   ` Lee Jones
2013-11-12 13:41 ` [PATCH] regulator: s5m8767: Disable OVCB in probe Krzysztof Kozlowski
2013-11-12 15:41   ` Lee Jones
2013-11-13 13:50   ` Mark Brown
2013-11-14  1:29     ` Kyungmin Park

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.