Esempio n. 1
0
void chipset_exit_hard_off(void)
{
	/*
	 * If not in the soft-off state, hard-off state, or headed there,
	 * nothing to do.
	 */
	if (state != POWER_G3 && state != POWER_S5G3 && state != POWER_S5)
		return;

	/*
	 * Set a flag to leave G3, then wake the task. If the power state is
	 * POWER_S5G3, or is POWER_S5 but the S5 inactivity timer has
	 * expired, set this flag can let system go to G3 and then exit G3
	 * immediately for powering on.
	 */
	want_g3_exit = 1;

	/*
	 * If the power state is in POWER_S5 and S5 inactivity timer is
	 * running, to wake the chipset task can cancel S5 inactivity timer and
	 * then restart the timer. This will give cpu a chance to start up if
	 * S5 inactivity timer is about to expire while power button is
	 * pressed. For other states here, to wake the chipset task to trigger
	 * the event for leaving G3 is necessary.
	 */
	if (task_start_called())
		task_wake(TASK_ID_CHIPSET);
}
Esempio n. 2
0
void chipset_exit_hard_off(void)
{
	/* If not in the hard-off state nor headed there, nothing to do */
	if (state != POWER_G3 && state != POWER_S5G3)
		return;

	/* Set a flag to leave G3, then wake the task */
	want_g3_exit = 1;

	if (task_start_called())
		task_wake(TASK_ID_CHIPSET);
}
static void __attribute__((noinline)) _task_dump_trace_dispatch(int sig)
{
	int need_dispatch = 1;
	task_id_t running = task_get_running();

	if (!pthread_equal(pthread_self(), main_thread)) {
		need_dispatch = 0;
	} else if (!task_start_called()) {
		fprintf(stderr, "Stack trace of main thread:\n");
		need_dispatch = 0;
	} else if (in_interrupt_context()) {
		fprintf(stderr, "Stack trace of ISR:\n");
	} else {
		fprintf(stderr, "Stack trace of task %d (%s):\n",
				running, task_get_name(running));
	}

	if (need_dispatch) {
		pthread_kill(task_get_thread(running), SIGNAL_TRACE_DUMP);
	} else {
		_task_dump_trace_impl(SIGNAL_TRACE_OFFSET);
		exit(1);
	}
}