From d883f0096e6497b9f7e7c5b5f865f3bd094691a6 Mon Sep 17 00:00:00 2001 From: hhb Date: Wed, 20 Feb 2013 15:13:14 +0800 Subject: [PATCH] rk_gps: fix bug when disable gps aclk --- arch/arm/mach-rk30/board-rk3168-tb.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-rk30/board-rk3168-tb.c b/arch/arm/mach-rk30/board-rk3168-tb.c index 346a66723ae5..ba2c1dc51199 100755 --- a/arch/arm/mach-rk30/board-rk3168-tb.c +++ b/arch/arm/mach-rk30/board-rk3168-tb.c @@ -1184,14 +1184,30 @@ int rk_gps_reset_set(int level) } int rk_enable_hclk_gps(void) { - printk("%s \n", __FUNCTION__); - clk_enable(clk_get(NULL, "hclk_gps")); + struct clk *gps_aclk = NULL; + gps_aclk = clk_get(NULL, "aclk_gps"); + if(gps_aclk) { + clk_enable(gps_aclk); + clk_put(gps_aclk); + printk("%s \n", __FUNCTION__); + } + else + printk("get gps aclk fail\n"); return 0; } int rk_disable_hclk_gps(void) { - printk("%s \n", __FUNCTION__); - clk_disable(clk_get(NULL, "hclk_gps")); + struct clk *gps_aclk = NULL; + gps_aclk = clk_get(NULL, "aclk_gps"); + if(gps_aclk) { + //TO wait long enough until GPS ISR is finished. + msleep(5); + clk_disable(gps_aclk); + clk_put(gps_aclk); + printk("%s \n", __FUNCTION__); + } + else + printk("get gps aclk fail\n"); return 0; } struct rk_gps_data rk_gps_info = { -- 2.34.1