23 #define DSS_SUBSYS_NAME "CORE"
25 #include <linux/kernel.h>
26 #include <linux/module.h>
33 #include <linux/device.h>
36 #include <linux/slab.h>
52 static char *def_disp_name;
63 return core.default_display_name;
73 return core.vdds_dsi_reg;
87 return core.vdds_sdi_reg;
106 WARN_ONCE(cnt < 0,
"get_context_loss_count failed: %d\n", cnt);
141 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
155 .
open = dss_debug_open,
161 static struct dentry *dss_debugfs_dir;
163 static int dss_initialize_debugfs(
void)
166 if (IS_ERR(dss_debugfs_dir)) {
167 int err = PTR_ERR(dss_debugfs_dir);
168 dss_debugfs_dir =
NULL;
173 &dss_debug_dump_clocks, &dss_debug_fops);
178 static void dss_uninitialize_debugfs(
void)
189 write, &dss_debug_fops);
197 static inline int dss_initialize_debugfs(
void)
201 static inline void dss_uninitialize_debugfs(
void)
211 static int omap_dss_pm_notif(
struct notifier_block *
b,
unsigned long v,
void *d)
213 DSSDBG(
"pm notif %lu\n", v);
217 DSSDBG(
"suspending displays\n");
221 DSSDBG(
"resuming displays\n");
230 .notifier_call = omap_dss_pm_notif,
247 r = dss_initialize_debugfs();
252 core.default_display_name = def_disp_name;
256 register_pm_notifier(&omap_dss_pm_notif_block);
267 unregister_pm_notifier(&omap_dss_pm_notif_block);
269 dss_uninitialize_debugfs();
284 .
remove = omap_dss_remove,
285 .shutdown = omap_dss_shutdown,
297 DSSDBG(
"bus_match. dev %s/%s, drv %s\n",
322 dssdrv->
driver.name :
"");
329 static struct bus_type dss_bus_type = {
331 .match = dss_bus_match,
332 .dev_attrs = default_dev_attrs,
333 .drv_attrs = default_drv_attrs,
336 static void dss_bus_release(
struct device *dev)
341 static struct device dss_bus = {
342 .release = dss_bus_release,
347 return &dss_bus_type;
351 static int dss_driver_probe(
struct device *dev)
357 DSSDBG(
"driver_probe: dev %s/%s, drv %s\n",
365 r = dssdrv->
probe(dssdev);
368 DSSERR(
"driver probe failed: %d\n", r);
373 DSSDBG(
"probe done for device %s\n", dev_name(dev));
380 static int dss_driver_remove(
struct device *dev)
385 DSSDBG(
"driver_remove: dev %s/%s\n", dev_name(dev),
399 dssdriver->
driver.bus = &dss_bus_type;
400 dssdriver->
driver.probe = dss_driver_probe;
401 dssdriver->
driver.remove = dss_driver_remove;
423 static void omap_dss_dev_release(
struct device *dev)
429 static int disp_num_counter;
435 dssdev = kzalloc(
sizeof(*dssdev),
GFP_KERNEL);
439 dssdev->
dev.bus = &dss_bus_type;
440 dssdev->
dev.parent = parent;
441 dssdev->
dev.release = omap_dss_dev_release;
464 static int dss_unregister_dss_dev(
struct device *dev,
void *
data)
481 size_t dsize =
sizeof(
struct device);
487 static int __init omap_dss_bus_register(
void)
493 DSSERR(
"bus register failed\n");
500 DSSERR(
"bus driver register failed\n");
510 #ifdef CONFIG_OMAP2_DSS_DPI
513 #ifdef CONFIG_OMAP2_DSS_SDI
516 #ifdef CONFIG_OMAP2_DSS_RFBI
519 #ifdef CONFIG_OMAP2_DSS_VENC
522 #ifdef CONFIG_OMAP2_DSS_DSI
525 #ifdef CONFIG_OMAP4_DSS_HDMI
531 #ifdef CONFIG_OMAP2_DSS_DPI
534 #ifdef CONFIG_OMAP2_DSS_SDI
537 #ifdef CONFIG_OMAP2_DSS_RFBI
540 #ifdef CONFIG_OMAP2_DSS_VENC
543 #ifdef CONFIG_OMAP2_DSS_DSI
546 #ifdef CONFIG_OMAP4_DSS_HDMI
551 static bool dss_output_drv_loaded[
ARRAY_SIZE(dss_output_drv_reg_funcs)];
553 static int __init omap_dss_register_drivers(
void)
564 DSSERR(
"Failed to initialize DSS platform driver\n");
570 DSSERR(
"Failed to initialize dispc platform driver\n");
578 for (i = 0; i <
ARRAY_SIZE(dss_output_drv_reg_funcs); ++
i) {
579 r = dss_output_drv_reg_funcs[
i]();
581 dss_output_drv_loaded[
i] =
true;
594 static void __exit omap_dss_unregister_drivers(
void)
598 for (i = 0; i <
ARRAY_SIZE(dss_output_drv_unreg_funcs); ++
i) {
599 if (dss_output_drv_loaded[i])
600 dss_output_drv_unreg_funcs[
i]();
609 #ifdef CONFIG_OMAP2_DSS_MODULE
610 static void omap_dss_bus_unregister(
void)
617 static int __init omap_dss_init(
void)
621 r = omap_dss_bus_register();
625 r = omap_dss_register_drivers();
627 omap_dss_bus_unregister();
634 static void __exit omap_dss_exit(
void)
646 omap_dss_unregister_drivers();
648 omap_dss_bus_unregister();
654 static int __init omap_dss_init(
void)
656 return omap_dss_bus_register();
659 static int __init omap_dss_init2(
void)
661 return omap_dss_register_drivers();