18 #include <linux/string.h>
19 #include <linux/kernel.h>
38 #define DISPC_CONTROL 0x0040
39 #define DISPC_CONTROL2 0x0238
40 #define DISPC_CONTROL3 0x0848
41 #define DISPC_IRQSTATUS 0x0018
43 #define DSS_SYSCONFIG 0x10
44 #define DSS_SYSSTATUS 0x14
45 #define DSS_CONTROL 0x40
46 #define DSS_SDI_CONTROL 0x44
47 #define DSS_PLL_CONTROL 0x48
49 #define LCD_EN_MASK (0x1 << 0)
50 #define DIGIT_EN_MASK (0x1 << 1)
52 #define FRAMEDONE_IRQ_SHIFT 0
53 #define EVSYNC_EVEN_IRQ_SHIFT 2
54 #define EVSYNC_ODD_IRQ_SHIFT 3
55 #define FRAMEDONE2_IRQ_SHIFT 22
56 #define FRAMEDONE3_IRQ_SHIFT 30
57 #define FRAMEDONETV_IRQ_SHIFT 24
63 #define FRAMEDONE_IRQ_TIMEOUT 100
69 .platform_data =
NULL,
80 {
"dss_core",
"omapdss_dss", -1 },
81 {
"dss_dispc",
"omapdss_dispc", -1 },
82 {
"dss_rfbi",
"omapdss_rfbi", -1 },
83 {
"dss_venc",
"omapdss_venc", -1 },
87 {
"dss_core",
"omapdss_dss", -1 },
88 {
"dss_dispc",
"omapdss_dispc", -1 },
89 {
"dss_rfbi",
"omapdss_rfbi", -1 },
90 {
"dss_venc",
"omapdss_venc", -1 },
91 {
"dss_dsi1",
"omapdss_dsi", 0 },
95 {
"dss_core",
"omapdss_dss", -1 },
96 {
"dss_dispc",
"omapdss_dispc", -1 },
97 {
"dss_rfbi",
"omapdss_rfbi", -1 },
98 {
"dss_dsi1",
"omapdss_dsi", 0 },
99 {
"dss_dsi2",
"omapdss_dsi", 1 },
100 {
"dss_hdmi",
"omapdss_hdmi", -1 },
108 omap_mux_init_signal(
"hdmi_cec",
110 omap_mux_init_signal(
"hdmi_ddc_scl",
112 omap_mux_init_signal(
"hdmi_ddc_sda",
129 static int omap4_dsi_mux_pads(
int dsi_id,
unsigned lanes)
131 u32 enable_mask, enable_shift;
132 u32 pipd_mask, pipd_shift;
140 }
else if (dsi_id == 1) {
154 reg |= (lanes << enable_shift) & enable_mask;
155 reg |= (lanes << pipd_shift) & pipd_mask;
165 omap4_hdmi_mux_pads(flags);
170 static int omap_dsi_enable_pads(
int dsi_id,
unsigned lane_mask)
173 return omap4_dsi_mux_pads(dsi_id, lane_mask);
178 static void omap_dsi_disable_pads(
int dsi_id,
unsigned lane_mask)
181 omap4_dsi_mux_pads(dsi_id, 0);
184 static int omap_dss_set_min_bus_tput(
struct device *
dev,
unsigned long tput)
190 int pdev_id,
const char *oh_name,
void *
pdata,
int pdata_len,
201 pr_err(
"Could not look up %s\n", oh_name);
208 pr_err(
"Could not create pdev for %s\n", pdev_name);
214 pdev->
dev.parent = &parent->
dev;
224 pr_err(
"Could not alloc omap_device for %s\n", pdev_name);
231 pr_err(
"Could not set pdata for %s\n", pdev_name);
237 pr_err(
"Could not register omap_device for %s\n", pdev_name);
247 static struct platform_device *create_simple_dss_pdev(
const char *pdev_name,
248 int pdev_id,
void *pdata,
int pdata_len,
256 pr_err(
"Could not create pdev for %s\n", pdev_name);
262 pdev->
dev.parent = &parent->
dev;
271 pr_err(
"Could not set pdata for %s\n", pdev_name);
277 pr_err(
"Could not register platform_device for %s\n", pdev_name);
302 omap_display_device.
dev.platform_data = board_data;
306 pr_err(
"Unable to register omapdss device\n");
313 curr_dss_hwmod = omap2_dss_hwmod_data;
316 curr_dss_hwmod = omap3_dss_hwmod_data;
319 curr_dss_hwmod = omap4_dss_hwmod_data;
328 dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name,
329 curr_dss_hwmod[0].
id,
330 curr_dss_hwmod[0].oh_name,
331 board_data,
sizeof(*board_data),
334 if (IS_ERR(dss_pdev)) {
335 pr_err(
"Could not build omap_device for %s\n",
336 curr_dss_hwmod[0].oh_name);
338 return PTR_ERR(dss_pdev);
341 for (i = 1; i < oh_count; i++) {
342 pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name,
343 curr_dss_hwmod[i].
id,
344 curr_dss_hwmod[i].oh_name,
345 board_data,
sizeof(*board_data),
349 pr_err(
"Could not build omap_device for %s\n",
350 curr_dss_hwmod[i].oh_name);
352 return PTR_ERR(pdev);
358 pdev = create_simple_dss_pdev(
"omapdss_dpi", -1,
359 board_data,
sizeof(*board_data), dss_pdev);
361 pr_err(
"Could not build platform_device for omapdss_dpi\n");
362 return PTR_ERR(pdev);
366 pdev = create_simple_dss_pdev(
"omapdss_sdi", -1,
367 board_data,
sizeof(*board_data), dss_pdev);
369 pr_err(
"Could not build platform_device for omapdss_sdi\n");
370 return PTR_ERR(pdev);
377 static void dispc_disable_outputs(
void)
380 bool lcd_en, digit_en, lcd2_en =
false, lcd3_en =
false;
387 WARN(1,
"display: could not disable outputs during reset - could not find dss_dispc hwmod\n");
392 pr_err(
"display: could not disable outputs during reset due to missing dev_attr\n");
415 if (!(lcd_en | digit_en | lcd2_en | lcd3_en))
469 pr_err(
"didn't get FRAMEDONE1/2/3 or TV interrupt\n");
476 #define MAX_MODULE_SOFTRESET_WAIT 10000
484 pr_err(
"dss_core: hwmod data doesn't contain reset data\n");
490 clk_prepare_enable(oc->
_clk);
492 dispc_disable_outputs();
511 pr_warning(
"dss_core: waiting for reset to finish failed\n");
513 pr_debug(
"dss_core: softreset done\n");
517 clk_disable_unprepare(oc->
_clk);