From cb6ec182c13fc87a6562d47f18721dbd702adb52 Mon Sep 17 00:00:00 2001 From: Himangi Saraogi Date: Sat, 21 Jun 2014 21:27:59 +0530 Subject: [PATCH 01/16] drivers/video/fbdev : dereference without an error test After a variable is assigned the result of backlight_device_register, an error test should be performed before a dereference. A simplified version of the semantic match that finds this problem is as follows: // @def0@ expression x; position p0; @@ x@p0 = backlight_device_register(...) @protected@ expression def0.x,E; position def0.p0; position p; statement S; @@ x@p0 ... when != x = E if (!IS_ERR(x) && ...) {<... x@p ...>} else S @unprotected@ expression def0.x,E; identifier fld; position def0.p0; position p != protected.p; @@ x@p0 ... when != x = E * x@p->fld // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- .../video/fbdev/omap2/displays-new/panel-sony-acx565akm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c index c7ba4d8b928a..617f8d2f5127 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c @@ -817,6 +817,10 @@ static int acx565akm_probe(struct spi_device *spi) bldev = backlight_device_register("acx565akm", &ddata->spi->dev, ddata, &acx565akm_bl_ops, &props); + if (IS_ERR(bldev)) { + r = PTR_ERR(bldev); + goto err_reg_bl; + } ddata->bl_dev = bldev; if (ddata->has_cabc) { r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); @@ -862,6 +866,7 @@ static int acx565akm_probe(struct spi_device *spi) sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group); err_sysfs: backlight_device_unregister(bldev); +err_reg_bl: err_detect: err_gpio: omap_dss_put_device(ddata->in); From 21d9ca906370e5b3cbd7f507fd7116bbe8edb877 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Jun 2014 11:05:14 +0300 Subject: [PATCH 02/16] OMAPDSS: DISPC: fix debugfs reg dump DISPC reg dump prints a few registers twice. Remove the extra prints. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dispc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index 7aa33b0f4a1f..d1f0dbb486b8 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -3257,13 +3257,10 @@ static void dispc_dump_regs(struct seq_file *s) if (i == OMAP_DSS_CHANNEL_DIGIT) continue; - DUMPREG(i, DISPC_DEFAULT_COLOR); - DUMPREG(i, DISPC_TRANS_COLOR); DUMPREG(i, DISPC_TIMING_H); DUMPREG(i, DISPC_TIMING_V); DUMPREG(i, DISPC_POL_FREQ); DUMPREG(i, DISPC_DIVISORo); - DUMPREG(i, DISPC_SIZE_MGR); DUMPREG(i, DISPC_DATA_CYCLE1); DUMPREG(i, DISPC_DATA_CYCLE2); From beb8384d4a67179e8c207f00e9035ab121ed5940 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Jun 2014 11:35:10 +0300 Subject: [PATCH 03/16] OMAPDSS: DISPC: reject interlace for lcd out OMAP2/3 does not support interlace for LCD out. OMAP4+ does, but is not supported by the driver at the moment. The driver still accepts interlaced mode for LCD out, causing broken display output. This patch makes dispc reject interlace for LCD out. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dispc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index d1f0dbb486b8..37373b61784e 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -2886,6 +2886,9 @@ bool dispc_mgr_timings_ok(enum omap_channel channel, timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock); if (dss_mgr_is_lcd(channel)) { + /* TODO: OMAP4+ supports interlace for LCD outputs */ + timings_ok &= timings->interlace == false; + timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp, timings->hbp, timings->vsw, timings->vfp, timings->vbp); From eadd33bb95e0ab5e3f443bcd9ca45af4010110c8 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 5 Jun 2014 11:36:08 +0300 Subject: [PATCH 04/16] OMAPDSS: DISPC: clean up dispc_mgr_timings_ok dispc_mgr_timings_ok() is a bit confusing how it handles the return value. Change the function to just return immediately when a timing is deemed not valid, making the code much easier to follow. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/dispc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index 37373b61784e..be053aa80880 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c @@ -2879,22 +2879,24 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel, bool dispc_mgr_timings_ok(enum omap_channel channel, const struct omap_video_timings *timings) { - bool timings_ok; + if (!_dispc_mgr_size_ok(timings->x_res, timings->y_res)) + return false; - timings_ok = _dispc_mgr_size_ok(timings->x_res, timings->y_res); - - timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock); + if (!_dispc_mgr_pclk_ok(channel, timings->pixelclock)) + return false; if (dss_mgr_is_lcd(channel)) { /* TODO: OMAP4+ supports interlace for LCD outputs */ - timings_ok &= timings->interlace == false; + if (timings->interlace) + return false; - timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp, + if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp, timings->hbp, timings->vsw, timings->vfp, - timings->vbp); + timings->vbp)) + return false; } - return timings_ok; + return true; } static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw, From d27d20c88da7d78b389e5e824aff0cdfc9ce203f Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 9 Jun 2014 13:08:02 +0300 Subject: [PATCH 05/16] OMAPDSS: HDMI: fix name conflict OMAP HDMI driver has an 'enum hdmi_audio_sample_size', which conflicts with the common include/linux/hdmi.h. Change the name of the OMAP specific enum with '_omap" postfix. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/hdmi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index fbee07816337..1a62dc3fe54e 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -142,7 +142,7 @@ enum hdmi_audio_samples_perword { HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1 }; -enum hdmi_audio_sample_size { +enum hdmi_audio_sample_size_omap { HDMI_AUDIO_SAMPLE_16BITS = 0, HDMI_AUDIO_SAMPLE_24BITS = 1 }; @@ -260,7 +260,7 @@ struct hdmi_audio_format { enum hdmi_audio_justify justification; enum hdmi_audio_sample_order sample_order; enum hdmi_audio_samples_perword samples_per_word; - enum hdmi_audio_sample_size sample_size; + enum hdmi_audio_sample_size_omap sample_size; enum hdmi_audio_blk_strt_end_sig en_sig_blk_strt_end; }; From 89a2d6183bbd87431fccf9f57a7fec7ae38843e1 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 9 Jun 2014 15:29:42 +0300 Subject: [PATCH 06/16] OMAPDSS: Kconfig: select HDMI Select HDMI support to be able to use HDMI infoframe helpers. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/omap2/dss/Kconfig b/drivers/video/fbdev/omap2/dss/Kconfig index 285bcd103dce..3d5eb6c36c22 100644 --- a/drivers/video/fbdev/omap2/dss/Kconfig +++ b/drivers/video/fbdev/omap2/dss/Kconfig @@ -5,6 +5,7 @@ menuconfig OMAP2_DSS tristate "OMAP2+ Display Subsystem support" select VIDEOMODE_HELPERS select OMAP2_DSS_INIT + select HDMI help OMAP2+ Display Subsystem support. From db85ca7ca51ca886e8cd127368e09a7955bb041c Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 9 Jun 2014 13:09:00 +0300 Subject: [PATCH 07/16] OMAPDSS: HDMI4: use common AVI infoframe support Instead of using OMAP specific AVI infoframe structs, use the common one from include/linux/hdmi.h. Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap2/dss/hdmi.h | 2 + drivers/video/fbdev/omap2/dss/hdmi4_core.c | 134 ++++----------------- drivers/video/fbdev/omap2/dss/hdmi4_core.h | 1 + 3 files changed, 27 insertions(+), 110 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h index 1a62dc3fe54e..6cd4a755b0ac 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi.h +++ b/drivers/video/fbdev/omap2/dss/hdmi.h @@ -22,6 +22,7 @@ #include #include #include +#include #include