regulator pre-enable
Subsystems (2)
v2 cover regulator pre-enable
Rockchip io-domain care about regulator pre-enable
Jianqun Xu (3):
regulator: add PRE_ENABLE event define
regulator: core: add pre-enable event notify to regulator
soc: rockchip: io-domain: do more thing about regulator notify
drivers/regulator/core.c | 3 +++ drivers/soc/rockchip/io-domain.c | 6 ++++++ include/linux/regulator/consumer.h | 2 ++ 3 files changed, 11 insertions(+)
Signature · 7 lines
v2: - remove patch "regulator: core: notify regulator enable with the voltage value" - use "uV = regulator_get_voltage(supply->reg);" but from notify data v1: - first 2.25.1
PATCH v2 1/3 regulator: add PRE_ENABLE event define
Add REGULATOR_EVENT_PRE_ENABLE to allow to notify driver that the regulator is about to enabled.
---
v2: none
include/linux/regulator/consumer.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/regulator/consumer.h +2 -0
@@ -102,6 +102,7 @@ struct regulator_dev;* Data passed is old voltage cast to (void *). * PRE_DISABLE Regulator is about to be disabled * ABORT_DISABLE Regulator disable failed for some reason +* PRE_ENABLE Regulator is about to be enabled * * NOTE: These events can be OR'ed together when passed into handler. */
@@ -119,6 +120,7 @@ struct regulator_dev;#define REGULATOR_EVENT_PRE_DISABLE 0x400#define REGULATOR_EVENT_ABORT_DISABLE 0x800#define REGULATOR_EVENT_ENABLE 0x1000 +#define REGULATOR_EVENT_PRE_ENABLE 0x2000/* * Regulator errors that can be queried using regulator_get_error_flags
Signature · 1 line
2.25.1
Mark Brown
maintainerRe: [PATCH v2 1/3] regulator: add PRE_ENABLE event define
Quoted 2 lines · Jianqun Xu
Add
REGULATOR_EVENT_PRE_ENABLEto allow to notify driver that the regulator is about to enabled.
This doesn't apply against current code, please check and resend.
PATCH v2 2/3 regulator: core: add pre-enable event notify to regulator
In reply to Jianqun XuNotify the event about regulator to be enabled to driver.
The IO-DOMAIN driver on Rockchip SoCs will take this event and then to configure the io-domain mode before regualtor_enable.
---
v2: none
drivers/regulator/core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/regulator/core.c +3 -0
@@ -2654,6 +2654,9 @@ static int _regulator_enable(struct regulator *regulator) goto err_consumer_disable; } +_notifier_call_chain (rdev,REGULATOR_EVENT_PRE_ENABLE , +NULL ); + ret =_regulator_do_enable (rdev);if (ret <0 ) goto err_consumer_disable;
Signature · 1 line
2.25.1
PATCH v2 3/3 soc: rockchip: io-domain: do more thing about regulator notify
In reply to Jianqun XuDo a fix to rockchip io-domain, follow this orders:
* system running state
-> io-domain vsel to 3.3V
-> regulator_enable
-> vsel change according to regulator voltage* system running state
-> io-domain vsel to 3.3V
-> regulator_disable
Found on some Rockchip SoCs, the regulator enable or disable without care about the io-domain maybe caused soc damaged.
---
v2:
- use "uV = regulator_get_voltage(supply->reg);" but from notify data
v1:
- first version
drivers/soc/rockchip/io-domain.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/soc/rockchip/io-domain.c +6 -0
@@ -123,6 +123,12 @@ static int rockchip_iodomain_notify(struct notifier_block *nb, }else if (event & (REGULATOR_EVENT_VOLTAGE_CHANGE |REGULATOR_EVENT_ABORT_VOLTAGE_CHANGE )) { uV = (unsigned long )data; + }else if (event ®ULATOR_EVENT_PRE_ENABLE ) { + uV =MAX_VOLTAGE_3_3 ; + }else if (event ®ULATOR_EVENT_PRE_DISABLE ) { + uV =MAX_VOLTAGE_3_3 ; + }else if (event ®ULATOR_EVENT_ENABLE ) { + uV =regulator_get_voltage (supply->reg); }else {return NOTIFY_OK ; }
Signature · 1 line
2.25.1
Mark Brown
maintainerRe: [PATCH v2 3/3] soc: rockchip: io-domain: do more thing about regulator notify
drivers/soc/rockchip/io-domain.c static int rockchip_iodomain_notify(struct notifier_block *nb, · line 132
Quoted 3 lines · Jianqun Xu
drivers/soc/rockchip/io-domain.c +2
-0+ }else if (event ®ULATOR_EVENT_ENABLE ) { + uV =regulator_get_voltage (supply->reg); }else {
I am very surprised this doesn't cause locking issues given that we might call notifiers with the regulator API's locks held. Have you tested this with lockdep on?
Re: Re: [PATCH v2 3/3] soc: rockchip: io-domain: do more thing about regulator notify
Hi Mark
--------------
[email protected]
Quoted 9 lines · Jianqun Xu
Quoted 4 lines
drivers/soc/rockchip/io-domain.c +2
-0+ }else if (event ®ULATOR_EVENT_ENABLE ) { + uV =regulator_get_voltage (supply->reg);} else {
I am very surprised this doesn't cause locking issues given that we might call notifiers with the regulator API's locks held. Have you tested this with lockdep on?
Thanks for your reply, there really has locking issue, our test team fail to find out it but get a pass result.
So, if the voltage cannot get here by driver, can the notify pass it, like pre-version patch?
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: Re: [PATCH v2 3/3] soc: rockchip: io-domain: do more thing about regulator notify
Hi Mark
--------------
[email protected]
Quoted 12 lines
Hi Mark
--------------
[email protected]Quoted 9 lines · Jianqun Xu
Quoted 4 lines
drivers/soc/rockchip/io-domain.c +2
-0+ }else if (event ®ULATOR_EVENT_ENABLE ) { + uV =regulator_get_voltage (supply->reg);} else {
I am very surprised this doesn't cause locking issues given that we might call notifiers with the regulator API's locks held. Have you tested this with lockdep on?
Quoted 4 lines
Thanks for your reply, there really has locking issue, our test team fail to find out it but get a pass result.
So, if the voltage cannot get here by driver, can the notify pass it, like pre-version patch?
I think it's possilbe to store the voltage in driver side, and do the io-domain config after EVENT_ENABLE notify witout voltage, I will push it to io-domain maintainer to review, can I add yours' review in that patch ?
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip