mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 04:48:04 +09:00
rk gps: add soc gps board level code
This commit is contained in:
@@ -59,6 +59,10 @@
|
||||
#include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_GPS_RK)
|
||||
#include "../../../drivers/misc/gps/rk_gps/rk_gps.h"
|
||||
#endif
|
||||
|
||||
#include "board-rk3026-tb-camera.c"
|
||||
|
||||
/***********************************************************
|
||||
@@ -1024,6 +1028,111 @@ void __sramfunc board_pmu_resume(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CONFIG_GPS_RK)
|
||||
#define GPS_OSCEN_PIN RK2928_PIN1_PB0
|
||||
#define GPS_RXEN_PIN RK2928_PIN1_PB0
|
||||
|
||||
int rk_gps_io_init(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
gpio_request(GPS_OSCEN_PIN, NULL);
|
||||
gpio_direction_output(GPS_OSCEN_PIN, GPIO_LOW);
|
||||
|
||||
iomux_set(GPS_CLK);//GPS_CLK
|
||||
iomux_set(GPS_MAG);//GPS_MAG
|
||||
iomux_set(GPS_SIGN);//GPS_SIGN
|
||||
#if 0
|
||||
gpio_request(RK30_PIN1_PA6, NULL);
|
||||
gpio_direction_output(RK30_PIN1_PA6, GPIO_LOW);
|
||||
|
||||
gpio_request(RK30_PIN1_PA5, NULL);
|
||||
gpio_direction_output(RK30_PIN1_PA5, GPIO_LOW);
|
||||
|
||||
gpio_request(RK30_PIN1_PA7, NULL);
|
||||
gpio_direction_output(RK30_PIN1_PA7, GPIO_LOW);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
int rk_gps_power_up(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rk_gps_power_down(void)
|
||||
{
|
||||
printk("%s \n", __FUNCTION__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rk_gps_reset_set(int level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int rk_enable_hclk_gps(void)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 = {
|
||||
.io_init = rk_gps_io_init,
|
||||
.power_up = rk_gps_power_up,
|
||||
.power_down = rk_gps_power_down,
|
||||
.reset = rk_gps_reset_set,
|
||||
.enable_hclk_gps = rk_enable_hclk_gps,
|
||||
.disable_hclk_gps = rk_disable_hclk_gps,
|
||||
.GpsSign = RK2928_PIN1_PA5,
|
||||
.GpsMag = RK2928_PIN1_PA4, //GPIO index
|
||||
.GpsClk = RK2928_PIN1_PA2, //GPIO index
|
||||
.GpsVCCEn = GPS_OSCEN_PIN, //GPIO index
|
||||
#if 0
|
||||
.GpsSpi_CSO = RK30_PIN1_PA4, //GPIO index
|
||||
.GpsSpiClk = RK30_PIN1_PA5, //GPIO index
|
||||
.GpsSpiMOSI = RK30_PIN1_PA7, //GPIO index
|
||||
#endif
|
||||
.GpsIrq = IRQ_GPS,
|
||||
.GpsSpiEn = 0,
|
||||
.GpsAdcCh = 2,
|
||||
.u32GpsPhyAddr = RK2928_GPS_PHYS,
|
||||
.u32GpsPhySize = RK2928_GPS_SIZE,
|
||||
};
|
||||
|
||||
struct platform_device rk_device_gps = {
|
||||
.name = "gps_hv5820b",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk_gps_info,
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* i2c
|
||||
************************************************************/
|
||||
@@ -1130,6 +1239,9 @@ static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_SND_SOC_RK3026
|
||||
&rk3026_codec,
|
||||
#endif
|
||||
#ifdef CONFIG_GPS_RK
|
||||
&rk_device_gps,
|
||||
#endif
|
||||
};
|
||||
|
||||
static void rk30_pm_power_off(void)
|
||||
@@ -1183,6 +1295,10 @@ static void __init rk30_reserve(void)
|
||||
|
||||
#ifdef CONFIG_VIDEO_RK29
|
||||
rk30_camera_request_reserve_mem();
|
||||
#endif
|
||||
#ifdef CONFIG_GPS_RK
|
||||
//it must be more than 8MB
|
||||
rk_gps_info.u32MemoryPhyAddr = board_mem_reserve_add("gps", SZ_8M);
|
||||
#endif
|
||||
board_mem_reserved();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user