void dss_disable_all_devices(void) { struct bus_type *bus = dss_get_bus(); mutex_lock(&display.power_lock); bus_for_each_dev(bus, NULL, NULL, dss_disable_device); mutex_unlock(&display.power_lock); }
/* ref count of the found device is incremented. ref count * of from-device is decremented. */ struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from) { struct device *dev = NULL; struct device *dev_start = NULL; struct omap_dss_device *dssdev = NULL; int match(struct device *dev, void *data) { /* skip panels connected to controllers */ if (to_dss_device(dev)->panel.ctrl) return 0; return 1; } if (from) dev_start = &from->dev; dev = bus_find_device(dss_get_bus(), dev_start, NULL, match); if (dev) dssdev = to_dss_device(dev); if (from) put_device(&from->dev); return dssdev; }
/* * 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; }
int dss_resume_all_devices(void) { struct bus_type *bus = dss_get_bus(); int r = 0; mutex_lock(&display.power_lock); r = bus_for_each_dev(bus, NULL, NULL, dss_resume_device); mutex_unlock(&display.power_lock); return r; }
int dss_suspend_all_devices(void) { int r; struct bus_type *bus = dss_get_bus(); r = bus_for_each_dev(bus, NULL, NULL, dss_suspend_device); if (r) { /* resume all displays that were suspended */ dss_resume_all_devices(); return r; } return 0; }
/* * enables mainclk (DSS clocks on OMAP4 if any device is enabled. * Returns 0 on success. */ int dss_mainclk_state_enable(void) { int r; struct bus_type *bus = dss_get_bus(); r = bus_for_each_dev(bus, NULL, NULL, dss_check_state_disabled); if (r) { r = dss_mainclk_enable(); if (!r) restore_all_ctx(); return r; } else { /* All devices are disabled/suspended */ return -EAGAIN; } }
/* * 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; } }
/* ref count of the found device is incremented. ref count * of from-device is decremented. */ struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from) { struct device *dev; struct device *dev_start = NULL; struct omap_dss_device *dssdev = NULL; int match(struct device *dev, void *data) { return 1; } if (from) dev_start = &from->dev; dev = bus_find_device(dss_get_bus(), dev_start, NULL, match); if (dev) dssdev = to_dss_device(dev); if (from) put_device(&from->dev); return dssdev; }
/* * enables mainclk (DSS clocks on OMAP4 if any device is enabled. * Returns 0 on success. */ int dss_clken_restore_ctx(void) { 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) { r = dsi_runtime_get(); if ((!r) && (atomic_cmpxchg(&context_state, DSS_CONTEXT_NOT_RESTORED, DSS_CONTEXT_RESTORED) == DSS_CONTEXT_NOT_RESTORED)) { restore_all_ctx(); } return r; } else { /* All devices are disabled/suspended */ return -EAGAIN; } }
void dss_disable_all_devices(void) { struct bus_type *bus = dss_get_bus(); bus_for_each_dev(bus, NULL, NULL, dss_disable_device); }
int dss_resume_all_devices(void) { struct bus_type *bus = dss_get_bus(); return bus_for_each_dev(bus, NULL, NULL, dss_resume_device); }