/* This funtion will be init breakpoint for GPIO verification */
void gpio_init_done(void)
{
	pr_info("%s\n", __func__);
#ifdef CONFIG_SEC_GPIO_DVS
	/************************ Caution !!! ****************************/
	/* This function must be located in appropriate INIT position
	 * in accordance with the specification of each BB vendor.
	 */
	/************************ Caution !!! ****************************/
	gpio_dvs_check_initgpio();
#endif
}
void midas_power_init(void)
{
	printk(KERN_INFO "%s\n", __func__);
#if defined(CONFIG_SEC_GPIO_DVS)
	/************************ Caution !!! ****************************/
	/* This function must be located in an appropriate position for INIT state
	 * in accordance with the specification of each BB vendor.
	 */
	/************************ Caution !!! ****************************/
	gpio_dvs_check_initgpio();
#endif
}
int pm_autosleep_set_state(suspend_state_t state)
{
#ifdef CONFIG_SEC_GPIO_DVS
	static bool gpio_init_done = false;
#endif

#ifndef CONFIG_HIBERNATION
	if (state >= PM_SUSPEND_MAX)
		return -EINVAL;
#endif

#ifdef CONFIG_SEC_GPIO_DVS
		/************************ Caution !!! ****************************/
		/* This function must be located in appropriate INIT position
		 * in accordance with the specification of each BB vendor.
		 */
		/************************ Caution !!! ****************************/
	if (unlikely(!gpio_init_done) && state==PM_SUSPEND_ON) {
		gpio_dvs_check_initgpio();
		gpio_init_done = true;
	}
#endif

	__pm_stay_awake(autosleep_ws);

	mutex_lock(&autosleep_lock);

	autosleep_state = state;

	__pm_relax(autosleep_ws);

#ifdef CONFIG_SEC_PM_DEBUG
	wakeup_sources_stats_active();
#endif

	if (state > PM_SUSPEND_ON) {
		pm_wakep_autosleep_enabled(true);
#ifdef CONFIG_ADAPTIVE_KSM
		AKSM_suspend();
#endif
		queue_up_suspend_work();
	} else {
#ifdef CONFIG_ADAPTIVE_KSM
		AKSM_resume();
#endif
		pm_wakep_autosleep_enabled(false);
	}

	mutex_unlock(&autosleep_lock);
	return 0;
}
/* GPS: power on/off control */
static void gps_power_on(void)
{
	unsigned int gps_rst_n,gps_on;


	gps_rst_n = GPIO_GPS_RESET;
	if (gpio_request(gps_rst_n, "gpio_gps_rst")) {
		pr_err("Request GPIO failed, gpio: %d\n", gps_rst_n);
		return;
	}
	
	gps_on = GPIO_GPS_ONOFF;
	if (gpio_request(gps_on, "gpio_gps_on")) {
		pr_err("Request GPIO failed,gpio: %d\n", gps_on);
		goto out;
	}

	gpio_direction_output(gps_rst_n, 0);
	gpio_direction_output(gps_on, 0);

	gps_enable_control(1);
	
	mdelay(10);
//	gpio_direction_output(gps_rst_n, 1);
	mdelay(10);
//	gpio_direction_output(gps_on, 1);

	pr_info("gps chip powered on\n");

	gpio_free(gps_on);
out:
	gpio_free(gps_rst_n);

#ifdef CONFIG_SEC_GPIO_DVS
	/************************ Caution !!! ****************************/
	/* This function must be located in appropriate INIT position
	 * in accordance with the specification of each BB vendor.
	 */
	/************************ Caution !!! ****************************/
	gpio_dvs_check_initgpio();
#endif

	return;
}
void sec_boot_stat_add(const char * c)
{
	int i;

	i = 0;
	while(boot_events[i].string != NULL)
	{
		if(strcmp(c, boot_events[i].string) == 0)
		{
			if (boot_events[i].time == 0)
				boot_events[i].time = get_boot_stat_time(); 
#ifdef CONFIG_SEC_GPIO_DVS
			if (boot_events[i].type==PLATFORM_BOOT_COMPLETE)
				gpio_dvs_check_initgpio();
#endif
			break;
		}
		i = i + 1;
	}
}