summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/arche-platform.c
diff options
context:
space:
mode:
authorVaibhav Hiremath <vaibhav.hiremath@linaro.org>2016-05-24 18:32:03 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-05-25 22:36:45 -0700
commit0b1283e33f7a38645c9d060ce2e2b24a44e3b125 (patch)
tree15f1a7d7c41272e6bc23b20c2d8cef9ea720b032 /drivers/staging/greybus/arche-platform.c
parentc61a8b49846ecc11f7959f573b9548f859bc73a5 (diff)
greybus: arche-platform: Enter ACTIVE state only from OFF state
Make sure that, transition to active state happens only from OFF state. Instead of imposing the restriction to user-space, driver internally switches to OFF state and then to ACTIVE state. Testing Done: Tested on EVT1.5 platform. Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Tested-by: Michael Scott <michael.scott@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/arche-platform.c')
-rw-r--r--drivers/staging/greybus/arche-platform.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
index a8e36e1141fd..58b370774399 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -407,8 +407,15 @@ static ssize_t state_store(struct device *dev,
if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE)
goto exit;
+ /* First we want to make sure we power off everything
+ * and then activate back again */
+ device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
+ arche_platform_poweroff_seq(arche_pdata);
+
arche_platform_wd_irq_en(arche_pdata);
ret = arche_platform_coldboot_seq(arche_pdata);
+ if (ret)
+ goto exit;
} else if (sysfs_streq(buf, "standby")) {
if (arche_pdata->state == ARCHE_PLATFORM_STATE_STANDBY)