/*
 * Checks if all devices are suspended/disabled.
 * Disables mainclk (DSS clocks on OMAP4) if true and do_clk_disable is true.
 */
int dss_clkdis_save_ctx(bool do_clk_disable)
{
	int r;
	struct bus_type *bus = dss_get_bus();

	DSSDBG("%s enter\n", __func__);

	r = bus_for_each_dev(bus, NULL, NULL, dss_check_state_disabled);

	if (r) {
		/* Some devices are not disabled/suspended */
		r = -EBUSY;
	} else {
		if (do_clk_disable) {
			atomic_set(&context_state, DSS_CONTEXT_NOT_RESTORED);
			save_all_ctx();
		}
		r = 0;
	}

	if (do_clk_disable)
		dsi_runtime_put();

	return r;
}
void dss_clk_disable(enum dss_clock clks)
{
	if (cpu_is_omap34xx()) {
		unsigned num_clks = count_clk_bits(clks);

		BUG_ON(core.num_clks_enabled < num_clks);

		if (core.num_clks_enabled == num_clks)
			save_all_ctx();
	}

	dss_clk_disable_no_ctx(clks);
}
Exemple #3
0
/*
 * Checks if all devices are suspended/disabled.
 * Disables mainclk (DSS clocks on OMAP4) if true and do_clk_disable is true.
 */
int dss_mainclk_state_disable(bool do_clk_disable)
{
	int r;
	struct bus_type *bus = dss_get_bus();

	r = bus_for_each_dev(bus, NULL, NULL, dss_check_state_disabled);

	if (r) {
		/* Some devices are not disabled/suspended */
		return -EBUSY;
	} else {
		if (do_clk_disable) {
			save_all_ctx();
			dss_mainclk_disable();
		}
		return 0;
	}
}