*/
static void dcon_load_holdoff(struct dcon_priv *dcon)
{
- struct timespec delta_t, now;
+ ktime_t delta_t, now;
while (1) {
- getnstimeofday(&now);
- delta_t = timespec_sub(now, dcon->load_time);
- if (delta_t.tv_sec != 0 ||
- delta_t.tv_nsec > NSEC_PER_MSEC * 20) {
+ now = ktime_get();
+ delta_t = ktime_sub(now, dcon->load_time);
+ if (ktime_to_ns(delta_t) > NSEC_PER_MSEC * 20) {
break;
}
mdelay(4);
/* And turn off the DCON */
pdata->set_dconload(1);
- getnstimeofday(&dcon->load_time);
+ dcon->load_time = ktime_get();
pr_info("The CPU has control\n");
break;
case DCON_SOURCE_DCON:
{
- struct timespec delta_t;
+ ktime_t delta_t;
pr_info("dcon_source_switch to DCON\n");
/* Clear DCONLOAD - this implies that the DCON is in control */
pdata->set_dconload(0);
- getnstimeofday(&dcon->load_time);
+ dcon->load_time = ktime_get();
wait_event_timeout(dcon->waitq, dcon->switched, HZ/2);
* deassert and reassert, and hope for the best.
* see http://dev.laptop.org/ticket/9664
*/
- delta_t = timespec_sub(dcon->irq_time, dcon->load_time);
- if (dcon->switched && delta_t.tv_sec == 0 &&
- delta_t.tv_nsec < NSEC_PER_MSEC * 20) {
+ delta_t = ktime_sub(dcon->irq_time, dcon->load_time);
+ if (dcon->switched && ktime_to_ns(delta_t)
+ < NSEC_PER_MSEC * 20) {
pr_err("missed loading, retrying\n");
pdata->set_dconload(1);
mdelay(41);
pdata->set_dconload(0);
- getnstimeofday(&dcon->load_time);
+ dcon->load_time = ktime_get();
mdelay(41);
}
}
case 2: /* switch to DCON mode */
case 1: /* switch to CPU mode */
dcon->switched = true;
- getnstimeofday(&dcon->irq_time);
+ dcon->irq_time = ktime_get();
wake_up(&dcon->waitq);
break;
*/
if (dcon->curr_src != dcon->pending_src && !dcon->switched) {
dcon->switched = true;
- getnstimeofday(&dcon->irq_time);
+ dcon->irq_time = ktime_get();
wake_up(&dcon->waitq);
pr_debug("switching w/ status 0/0\n");
} else {