|
@@ -289,3 +289,158 @@ static struct platform_device *create_simple_dss_pdev(const char *pdev_name,
|
|
|
|
|
|
err:
|
|
|
return ERR_PTR(r);
|
|
|
+}
|
|
|
+
|
|
|
+static enum omapdss_version __init omap_display_get_version(void)
|
|
|
+{
|
|
|
+ if (cpu_is_omap24xx())
|
|
|
+ return OMAPDSS_VER_OMAP24xx;
|
|
|
+ else if (cpu_is_omap3630())
|
|
|
+ return OMAPDSS_VER_OMAP3630;
|
|
|
+ else if (cpu_is_omap34xx()) {
|
|
|
+ if (soc_is_am35xx()) {
|
|
|
+ return OMAPDSS_VER_AM35xx;
|
|
|
+ } else {
|
|
|
+ if (omap_rev() < OMAP3430_REV_ES3_0)
|
|
|
+ return OMAPDSS_VER_OMAP34xx_ES1;
|
|
|
+ else
|
|
|
+ return OMAPDSS_VER_OMAP34xx_ES3;
|
|
|
+ }
|
|
|
+ } else if (omap_rev() == OMAP4430_REV_ES1_0)
|
|
|
+ return OMAPDSS_VER_OMAP4430_ES1;
|
|
|
+ else if (omap_rev() == OMAP4430_REV_ES2_0 ||
|
|
|
+ omap_rev() == OMAP4430_REV_ES2_1 ||
|
|
|
+ omap_rev() == OMAP4430_REV_ES2_2)
|
|
|
+ return OMAPDSS_VER_OMAP4430_ES2;
|
|
|
+ else if (cpu_is_omap44xx())
|
|
|
+ return OMAPDSS_VER_OMAP4;
|
|
|
+ else if (soc_is_omap54xx())
|
|
|
+ return OMAPDSS_VER_OMAP5;
|
|
|
+ else
|
|
|
+ return OMAPDSS_VER_UNKNOWN;
|
|
|
+}
|
|
|
+
|
|
|
+int __init omap_display_init(struct omap_dss_board_info *board_data)
|
|
|
+{
|
|
|
+ int r = 0;
|
|
|
+ struct platform_device *pdev;
|
|
|
+ int i, oh_count;
|
|
|
+ const struct omap_dss_hwmod_data *curr_dss_hwmod;
|
|
|
+ struct platform_device *dss_pdev;
|
|
|
+ enum omapdss_version ver;
|
|
|
+
|
|
|
+ /* create omapdss device */
|
|
|
+
|
|
|
+ ver = omap_display_get_version();
|
|
|
+
|
|
|
+ if (ver == OMAPDSS_VER_UNKNOWN) {
|
|
|
+ pr_err("DSS not supported on this SoC\n");
|
|
|
+ return -ENODEV;
|
|
|
+ }
|
|
|
+
|
|
|
+ board_data->version = ver;
|
|
|
+ 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;
|
|
|
+
|
|
|
+ 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;
|
|
|
+ oh_count = ARRAY_SIZE(omap2_dss_hwmod_data);
|
|
|
+ } else if (cpu_is_omap34xx()) {
|
|
|
+ curr_dss_hwmod = omap3_dss_hwmod_data;
|
|
|
+ oh_count = ARRAY_SIZE(omap3_dss_hwmod_data);
|
|
|
+ } else {
|
|
|
+ curr_dss_hwmod = omap4_dss_hwmod_data;
|
|
|
+ oh_count = ARRAY_SIZE(omap4_dss_hwmod_data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 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);
|
|
|
+
|
|
|
+ if (IS_ERR(dss_pdev)) {
|
|
|
+ pr_err("Could not build omap_device for %s\n",
|
|
|
+ curr_dss_hwmod[0].oh_name);
|
|
|
+
|
|
|
+ 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 PTR_ERR(pdev);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Create devices for DPI and SDI */
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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 0;
|
|
|
+}
|
|
|
+
|
|
|
+static void dispc_disable_outputs(void)
|
|
|
+{
|
|
|
+ u32 v, irq_mask = 0;
|
|
|
+ bool lcd_en, digit_en, lcd2_en = false, lcd3_en = false;
|
|
|
+ int i;
|
|
|
+ struct omap_dss_dispc_dev_attr *da;
|
|
|
+ struct omap_hwmod *oh;
|
|
|
+
|
|
|
+ oh = omap_hwmod_lookup("dss_dispc");
|
|
|
+ if (!oh) {
|
|
|
+ WARN(1, "display: could not disable outputs during reset - could not find dss_dispc hwmod\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!oh->dev_attr) {
|
|
|
+ pr_err("display: could not disable outputs during reset due to missing dev_attr\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ da = (struct omap_dss_dispc_dev_attr *)oh->dev_attr;
|
|
|
+
|
|
|
+ /* store value of LCDENABLE and DIGITENABLE bits */
|
|
|
+ v = omap_hwmod_read(oh, DISPC_CONTROL);
|
|
|
+ lcd_en = v & LCD_EN_MASK;
|
|
|
+ digit_en = v & DIGIT_EN_MASK;
|