mfd: EXYNOS: Properly shutdown Odroid XU3
Subsystems (4)
v2 cover mfd: EXYNOS: Properly shutdown Odroid XU3
Hi,
Changelog put in each patch message.
This fixes shutdown of Odroid XU3 family. More details in patch 2.
Patches are independent, please pick up freely.
Best regards,
Krzysztof
Krzysztof Kozlowski (3):
mfd: documentation: dt: Document grounded ACOKB pin on S2MPS11
mfd: s2mps11: Add manual shutdown method for Odroid XU3
ARM: dts: Fix power off method on exynos5422-odroidxu3
Documentation/devicetree/bindings/mfd/s2mps11.txt | 4 +++ arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi | 1 + drivers/mfd/sec-core.c | 30 ++++++++++++++++++++++ include/linux/mfd/samsung/core.h | 2 ++ include/linux/mfd/samsung/s2mps11.h | 1 + 5 files changed, 38 insertions(+)
Signature · 1 line
2.1.4
PATCH v2 1/3 mfd: documentation: dt: Document grounded ACOKB pin on S2MPS11
Document a new Device Tree property 'samsung,s2mps11-acokb-ground' indicating that ACOKB pin of S2MPS11 PMIC is connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the power.
---
Changes since v1:
1. Split bindings documentation to separate patch (suggested by Lee).
2. Add Javier's reviewed-by and Lee's acked-by.
--- Documentation/devicetree/bindings/mfd/s2mps11.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/mfd/s2mps11.txt +4 -0
@@ -15,6 +15,10 @@ Optional properties: - interrupt-parent: Specifies the phandle of the interrupt controller to which the interrupts from s2mps11 are delivered to. - interrupts: Interrupt specifiers for interrupt sources. +- samsung,s2mps11-acokb-ground: Indicates that ACOKB pin of S2MPS11 PMIC is + connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1 + register to turn off the power. Usually the ACOKB is pulled up to VBATT so + when PWRHOLD pin goes low, the rising ACOKB will trigger power off. Optional nodes: - clocks: s2mps11, s2mps13 and s5m8767 provide three(AP/CP/BT) buffered 32.768
Signature · 1 line
2.1.4
RE: [PATCH v2 1/3] mfd: documentation: dt: Document grounded ACOKB pin on S2MPS11
Quoted 36 lines · Krzysztof Kozlowski
Document a new Device Tree property 'samsung,s2mps11-acokb-ground' indicating that ACOKB pin of S2MPS11 PMIC is connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the power.
Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>Acked-by Lee Jones <[email protected]>---
Changes since v1:
1. Split bindings documentation to separate patch (suggested by Lee).
2. Add Javier's reviewed-by and Lee's acked-by.--- Documentation/devicetree/bindings/mfd/s2mps11.txt | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/mfd/s2mps11.txt +4
-1@@ -15,6 +15,10 @@ Optional properties: - interrupt-parent: Specifies the phandle of the interrupt controller to which the interrupts from s2mps11 are delivered to. - interrupts: Interrupt specifiers for interrupt sources. +- samsung,s2mps11-acokb-ground: Indicates that ACOKB pin of S2MPS11 PMIC is + connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1 + register to turn off the power. Usually the ACOKB is pulled up to VBATT so + when PWRHOLD pin goes low, the rising ACOKB will trigger power off. Optional nodes: - clocks: s2mps11, s2mps13 and s5m8767 provide three(AP/CP/BT) buffered 32.768 --
Quoted 1 line
2.1.4
Applied 1/3 and 3/3.
Thanks,
Kukjin
Re: [PATCH v2 1/3] mfd: documentation: dt: Document grounded ACOKB pin on S2MPS11
Quoted 34 lines · Kukjin Kim
Quoted 33 lines · Krzysztof Kozlowski
Document a new Device Tree property 'samsung,s2mps11-acokb-ground' indicating that ACOKB pin of S2MPS11 PMIC is connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1 register to turn off the power.
Signed-off-by Krzysztof Kozlowski <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>Acked-by Lee Jones <[email protected]>---
Changes since v1:
1. Split bindings documentation to separate patch (suggested by Lee).
2. Add Javier's reviewed-by and Lee's acked-by.--- Documentation/devicetree/bindings/mfd/s2mps11.txt | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/mfd/s2mps11.txt +4
-0@@ -15,6 +15,10 @@ Optional properties: - interrupt-parent: Specifies the phandle of the interrupt controller to which the interrupts from s2mps11 are delivered to. - interrupts: Interrupt specifiers for interrupt sources. +- samsung,s2mps11-acokb-ground: Indicates that ACOKB pin of S2MPS11 PMIC is + connected to the ground so the PMIC must manually set PWRHOLD bit in CTRL1 + register to turn off the power. Usually the ACOKB is pulled up to VBATT so + when PWRHOLD pin goes low, the rising ACOKB will trigger power off.
Quoted 4 lines
Documentation/devicetree/bindings/mfd/s2mps11.txt Optional properties: · line 24
Quoted 2 lines
Documentation/devicetree/bindings/mfd/s2mps11.txt +0
-0Optional nodes: - clocks: s2mps11, s2mps13 and s5m8767 provide three(AP/CP/BT) buffered 32.768Applied 1/3 and 3/3.
Any chance you applied these on their own branch (which can be tagged)?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 2/3 mfd: s2mps11: Add manual shutdown method for Odroid XU3
In reply to Krzysztof KozlowskiOn Odroid XU3 board (with S2MPS11 PMIC) the PWRHOLD bit in CTRL1 register must be manually set to 0 before initiating power off sequence.
One of usual power down methods for Exynos based devices looks like:
1. PWRHOLD pin of PMIC is connected to PSHOLD of Exynos.
2. Exynos holds up this pin during system operation.
3. ACOKB pin of PMIC is pulled up to VBATT and optionally to pin in other device.
4. When PWRHOLD/PSHOLD goes low, the PMIC will turn off the power if ACOKB goes high.
On Odroid XU3 family the difference is in (3) - the ACOKB is grounded. This means that PMIC must manually set PWRHOLD field to low and then wait for signal from Application Processor (the usual change in PWRHOLD/PSHOLD pin will actually cut off the power).
The patch adds respective binding allowing Odroid XU3 device to be powered off.
---
Changes since v1:
1. Split bindings documentation to separate patch (suggested by Lee).
2. Fix additional empty line (suggested by Lee).
3. Add Anand's tested-by, Javier's reviewed-by and Lee's acked-by.
Patch is losely based on patch in Hardkernel repository [0] and previous work of Anand Moon [1].
[0] https://github.com/hardkernel/linux/commit/6897e62ba328bd1c8c095d918101863250cd73e7
[1] http://www.spinics.net/lists/linux-samsung-soc/msg45959.html
--- drivers/mfd/sec-core.c | 30 ++++++++++++++++++++++++++++++ include/linux/mfd/samsung/core.h | 2 ++ include/linux/mfd/samsung/s2mps11.h | 1 + 3 files changed, 33 insertions(+)
drivers/mfd/sec-core.c +30 -0
@@ -278,6 +278,8 @@ static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(* not parsed here. */ + pd->manual_poweroff =of_property_read_bool (dev->of_node, +"samsung,s2mps11-acokb-ground" ); return pd; }#else
@@ -440,6 +442,33 @@ static int sec_pmic_remove(struct i2c_client *i2c)return 0 ; } +static void sec_pmic_shutdown (struct i2c_client *i2c) +{ +struct sec_pmic_dev *sec_pmic =i2c_get_clientdata (i2c); +unsigned int reg, mask; + +if (!sec_pmic->pdata->manual_poweroff) +return ; + +switch (sec_pmic->device_type) { +case S2MPS11X : + reg =S2MPS11_REG_CTRL1 ; + mask =S2MPS11_CTRL1_PWRHOLD_MASK ; +break ; +default : +/* +* Currently only one board with S2MPS11 needs this, so just +* ignore the rest. +*/ +dev_warn (sec_pmic->dev, +"Unsupported device %lu for manual power off\n" , + sec_pmic->device_type); +return ; + } + +regmap_update_bits (sec_pmic->regmap_pmic, reg, mask,0 ); +} +#ifdef CONFIG_PM_SLEEP static int sec_pmic_suspend (struct device *dev) {
@@ -491,6 +520,7 @@ static struct i2c_driver sec_pmic_driver = { }, .probe = sec_pmic_probe, .remove = sec_pmic_remove, + .shutdown = sec_pmic_shutdown, .id_table = sec_pmic_id, };
include/linux/mfd/samsung/core.h +2 -0
@@ -132,6 +132,8 @@ struct sec_platform_data {int buck2_init;int buck3_init;int buck4_init; +/* Whether or not manually set PWRHOLD to low during shutdown. */ +bool manual_poweroff; };/**
include/linux/mfd/samsung/s2mps11.h +1 -0
@@ -179,6 +179,7 @@ enum s2mps11_regulators {#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)#define S2MPS11_RAMP_DELAY 25000/* uV/us */ +#define S2MPS11_CTRL1_PWRHOLD_MASK BIT(4)#define S2MPS11_BUCK2_RAMP_SHIFT 6#define S2MPS11_BUCK34_RAMP_SHIFT 4
Signature · 1 line
2.1.4
Re: [PATCH v2 2/3] mfd: s2mps11: Add manual shutdown method for Odroid XU3
Hi Lee,
You acked this patch. However finally it did not go through other tree so maybe you could pick it up for 4.4?
If you want I could reabse and resend it.
Best regards,
Krzysztof
2015-08-11 19:09 GMT+09:00 Krzysztof Kozlowski <[email protected]>:
Quoted 127 lines
On Odroid XU3 board (with S2MPS11 PMIC) the PWRHOLD bit in CTRL1 register must be manually set to 0 before initiating power off sequence.
One of usual power down methods for Exynos based devices looks like:
1. PWRHOLD pin of PMIC is connected to PSHOLD of Exynos.
2. Exynos holds up this pin during system operation.
3. ACOKB pin of PMIC is pulled up to VBATT and optionally to pin in other device.
4. When PWRHOLD/PSHOLD goes low, the PMIC will turn off the power if ACOKB goes high.On Odroid XU3 family the difference is in (3) - the ACOKB is grounded. This means that PMIC must manually set PWRHOLD field to low and then wait for signal from Application Processor (the usual change in PWRHOLD/PSHOLD pin will actually cut off the power).
The patch adds respective binding allowing Odroid XU3 device to be powered off.
Signed-off-by Krzysztof Kozlowski <[email protected]>Reported-by Anand Moon <[email protected]>Tested-by Anand Moon <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>Acked-by Lee Jones <[email protected]>---
Changes since v1:
1. Split bindings documentation to separate patch (suggested by Lee).
2. Fix additional empty line (suggested by Lee).
3. Add Anand's tested-by, Javier's reviewed-by and Lee's acked-by.Patch is losely based on patch in Hardkernel repository [0] and previous work of Anand Moon [1].
[0] https://github.com/hardkernel/linux/commit/6897e62ba328bd1c8c095d918101863250cd73e7
[1] http://www.spinics.net/lists/linux-samsung-soc/msg45959.html--- drivers/mfd/sec-core.c | 30 ++++++++++++++++++++++++++++++ include/linux/mfd/samsung/core.h | 2 ++ include/linux/mfd/samsung/s2mps11.h | 1 + 3 files changed, 33 insertions(+)drivers/mfd/sec-core.c +30
-0@@ -278,6 +278,8 @@ static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(* not parsed here. */ + pd->manual_poweroff =of_property_read_bool (dev->of_node, +"samsung,s2mps11-acokb-ground" ); return pd; }#else @@ -440,6 +442,33 @@ static int sec_pmic_remove(struct i2c_client *i2c)return 0 ; } +static void sec_pmic_shutdown (struct i2c_client *i2c) +{ +struct sec_pmic_dev *sec_pmic =i2c_get_clientdata (i2c); +unsigned int reg, mask; + +if (!sec_pmic->pdata->manual_poweroff) +return ; + +switch (sec_pmic->device_type) { +case S2MPS11X : + reg =S2MPS11_REG_CTRL1 ; + mask =S2MPS11_CTRL1_PWRHOLD_MASK ; +break ; +default : +/* +* Currently only one board with S2MPS11 needs this, so just +* ignore the rest. +*/ +dev_warn (sec_pmic->dev, +"Unsupported device %lu for manual power off\n" , + sec_pmic->device_type); +return ; + } + +regmap_update_bits (sec_pmic->regmap_pmic, reg, mask,0 ); +} +#ifdef CONFIG_PM_SLEEP static int sec_pmic_suspend (struct device *dev) {@@ -491,6 +520,7 @@ static struct i2c_driver sec_pmic_driver = { }, .probe = sec_pmic_probe, .remove = sec_pmic_remove, + .shutdown = sec_pmic_shutdown, .id_table = sec_pmic_id, };include/linux/mfd/samsung/core.h +2
-0@@ -132,6 +132,8 @@ struct sec_platform_data {int buck2_init;int buck3_init;int buck4_init; +/* Whether or not manually set PWRHOLD to low during shutdown. */ +bool manual_poweroff; };/** include/linux/mfd/samsung/s2mps11.h +1
-1@@ -179,6 +179,7 @@ enum s2mps11_regulators {#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)#define S2MPS11_RAMP_DELAY 25000/* uV/us */ +#define S2MPS11_CTRL1_PWRHOLD_MASK BIT(4)#define S2MPS11_BUCK2_RAMP_SHIFT 6#define S2MPS11_BUCK34_RAMP_SHIFT 4 --2.1.4
Re: [PATCH v2 2/3] mfd: s2mps11: Add manual shutdown method for Odroid XU3
Quoted 4 lines · Krzysztof Kozlowski
You acked this patch. However finally it did not go through other tree so maybe you could pick it up for 4.4?
If you want I could reabse and resend it.
Yes, please rebase and resend.
Quoted 126 lines
2015-08-11 19:09 GMT+09:00 Krzysztof Kozlowski <[email protected]>:
Quoted 125 lines
On Odroid XU3 board (with S2MPS11 PMIC) the PWRHOLD bit in CTRL1 register must be manually set to 0 before initiating power off sequence.
One of usual power down methods for Exynos based devices looks like:
1. PWRHOLD pin of PMIC is connected to PSHOLD of Exynos.
2. Exynos holds up this pin during system operation.
3. ACOKB pin of PMIC is pulled up to VBATT and optionally to pin in other device.
4. When PWRHOLD/PSHOLD goes low, the PMIC will turn off the power if ACOKB goes high.On Odroid XU3 family the difference is in (3) - the ACOKB is grounded. This means that PMIC must manually set PWRHOLD field to low and then wait for signal from Application Processor (the usual change in PWRHOLD/PSHOLD pin will actually cut off the power).
The patch adds respective binding allowing Odroid XU3 device to be powered off.
Signed-off-by Krzysztof Kozlowski <[email protected]>Reported-by Anand Moon <[email protected]>Tested-by Anand Moon <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>Acked-by Lee Jones <[email protected]>---
Changes since v1:
1. Split bindings documentation to separate patch (suggested by Lee).
2. Fix additional empty line (suggested by Lee).
3. Add Anand's tested-by, Javier's reviewed-by and Lee's acked-by.Patch is losely based on patch in Hardkernel repository [0] and previous work of Anand Moon [1].
[0] https://github.com/hardkernel/linux/commit/6897e62ba328bd1c8c095d918101863250cd73e7
[1] http://www.spinics.net/lists/linux-samsung-soc/msg45959.html--- drivers/mfd/sec-core.c | 30 ++++++++++++++++++++++++++++++ include/linux/mfd/samsung/core.h | 2 ++ include/linux/mfd/samsung/s2mps11.h | 1 + 3 files changed, 33 insertions(+)drivers/mfd/sec-core.c +30
-0@@ -278,6 +278,8 @@ static struct sec_platform_data *sec_pmic_i2c_parse_dt_pdata(* not parsed here. */ + pd->manual_poweroff =of_property_read_bool (dev->of_node, +"samsung,s2mps11-acokb-ground" ); return pd; }#else @@ -440,6 +442,33 @@ static int sec_pmic_remove(struct i2c_client *i2c)return 0 ; } +static void sec_pmic_shutdown (struct i2c_client *i2c) +{ +struct sec_pmic_dev *sec_pmic =i2c_get_clientdata (i2c); +unsigned int reg, mask; + +if (!sec_pmic->pdata->manual_poweroff) +return ; + +switch (sec_pmic->device_type) { +case S2MPS11X : + reg =S2MPS11_REG_CTRL1 ; + mask =S2MPS11_CTRL1_PWRHOLD_MASK ; +break ; +default : +/* +* Currently only one board with S2MPS11 needs this, so just +* ignore the rest. +*/ +dev_warn (sec_pmic->dev, +"Unsupported device %lu for manual power off\n" , + sec_pmic->device_type); +return ; + } + +regmap_update_bits (sec_pmic->regmap_pmic, reg, mask,0 ); +} +#ifdef CONFIG_PM_SLEEP static int sec_pmic_suspend (struct device *dev) {@@ -491,6 +520,7 @@ static struct i2c_driver sec_pmic_driver = { }, .probe = sec_pmic_probe, .remove = sec_pmic_remove, + .shutdown = sec_pmic_shutdown, .id_table = sec_pmic_id, };include/linux/mfd/samsung/core.h +2
-0@@ -132,6 +132,8 @@ struct sec_platform_data {int buck2_init;int buck3_init;int buck4_init; +/* Whether or not manually set PWRHOLD to low during shutdown. */ +bool manual_poweroff; };/** include/linux/mfd/samsung/s2mps11.h +1
-0@@ -179,6 +179,7 @@ enum s2mps11_regulators {#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)#define S2MPS11_RAMP_DELAY 25000/* uV/us */ +#define S2MPS11_CTRL1_PWRHOLD_MASK BIT(4)#define S2MPS11_BUCK2_RAMP_SHIFT 6#define S2MPS11_BUCK34_RAMP_SHIFT 4
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 3/3 ARM: dts: Fix power off method on exynos5422-odroidxu3
In reply to Krzysztof KozlowskiThe Odroid XU3 family boards have ACOKB pin of PMIC grounded, instead of pulled up as usual. This means that PMIC must manually set PWRHOLD field in its CTRL1 register to low before initiating power down.
This fixes Odroid XU3 powering off:
[ 25.966053] reboot: Power down [ 25.967679] Power down. [ 26.070174] Power down failed, please power off system manually.
---
Changes since v1:
1. Add Javier's reviewed-by.
--- arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi +1 -0
@@ -159,6 +159,7 @@ s2mps11,buck2-ramp-enable = <1>; s2mps11,buck3-ramp-enable = <1>; s2mps11,buck4-ramp-enable = <1>; + samsung,s2mps11-acokb-ground; interrupt-parent = <&gpx0>; interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
Signature · 1 line
2.1.4