Ejemplo n.º 1
0
static int
msmrtc_suspend(struct platform_device *dev, pm_message_t state)
{
	unsigned secs;
	struct msm_dex_command dex;
	if (rtcalarm_time) {
		unsigned long now = msmrtc_get_seconds();
		int diff = rtcalarm_time - now;
		if (diff <= 0) {
			msmrtc_alarmtimer_expired(1);
			return 0;
		}

		if(max_diff)
			diff = max_diff;

		dex.cmd = PCOM_READ_RTC;
		msm_proc_comm_wince(&dex, &secs);

		printk("Wake up in %d seconds\n",diff);

		dex.cmd = PCOM_SET_ALARM_RTC;
		dex.has_data = 1;
		dex.data = secs + diff;
		msm_proc_comm_wince(&dex, 0);
	}

	return 0;
}
static int
msmrtc_suspend(struct platform_device *dev, pm_message_t state)
{
	int rc, diff;
	struct rtc_time tm;
	unsigned long now;
	struct msm_rtc *rtc_pdata = platform_get_drvdata(dev);

	suspend_state.tick_at_suspend = msm_timer_get_sclk_time(NULL);
	if (rtc_pdata->rtcalarm_time) {
		rc = msmrtc_timeremote_read_time(&dev->dev, &tm);
		if (rc) {
			dev_err(&dev->dev,
				"%s: Unable to read from RTC\n", __func__);
			return rc;
		}
		rtc_tm_to_time(&tm, &now);
		diff = rtc_pdata->rtcalarm_time - now;
		if (diff <= 0) {
			msmrtc_alarmtimer_expired(1 , rtc_pdata);
			msm_pm_set_max_sleep_time(0);
			atomic_inc(&suspend_state.state);
			return 0;
		}
		msm_pm_set_max_sleep_time((int64_t)
			((int64_t) diff * NSEC_PER_SEC));
	} else
		msm_pm_set_max_sleep_time(0);
	atomic_inc(&suspend_state.state);
	return 0;
}
Ejemplo n.º 3
0
static int
msmrtc_suspend(struct platform_device *dev, pm_message_t state)
{
	int rc, diff;
	struct rtc_time tm;
	unsigned long now;

	if (rtcalarm_time) {
		rc = msmrtc_timeremote_read_time(NULL, &tm);
		if (rc) {
			pr_err("%s: Unable to read from RTC\n", __func__);
			return rc;
		}
		rtc_tm_to_time(&tm, &now);
		diff = rtcalarm_time - now;
		if (diff <= 0) {
			msmrtc_alarmtimer_expired(1);
			msm_pm_set_max_sleep_time(0);
			return 0;
		}
		msm_pm_set_max_sleep_time((int64_t) ((int64_t) diff * NSEC_PER_SEC));
	} else
		msm_pm_set_max_sleep_time(0);
	return 0;
}
static int
msmrtc_suspend(struct platform_device *dev, pm_message_t state)
{
	int rc, diff;
	struct rtc_time tm;
	unsigned long now;
	struct msm_rtc *rtc_pdata = platform_get_drvdata(dev);

	suspend_state.tick_at_suspend = msm_timer_get_sclk_time(NULL);
	if (rtc_pdata->rtcalarm_time) {
		rc = msmrtc_timeremote_read_time(&dev->dev, &tm);
		if (rc) {
			dev_err(&dev->dev,
				"%s: Unable to read from RTC\n", __func__);
			return rc;
		}
		rtc_tm_to_time(&tm, &now);
		diff = rtc_pdata->rtcalarm_time - now;
		if (diff <= 0) {
			msmrtc_alarmtimer_expired(1 , rtc_pdata);
			msm_pm_set_max_sleep_time(0);
/* CR 293735 - Function/Feature Failure (Partial)
 * When system was in suspend, could make invalid "elapsed system time" at AP side.
 * 
 * Problem description
 * When system is in suspend mode and if more than one network time update
 * comes while system is in suspend mode then the uptime gets corrupted.
 * 
 * Failure frequency: Occasionally
 * Scenario frequency: Uncommon
 * Change description
 * Added change to modify tick_at_suspend (variable that stores time tick
 * while entering suspend) after each update to the current time tick.
 * Setting the suspend mode variable in case alarm time expires the current
 * RTC time as in thic case also system enters suspend mode.
 * to sdcc irq handlers returning IRQ_NONE without handling the interrupt.
 * When interrupt is disabled the communication between the SDIO client and
 * SDCC host controller is stopped while a pending command is in progress
 * and hence WLAN operation is stuck forever and LOGP recovery cannot be
 * processed.
 * Files affected
 * arch/arm/mach-msm/rpc_server_time_remote.c
 * drivers/rtc/rtc-msm.c
 * include/linux/rtc-msm.h
 */
#if 1 //QCT SBA 404017
			atomic_inc(&suspend_state.state);
#endif
			return 0;
		}
		msm_pm_set_max_sleep_time((int64_t)
			((int64_t) diff * NSEC_PER_SEC));
	} else
		msm_pm_set_max_sleep_time(0);
	atomic_inc(&suspend_state.state);
	return 0;
}
Ejemplo n.º 5
0
static int
msmrtc_resume(struct platform_device *dev)
{
	if (rtcalarm_time) {
		unsigned long now = msmrtc_get_seconds();
		int diff = rtcalarm_time - now;
		if (diff <= 0)
			msmrtc_alarmtimer_expired(2);
	}
	return 0;
}
Ejemplo n.º 6
0
static int
msmrtc_suspend(struct platform_device *dev, pm_message_t state)
{
	if (rtcalarm_time) {
		unsigned long now = msmrtc_get_seconds();
		int diff = rtcalarm_time - now;
		if (diff <= 0) {
			msmrtc_alarmtimer_expired(1);
			msm_pm_set_max_sleep_time(0);
			return 0;
		}
		msm_pm_set_max_sleep_time((int64_t) ((int64_t) diff * NSEC_PER_SEC));
	} else
		msm_pm_set_max_sleep_time(0);
	return 0;
}
Ejemplo n.º 7
0
static int
msmrtc_resume(struct platform_device *dev)
{
	int rc, diff;
	struct rtc_time tm;
	unsigned long now;

	if (rtcalarm_time) {
		rc = msmrtc_timeremote_read_time(NULL, &tm);
		if (rc) {
			pr_err("%s: Unable to read from RTC\n", __func__);
			return rc;
		}
		rtc_tm_to_time(&tm, &now);
		diff = rtcalarm_time - now;
		if (diff <= 0)
			msmrtc_alarmtimer_expired(2);
	}
	return 0;
}
Ejemplo n.º 8
0
static int
msmrtc_suspend(struct platform_device *dev, pm_message_t state)
{
	int rc, diff;
	struct rtc_time tm;
	unsigned long now;

	if (rtcalarm_time) {
		rc = msmrtc_timeremote_read_time(NULL, &tm);
		if (rc) {
			pr_err("%s: Unable to read from RTC\n", __func__);
			return rc;
		}
		rtc_tm_to_time(&tm, &now);
		diff = rtcalarm_time - now;
		
/* Div2-SW2-BSP-FBX-BATT { */
#ifdef CONFIG_BATTERY_FIH_MSM
        if (diff > RPC_wakeup_cycle_time && RPC_wakeup_cycle_time != 0)
            diff = RPC_wakeup_cycle_time;
#endif
/* } Div2-SW2-BSP-FBX-BATT */

		if (diff <= 0) {
			msmrtc_alarmtimer_expired(1);
			msm_pm_set_max_sleep_time(0);
			return 0;
		}
		msm_pm_set_max_sleep_time((int64_t) ((int64_t) diff * NSEC_PER_SEC));
	} else
/* Div2-SW2-BSP-FBX-BATT { */
#ifdef CONFIG_BATTERY_FIH_MSM
        msm_pm_set_max_sleep_time((int64_t) ((int64_t) RPC_wakeup_cycle_time * NSEC_PER_SEC));
#else
		msm_pm_set_max_sleep_time(0);
#endif
/* } Div2-SW2-BSP-FBX-BATT */

	return 0;
}
Ejemplo n.º 9
0
static int
msmrtc_resume(struct platform_device *dev)
{
	int rc, diff;
	struct rtc_time tm;
	unsigned long now;
	struct msm_rtc *rtc_pdata = platform_get_drvdata(dev);

	if (rtc_pdata->rtcalarm_time) {
		rc = msmrtc_timeremote_read_time(&dev->dev, &tm);
		if (rc) {
			dev_err(&dev->dev,
				"%s: Unable to read from RTC\n", __func__);
			return rc;
		}
		rtc_tm_to_time(&tm, &now);
		diff = rtc_pdata->rtcalarm_time - now;
		if (diff <= 0)
			msmrtc_alarmtimer_expired(2 , rtc_pdata);
	}
	return 0;
}