diff options
author | Vaibhav Hiremath <vaibhav.hiremath@linaro.org> | 2016-02-13 02:04:10 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-02-15 13:18:40 -0800 |
commit | 5667ab17999a16c2bb1a5cdcaf183d8710aeb717 (patch) | |
tree | 2e74b0f72f8b44097fdef283f02dc72f0f4c12a3 /drivers/staging/greybus/arche-apb-ctrl.c | |
parent | 6ceed512e68ea8a82cc320630e24656f03c50424 (diff) | |
download | op-kernel-dev-5667ab17999a16c2bb1a5cdcaf183d8710aeb717.zip op-kernel-dev-5667ab17999a16c2bb1a5cdcaf183d8710aeb717.tar.gz |
greybus: arche-apb-ctrl: Rename init_seq and cleanup fn
apb_ctrl_coldboot_seq() and apb_ctrl_poweroff_seq()
is appropriate name as per spec and implementation, so rename it.
Also move apb_ctrl_poweroff_seq() fn above, to group it with
other _seq functions.
Testing Done: Tested on EVT1.2 and DB3.5 platform.
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/arche-apb-ctrl.c')
-rw-r--r-- | drivers/staging/greybus/arche-apb-ctrl.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c index 7720153..9b7d61f 100644 --- a/drivers/staging/greybus/arche-apb-ctrl.c +++ b/drivers/staging/greybus/arche-apb-ctrl.c @@ -71,7 +71,7 @@ static void unexport_gpios(struct arche_apb_ctrl_drvdata *apb) /* * Note: Please do not modify the below sequence, as it is as per the spec */ -static int apb_ctrl_init_seq(struct platform_device *pdev, +static int apb_ctrl_coldboot_seq(struct platform_device *pdev, struct arche_apb_ctrl_drvdata *apb) { struct device *dev = &pdev->dev; @@ -113,6 +113,25 @@ static int apb_ctrl_init_seq(struct platform_device *pdev, return 0; } +static void apb_ctrl_poweroff_seq(struct arche_apb_ctrl_drvdata *apb) +{ + /* disable the clock */ + if (gpio_is_valid(apb->clk_en_gpio)) + gpio_set_value(apb->clk_en_gpio, 0); + + if (!IS_ERR(apb->vcore) && regulator_is_enabled(apb->vcore) > 0) + regulator_disable(apb->vcore); + + if (!IS_ERR(apb->vio) && regulator_is_enabled(apb->vio) > 0) + regulator_disable(apb->vio); + + /* As part of exit, put APB back in reset state */ + assert_reset(apb->resetn_gpio); + apb->state = ARCHE_PLATFORM_STATE_OFF; + + /* TODO: May have to send an event to SVC about this exit */ +} + static int apb_ctrl_get_devtree_data(struct platform_device *pdev, struct arche_apb_ctrl_drvdata *apb) { @@ -201,25 +220,6 @@ static int apb_ctrl_get_devtree_data(struct platform_device *pdev, return 0; } -static void apb_ctrl_cleanup(struct arche_apb_ctrl_drvdata *apb) -{ - /* disable the clock */ - if (gpio_is_valid(apb->clk_en_gpio)) - gpio_set_value(apb->clk_en_gpio, 0); - - if (!IS_ERR(apb->vcore) && regulator_is_enabled(apb->vcore) > 0) - regulator_disable(apb->vcore); - - if (!IS_ERR(apb->vio) && regulator_is_enabled(apb->vio) > 0) - regulator_disable(apb->vio); - - /* As part of exit, put APB back in reset state */ - assert_reset(apb->resetn_gpio); - apb->state = ARCHE_PLATFORM_STATE_OFF; - - /* TODO: May have to send an event to SVC about this exit */ -} - int arche_apb_ctrl_probe(struct platform_device *pdev) { int ret; @@ -236,7 +236,7 @@ int arche_apb_ctrl_probe(struct platform_device *pdev) return ret; } - ret = apb_ctrl_init_seq(pdev, apb); + ret = apb_ctrl_coldboot_seq(pdev, apb); if (ret) { dev_err(dev, "failed to set init state of control signal %d\n", ret); @@ -255,7 +255,7 @@ int arche_apb_ctrl_remove(struct platform_device *pdev) { struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev); - apb_ctrl_cleanup(apb); + apb_ctrl_poweroff_seq(apb); platform_set_drvdata(pdev, NULL); unexport_gpios(apb); |