In some HQX targets (where Linux is running as guest OS),
when S2R is triggered from host OS, the GVM is sent to
Deep Sleep state.
Since Deep Sleep is getting triggered from Guest point of view,
ufs spm level is set to 5, Power OFF SSU command is sent to the
ufs device and all regulators are turned off from ufs. But since
it is actually an S2R event from Host PoV, the regulators are
not turned off by the PMIC. This is causing power leakage.
To fix this issue, create a sysfs node "ufs_pm_mode". The Host OS
will write to this node which the event (S2R or Deep Sleep) is
getting triggered at the Host. UFS will set the correct spm level
accordingly. For S2R case, the default spm level is retained while
for Deep Sleep it is set to 5.
The default value for this node is 0( which is set during ufs init).
This means it will not set anything unless "S2R" or "DEEPSLEEP" is
explicitly written to the node.
ufs_pm_mode can have three values: "NONE","S2R","DEEPSLEEP":
1. When "NONE" is written to sysfs node: the spm level
is set to 5 for deep sleep and existing spm value
left unchanged for s2idle case.
2. When "S2R" is written to the node: the default spm level
value is retained.
3. When "DEEPSLEEP" is written to the node: the spm level
is set to 5.
Change-Id: I232449cf93a3b37652897e74a621bf219302b76b
Signed-off-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>