mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
spi: disable_depth > 0 when pm runtime get sync
Port the spi changes from bq-6125.
when unit suspend, pm_runtime_disalbe() would be called. And
then dev.power.disable_depth number will +1. And its value
will be -1 when pm_runtime_enable() is called.
And if spi bus want to work as soon as system resume, it will call
pm_runtime_get_sync(), which would check the value of
disable_depth. If its value is not 0, spi operation will fail.
The sequence is as following:
runtime_suspend
pm_runtime_disable()-> disable_depth +1
rumtime_resume
pm_runtime_eanble() -> disable_depth -1
spi_sync()
pm_runtime_get_sync -> check the value of disable_depth
But for sometimes, spi operation will earlier than pm_runtime_enable()
called. Then spi_sync() will fail duel to non-zero disable_depth value.
So we add a checking logic before pm_runtime_get_sync() to make sure
disable_depth is 0.
Change-Id: I673363bfd861402b5c54874137b12700ef2df14d
Signed-off-by: wengjun1 <wengjun1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1793166
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wei Wei <weiweij@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
parent
e008ef1062
commit
b6a7ab72bd
1 changed files with 6 additions and 0 deletions
|
|
@ -1366,6 +1366,12 @@ static int spi_geni_prepare_transfer_hardware(struct spi_master *spi)
|
|||
"%s: Error %d pinctrl_select_state\n", __func__, ret);
|
||||
}
|
||||
|
||||
if (mas->dev->power.disable_depth > 0) {
|
||||
dev_err(mas->dev, "%s:disable_depth not zero %d\n",
|
||||
__func__, mas->dev->power.disable_depth);
|
||||
pm_runtime_enable(mas->dev);
|
||||
}
|
||||
|
||||
if (!mas->setup || !mas->shared_ee) {
|
||||
ret = pm_runtime_get_sync(mas->dev);
|
||||
if (ret < 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue