Re: [GIT PULL 1/2] Samsung fixes for v3.18

2014-10-15 Thread Olof Johansson
On Tue, Oct 14, 2014 at 4:26 PM, Kukjin Kim kgene@samsung.com wrote:
 The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:

   Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)

 are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git

Merged, thanks.


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


Re: [GIT PULL 2/2] Samsung defconfig updates for v3.18

2014-10-15 Thread Olof Johansson
On Tue, Oct 14, 2014 at 4:27 PM, Kukjin Kim kgene@samsung.com wrote:
 The following changes since commit 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9:

   Linux 3.17-rc1 (2014-08-16 10:40:26 -0600)

 are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
 tags/samsung-defconfig

 for you to fetch changes up to 508423bebcda29eb0ba7c627f895387dad7cdcd6:

   ARM: exynos_defconfig: enable USB gadget support (2014-09-25 18:20:18
 +0900)

Merged, thanks.


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


[PATCH] arm64: dts: exynos7: add support for cpuidle core power down

2014-10-15 Thread Chander Kashyap
Exynos7 has core power down state where cores can be powered off independently.
This patch adds support for this state.

Signed-off-by: Chander Kashyap k.chan...@samsung.com
---
This patch has following dependencies:
- [PATCH v5 0/8] arch: arm64: Enable support for Samsung Exynos7 SoC
http://www.spinics.net/lists/linux-samsung-soc/msg37047.html
- [PATCH v9 0/8] ARM generic idle states

http://permalink.gmane.org/gmane.linux.power-management.general/49224

 arch/arm64/boot/dts/exynos/exynos7.dtsi |   18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi 
b/arch/arm64/boot/dts/exynos/exynos7.dtsi
index ce221ac..8e0a034 100644
--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
@@ -36,6 +36,7 @@
device_type = cpu;
compatible = arm,cortex-a57, arm,armv8;
enable-method = psci;
+   cpu-idle-states = CPU_SLEEP;
reg = 0x0;
};
 
@@ -43,6 +44,7 @@
device_type = cpu;
compatible = arm,cortex-a57, arm,armv8;
enable-method = psci;
+   cpu-idle-states = CPU_SLEEP;
reg = 0x1;
};
 
@@ -50,6 +52,7 @@
device_type = cpu;
compatible = arm,cortex-a57, arm,armv8;
enable-method = psci;
+   cpu-idle-states = CPU_SLEEP;
reg = 0x2;
};
 
@@ -57,8 +60,23 @@
device_type = cpu;
compatible = arm,cortex-a57, arm,armv8;
enable-method = psci;
+   cpu-idle-states = CPU_SLEEP;
reg = 0x3;
};
+
+   idle-states {
+   entry-method = arm,psci;
+
+   CPU_SLEEP: cpu-sleep {
+   compatible = arm,idle-state;
+   local-timer-stop;
+   arm,psci-suspend-param = 0x001;
+   entry-latency-us = 20;
+   exit-latency-us = 150;
+   min-residency-us = 2100;
+   status = enabled;
+   };
+   };
};
 
psci {
-- 
1.7.9.5

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


Re: [PATCH] arm64: dts: exynos7: add support for cpuidle core power down

2014-10-15 Thread Lorenzo Pieralisi
On Wed, Oct 15, 2014 at 07:35:20AM +0100, Chander Kashyap wrote:
 Exynos7 has core power down state where cores can be powered off 
 independently.
 This patch adds support for this state.

Please tell us more about the idle-state values you are adding, in particular
entry, exit latencies and min-residency values.

 Signed-off-by: Chander Kashyap k.chan...@samsung.com
 ---
 This patch has following dependencies:
   - [PATCH v5 0/8] arch: arm64: Enable support for Samsung Exynos7 SoC
   http://www.spinics.net/lists/linux-samsung-soc/msg37047.html
   - [PATCH v9 0/8] ARM generic idle states
   
 http://permalink.gmane.org/gmane.linux.power-management.general/49224

Series above was merged, so dependency is stale.

  arch/arm64/boot/dts/exynos/exynos7.dtsi |   18 ++
  1 file changed, 18 insertions(+)
 
 diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi 
 b/arch/arm64/boot/dts/exynos/exynos7.dtsi
 index ce221ac..8e0a034 100644
 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
 +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
 @@ -36,6 +36,7 @@
   device_type = cpu;
   compatible = arm,cortex-a57, arm,armv8;
   enable-method = psci;
 + cpu-idle-states = CPU_SLEEP;

I would add cpu-idle-states phandle after the reg property, as defined
in the idle states bindings.

   reg = 0x0;
   };
  
 @@ -43,6 +44,7 @@
   device_type = cpu;
   compatible = arm,cortex-a57, arm,armv8;
   enable-method = psci;
 + cpu-idle-states = CPU_SLEEP;
   reg = 0x1;
   };
  
 @@ -50,6 +52,7 @@
   device_type = cpu;
   compatible = arm,cortex-a57, arm,armv8;
   enable-method = psci;
 + cpu-idle-states = CPU_SLEEP;
   reg = 0x2;
   };
  
 @@ -57,8 +60,23 @@
   device_type = cpu;
   compatible = arm,cortex-a57, arm,armv8;
   enable-method = psci;
 + cpu-idle-states = CPU_SLEEP;
   reg = 0x3;
   };
 +
 + idle-states {
 + entry-method = arm,psci;
 +
 + CPU_SLEEP: cpu-sleep {
 + compatible = arm,idle-state;
 + local-timer-stop;
 + arm,psci-suspend-param = 0x001;
 + entry-latency-us = 20;
 + exit-latency-us = 150;
 + min-residency-us = 2100;
 + status = enabled;

status ? This is not a documented property. If you need it please explain
why, define its bindings and we can see how to accommodate it.

Thank you,
Lorenzo

 + };
 + };
   };
  
   psci {
 -- 
 1.7.9.5
 
 

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


Re: exynos5422-odroid-xu3: MCPM: only 6 of 8 CPUs coming online

2014-10-15 Thread Joonyoung Shim
Hi,

Kevin Hilman khilman at kernel.org writes:

 
 Hi Abhilash,
 
 Abhilash Kesavan a.kesavan at samsung.com writes:
 
  I had noticed a similar issue where only 6 cores would come up during
  development on 5420. This was because there was a check in our u-boot
  secondary boot-up path which would put a core into WFI if a flag was
  not present and hence fail to boot. I wonder if it is the same
  situation in your case too.
  Is the u-boot for odroid-xu3 publically available or can you check if
there is any such code present in your
 secondary bring-up path.
 
 I'm using the hardkernel u-boot[1], branch: odroidxu3-v2012.07.  I'm
 currently using the pre-built binaries that are in the
 sd_fuse/hardkernel directory of that branch, but I can rebuild u-boot if
 needed.
 
 I'm not very familiar with u-boot, but if f you have some pointers where
 to start looking in that code, that would be helpful.
 
 Kevin
 
 [1] https://github.com/hardkernel/u-boot.git
 
 

It seems to need magic code.

Please refer
https://github.com/abhijeet-dev/linux-samsung/commit
/553b7f40465ab4fad6c270f289cd4780942f7fae

Thanks.

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


[PATCH 1/1] ARM: EXYNOS: Call regulator core suspend prepare and finish functions

2014-10-15 Thread Javier Martinez Canillas
The regulator framework has a set of helpers functions to be used when
the system is entering and leaving from suspend but these are not called
on Exynos platforms. This means that the .set_suspend_* function handlers
defined in regulator drivers are never called when the system is suspended.

Suggested-by: Doug Anderson diand...@chromium.org
Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 arch/arm/mach-exynos/suspend.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index f5d9773..5b9c551 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -20,6 +20,7 @@
 #include linux/io.h
 #include linux/irqchip/arm-gic.h
 #include linux/err.h
+#include linux/regulator/machine.h
 
 #include asm/cacheflush.h
 #include asm/hardware/cache-l2x0.h
@@ -270,14 +271,29 @@ static int exynos_suspend_enter(suspend_state_t state)
 
 static int exynos_suspend_prepare(void)
 {
+   int ret;
+
s3c_pm_check_prepare();
 
+   /*
+* REVISIT: It would be better if struct platform_suspend_ops
+* .prepare handler get the suspend_state_t as a parameter to
+* avoid hard-coding the suspend to mem state. It's safe to do
+* it only because the suspend_valid_only_mem function is the
+* .valid callback used to check if a given state is supported
+* by the platform.
+*/
+   ret = regulator_suspend_prepare(PM_SUSPEND_MEM);
+   if (ret)
+   pr_info(Failed to prepare regulators for system suspend\n);
+
return 0;
 }
 
 static void exynos_suspend_finish(void)
 {
s3c_pm_check_cleanup();
+   regulator_suspend_finish();
 }
 
 static const struct platform_suspend_ops exynos_suspend_ops = {
-- 
2.1.0

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


Re: [GIT PULL 2/2] Samsung defconfig updates for v3.18

2014-10-15 Thread Sjoerd Simons
On Tue, 2014-10-14 at 23:32 -0700, Olof Johansson wrote:
 On Tue, Oct 14, 2014 at 4:27 PM, Kukjin Kim kgene@samsung.com wrote:
git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
  tags/samsung-defconfig
 
  for you to fetch changes up to 508423bebcda29eb0ba7c627f895387dad7cdcd6:
 
ARM: exynos_defconfig: enable USB gadget support (2014-09-25 18:20:18
  +0900)
 
 Merged, thanks.

Hrm, enabling USB gadget support will actually regress USB on Exynos
peach boards and Arndale Octa without some of the DT fixes that landed
in armsoc next/late branch. Specifically:

5c42acdb9bab595482b966b22ab5e2f6f359 
dbb62ef9ade6e92737d3fac199665b8b7c455959

Might be good to cherry-pick those into for-next at this point (they're
rather trivial)

-- 
Sjoerd Simons sjoerd.sim...@collabora.co.uk
Collabora Ltd.


smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

2014-10-15 Thread Felipe Balbi
Hi,

On Tue, Oct 14, 2014 at 10:25:00AM +0530, Vivek Gautam wrote:
 Hi Felipe,
 
 
 On Tue, Oct 14, 2014 at 4:14 AM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Mon, Oct 13, 2014 at 01:54:59PM +0900, Anton Tikhomirov wrote:
  Hi Vivek,
 
   Exynos7 also has a separate special gate clock going to the IP
   apart from the usual AHB clock. So add support for the same.
 
  As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
  by the driver. Adding only sclk is not enough.
 
  
   Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
   ---
drivers/usb/dwc3/dwc3-exynos.c |   16 
1 file changed, 16 insertions(+)
  
   diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-
   exynos.c
   index 3951a65..7dc6a98 100644
   --- a/drivers/usb/dwc3/dwc3-exynos.c
   +++ b/drivers/usb/dwc3/dwc3-exynos.c
   @@ -35,6 +35,7 @@ struct dwc3_exynos {
   struct device   *dev;
  
   struct clk  *clk;
 
  The clock clk in Exynos5 just gated all that above 7 clocks, which
  we should control separately now in Exynos7.
 
 
  should I drop this patch for now ?
 
 Yes, better to hold this for some time till we get more clarity
 from our h/w team.

now dropped. Please a new one if needed.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 1/1] ARM: EXYNOS: Call regulator core suspend prepare and finish functions

2014-10-15 Thread Doug Anderson
Javier,

On Wed, Oct 15, 2014 at 5:01 AM, Javier Martinez Canillas
javier.marti...@collabora.co.uk wrote:
 The regulator framework has a set of helpers functions to be used when
 the system is entering and leaving from suspend but these are not called
 on Exynos platforms. This means that the .set_suspend_* function handlers
 defined in regulator drivers are never called when the system is suspended.

 Suggested-by: Doug Anderson diand...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk

Could you also add a patch to your series ripping out the call in
drivers/mfd/sec-core.c since it doesn't belong there.  If you don't
rip that out then it will be called twice on systems with that
regulator.


 ---
  arch/arm/mach-exynos/suspend.c | 16 
  1 file changed, 16 insertions(+)

 diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
 index f5d9773..5b9c551 100644
 --- a/arch/arm/mach-exynos/suspend.c
 +++ b/arch/arm/mach-exynos/suspend.c
 @@ -20,6 +20,7 @@
  #include linux/io.h
  #include linux/irqchip/arm-gic.h
  #include linux/err.h
 +#include linux/regulator/machine.h

  #include asm/cacheflush.h
  #include asm/hardware/cache-l2x0.h
 @@ -270,14 +271,29 @@ static int exynos_suspend_enter(suspend_state_t state)

  static int exynos_suspend_prepare(void)
  {
 +   int ret;
 +
 s3c_pm_check_prepare();

 +   /*
 +* REVISIT: It would be better if struct platform_suspend_ops
 +* .prepare handler get the suspend_state_t as a parameter to
 +* avoid hard-coding the suspend to mem state. It's safe to do
 +* it only because the suspend_valid_only_mem function is the
 +* .valid callback used to check if a given state is supported
 +* by the platform.
 +*/
 +   ret = regulator_suspend_prepare(PM_SUSPEND_MEM);
 +   if (ret)
 +   pr_info(Failed to prepare regulators for system suspend\n);
 +

nit: can you put this before s3c_pm_check_prepare().  pm_check is
pretty darn broken and I have a feeling that it will eventually be
ripped out (or in the very least ported to not be Samsung-specific and
include all of the suspend volatile crud that we have in the
chromeos-3.8 kernel), but might as well try not to break it further.

Changing the order also has the advantage of making prepare / finish
opposite orders (good!) and handling the fact that you would call
s3c_pm_check_prepare() but not s3c_pm_check_cleanup() if
regulator_suspend_prepare() fails.


 return 0;
  }

  static void exynos_suspend_finish(void)
  {
 s3c_pm_check_cleanup();
 +   regulator_suspend_finish();
  }

  static const struct platform_suspend_ops exynos_suspend_ops = {
 --
 2.1.0

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


[PATCH 7/9] regulator: max77802: Document regulator opmode DT properties

2014-10-15 Thread Javier Martinez Canillas
Some regulators from the max77802 PMIC support to be configured in one
of two operating mode: Output ON (normal) and Output On Low Power Mode.
Not all regulators support these two modes and for some of them, the
mode can be changed while the system is running in normal operation
while others only support their mode to be changed on system suspend.

Extend the max77802 PMIC binding adding Device Tree properties so the
regulators operating modes can be configured.

Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 .../devicetree/bindings/regulator/max77802.txt | 45 ++
 1 file changed, 45 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/max77802.txt 
b/Documentation/devicetree/bindings/regulator/max77802.txt
index 5aeaffc..34812e0 100644
--- a/Documentation/devicetree/bindings/regulator/max77802.txt
+++ b/Documentation/devicetree/bindings/regulator/max77802.txt
@@ -25,6 +25,39 @@ with their hardware counterparts as follow. The valid names 
are:
example: LDO1, LDO2, LDO35.
-BUCKn  :   for BUCKs, where n can lie in range 1 to 10.
example: BUCK1, BUCK5, BUCK10.
+
+Besides the standard regulator constraints, the max77802 regulator supports
+two different operating modes: Normal and Low Power Mode. Some regulators
+support the modes to be changed at startup or by the consumers during normal
+operation while others only support to change the mode during system suspend.
+The following optional properties can be used to configure the operating modes:
+
+- maxim,regulator-initial-mode: initial operating mode.
+  This property can only be used on regulators that support changing their mode
+  during normal operation. These regulators are LDO1, LDO3, LDO20 and LDO21.
+- maxim,regulator-disk-mode: operating mode for the regulator when the system
+  enters in the Suspend-to-Disk state.
+- maxim,regulator-mem-mode: operating mode for the regulator when the system
+  enters in the Suspend-to-RAM state.
+
+The value for maxim,regulator-[initial,disk,mem]-mode is one of the following:
+   1: Normal regulator voltage output mode.
+   3: Low Power which reduces the quiescent current down to only 1uA
+
+The list of valid modes are defined in the dt-bindings/regulator/regulator.h
+header and can be included by device tree source files. If no mode is defined,
+then the OS will not manage the modes and the HW default values will be used.
+
+The maxim,regulator-[initial,disk,mem]-mode properties can only be used with
+regulators that support changing their mode to Low Power Mode during suspend.
+These regulators are BUCKs 2-4 and LDOs 1-35.
+
+The maxim,regulator-[disk,mem]-mode property only takes effect if the regulator
+has been marked as enabled for the given suspend mode using the standard
+regulator-on-in-suspend property. If the regulator has not been explicitly
+enabled or if it was marked as disabled with regulator-off-in-suspend, then
+setting the operating mode for that state will have no effect.
+
 Example:
 
max77802@09 {
@@ -36,11 +69,23 @@ Example:
#size-cells = 0;
 
regulators {
+   ldo1_reg: LDO1 {
+   regulator-name = vdd_1v0;
+   regulator-min-microvolt = 100;
+   regulator-max-microvolt = 100;
+   regulator-always-on;
+   maxim,regulator-initial-mode = 
MAX77802_OPMODE_LP;
+   };
+
ldo11_reg: LDO11 {
regulator-name = vdd_ldo11;
regulator-min-microvolt = 190;
regulator-max-microvolt = 190;
regulator-always-on;
+   maxim,regulator-mem-mode = MAX77802_OPMODE_LP;
+   regulator-state-mem {
+   regulator-on-in-suspend;
+   };
};
 
buck1_reg: BUCK1 {
-- 
2.1.0

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


[PATCH 9/9] ARM: dts: Configure regulators for suspend on exynos Peach boards

2014-10-15 Thread Javier Martinez Canillas
The regulator core now has support to choose if a regulator
has to be enabled or disabled during system suspend and also
the max77802 driver supports changing the regulator operating
mode during runtime and when the system enters into sleep mode.

To lower power during suspend, configure the regulators state
using the same configuration found in the ChromeOS 3.8 kernel.

Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 arch/arm/boot/dts/exynos5420-peach-pit.dts | 81 ++
 arch/arm/boot/dts/exynos5800-peach-pi.dts  | 81 ++
 2 files changed, 162 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts 
b/arch/arm/boot/dts/exynos5420-peach-pit.dts
index 9a050e1..72d4e14 100644
--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
+++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
@@ -13,6 +13,7 @@
 #include dt-bindings/gpio/gpio.h
 #include dt-bindings/interrupt-controller/irq.h
 #include dt-bindings/clock/maxim,max77802.h
+#include dt-bindings/regulator/maxim,max77802.h
 #include exynos5420.dtsi
 
 / {
@@ -192,6 +193,9 @@
regulator-always-on;
regulator-boot-on;
regulator-ramp-delay = 12500;
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
};
 
buck2_reg: BUCK2 {
@@ -201,6 +205,9 @@
regulator-always-on;
regulator-boot-on;
regulator-ramp-delay = 12500;
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
};
 
buck3_reg: BUCK3 {
@@ -210,6 +217,9 @@
regulator-always-on;
regulator-boot-on;
regulator-ramp-delay = 12500;
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
};
 
buck4_reg: BUCK4 {
@@ -219,6 +229,9 @@
regulator-always-on;
regulator-boot-on;
regulator-ramp-delay = 12500;
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
};
 
buck5_reg: BUCK5 {
@@ -227,6 +240,9 @@
regulator-max-microvolt = 120;
regulator-always-on;
regulator-boot-on;
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
};
 
buck6_reg: BUCK6 {
@@ -236,6 +252,9 @@
regulator-always-on;
regulator-boot-on;
regulator-ramp-delay = 12500;
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
};
 
buck7_reg: BUCK7 {
@@ -244,6 +263,9 @@
regulator-max-microvolt = 135;
regulator-always-on;
regulator-boot-on;
+   regulator-state-mem {
+   regulator-on-in-suspend;
+   };
};
 
buck8_reg: BUCK8 {
@@ -252,6 +274,9 @@
regulator-max-microvolt = 285;
regulator-always-on;
regulator-boot-on;
+   regulator-state-mem {
+   regulator-off-in-suspend;
+   };
};
 
buck9_reg: BUCK9 {
@@ -260,6 +285,9 @@
regulator-max-microvolt = 200;
regulator-always-on;
regulator-boot-on;
+   regulator-state-mem {
+   regulator-on-in-suspend;
+   };
};
 
buck10_reg: BUCK10 {
@@ -268,6 +296,9 @@
regulator-max-microvolt = 180;
regulator-always-on;
 

[PATCH 6/9] regulator: max77802: Add header for operating modes

2014-10-15 Thread Javier Martinez Canillas
Add a header file for the max77802 constants that could be shared between
the regulator driver and Device Tree source files. Also, remove standby
and off opmodes since only normal and low power are valid operating modes.

Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 drivers/regulator/max77802.c   |  1 +
 include/dt-bindings/regulator/maxim,max77802.h | 18 ++
 include/linux/mfd/max77686.h   |  7 ---
 3 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 include/dt-bindings/regulator/maxim,max77802.h

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index 046b9b7..43e34dd 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -33,6 +33,7 @@
 #include linux/regulator/of_regulator.h
 #include linux/mfd/max77686.h
 #include linux/mfd/max77686-private.h
+#include dt-bindings/regulator/maxim,max77802.h
 
 /* Default ramp delay in case it is not manually set */
 #define MAX77802_RAMP_DELAY10  /* uV/us */
diff --git a/include/dt-bindings/regulator/maxim,max77802.h 
b/include/dt-bindings/regulator/maxim,max77802.h
new file mode 100644
index 000..cf28631
--- /dev/null
+++ b/include/dt-bindings/regulator/maxim,max77802.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2014 Google, Inc
+ *
+ * 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.
+ *
+ * Device Tree binding constants for the Maxim 77802 PMIC regulators
+ */
+
+#ifndef _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H
+#define _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H
+
+/* Regulator operating modes */
+#define MAX77802_OPMODE_LP 1
+#define MAX77802_OPMODE_NORMAL 3
+
+#endif /* _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H */
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 7e6dc4b..553f7d0 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -131,13 +131,6 @@ enum max77686_opmode {
MAX77686_OPMODE_STANDBY,
 };
 
-enum max77802_opmode {
-   MAX77802_OPMODE_OFF,
-   MAX77802_OPMODE_STANDBY,
-   MAX77802_OPMODE_LP,
-   MAX77802_OPMODE_NORMAL,
-};
-
 struct max77686_opmode_data {
int id;
int mode;
-- 
2.1.0

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


[PATCH 5/9] regulator: max77802: Don't treat OFF as an operating mode

2014-10-15 Thread Javier Martinez Canillas
The only operating modes that are supported by the regulators in the
max77802 PMIC are Output ON (normal) and Output On in Low Power Mode.
OFF was wrongly counted as an operating mode while is only a regulator
status. Make clear in the code that OFF is not an operating mode.

Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 drivers/regulator/max77802.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index 150eb3a..046b9b7 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -49,6 +49,7 @@
 #define MAX77802_RAMP_RATE_MASK_4BIT   0xF0
 #define MAX77802_RAMP_RATE_SHIFT_4BIT  4
 
+#define MAX77802_STATUS_OFF0x0
 #define MAX77802_OFF_PWRREQ0x1
 #define MAX77802_LP_PWRREQ 0x2
 
@@ -614,7 +615,7 @@ static int max77802_pmic_probe(struct platform_device *pdev)
 * the hardware reports OFF as the regulator operating mode.
 * Default to operating mode NORMAL in that case.
 */
-   if (val == MAX77802_OPMODE_OFF)
+   if (val == MAX77802_STATUS_OFF)
max77802-opmode[id] = MAX77802_OPMODE_NORMAL;
else
max77802-opmode[id] = val;
-- 
2.1.0

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


[PATCH 1/9] regulator: max77802: Add .set_suspend_{enable,disable} callbacks

2014-10-15 Thread Javier Martinez Canillas
The max77802 PMIC has an enable pin (PWRREQ) that can be used to switch
regulators ON and OFF automatically by the Application Processor when
the system is leaving and entering sleep mode.

Only the BUCKs regulators had a .set_suspend_disable function handler
that used the enable pin to turn OFF the regulators during suspend.

But most LDOs also support that functionality (besides 1, 3, 20 and 21)
so rename the function to a more generic name and use the same function
for the LDOs. Also add a .set_suspend_enable handler for all regulators
and use the same function used for the .enable operation.

Finally, don't treat output ON/OFF controlled by PWRREQ as an operating
mode using the ambiguous MAX77802_OPMODE_STANDBY since it's not an opmode.
Instead make it clear that is a control value to switch the regulator OFF
by PWRREQ when the system is entering in a suspend state.

Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 drivers/regulator/max77802.c | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index d89792b..26f6963 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -49,6 +49,8 @@
 #define MAX77802_RAMP_RATE_MASK_4BIT   0xF0
 #define MAX77802_RAMP_RATE_SHIFT_4BIT  4
 
+#define MAX77802_OFF_PWRREQ0x1
+
 /* MAX77802 has two register formats: 2-bit and 4-bit */
 static const unsigned int ramp_table_77802_2bit[] = {
12500,
@@ -83,17 +85,16 @@ static int max77802_get_opmode_shift(int id)
return -EINVAL;
 }
 
-/*
- * Some BUCKS supports Normal[ON/OFF] mode during suspend
+/**
+ * max77802_set_suspend_disable - Disable the regulator during system suspend
+ * @rdev: regulator to mark as disabled
  *
- * BUCK 1, 6, 2-4, 5, 7-10 (all)
- *
- * The other mode (0x02) will make PWRREQ switch between normal
- * and low power.
+ * All regulators expect LDO 1, 3, 20 and 21 support OFF by PWRREQ.
+ * Configure the regulator so the PMIC will turn it OFF during system suspend.
  */
-static int max77802_buck_set_suspend_disable(struct regulator_dev *rdev)
+static int max77802_set_suspend_disable(struct regulator_dev *rdev)
 {
-   unsigned int val = MAX77802_OPMODE_STANDBY;
+   unsigned int val = MAX77802_OFF_PWRREQ;
struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
int shift = max77802_get_opmode_shift(id);
@@ -178,6 +179,9 @@ static int max77802_enable(struct regulator_dev *rdev)
int id = rdev_get_id(rdev);
int shift = max77802_get_opmode_shift(id);
 
+   if (max77802-opmode[id] == MAX77802_OFF_PWRREQ)
+   max77802-opmode[id] = MAX77802_OPMODE_NORMAL;
+
return regmap_update_bits(rdev-regmap, rdev-desc-enable_reg,
  rdev-desc-enable_mask,
  max77802-opmode[id]  shift);
@@ -247,6 +251,8 @@ static struct regulator_ops max77802_ldo_ops_logic1 = {
.get_voltage_sel= regulator_get_voltage_sel_regmap,
.set_voltage_sel= regulator_set_voltage_sel_regmap,
.set_voltage_time_sel   = regulator_set_voltage_time_sel,
+   .set_suspend_enable = max77802_enable,
+   .set_suspend_disable= max77802_set_suspend_disable,
.set_suspend_mode   = max77802_ldo_set_suspend_mode_logic1,
 };
 
@@ -276,7 +282,8 @@ static struct regulator_ops max77802_buck_16_dvs_ops = {
.set_voltage_sel= regulator_set_voltage_sel_regmap,
.set_voltage_time_sel   = regulator_set_voltage_time_sel,
.set_ramp_delay = max77802_set_ramp_delay_4bit,
-   .set_suspend_disable= max77802_buck_set_suspend_disable,
+   .set_suspend_enable = max77802_enable,
+   .set_suspend_disable= max77802_set_suspend_disable,
 };
 
 /* BUCKs 2-4, 5, 7-10 */
@@ -290,7 +297,8 @@ static struct regulator_ops max77802_buck_dvs_ops = {
.set_voltage_sel= regulator_set_voltage_sel_regmap,
.set_voltage_time_sel   = regulator_set_voltage_time_sel,
.set_ramp_delay = max77802_set_ramp_delay_2bit,
-   .set_suspend_disable= max77802_buck_set_suspend_disable,
+   .set_suspend_enable = max77802_enable,
+   .set_suspend_disable= max77802_set_suspend_disable,
 };
 
 /* LDOs 3-7, 9-14, 18-26, 28, 29, 32-34 */
-- 
2.1.0

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


[PATCH 3/9] regulator: max77802: Split regulator operations for BUCKs

2014-10-15 Thread Javier Martinez Canillas
Not all the max77802 BUCKs regulators have the same functionality, for
example BUCKs 2-4 support the output to be configured as normal or Low
Power Mode by the PWRREQ enable pin while the other BUCKs only support
their output to be set ON or OFF by PWRREQ. As a preparation for adding
a set_suspend_mode function handler for all the regulators that support
Low Power Mode by PWRREQ, split the operations for BUCKs regulators.

Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 drivers/regulator/max77802.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index baf834d..a621700 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -330,7 +330,22 @@ static struct regulator_ops max77802_buck_16_dvs_ops = {
.set_suspend_disable= max77802_set_suspend_disable,
 };
 
-/* BUCKs 2-4, 5, 7-10 */
+/* BUCKs 2-4 */
+static struct regulator_ops max77802_buck_234_ops = {
+   .list_voltage   = regulator_list_voltage_linear,
+   .map_voltage= regulator_map_voltage_linear,
+   .is_enabled = regulator_is_enabled_regmap,
+   .enable = max77802_enable,
+   .disable= regulator_disable_regmap,
+   .get_voltage_sel= regulator_get_voltage_sel_regmap,
+   .set_voltage_sel= regulator_set_voltage_sel_regmap,
+   .set_voltage_time_sel   = regulator_set_voltage_time_sel,
+   .set_ramp_delay = max77802_set_ramp_delay_2bit,
+   .set_suspend_enable = max77802_enable,
+   .set_suspend_disable= max77802_set_suspend_disable,
+};
+
+/* BUCKs 5, 7-10 */
 static struct regulator_ops max77802_buck_dvs_ops = {
.list_voltage   = regulator_list_voltage_linear,
.map_voltage= regulator_map_voltage_linear,
@@ -404,7 +419,7 @@ static struct regulator_ops max77802_buck_dvs_ops = {
.name   = BUCK#num,   \
.id = MAX77802_BUCK##num,   \
.supply_name= inb#num,\
-   .ops= max77802_buck_dvs_ops,   \
+   .ops= max77802_buck_234_ops,   \
.type   = REGULATOR_VOLTAGE,\
.owner  = THIS_MODULE,  \
.min_uV = 60,   \
-- 
2.1.0

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


[PATCH 2/9] regulator: max77802: Add .{get,set}_mode callbacks

2014-10-15 Thread Javier Martinez Canillas
Some max77802 LDOs (1, 3, 20 and 21) support to be configured in Low
Power Mode during system normal operation. Add function handlers for
the .get_mode and .set_mode operations to set the mode on these LDOs.

Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
---
 drivers/regulator/max77802.c | 44 
 1 file changed, 44 insertions(+)

diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c
index 26f6963..baf834d 100644
--- a/drivers/regulator/max77802.c
+++ b/drivers/regulator/max77802.c
@@ -51,6 +51,9 @@
 
 #define MAX77802_OFF_PWRREQ0x1
 
+#define MAX77802_MODE(pval) ((pval == MAX77802_OPMODE_NORMAL) ?\
+REGULATOR_MODE_NORMAL : REGULATOR_MODE_STANDBY)
+
 /* MAX77802 has two register formats: 2-bit and 4-bit */
 static const unsigned int ramp_table_77802_2bit[] = {
12500,
@@ -105,6 +108,45 @@ static int max77802_set_suspend_disable(struct 
regulator_dev *rdev)
 }
 
 /*
+ * Some LDOs support Low Power Mode while the system is running.
+ *
+ * LDOs 1, 3, 20, 21.
+ */
+static int max77802_set_mode(struct regulator_dev *rdev, unsigned int mode)
+{
+   struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
+   int id = rdev_get_id(rdev);
+   unsigned int val;
+   int shift = max77802_get_opmode_shift(id);
+
+   switch (mode) {
+   case REGULATOR_MODE_IDLE:
+   case REGULATOR_MODE_STANDBY:
+   val = MAX77802_OPMODE_LP;   /* ON in Low Power Mode */
+   break;
+   case REGULATOR_MODE_NORMAL:
+   val = MAX77802_OPMODE_NORMAL;   /* ON in Normal Mode */
+   break;
+   default:
+   dev_warn(rdev-dev, %s: regulator mode: 0x%x not supported\n,
+rdev-desc-name, mode);
+   return -EINVAL;
+   }
+
+   max77802-opmode[id] = val;
+   return regmap_update_bits(rdev-regmap, rdev-desc-enable_reg,
+ rdev-desc-enable_mask, val  shift);
+}
+
+static unsigned max77802_get_mode(struct regulator_dev *rdev)
+{
+   struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
+   int id = rdev_get_id(rdev);
+
+   return MAX77802_MODE(max77802-opmode[id]);
+}
+
+/*
  * Some LDOs supports LPM-ON/OFF/Normal-ON mode during suspend state
  * (Enable Control Logic1 by PWRREQ)
  *
@@ -268,6 +310,8 @@ static struct regulator_ops max77802_ldo_ops_logic2 = {
.get_voltage_sel= regulator_get_voltage_sel_regmap,
.set_voltage_sel= regulator_set_voltage_sel_regmap,
.set_voltage_time_sel   = regulator_set_voltage_time_sel,
+   .set_mode   = max77802_set_mode,
+   .get_mode   = max77802_get_mode,
.set_suspend_mode   = max77802_ldo_set_suspend_mode_logic2,
 };
 
-- 
2.1.0

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


Re: [PATCH 1/1] ARM: EXYNOS: Call regulator core suspend prepare and finish functions

2014-10-15 Thread Javier Martinez Canillas
Hello Doug,

Thanks a lot for your feedback.

On 10/15/2014 06:19 PM, Doug Anderson wrote:
 Javier,
 
 On Wed, Oct 15, 2014 at 5:01 AM, Javier Martinez Canillas
 javier.marti...@collabora.co.uk wrote:
 The regulator framework has a set of helpers functions to be used when
 the system is entering and leaving from suspend but these are not called
 on Exynos platforms. This means that the .set_suspend_* function handlers
 defined in regulator drivers are never called when the system is suspended.

 Suggested-by: Doug Anderson diand...@chromium.org
 Signed-off-by: Javier Martinez Canillas javier.marti...@collabora.co.uk
 
 Could you also add a patch to your series ripping out the call in
 drivers/mfd/sec-core.c since it doesn't belong there.  If you don't
 rip that out then it will be called twice on systems with that
 regulator.
 

Sure, in fact I thought the same before sending $subject but didn't remove it
because mfd sec-core only calls regulator_suspend_prepare() but does not call
regulator_suspend_finish() on resume. So I wondered if $subject would not break
it anyways since it may change the driver assumption that the regulators .enable
function won't be called on resume. That's why I added Chanwoo Choi to the cc
list so he can be aware of this change and give his opinion is on that regard.

I should had commented that on the patch...

 
 ---
  arch/arm/mach-exynos/suspend.c | 16 
  1 file changed, 16 insertions(+)

 diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
 index f5d9773..5b9c551 100644
 --- a/arch/arm/mach-exynos/suspend.c
 +++ b/arch/arm/mach-exynos/suspend.c
 @@ -20,6 +20,7 @@
  #include linux/io.h
  #include linux/irqchip/arm-gic.h
  #include linux/err.h
 +#include linux/regulator/machine.h

  #include asm/cacheflush.h
  #include asm/hardware/cache-l2x0.h
 @@ -270,14 +271,29 @@ static int exynos_suspend_enter(suspend_state_t state)

  static int exynos_suspend_prepare(void)
  {
 +   int ret;
 +
 s3c_pm_check_prepare();

 +   /*
 +* REVISIT: It would be better if struct platform_suspend_ops
 +* .prepare handler get the suspend_state_t as a parameter to
 +* avoid hard-coding the suspend to mem state. It's safe to do
 +* it only because the suspend_valid_only_mem function is the
 +* .valid callback used to check if a given state is supported
 +* by the platform.
 +*/
 +   ret = regulator_suspend_prepare(PM_SUSPEND_MEM);
 +   if (ret)
 +   pr_info(Failed to prepare regulators for system suspend\n);
 +
 
 nit: can you put this before s3c_pm_check_prepare().  pm_check is
 pretty darn broken and I have a feeling that it will eventually be
 ripped out (or in the very least ported to not be Samsung-specific and
 include all of the suspend volatile crud that we have in the
 chromeos-3.8 kernel), but might as well try not to break it further.
 
 Changing the order also has the advantage of making prepare / finish
 opposite orders (good!) and handling the fact that you would call
 s3c_pm_check_prepare() but not s3c_pm_check_cleanup() if
 regulator_suspend_prepare() fails.
 

Good point, I'll change that on v2. I'll wait until tomorrow to see if there
are more comments and re-post with your suggestions.

 
 return 0;
  }

  static void exynos_suspend_finish(void)
  {
 s3c_pm_check_cleanup();
 +   regulator_suspend_finish();
  }

  static const struct platform_suspend_ops exynos_suspend_ops = {

Best regards,
Javier 

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


RE: [GIT PULL 2/2] Samsung defconfig updates for v3.18

2014-10-15 Thread Kukjin Kim
Sjoerd Simons wrote:
  On Tue, 2014-10-14 at 23:32 -0700, Olof Johansson wrote:
  On Tue, Oct 14, 2014 at 4:27 PM, Kukjin Kim kgene@samsung.com wrote:
 git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git
   tags/samsung-defconfig
  
   for you to fetch changes up to 508423bebcda29eb0ba7c627f895387dad7cdcd6:
  
 ARM: exynos_defconfig: enable USB gadget support (2014-09-25 18:20:18
   +0900)
 
  Merged, thanks.
 
 Hrm, enabling USB gadget support will actually regress USB on Exynos
 peach boards and Arndale Octa without some of the DT fixes that landed
 in armsoc next/late branch. Specifically:
 
 5c42acdb9bab595482b966b22ab5e2f6f359
 dbb62ef9ade6e92737d3fac199665b8b7c455959
 
Yeah...I've missed it. Sorry.

 Might be good to cherry-pick those into for-next at this point (they're
 rather trivial)
 
So...Olof, can you please cherry pick them into arm-soc/fixes? Or shall I send
pull-request for them again?

- Kukjin

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