From a247ce78ca3fa041f3e6b1187c4ae96c7016e83a Mon Sep 17 00:00:00 2001 From: Archit Taneja Date: Fri, 10 Feb 2012 11:45:52 +0530 Subject: [PATCH 1/6] OMAPDSS: HACK: Ensure DSS clock domain gets out of idle when HDMI is enabled For DSS clock domain to transition from idle to active state. It's necessary to enable the optional clock DSS_FCLK before we enable the module using the MODULEMODE bits in the clock domain's CM_DSS_DSS_CLKCTRL register. This sequence was not followed correctly for the 'dss_hdmi' hwmod and it led to DSS clock domain not getting out of idle when pm_runtime_get_sync() was called for hdmi's platform device. Since the clock domain failed to change it's state to active, the hwmod code disables any clocks it had enabled before for this hwmod. This led to the clock 'dss_48mhz_clk' gettind disabled. When hdmi's runtime_resume() op is called, the call to dss_runtime_get() correctly enables the DSS clock domain this time. However, the clock 'dss_48mhz_clk' is needed for HDMI's PHY to function correctly. Since it was disabled previously, the driver fails when it tries to enable HDMI's PHY. Fix this for now by ensuring that dss_runtime_get() is called before we call pm_runtime_get_sync() for hdmi's platform device. A correct fix for later would be to modify the DSS related hwmod's mainclks, and also some changes in how opt clocks are handled in the DSS driver. This fixes the issue of HDMI not working when it's the default display. The issue is not seen if any other display is already enabled as the first display would have correctly enabled the DSS clockdomain. Signed-off-by: Archit Taneja Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/hdmi.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index d7aa3b056529..a36b934b2db4 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c @@ -165,9 +165,25 @@ static int hdmi_runtime_get(void) DSSDBG("hdmi_runtime_get\n"); + /* + * HACK: Add dss_runtime_get() to ensure DSS clock domain is enabled. + * This should be removed later. + */ + r = dss_runtime_get(); + if (r < 0) + goto err_get_dss; + r = pm_runtime_get_sync(&hdmi.pdev->dev); WARN_ON(r < 0); - return r < 0 ? r : 0; + if (r < 0) + goto err_get_hdmi; + + return 0; + +err_get_hdmi: + dss_runtime_put(); +err_get_dss: + return r; } static void hdmi_runtime_put(void) @@ -178,6 +194,12 @@ static void hdmi_runtime_put(void) r = pm_runtime_put_sync(&hdmi.pdev->dev); WARN_ON(r < 0); + + /* + * HACK: This is added to complement the dss_runtime_get() call in + * hdmi_runtime_get(). This should be removed later. + */ + dss_runtime_put(); } int hdmi_init_display(struct omap_dss_device *dssdev) From ca888a7958b3d808e4efd08ceff88913f4212c69 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 20 Feb 2012 15:03:36 -0600 Subject: [PATCH 2/6] OMAPDSS: HDMI: hot plug detect fix The "OMAPDSS: HDMI: PHY burnout fix" commit switched the HDMI driver over to using a GPIO for plug detect. Unfortunately the ->detect() method was not also updated, causing HDMI to no longer work for the omapdrm driver (because it would actually check if a connection was detected before attempting to enable display). Signed-off-by: Rob Clark Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c index 2d72334ca3da..6847a478b459 100644 --- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c +++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c @@ -479,14 +479,7 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data, bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data) { - int r; - - void __iomem *base = hdmi_core_sys_base(ip_data); - - /* HPD */ - r = REG_GET(base, HDMI_CORE_SYS_SYS_STAT, 1, 1); - - return r == 1; + return gpio_get_value(ip_data->hpd_gpio); } static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, From 050f0e02c8dc38b2b4f2df345ac760d22ca5c7ba Mon Sep 17 00:00:00 2001 From: Florian Tobias Schandinat Date: Wed, 22 Feb 2012 18:53:07 +0000 Subject: [PATCH 3/6] viafb: select HW scaling on VX900 for IGA2 VX900 can do hardware scaling for both IGAs in contrast to previous hardware which could do it only for IGA2. This patch ensures that we set the parameter for IGA2 and not for IGA1. This fixes hardware scaling on VX900 until we have the infrastructure to support it for both IGAs. Signed-off-by: Florian Tobias Schandinat Cc: stable@vger.kernel.org --- drivers/video/via/hw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index d5aaca9cfa7e..8bdf80e270e2 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -1811,6 +1811,7 @@ static void hw_init(void) } /* probably this should go to the scaling code one day */ + via_write_reg_mask(VIACR, 0xFD, 0, 0x80); /* VX900 hw scale on IGA2 */ viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters)); /* Fill VPIT Parameters */ From e29206381a1436e0f47c0f5b9a23159a03c57715 Mon Sep 17 00:00:00 2001 From: Florian Tobias Schandinat Date: Wed, 22 Feb 2012 18:53:08 +0000 Subject: [PATCH 4/6] viafb: fix IGA1 modesetting on VX900 Even if the documentation calls this bit "Reserved" it has to be set to 0 for correct modesetting on IGA1. Signed-off-by: Florian Tobias Schandinat Cc: stable@vger.kernel.org --- drivers/video/via/hw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 8bdf80e270e2..8497727d66de 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -1810,6 +1810,9 @@ static void hw_init(void) break; } + /* magic required on VX900 for correct modesetting on IGA1 */ + via_write_reg_mask(VIACR, 0x45, 0x00, 0x01); + /* probably this should go to the scaling code one day */ via_write_reg_mask(VIACR, 0xFD, 0, 0x80); /* VX900 hw scale on IGA2 */ viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters)); From c9043ff9e6c863f5d8eb5c53f24ef565cb1ceecb Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 29 Feb 2012 10:48:21 +0200 Subject: [PATCH 5/6] OMAPDSS: panel-dvi: Add Kconfig dependency on I2C panel-dvi uses i2c, but the Kconfig didn't have dependency on I2C. Add it. Signed-off-by: Tomi Valkeinen Signed-off-by: Florian Tobias Schandinat --- drivers/video/omap2/displays/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig index 74d29b552901..408a9927be92 100644 --- a/drivers/video/omap2/displays/Kconfig +++ b/drivers/video/omap2/displays/Kconfig @@ -12,7 +12,7 @@ config PANEL_GENERIC_DPI config PANEL_DVI tristate "DVI output" - depends on OMAP2_DSS_DPI + depends on OMAP2_DSS_DPI && I2C help Driver for external monitors, connected via DVI. The driver uses i2c to read EDID information from the monitor. From a3d0e4aecaa32001e02d5ce860d38f14095d06d2 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 29 Feb 2012 10:48:22 +0200 Subject: [PATCH 6/6] OMAPDSS: APPLY: make ovl_enable/disable synchronous ovl->enable/disable are meant to be synchronous so that they can handle the configuration of fifo sizes. The current kernel doesn't configure fifo sizes yet, and so the code doesn't need to block to function (from omapdss driver's perspective). However, for the users of omapdss a non-blocking ovl->disable is confusing, because they don't know when the memory area is not used any more. Furthermore, when the fifo size configuration is added in the next merge window, the change from non-blocking to blocking could cause side effects to the users of omapdss. So by making the functions block already will keep them behaving in the same manner. And, while not the main purpose of this patch, this will also remove the compile warning: drivers/video/omap2/dss/apply.c:350: warning: 'wait_pending_extra_info_updates' defined but not used Signed-off-by: Tomi Valkeinen Signed-off-by: Florian Tobias Schandinat --- drivers/video/omap2/dss/apply.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index 052dc874cd3d..87b3e25294cf 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c @@ -1276,6 +1276,9 @@ int dss_ovl_enable(struct omap_overlay *ovl) spin_unlock_irqrestore(&data_lock, flags); + /* wait for overlay to be enabled */ + wait_pending_extra_info_updates(); + mutex_unlock(&apply_lock); return 0; @@ -1313,6 +1316,9 @@ int dss_ovl_disable(struct omap_overlay *ovl) spin_unlock_irqrestore(&data_lock, flags); + /* wait for the overlay to be disabled */ + wait_pending_extra_info_updates(); + mutex_unlock(&apply_lock); return 0;