Loading arch/arm/mach-omap2/display.c +161 −31 Original line number Diff line number Diff line Loading @@ -185,16 +185,128 @@ static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput) return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput); } static struct platform_device *create_dss_pdev(const char *pdev_name, int pdev_id, const char *oh_name, void *pdata, int pdata_len, struct platform_device *parent) { struct platform_device *pdev; struct omap_device *od; struct omap_hwmod *ohs[1]; struct omap_hwmod *oh; int r; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up %s\n", oh_name); r = -ENODEV; goto err; } pdev = platform_device_alloc(pdev_name, pdev_id); if (!pdev) { pr_err("Could not create pdev for %s\n", pdev_name); r = -ENOMEM; goto err; } if (parent != NULL) pdev->dev.parent = &parent->dev; if (pdev->id != -1) dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); else dev_set_name(&pdev->dev, "%s", pdev->name); ohs[0] = oh; od = omap_device_alloc(pdev, ohs, 1, NULL, 0); if (!od) { pr_err("Could not alloc omap_device for %s\n", pdev_name); r = -ENOMEM; goto err; } r = platform_device_add_data(pdev, pdata, pdata_len); if (r) { pr_err("Could not set pdata for %s\n", pdev_name); goto err; } r = omap_device_register(pdev); if (r) { pr_err("Could not register omap_device for %s\n", pdev_name); goto err; } return pdev; err: return ERR_PTR(r); } static struct platform_device *create_simple_dss_pdev(const char *pdev_name, int pdev_id, void *pdata, int pdata_len, struct platform_device *parent) { struct platform_device *pdev; int r; pdev = platform_device_alloc(pdev_name, pdev_id); if (!pdev) { pr_err("Could not create pdev for %s\n", pdev_name); r = -ENOMEM; goto err; } if (parent != NULL) pdev->dev.parent = &parent->dev; if (pdev->id != -1) dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); else dev_set_name(&pdev->dev, "%s", pdev->name); r = platform_device_add_data(pdev, pdata, pdata_len); if (r) { pr_err("Could not set pdata for %s\n", pdev_name); goto err; } r = omap_device_register(pdev); if (r) { pr_err("Could not register omap_device for %s\n", pdev_name); goto err; } return pdev; err: return ERR_PTR(r); } int __init omap_display_init(struct omap_dss_board_info *board_data) { int r = 0; struct omap_hwmod *oh; struct platform_device *pdev; int i, oh_count; struct omap_display_platform_data pdata; const struct omap_dss_hwmod_data *curr_dss_hwmod; struct platform_device *dss_pdev; /* create omapdss device */ board_data->dsi_enable_pads = omap_dsi_enable_pads; board_data->dsi_disable_pads = omap_dsi_disable_pads; board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; memset(&pdata, 0, sizeof(pdata)); omap_display_device.dev.platform_data = board_data; r = platform_device_register(&omap_display_device); if (r < 0) { pr_err("Unable to register omapdss device\n"); return r; } /* create devices for dss hwmods */ if (cpu_is_omap24xx()) { curr_dss_hwmod = omap2_dss_hwmod_data; Loading @@ -207,40 +319,58 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); } if (board_data->dsi_enable_pads == NULL) board_data->dsi_enable_pads = omap_dsi_enable_pads; if (board_data->dsi_disable_pads == NULL) board_data->dsi_disable_pads = omap_dsi_disable_pads; /* * First create the pdev for dss_core, which is used as a parent device * by the other dss pdevs. Note: dss_core has to be the first item in * the hwmod list. */ dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name, curr_dss_hwmod[0].id, curr_dss_hwmod[0].oh_name, board_data, sizeof(*board_data), NULL); pdata.board_data = board_data; pdata.board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; pdata.board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; if (IS_ERR(dss_pdev)) { pr_err("Could not build omap_device for %s\n", curr_dss_hwmod[0].oh_name); for (i = 0; i < oh_count; i++) { oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); if (!oh) { pr_err("Could not look up %s\n", return PTR_ERR(dss_pdev); } for (i = 1; i < oh_count; i++) { pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name, curr_dss_hwmod[i].id, curr_dss_hwmod[i].oh_name, board_data, sizeof(*board_data), dss_pdev); if (IS_ERR(pdev)) { pr_err("Could not build omap_device for %s\n", curr_dss_hwmod[i].oh_name); return -ENODEV; return PTR_ERR(pdev); } } pdev = omap_device_build(curr_dss_hwmod[i].dev_name, curr_dss_hwmod[i].id, oh, &pdata, sizeof(struct omap_display_platform_data), NULL, 0, 0); /* Create devices for DPI and SDI */ if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n", curr_dss_hwmod[i].oh_name)) return -ENODEV; pdev = create_simple_dss_pdev("omapdss_dpi", -1, board_data, sizeof(*board_data), dss_pdev); if (IS_ERR(pdev)) { pr_err("Could not build platform_device for omapdss_dpi\n"); return PTR_ERR(pdev); } omap_display_device.dev.platform_data = board_data; r = platform_device_register(&omap_display_device); if (r < 0) printk(KERN_ERR "Unable to register OMAP-Display device\n"); if (cpu_is_omap34xx()) { pdev = create_simple_dss_pdev("omapdss_sdi", -1, board_data, sizeof(*board_data), dss_pdev); if (IS_ERR(pdev)) { pr_err("Could not build platform_device for omapdss_sdi\n"); return PTR_ERR(pdev); } } return r; return 0; } static void dispc_disable_outputs(void) Loading drivers/video/omap2/displays/panel-tfp410.c +40 −36 Original line number Diff line number Diff line Loading @@ -47,13 +47,9 @@ struct panel_drv_data { struct mutex lock; int pd_gpio; }; static inline struct tfp410_platform_data *get_pdata(const struct omap_dss_device *dssdev) { return dssdev->data; } struct i2c_adapter *i2c_adapter; }; static int tfp410_power_on(struct omap_dss_device *dssdev) { Loading @@ -68,7 +64,7 @@ static int tfp410_power_on(struct omap_dss_device *dssdev) goto err0; if (gpio_is_valid(ddata->pd_gpio)) gpio_set_value(ddata->pd_gpio, 1); gpio_set_value_cansleep(ddata->pd_gpio, 1); return 0; err0: Loading @@ -83,18 +79,18 @@ static void tfp410_power_off(struct omap_dss_device *dssdev) return; if (gpio_is_valid(ddata->pd_gpio)) gpio_set_value(ddata->pd_gpio, 0); gpio_set_value_cansleep(ddata->pd_gpio, 0); omapdss_dpi_display_disable(dssdev); } static int tfp410_probe(struct omap_dss_device *dssdev) { struct tfp410_platform_data *pdata = get_pdata(dssdev); struct panel_drv_data *ddata; int r; int i2c_bus_num; ddata = kzalloc(sizeof(*ddata), GFP_KERNEL); ddata = devm_kzalloc(&dssdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) return -ENOMEM; Loading @@ -104,10 +100,15 @@ static int tfp410_probe(struct omap_dss_device *dssdev) ddata->dssdev = dssdev; mutex_init(&ddata->lock); if (pdata) if (dssdev->data) { struct tfp410_platform_data *pdata = dssdev->data; ddata->pd_gpio = pdata->power_down_gpio; else i2c_bus_num = pdata->i2c_bus_num; } else { ddata->pd_gpio = -1; i2c_bus_num = -1; } if (gpio_is_valid(ddata->pd_gpio)) { r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW, Loading @@ -115,13 +116,31 @@ static int tfp410_probe(struct omap_dss_device *dssdev) if (r) { dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n", ddata->pd_gpio); ddata->pd_gpio = -1; return r; } } if (i2c_bus_num != -1) { struct i2c_adapter *adapter; adapter = i2c_get_adapter(i2c_bus_num); if (!adapter) { dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", i2c_bus_num); r = -EINVAL; goto err_i2c; } ddata->i2c_adapter = adapter; } dev_set_drvdata(&dssdev->dev, ddata); return 0; err_i2c: if (gpio_is_valid(ddata->pd_gpio)) gpio_free(ddata->pd_gpio); return r; } static void __exit tfp410_remove(struct omap_dss_device *dssdev) Loading @@ -130,14 +149,15 @@ static void __exit tfp410_remove(struct omap_dss_device *dssdev) mutex_lock(&ddata->lock); if (ddata->i2c_adapter) i2c_put_adapter(ddata->i2c_adapter); if (gpio_is_valid(ddata->pd_gpio)) gpio_free(ddata->pd_gpio); dev_set_drvdata(&dssdev->dev, NULL); mutex_unlock(&ddata->lock); kfree(ddata); } static int tfp410_enable(struct omap_dss_device *dssdev) Loading Loading @@ -269,27 +289,17 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, u8 *edid, int len) { struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); struct tfp410_platform_data *pdata = get_pdata(dssdev); struct i2c_adapter *adapter; int r, l, bytes_read; mutex_lock(&ddata->lock); if (pdata->i2c_bus_num == 0) { if (!ddata->i2c_adapter) { r = -ENODEV; goto err; } adapter = i2c_get_adapter(pdata->i2c_bus_num); if (!adapter) { dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", pdata->i2c_bus_num); r = -EINVAL; goto err; } l = min(EDID_LENGTH, len); r = tfp410_ddc_read(adapter, edid, l, 0); r = tfp410_ddc_read(ddata->i2c_adapter, edid, l, 0); if (r) goto err; Loading @@ -299,7 +309,7 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, if (len > EDID_LENGTH && edid[0x7e] > 0) { l = min(EDID_LENGTH, len - EDID_LENGTH); r = tfp410_ddc_read(adapter, edid + EDID_LENGTH, r = tfp410_ddc_read(ddata->i2c_adapter, edid + EDID_LENGTH, l, EDID_LENGTH); if (r) goto err; Loading @@ -319,21 +329,15 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, static bool tfp410_detect(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); struct tfp410_platform_data *pdata = get_pdata(dssdev); struct i2c_adapter *adapter; unsigned char out; int r; mutex_lock(&ddata->lock); if (pdata->i2c_bus_num == 0) goto out; adapter = i2c_get_adapter(pdata->i2c_bus_num); if (!adapter) if (!ddata->i2c_adapter) goto out; r = tfp410_ddc_read(adapter, &out, 1, 0); r = tfp410_ddc_read(ddata->i2c_adapter, &out, 1, 0); mutex_unlock(&ddata->lock); Loading drivers/video/omap2/dss/core.c +140 −103 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ static struct { struct regulator *vdds_dsi_reg; struct regulator *vdds_sdi_reg; const char *default_display_name; } core; static char *def_disp_name; Loading @@ -54,9 +56,6 @@ bool dss_debug; module_param_named(debug, dss_debug, bool, 0644); #endif static int omap_dss_register_device(struct omap_dss_device *); static void omap_dss_unregister_device(struct omap_dss_device *); /* REGULATORS */ struct regulator *dss_get_vdds_dsi(void) Loading Loading @@ -87,6 +86,41 @@ struct regulator *dss_get_vdds_sdi(void) return reg; } int dss_get_ctx_loss_count(struct device *dev) { struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; int cnt; if (!board_data->get_context_loss_count) return -ENOENT; cnt = board_data->get_context_loss_count(dev); WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); return cnt; } int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask) { struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; if (!board_data->dsi_enable_pads) return -ENOENT; return board_data->dsi_enable_pads(dsi_id, lane_mask); } void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask) { struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; if (!board_data->dsi_enable_pads) return; return board_data->dsi_disable_pads(dsi_id, lane_mask); } int dss_set_min_bus_tput(struct device *dev, unsigned long tput) { struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; Loading Loading @@ -131,34 +165,6 @@ static int dss_initialize_debugfs(void) debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, &dss_debug_dump_clocks, &dss_debug_fops); #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir, &dispc_dump_irqs, &dss_debug_fops); #endif #if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS) dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops); #endif debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir, &dss_dump_regs, &dss_debug_fops); debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir, &dispc_dump_regs, &dss_debug_fops); #ifdef CONFIG_OMAP2_DSS_RFBI debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir, &rfbi_dump_regs, &dss_debug_fops); #endif #ifdef CONFIG_OMAP2_DSS_DSI dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops); #endif #ifdef CONFIG_OMAP2_DSS_VENC debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir, &venc_dump_regs, &dss_debug_fops); #endif #ifdef CONFIG_OMAP4_DSS_HDMI debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir, &hdmi_dump_regs, &dss_debug_fops); #endif return 0; } Loading @@ -167,6 +173,19 @@ static void dss_uninitialize_debugfs(void) if (dss_debugfs_dir) debugfs_remove_recursive(dss_debugfs_dir); } int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) { struct dentry *d; d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, write, &dss_debug_fops); if (IS_ERR(d)) return PTR_ERR(d); return 0; } #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ static inline int dss_initialize_debugfs(void) { Loading @@ -175,14 +194,18 @@ static inline int dss_initialize_debugfs(void) static inline void dss_uninitialize_debugfs(void) { } static inline int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) { return 0; } #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ /* PLATFORM DEVICE */ static int omap_dss_probe(struct platform_device *pdev) static int __init omap_dss_probe(struct platform_device *pdev) { struct omap_dss_board_info *pdata = pdev->dev.platform_data; int r; int i; core.pdev = pdev; Loading @@ -197,28 +220,13 @@ static int omap_dss_probe(struct platform_device *pdev) if (r) goto err_debugfs; for (i = 0; i < pdata->num_devices; ++i) { struct omap_dss_device *dssdev = pdata->devices[i]; r = omap_dss_register_device(dssdev); if (r) { DSSERR("device %d %s register failed %d\n", i, dssdev->name ?: "unnamed", r); while (--i >= 0) omap_dss_unregister_device(pdata->devices[i]); goto err_register; } if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0) pdata->default_device = dssdev; } if (def_disp_name) core.default_display_name = def_disp_name; else if (pdata->default_device) core.default_display_name = pdata->default_device->name; return 0; err_register: dss_uninitialize_debugfs(); err_debugfs: return r; Loading @@ -226,17 +234,11 @@ static int omap_dss_probe(struct platform_device *pdev) static int omap_dss_remove(struct platform_device *pdev) { struct omap_dss_board_info *pdata = pdev->dev.platform_data; int i; dss_uninitialize_debugfs(); dss_uninit_overlays(pdev); dss_uninit_overlay_managers(pdev); for (i = 0; i < pdata->num_devices; ++i) omap_dss_unregister_device(pdata->devices[i]); return 0; } Loading @@ -261,7 +263,6 @@ static int omap_dss_resume(struct platform_device *pdev) } static struct platform_driver omap_dss_driver = { .probe = omap_dss_probe, .remove = omap_dss_remove, .shutdown = omap_dss_shutdown, .suspend = omap_dss_suspend, Loading Loading @@ -336,7 +337,6 @@ static int dss_driver_probe(struct device *dev) int r; struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver); struct omap_dss_device *dssdev = to_dss_device(dev); struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; bool force; DSSDBG("driver_probe: dev %s/%s, drv %s\n", Loading @@ -345,7 +345,8 @@ static int dss_driver_probe(struct device *dev) dss_init_device(core.pdev, dssdev); force = pdata->default_device == dssdev; force = core.default_display_name && strcmp(core.default_display_name, dssdev->name) == 0; dss_recheck_connections(dssdev, force); r = dssdrv->probe(dssdev); Loading Loading @@ -439,27 +440,38 @@ static void omap_dss_dev_release(struct device *dev) reset_device(dev, 0); } static int omap_dss_register_device(struct omap_dss_device *dssdev) int omap_dss_register_device(struct omap_dss_device *dssdev, struct device *parent, int disp_num) { static int dev_num; WARN_ON(!dssdev->driver_name); reset_device(&dssdev->dev, 1); dssdev->dev.bus = &dss_bus_type; dssdev->dev.parent = &dss_bus; dssdev->dev.parent = parent; dssdev->dev.release = omap_dss_dev_release; dev_set_name(&dssdev->dev, "display%d", dev_num++); dev_set_name(&dssdev->dev, "display%d", disp_num); return device_register(&dssdev->dev); } static void omap_dss_unregister_device(struct omap_dss_device *dssdev) void omap_dss_unregister_device(struct omap_dss_device *dssdev) { device_unregister(&dssdev->dev); } static int dss_unregister_dss_dev(struct device *dev, void *data) { struct omap_dss_device *dssdev = to_dss_device(dev); omap_dss_unregister_device(dssdev); return 0; } void omap_dss_unregister_child_devices(struct device *parent) { device_for_each_child(parent, NULL, dss_unregister_dss_dev); } /* BUS */ static int omap_dss_bus_register(void) static int __init omap_dss_bus_register(void) { int r; Loading @@ -481,12 +493,56 @@ static int omap_dss_bus_register(void) } /* INIT */ static int (*dss_output_drv_reg_funcs[])(void) __initdata = { #ifdef CONFIG_OMAP2_DSS_DPI dpi_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_SDI sdi_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_RFBI rfbi_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_VENC venc_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_DSI dsi_init_platform_driver, #endif #ifdef CONFIG_OMAP4_DSS_HDMI hdmi_init_platform_driver, #endif }; static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = { #ifdef CONFIG_OMAP2_DSS_DPI dpi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_SDI sdi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_RFBI rfbi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_VENC venc_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_DSI dsi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP4_DSS_HDMI hdmi_uninit_platform_driver, #endif }; static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)]; static int __init omap_dss_register_drivers(void) { int r; int i; r = platform_driver_register(&omap_dss_driver); r = platform_driver_probe(&omap_dss_driver, omap_dss_probe); if (r) return r; Loading @@ -502,40 +558,18 @@ static int __init omap_dss_register_drivers(void) goto err_dispc; } r = rfbi_init_platform_driver(); if (r) { DSSERR("Failed to initialize rfbi platform driver\n"); goto err_rfbi; } r = venc_init_platform_driver(); if (r) { DSSERR("Failed to initialize venc platform driver\n"); goto err_venc; } r = dsi_init_platform_driver(); if (r) { DSSERR("Failed to initialize DSI platform driver\n"); goto err_dsi; } r = hdmi_init_platform_driver(); if (r) { DSSERR("Failed to initialize hdmi\n"); goto err_hdmi; /* * It's ok if the output-driver register fails. It happens, for example, * when there is no output-device (e.g. SDI for OMAP4). */ for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) { r = dss_output_drv_reg_funcs[i](); if (r == 0) dss_output_drv_loaded[i] = true; } return 0; err_hdmi: dsi_uninit_platform_driver(); err_dsi: venc_uninit_platform_driver(); err_venc: rfbi_uninit_platform_driver(); err_rfbi: dispc_uninit_platform_driver(); err_dispc: dss_uninit_platform_driver(); err_dss: Loading @@ -546,10 +580,13 @@ static int __init omap_dss_register_drivers(void) static void __exit omap_dss_unregister_drivers(void) { hdmi_uninit_platform_driver(); dsi_uninit_platform_driver(); venc_uninit_platform_driver(); rfbi_uninit_platform_driver(); int i; for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) { if (dss_output_drv_loaded[i]) dss_output_drv_unreg_funcs[i](); } dispc_uninit_platform_driver(); dss_uninit_platform_driver(); Loading drivers/video/omap2/dss/dispc.c +15 −35 Original line number Diff line number Diff line Loading @@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx) return __raw_readl(dispc.base + idx); } static int dispc_get_ctx_loss_count(void) { struct device *dev = &dispc.pdev->dev; struct omap_display_platform_data *pdata = dev->platform_data; struct omap_dss_board_info *board_data = pdata->board_data; int cnt; if (!board_data->get_context_loss_count) return -ENOENT; cnt = board_data->get_context_loss_count(dev); WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); return cnt; } #define SR(reg) \ dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) #define RR(reg) \ Loading Loading @@ -251,7 +234,7 @@ static void dispc_save_context(void) if (dss_has_feature(FEAT_CORE_CLK_DIV)) SR(DIVISOR); dispc.ctx_loss_cnt = dispc_get_ctx_loss_count(); dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev); dispc.ctx_valid = true; DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); Loading @@ -266,7 +249,7 @@ static void dispc_restore_context(void) if (!dispc.ctx_valid) return; ctx = dispc_get_ctx_loss_count(); ctx = dss_get_ctx_loss_count(&dispc.pdev->dev); if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) return; Loading Loading @@ -2778,7 +2761,7 @@ void dispc_dump_irqs(struct seq_file *s) } #endif void dispc_dump_regs(struct seq_file *s) static void dispc_dump_regs(struct seq_file *s) { int i, j; const char *mgr_names[] = { Loading Loading @@ -3499,7 +3482,7 @@ static void _omap_dispc_initial_config(void) } /* DISPC HW IP initialisation */ static int omap_dispchw_probe(struct platform_device *pdev) static int __init omap_dispchw_probe(struct platform_device *pdev) { u32 rev; int r = 0; Loading Loading @@ -3568,6 +3551,11 @@ static int omap_dispchw_probe(struct platform_device *pdev) dispc_runtime_put(); dss_debugfs_create_file("dispc", dispc_dump_regs); #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS dss_debugfs_create_file("dispc_irq", dispc_dump_irqs); #endif return 0; err_runtime_get: Loading @@ -3576,7 +3564,7 @@ static int omap_dispchw_probe(struct platform_device *pdev) return r; } static int omap_dispchw_remove(struct platform_device *pdev) static int __exit omap_dispchw_remove(struct platform_device *pdev) { pm_runtime_disable(&pdev->dev); Loading @@ -3588,19 +3576,12 @@ static int omap_dispchw_remove(struct platform_device *pdev) static int dispc_runtime_suspend(struct device *dev) { dispc_save_context(); dss_runtime_put(); return 0; } static int dispc_runtime_resume(struct device *dev) { int r; r = dss_runtime_get(); if (r < 0) return r; dispc_restore_context(); return 0; Loading @@ -3612,8 +3593,7 @@ static const struct dev_pm_ops dispc_pm_ops = { }; static struct platform_driver omap_dispchw_driver = { .probe = omap_dispchw_probe, .remove = omap_dispchw_remove, .remove = __exit_p(omap_dispchw_remove), .driver = { .name = "omapdss_dispc", .owner = THIS_MODULE, Loading @@ -3621,12 +3601,12 @@ static struct platform_driver omap_dispchw_driver = { }, }; int dispc_init_platform_driver(void) int __init dispc_init_platform_driver(void) { return platform_driver_register(&omap_dispchw_driver); return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe); } void dispc_uninit_platform_driver(void) void __exit dispc_uninit_platform_driver(void) { return platform_driver_unregister(&omap_dispchw_driver); platform_driver_unregister(&omap_dispchw_driver); } drivers/video/omap2/dss/display.c +0 −40 Original line number Diff line number Diff line Loading @@ -359,46 +359,6 @@ void dss_init_device(struct platform_device *pdev, int i; int r; switch (dssdev->type) { #ifdef CONFIG_OMAP2_DSS_DPI case OMAP_DISPLAY_TYPE_DPI: r = dpi_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_RFBI case OMAP_DISPLAY_TYPE_DBI: r = rfbi_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_VENC case OMAP_DISPLAY_TYPE_VENC: r = venc_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_SDI case OMAP_DISPLAY_TYPE_SDI: r = sdi_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_DSI case OMAP_DISPLAY_TYPE_DSI: r = dsi_init_display(dssdev); break; #endif case OMAP_DISPLAY_TYPE_HDMI: r = hdmi_init_display(dssdev); break; default: DSSERR("Support for display '%s' not compiled in.\n", dssdev->name); return; } if (r) { DSSERR("failed to init display %s\n", dssdev->name); return; } /* create device sysfs files */ i = 0; while ((attr = display_sysfs_attrs[i++]) != NULL) { Loading Loading
arch/arm/mach-omap2/display.c +161 −31 Original line number Diff line number Diff line Loading @@ -185,16 +185,128 @@ static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput) return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput); } static struct platform_device *create_dss_pdev(const char *pdev_name, int pdev_id, const char *oh_name, void *pdata, int pdata_len, struct platform_device *parent) { struct platform_device *pdev; struct omap_device *od; struct omap_hwmod *ohs[1]; struct omap_hwmod *oh; int r; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up %s\n", oh_name); r = -ENODEV; goto err; } pdev = platform_device_alloc(pdev_name, pdev_id); if (!pdev) { pr_err("Could not create pdev for %s\n", pdev_name); r = -ENOMEM; goto err; } if (parent != NULL) pdev->dev.parent = &parent->dev; if (pdev->id != -1) dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); else dev_set_name(&pdev->dev, "%s", pdev->name); ohs[0] = oh; od = omap_device_alloc(pdev, ohs, 1, NULL, 0); if (!od) { pr_err("Could not alloc omap_device for %s\n", pdev_name); r = -ENOMEM; goto err; } r = platform_device_add_data(pdev, pdata, pdata_len); if (r) { pr_err("Could not set pdata for %s\n", pdev_name); goto err; } r = omap_device_register(pdev); if (r) { pr_err("Could not register omap_device for %s\n", pdev_name); goto err; } return pdev; err: return ERR_PTR(r); } static struct platform_device *create_simple_dss_pdev(const char *pdev_name, int pdev_id, void *pdata, int pdata_len, struct platform_device *parent) { struct platform_device *pdev; int r; pdev = platform_device_alloc(pdev_name, pdev_id); if (!pdev) { pr_err("Could not create pdev for %s\n", pdev_name); r = -ENOMEM; goto err; } if (parent != NULL) pdev->dev.parent = &parent->dev; if (pdev->id != -1) dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); else dev_set_name(&pdev->dev, "%s", pdev->name); r = platform_device_add_data(pdev, pdata, pdata_len); if (r) { pr_err("Could not set pdata for %s\n", pdev_name); goto err; } r = omap_device_register(pdev); if (r) { pr_err("Could not register omap_device for %s\n", pdev_name); goto err; } return pdev; err: return ERR_PTR(r); } int __init omap_display_init(struct omap_dss_board_info *board_data) { int r = 0; struct omap_hwmod *oh; struct platform_device *pdev; int i, oh_count; struct omap_display_platform_data pdata; const struct omap_dss_hwmod_data *curr_dss_hwmod; struct platform_device *dss_pdev; /* create omapdss device */ board_data->dsi_enable_pads = omap_dsi_enable_pads; board_data->dsi_disable_pads = omap_dsi_disable_pads; board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; memset(&pdata, 0, sizeof(pdata)); omap_display_device.dev.platform_data = board_data; r = platform_device_register(&omap_display_device); if (r < 0) { pr_err("Unable to register omapdss device\n"); return r; } /* create devices for dss hwmods */ if (cpu_is_omap24xx()) { curr_dss_hwmod = omap2_dss_hwmod_data; Loading @@ -207,40 +319,58 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); } if (board_data->dsi_enable_pads == NULL) board_data->dsi_enable_pads = omap_dsi_enable_pads; if (board_data->dsi_disable_pads == NULL) board_data->dsi_disable_pads = omap_dsi_disable_pads; /* * First create the pdev for dss_core, which is used as a parent device * by the other dss pdevs. Note: dss_core has to be the first item in * the hwmod list. */ dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name, curr_dss_hwmod[0].id, curr_dss_hwmod[0].oh_name, board_data, sizeof(*board_data), NULL); pdata.board_data = board_data; pdata.board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; pdata.board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; if (IS_ERR(dss_pdev)) { pr_err("Could not build omap_device for %s\n", curr_dss_hwmod[0].oh_name); for (i = 0; i < oh_count; i++) { oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); if (!oh) { pr_err("Could not look up %s\n", return PTR_ERR(dss_pdev); } for (i = 1; i < oh_count; i++) { pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name, curr_dss_hwmod[i].id, curr_dss_hwmod[i].oh_name, board_data, sizeof(*board_data), dss_pdev); if (IS_ERR(pdev)) { pr_err("Could not build omap_device for %s\n", curr_dss_hwmod[i].oh_name); return -ENODEV; return PTR_ERR(pdev); } } pdev = omap_device_build(curr_dss_hwmod[i].dev_name, curr_dss_hwmod[i].id, oh, &pdata, sizeof(struct omap_display_platform_data), NULL, 0, 0); /* Create devices for DPI and SDI */ if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n", curr_dss_hwmod[i].oh_name)) return -ENODEV; pdev = create_simple_dss_pdev("omapdss_dpi", -1, board_data, sizeof(*board_data), dss_pdev); if (IS_ERR(pdev)) { pr_err("Could not build platform_device for omapdss_dpi\n"); return PTR_ERR(pdev); } omap_display_device.dev.platform_data = board_data; r = platform_device_register(&omap_display_device); if (r < 0) printk(KERN_ERR "Unable to register OMAP-Display device\n"); if (cpu_is_omap34xx()) { pdev = create_simple_dss_pdev("omapdss_sdi", -1, board_data, sizeof(*board_data), dss_pdev); if (IS_ERR(pdev)) { pr_err("Could not build platform_device for omapdss_sdi\n"); return PTR_ERR(pdev); } } return r; return 0; } static void dispc_disable_outputs(void) Loading
drivers/video/omap2/displays/panel-tfp410.c +40 −36 Original line number Diff line number Diff line Loading @@ -47,13 +47,9 @@ struct panel_drv_data { struct mutex lock; int pd_gpio; }; static inline struct tfp410_platform_data *get_pdata(const struct omap_dss_device *dssdev) { return dssdev->data; } struct i2c_adapter *i2c_adapter; }; static int tfp410_power_on(struct omap_dss_device *dssdev) { Loading @@ -68,7 +64,7 @@ static int tfp410_power_on(struct omap_dss_device *dssdev) goto err0; if (gpio_is_valid(ddata->pd_gpio)) gpio_set_value(ddata->pd_gpio, 1); gpio_set_value_cansleep(ddata->pd_gpio, 1); return 0; err0: Loading @@ -83,18 +79,18 @@ static void tfp410_power_off(struct omap_dss_device *dssdev) return; if (gpio_is_valid(ddata->pd_gpio)) gpio_set_value(ddata->pd_gpio, 0); gpio_set_value_cansleep(ddata->pd_gpio, 0); omapdss_dpi_display_disable(dssdev); } static int tfp410_probe(struct omap_dss_device *dssdev) { struct tfp410_platform_data *pdata = get_pdata(dssdev); struct panel_drv_data *ddata; int r; int i2c_bus_num; ddata = kzalloc(sizeof(*ddata), GFP_KERNEL); ddata = devm_kzalloc(&dssdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) return -ENOMEM; Loading @@ -104,10 +100,15 @@ static int tfp410_probe(struct omap_dss_device *dssdev) ddata->dssdev = dssdev; mutex_init(&ddata->lock); if (pdata) if (dssdev->data) { struct tfp410_platform_data *pdata = dssdev->data; ddata->pd_gpio = pdata->power_down_gpio; else i2c_bus_num = pdata->i2c_bus_num; } else { ddata->pd_gpio = -1; i2c_bus_num = -1; } if (gpio_is_valid(ddata->pd_gpio)) { r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW, Loading @@ -115,13 +116,31 @@ static int tfp410_probe(struct omap_dss_device *dssdev) if (r) { dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n", ddata->pd_gpio); ddata->pd_gpio = -1; return r; } } if (i2c_bus_num != -1) { struct i2c_adapter *adapter; adapter = i2c_get_adapter(i2c_bus_num); if (!adapter) { dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", i2c_bus_num); r = -EINVAL; goto err_i2c; } ddata->i2c_adapter = adapter; } dev_set_drvdata(&dssdev->dev, ddata); return 0; err_i2c: if (gpio_is_valid(ddata->pd_gpio)) gpio_free(ddata->pd_gpio); return r; } static void __exit tfp410_remove(struct omap_dss_device *dssdev) Loading @@ -130,14 +149,15 @@ static void __exit tfp410_remove(struct omap_dss_device *dssdev) mutex_lock(&ddata->lock); if (ddata->i2c_adapter) i2c_put_adapter(ddata->i2c_adapter); if (gpio_is_valid(ddata->pd_gpio)) gpio_free(ddata->pd_gpio); dev_set_drvdata(&dssdev->dev, NULL); mutex_unlock(&ddata->lock); kfree(ddata); } static int tfp410_enable(struct omap_dss_device *dssdev) Loading Loading @@ -269,27 +289,17 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, u8 *edid, int len) { struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); struct tfp410_platform_data *pdata = get_pdata(dssdev); struct i2c_adapter *adapter; int r, l, bytes_read; mutex_lock(&ddata->lock); if (pdata->i2c_bus_num == 0) { if (!ddata->i2c_adapter) { r = -ENODEV; goto err; } adapter = i2c_get_adapter(pdata->i2c_bus_num); if (!adapter) { dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", pdata->i2c_bus_num); r = -EINVAL; goto err; } l = min(EDID_LENGTH, len); r = tfp410_ddc_read(adapter, edid, l, 0); r = tfp410_ddc_read(ddata->i2c_adapter, edid, l, 0); if (r) goto err; Loading @@ -299,7 +309,7 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, if (len > EDID_LENGTH && edid[0x7e] > 0) { l = min(EDID_LENGTH, len - EDID_LENGTH); r = tfp410_ddc_read(adapter, edid + EDID_LENGTH, r = tfp410_ddc_read(ddata->i2c_adapter, edid + EDID_LENGTH, l, EDID_LENGTH); if (r) goto err; Loading @@ -319,21 +329,15 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, static bool tfp410_detect(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); struct tfp410_platform_data *pdata = get_pdata(dssdev); struct i2c_adapter *adapter; unsigned char out; int r; mutex_lock(&ddata->lock); if (pdata->i2c_bus_num == 0) goto out; adapter = i2c_get_adapter(pdata->i2c_bus_num); if (!adapter) if (!ddata->i2c_adapter) goto out; r = tfp410_ddc_read(adapter, &out, 1, 0); r = tfp410_ddc_read(ddata->i2c_adapter, &out, 1, 0); mutex_unlock(&ddata->lock); Loading
drivers/video/omap2/dss/core.c +140 −103 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ static struct { struct regulator *vdds_dsi_reg; struct regulator *vdds_sdi_reg; const char *default_display_name; } core; static char *def_disp_name; Loading @@ -54,9 +56,6 @@ bool dss_debug; module_param_named(debug, dss_debug, bool, 0644); #endif static int omap_dss_register_device(struct omap_dss_device *); static void omap_dss_unregister_device(struct omap_dss_device *); /* REGULATORS */ struct regulator *dss_get_vdds_dsi(void) Loading Loading @@ -87,6 +86,41 @@ struct regulator *dss_get_vdds_sdi(void) return reg; } int dss_get_ctx_loss_count(struct device *dev) { struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; int cnt; if (!board_data->get_context_loss_count) return -ENOENT; cnt = board_data->get_context_loss_count(dev); WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); return cnt; } int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask) { struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; if (!board_data->dsi_enable_pads) return -ENOENT; return board_data->dsi_enable_pads(dsi_id, lane_mask); } void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask) { struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; if (!board_data->dsi_enable_pads) return; return board_data->dsi_disable_pads(dsi_id, lane_mask); } int dss_set_min_bus_tput(struct device *dev, unsigned long tput) { struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; Loading Loading @@ -131,34 +165,6 @@ static int dss_initialize_debugfs(void) debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, &dss_debug_dump_clocks, &dss_debug_fops); #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir, &dispc_dump_irqs, &dss_debug_fops); #endif #if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS) dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops); #endif debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir, &dss_dump_regs, &dss_debug_fops); debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir, &dispc_dump_regs, &dss_debug_fops); #ifdef CONFIG_OMAP2_DSS_RFBI debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir, &rfbi_dump_regs, &dss_debug_fops); #endif #ifdef CONFIG_OMAP2_DSS_DSI dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops); #endif #ifdef CONFIG_OMAP2_DSS_VENC debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir, &venc_dump_regs, &dss_debug_fops); #endif #ifdef CONFIG_OMAP4_DSS_HDMI debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir, &hdmi_dump_regs, &dss_debug_fops); #endif return 0; } Loading @@ -167,6 +173,19 @@ static void dss_uninitialize_debugfs(void) if (dss_debugfs_dir) debugfs_remove_recursive(dss_debugfs_dir); } int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) { struct dentry *d; d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, write, &dss_debug_fops); if (IS_ERR(d)) return PTR_ERR(d); return 0; } #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ static inline int dss_initialize_debugfs(void) { Loading @@ -175,14 +194,18 @@ static inline int dss_initialize_debugfs(void) static inline void dss_uninitialize_debugfs(void) { } static inline int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) { return 0; } #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ /* PLATFORM DEVICE */ static int omap_dss_probe(struct platform_device *pdev) static int __init omap_dss_probe(struct platform_device *pdev) { struct omap_dss_board_info *pdata = pdev->dev.platform_data; int r; int i; core.pdev = pdev; Loading @@ -197,28 +220,13 @@ static int omap_dss_probe(struct platform_device *pdev) if (r) goto err_debugfs; for (i = 0; i < pdata->num_devices; ++i) { struct omap_dss_device *dssdev = pdata->devices[i]; r = omap_dss_register_device(dssdev); if (r) { DSSERR("device %d %s register failed %d\n", i, dssdev->name ?: "unnamed", r); while (--i >= 0) omap_dss_unregister_device(pdata->devices[i]); goto err_register; } if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0) pdata->default_device = dssdev; } if (def_disp_name) core.default_display_name = def_disp_name; else if (pdata->default_device) core.default_display_name = pdata->default_device->name; return 0; err_register: dss_uninitialize_debugfs(); err_debugfs: return r; Loading @@ -226,17 +234,11 @@ static int omap_dss_probe(struct platform_device *pdev) static int omap_dss_remove(struct platform_device *pdev) { struct omap_dss_board_info *pdata = pdev->dev.platform_data; int i; dss_uninitialize_debugfs(); dss_uninit_overlays(pdev); dss_uninit_overlay_managers(pdev); for (i = 0; i < pdata->num_devices; ++i) omap_dss_unregister_device(pdata->devices[i]); return 0; } Loading @@ -261,7 +263,6 @@ static int omap_dss_resume(struct platform_device *pdev) } static struct platform_driver omap_dss_driver = { .probe = omap_dss_probe, .remove = omap_dss_remove, .shutdown = omap_dss_shutdown, .suspend = omap_dss_suspend, Loading Loading @@ -336,7 +337,6 @@ static int dss_driver_probe(struct device *dev) int r; struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver); struct omap_dss_device *dssdev = to_dss_device(dev); struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; bool force; DSSDBG("driver_probe: dev %s/%s, drv %s\n", Loading @@ -345,7 +345,8 @@ static int dss_driver_probe(struct device *dev) dss_init_device(core.pdev, dssdev); force = pdata->default_device == dssdev; force = core.default_display_name && strcmp(core.default_display_name, dssdev->name) == 0; dss_recheck_connections(dssdev, force); r = dssdrv->probe(dssdev); Loading Loading @@ -439,27 +440,38 @@ static void omap_dss_dev_release(struct device *dev) reset_device(dev, 0); } static int omap_dss_register_device(struct omap_dss_device *dssdev) int omap_dss_register_device(struct omap_dss_device *dssdev, struct device *parent, int disp_num) { static int dev_num; WARN_ON(!dssdev->driver_name); reset_device(&dssdev->dev, 1); dssdev->dev.bus = &dss_bus_type; dssdev->dev.parent = &dss_bus; dssdev->dev.parent = parent; dssdev->dev.release = omap_dss_dev_release; dev_set_name(&dssdev->dev, "display%d", dev_num++); dev_set_name(&dssdev->dev, "display%d", disp_num); return device_register(&dssdev->dev); } static void omap_dss_unregister_device(struct omap_dss_device *dssdev) void omap_dss_unregister_device(struct omap_dss_device *dssdev) { device_unregister(&dssdev->dev); } static int dss_unregister_dss_dev(struct device *dev, void *data) { struct omap_dss_device *dssdev = to_dss_device(dev); omap_dss_unregister_device(dssdev); return 0; } void omap_dss_unregister_child_devices(struct device *parent) { device_for_each_child(parent, NULL, dss_unregister_dss_dev); } /* BUS */ static int omap_dss_bus_register(void) static int __init omap_dss_bus_register(void) { int r; Loading @@ -481,12 +493,56 @@ static int omap_dss_bus_register(void) } /* INIT */ static int (*dss_output_drv_reg_funcs[])(void) __initdata = { #ifdef CONFIG_OMAP2_DSS_DPI dpi_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_SDI sdi_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_RFBI rfbi_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_VENC venc_init_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_DSI dsi_init_platform_driver, #endif #ifdef CONFIG_OMAP4_DSS_HDMI hdmi_init_platform_driver, #endif }; static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = { #ifdef CONFIG_OMAP2_DSS_DPI dpi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_SDI sdi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_RFBI rfbi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_VENC venc_uninit_platform_driver, #endif #ifdef CONFIG_OMAP2_DSS_DSI dsi_uninit_platform_driver, #endif #ifdef CONFIG_OMAP4_DSS_HDMI hdmi_uninit_platform_driver, #endif }; static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)]; static int __init omap_dss_register_drivers(void) { int r; int i; r = platform_driver_register(&omap_dss_driver); r = platform_driver_probe(&omap_dss_driver, omap_dss_probe); if (r) return r; Loading @@ -502,40 +558,18 @@ static int __init omap_dss_register_drivers(void) goto err_dispc; } r = rfbi_init_platform_driver(); if (r) { DSSERR("Failed to initialize rfbi platform driver\n"); goto err_rfbi; } r = venc_init_platform_driver(); if (r) { DSSERR("Failed to initialize venc platform driver\n"); goto err_venc; } r = dsi_init_platform_driver(); if (r) { DSSERR("Failed to initialize DSI platform driver\n"); goto err_dsi; } r = hdmi_init_platform_driver(); if (r) { DSSERR("Failed to initialize hdmi\n"); goto err_hdmi; /* * It's ok if the output-driver register fails. It happens, for example, * when there is no output-device (e.g. SDI for OMAP4). */ for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) { r = dss_output_drv_reg_funcs[i](); if (r == 0) dss_output_drv_loaded[i] = true; } return 0; err_hdmi: dsi_uninit_platform_driver(); err_dsi: venc_uninit_platform_driver(); err_venc: rfbi_uninit_platform_driver(); err_rfbi: dispc_uninit_platform_driver(); err_dispc: dss_uninit_platform_driver(); err_dss: Loading @@ -546,10 +580,13 @@ static int __init omap_dss_register_drivers(void) static void __exit omap_dss_unregister_drivers(void) { hdmi_uninit_platform_driver(); dsi_uninit_platform_driver(); venc_uninit_platform_driver(); rfbi_uninit_platform_driver(); int i; for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) { if (dss_output_drv_loaded[i]) dss_output_drv_unreg_funcs[i](); } dispc_uninit_platform_driver(); dss_uninit_platform_driver(); Loading
drivers/video/omap2/dss/dispc.c +15 −35 Original line number Diff line number Diff line Loading @@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx) return __raw_readl(dispc.base + idx); } static int dispc_get_ctx_loss_count(void) { struct device *dev = &dispc.pdev->dev; struct omap_display_platform_data *pdata = dev->platform_data; struct omap_dss_board_info *board_data = pdata->board_data; int cnt; if (!board_data->get_context_loss_count) return -ENOENT; cnt = board_data->get_context_loss_count(dev); WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); return cnt; } #define SR(reg) \ dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) #define RR(reg) \ Loading Loading @@ -251,7 +234,7 @@ static void dispc_save_context(void) if (dss_has_feature(FEAT_CORE_CLK_DIV)) SR(DIVISOR); dispc.ctx_loss_cnt = dispc_get_ctx_loss_count(); dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev); dispc.ctx_valid = true; DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); Loading @@ -266,7 +249,7 @@ static void dispc_restore_context(void) if (!dispc.ctx_valid) return; ctx = dispc_get_ctx_loss_count(); ctx = dss_get_ctx_loss_count(&dispc.pdev->dev); if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) return; Loading Loading @@ -2778,7 +2761,7 @@ void dispc_dump_irqs(struct seq_file *s) } #endif void dispc_dump_regs(struct seq_file *s) static void dispc_dump_regs(struct seq_file *s) { int i, j; const char *mgr_names[] = { Loading Loading @@ -3499,7 +3482,7 @@ static void _omap_dispc_initial_config(void) } /* DISPC HW IP initialisation */ static int omap_dispchw_probe(struct platform_device *pdev) static int __init omap_dispchw_probe(struct platform_device *pdev) { u32 rev; int r = 0; Loading Loading @@ -3568,6 +3551,11 @@ static int omap_dispchw_probe(struct platform_device *pdev) dispc_runtime_put(); dss_debugfs_create_file("dispc", dispc_dump_regs); #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS dss_debugfs_create_file("dispc_irq", dispc_dump_irqs); #endif return 0; err_runtime_get: Loading @@ -3576,7 +3564,7 @@ static int omap_dispchw_probe(struct platform_device *pdev) return r; } static int omap_dispchw_remove(struct platform_device *pdev) static int __exit omap_dispchw_remove(struct platform_device *pdev) { pm_runtime_disable(&pdev->dev); Loading @@ -3588,19 +3576,12 @@ static int omap_dispchw_remove(struct platform_device *pdev) static int dispc_runtime_suspend(struct device *dev) { dispc_save_context(); dss_runtime_put(); return 0; } static int dispc_runtime_resume(struct device *dev) { int r; r = dss_runtime_get(); if (r < 0) return r; dispc_restore_context(); return 0; Loading @@ -3612,8 +3593,7 @@ static const struct dev_pm_ops dispc_pm_ops = { }; static struct platform_driver omap_dispchw_driver = { .probe = omap_dispchw_probe, .remove = omap_dispchw_remove, .remove = __exit_p(omap_dispchw_remove), .driver = { .name = "omapdss_dispc", .owner = THIS_MODULE, Loading @@ -3621,12 +3601,12 @@ static struct platform_driver omap_dispchw_driver = { }, }; int dispc_init_platform_driver(void) int __init dispc_init_platform_driver(void) { return platform_driver_register(&omap_dispchw_driver); return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe); } void dispc_uninit_platform_driver(void) void __exit dispc_uninit_platform_driver(void) { return platform_driver_unregister(&omap_dispchw_driver); platform_driver_unregister(&omap_dispchw_driver); }
drivers/video/omap2/dss/display.c +0 −40 Original line number Diff line number Diff line Loading @@ -359,46 +359,6 @@ void dss_init_device(struct platform_device *pdev, int i; int r; switch (dssdev->type) { #ifdef CONFIG_OMAP2_DSS_DPI case OMAP_DISPLAY_TYPE_DPI: r = dpi_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_RFBI case OMAP_DISPLAY_TYPE_DBI: r = rfbi_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_VENC case OMAP_DISPLAY_TYPE_VENC: r = venc_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_SDI case OMAP_DISPLAY_TYPE_SDI: r = sdi_init_display(dssdev); break; #endif #ifdef CONFIG_OMAP2_DSS_DSI case OMAP_DISPLAY_TYPE_DSI: r = dsi_init_display(dssdev); break; #endif case OMAP_DISPLAY_TYPE_HDMI: r = hdmi_init_display(dssdev); break; default: DSSERR("Support for display '%s' not compiled in.\n", dssdev->name); return; } if (r) { DSSERR("failed to init display %s\n", dssdev->name); return; } /* create device sysfs files */ i = 0; while ((attr = display_sysfs_attrs[i++]) != NULL) { Loading