From d8b16338df9bcef1fa0a047bd3e8d2e922dc5bb8 Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Tue, 26 Jan 2016 07:23:29 +0530 Subject: [PATCH] greybus: arche-platform: Disable clock as part of driver remove As part of driver remove (cleanup) function, disable the clock for both SVC, APB1 & APB2. Testing Done: Tested on EVT1 platform with Connect=>disconnect=>connect iteration, almost close to 100 iterations have passed (demo branch). And also tested with kernel-only build. Signed-off-by: Vaibhav Hiremath Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/arche-apb-ctrl.c | 4 ++++ drivers/staging/greybus/arche-platform.c | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c index d073543..f2bad8d 100644 --- a/drivers/staging/greybus/arche-apb-ctrl.c +++ b/drivers/staging/greybus/arche-apb-ctrl.c @@ -220,6 +220,10 @@ static int apb_ctrl_get_devtree_data(struct platform_device *pdev, 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); diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index d12fa0e..b5596ec 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -104,6 +104,7 @@ static void unexport_gpios(struct arche_platform_drvdata *arche_pdata) static void arche_platform_cleanup(struct arche_platform_drvdata *arche_pdata) { + clk_disable_unprepare(arche_pdata->svc_ref_clk); /* As part of exit, put APB back in reset state */ svc_reset_onoff(arche_pdata->svc_reset_gpio, arche_pdata->is_reset_act_hi); -- 2.7.4