Skip to contentSkip to conversation

support PMIC mc13892

PATCH New b00984 at freescale.com 5 participants 7 messages Dec 7, 2010 – Dec 8, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 support PMIC mc13892

From: Yong Shen <[email protected]>

add support for mc13892, tested on mx51 babbage board

---
 drivers/regulator/Kconfig             |    8 +
 drivers/regulator/Makefile            |    1 +
 drivers/regulator/mc13892-regulator.c |  645 +++++++++++++++++++++++++++++++++
 include/linux/mfd/mc13892.h           |   38 ++
 4 files changed, 692 insertions(+), 0 deletions(-)
 create mode 100644 drivers/regulator/mc13892-regulator.c
 create mode 100644 include/linux/mfd/mc13892.h
drivers/regulator/Kconfig +8 -0
index 6e54253..1673a4f 100644
@@ -197,6 +197,14 @@ config REGULATOR_MC13783
 	  Say y here to support the regulators found on the Freescale MC13783
 	  PMIC.
 
+config REGULATOR_MC13892
+	tristate "Support regulators on Freescale MC13892 PMIC"
+	depends on MFD_MC13XXX
+	select REGULATOR_MC13XXX_CORE
+	help
+	  Say y here to support the regulators found on the Freescale MC13892
+	  PMIC.
+
 config REGULATOR_AB3100
 	tristate "ST-Ericsson AB3100 Regulator functions"
 	depends on AB3100_CORE
drivers/regulator/Makefile +1 -0
index 11876be..3107480 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_REGULATOR_DA903X)	+= da903x.o
 obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
 obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
 obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
+obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
 obj-$(CONFIG_REGULATOR_MC13XXX_CORE) +=  mc13xxx-regulator-core.o
 obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o
 
drivers/regulator/mc13892-regulator.c new file +645 -0

645 lines not on this page · raw message

include/linux/mfd/mc13892.h new file +38 -0
new file mode 100644
index 0000000..7df13e8
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010 Yong Shen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+
+#ifndef __LINUX_MFD_MC13892_H
+#define __LINUX_MFD_MC13892_H
+#include <linux/mfd/mc13xxx.h>
+
+#define MC13892_SW1		0
+#define MC13892_SW2		1
+#define MC13892_SW3		2
+#define MC13892_SW4		3
+#define MC13892_SWBST	4
+#define MC13892_VIOHI	5
+#define MC13892_VPLL	6
+#define MC13892_VDIG	7
+#define MC13892_VSD	8
+#define MC13892_VUSB2	9
+#define MC13892_VVIDEO	10
+#define MC13892_VAUDIO	11
+#define MC13892_VCAM	12
+#define MC13892_VGEN1	13
+#define MC13892_VGEN2	14
+#define MC13892_VGEN3	15
+#define MC13892_VUSB	16
+#define MC13892_GPO1	17
+#define MC13892_GPO2	18
+#define MC13892_GPO3	19
+#define MC13892_GPO4	20
+#define MC13892_PWGT1SPI	21
+#define MC13892_PWGT2SPI	22
+#define MC13892_VCOINCELL	23
+
+#endif
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v2 1/1 support PMIC mc13892

Quoted 3 lines · <[email protected]> writes:

From: Yong Shen <[email protected]>

add support for mc13892, tested on mx51 babbage board

I've compared this version with mine, checked & tested it. I'm happy with it and moreover it has the nice idea to work on my efikamx.

I'm not sure if it should be a signed-off-by: or acked-by: or reviewed-by:
tag since I wrote the code you've used a basis. I'm putting my s-o-b but if I'm wrong, I do hope someone will correct it.

#2 lore raw

PATCH v2 1/1 support PMIC mc13892

Quoted 6 lines · Arnaud Patard
Quoted 3 lines · <[email protected]> writes:

From: Yong Shen <[email protected]>

add support for mc13892, tested on mx51 babbage board

Quoted 9 lines

I've compared this version with mine, checked & tested it. I'm happy with it and moreover it has the nice idea to work on my efikamx.

I'm not sure if it should be a signed-off-by: or acked-by: or reviewed-by:
tag since I wrote the code you've used a basis. I'm putting my s-o-b but if I'm wrong, I do hope someone will correct it.

I'd say

Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

PATCH v2 1/1 support PMIC mc13892

In reply to Arnaud Patard (Rtp)
Quoted 6 lines · Arnaud Patard
Quoted 3 lines · <[email protected]> writes:

From: Yong Shen <[email protected]>

add support for mc13892, tested on mx51 babbage board

Quoted 9 lines

I've compared this version with mine, checked & tested it. I'm happy with it and moreover it has the nice idea to work on my efikamx.

I'm not sure if it should be a signed-off-by: or acked-by: or reviewed-by:
tag since I wrote the code you've used a basis. I'm putting my s-o-b but if I'm wrong, I do hope someone will correct it.

It is nice that you mention this issue. I was also wondering for a while about what should I do about this, I was not sure, so I put Arnaud in the head comments. Is there any conventions for this? I am OK with:

It seems that I should send out a new patch for this, or can I just ask maintainer who is responsible for merging this patch to change the s-o-b?

Yong

#4 lore raw

PATCH v2 1/1 support PMIC mc13892

Quoted 6 lines · Yong Shen
Quoted 3 lines · Arnaud Patard

I'm not sure if it should be a signed-off-by: or acked-by: or reviewed-by:
tag since I wrote the code you've used a basis. I'm putting my s-o-b but if I'm wrong, I do hope someone will correct it.

Quoted 8 lines
Quoted 1 line

It is nice that you mention this issue. I was also wondering for a while about what should I do about this, I was not sure, so I put Arnaud in the head comments. Is there any conventions for this? I am OK with:

A signoff has a very specific meaning which would in this situation mean that Arnaud wrote part of the patch - see SubmittingPatches. Otherwise a Tested-by and/or Reviewed-by seem appropriate (with the obvious meanings).

Quoted 3 lines

It seems that I should send out a new patch for this, or can I just ask maintainer who is responsible for merging this patch to change the s-o-b?

Maintainers will usually take care of this, but if you need to resend please do include tags that still apply.

#5 lore raw

PATCH v2 1/1 support PMIC mc13892

In reply to b00984 at freescale.com
Quoted 15 lines · On Tue, Dec 07, 2010 at 04:01:45PM +0800, b00984 at freescale.com wrote:
drivers/regulator/mc13892-regulator.c new file +15 -0
+	mc13xxx_lock(priv->mc13xxx);
+	ret = mc13xxx_reg_read(priv->mc13xxx,
+				mc13892_regulators[id].vsel_reg, &val);
+	mc13xxx_unlock(priv->mc13xxx);
+	if (ret)
+		return ret;
+
+	hi  = val & MC13892_SWITCHERS0_SWxHI;
+	if (value > 1375)
+		hi = 1;
+	if (value < 1100)
+		hi = 0;
+
+	if (hi) {
+		value = (value - 1100000) / 25000;

drivers/regulator/mc13892-regulator.c line 476

Quoted 10 lines
drivers/regulator/mc13892-regulator.c new file +10 -0
+		value |= MC13892_SWITCHERS0_SWxHI;
+	} else
+		value = (value - 600000) / 25000;
+
+	mask = mc13892_regulators[id].vsel_mask | MC13892_SWITCHERS0_SWxHI;
+	mc13xxx_lock(priv->mc13xxx);
+	ret = mc13xxx_reg_rmw(priv->mc13xxx, mc13892_regulators[id].vsel_reg,
+			mask,
+			value << mc13892_regulators[id].vsel_shift);
+	mc13xxx_unlock(priv->mc13xxx);

This section here reads like it's all one big read/modify/write cycle and therefore the mutex ought to be held throughout?

Otherwise the patch looks good.

#6 lore raw

PATCH v2 1/1 support PMIC mc13892

Hi,

Quoted 22 lines · Mark Brown
Quoted 20 lines · On Tue, Dec 07, 2010 at 04:01:45PM +0800, b00984 at freescale.com wrote:

+ ? ? mc13xxx_lock(priv->mc13xxx);
+ ? ? ret = mc13xxx_reg_read(priv->mc13xxx,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? mc13892_regulators[id].vsel_reg, &val);
+ ? ? mc13xxx_unlock(priv->mc13xxx);
+ ? ? if (ret)
+ ? ? ? ? ? ? return ret;

(quoted diff) +14 -0
+
+ ? ? hi ?= val & MC13892_SWITCHERS0_SWxHI;
+ ? ? if (value > 1375)
+ ? ? ? ? ? ? hi = 1;
+ ? ? if (value < 1100)
+ ? ? ? ? ? ? hi = 0;
+
+ ? ? if (hi) {
+ ? ? ? ? ? ? value = (value - 1100000) / 25000;
+ ? ? ? ? ? ? value |= MC13892_SWITCHERS0_SWxHI;
+ ? ? } else
+ ? ? ? ? ? ? value = (value - 600000) / 25000;
+
+ ? ? mask = mc13892_regulators[id].vsel_mask | MC13892_SWITCHERS0_SWxHI;
Quoted 8 lines
Quoted 5 lines

+ ? ? mc13xxx_lock(priv->mc13xxx);
+ ? ? ret = mc13xxx_reg_rmw(priv->mc13xxx, mc13892_regulators[id].vsel_reg,
+ ? ? ? ? ? ? ? ? ? ? mask,
+ ? ? ? ? ? ? ? ? ? ? value << mc13892_regulators[id].vsel_shift);
+ ? ? mc13xxx_unlock(priv->mc13xxx);

This section here reads like it's all one big read/modify/write cycle and therefore the mutex ought to be held throughout?

That's right.

Yong

Quoted 3 lines

Otherwise the patch looks good.