From f474f0e1fbc8d0daa41f17b9a65466e7c7dfd170 Mon Sep 17 00:00:00 2001 From: Jon Ringle Date: Tue, 1 Apr 2014 08:39:33 -0400 Subject: [PATCH 01/31] video: da8xx-fb: Add support for Densitron 84-0023-001T Signed-off-by: Jon Ringle Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/da8xx-fb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 6b23508ff0a5..a8484f768d04 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -242,6 +242,20 @@ static struct fb_videomode known_lcd_panels[] = { .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, .flag = 0, }, + [3] = { + /* Densitron 84-0023-001T */ + .name = "Densitron_84-0023-001T", + .xres = 320, + .yres = 240, + .pixclock = KHZ2PICOS(6400), + .left_margin = 0, + .right_margin = 0, + .upper_margin = 0, + .lower_margin = 0, + .hsync_len = 30, + .vsync_len = 3, + .sync = 0, + }, }; static bool da8xx_fb_is_raster_enabled(void) From e6853aafd4339dbf2992957ff2616ef7164bc9d4 Mon Sep 17 00:00:00 2001 From: David Ung Date: Wed, 26 Mar 2014 15:35:37 -0700 Subject: [PATCH 02/31] video: Check EDID for HDMI connection Check EDID Vendor Specific Data Block bytes to see if the connection is HDMI and set FB_MISC_HDMI. Signed-off-by: David Ung Signed-off-by: Christopher Freeman Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/core/fbmon.c | 9 ++++++++- include/linux/fb.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c index c204ebe6187e..5b0e313849bd 100644 --- a/drivers/video/fbdev/core/fbmon.c +++ b/drivers/video/fbdev/core/fbmon.c @@ -1012,13 +1012,20 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) while (pos < edid[2]) { u8 len = edid[pos] & 0x1f, type = (edid[pos] >> 5) & 7; pr_debug("Data block %u of %u bytes\n", type, len); - if (type == 2) + if (type == 2) { for (i = pos; i < pos + len; i++) { u8 idx = edid[pos + i] & 0x7f; svd[svd_n++] = idx; pr_debug("N%sative mode #%d\n", edid[pos + i] & 0x80 ? "" : "on-n", idx); } + } else if (type == 3 && len >= 3) { + /* Check Vendor Specific Data Block. For HDMI, + it is always 00-0C-03 for HDMI Licensing, LLC. */ + if (edid[pos + 1] == 3 && edid[pos + 2] == 0xc && + edid[pos + 3] == 0) + specs->misc |= FB_MISC_HDMI; + } pos += len + 1; } diff --git a/include/linux/fb.h b/include/linux/fb.h index fe6ac956550e..506242979eea 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -47,6 +47,7 @@ struct device_node; #define FB_MISC_PRIM_COLOR 1 #define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ +#define FB_MISC_HDMI 4 struct fb_chroma { __u32 redx; /* in fraction of 1024 */ __u32 greenx; From 3ea4ccd004c669b3c1f8241976985ec8c1edaa33 Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Tue, 29 Apr 2014 21:21:54 +0900 Subject: [PATCH 03/31] video: fbdev: Fix format string mismatch in wm8505fb.c Fix format string mismatch in contrast_show(). Signed-off-by: Masanari Iida Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/wm8505fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c index 537d199612af..d2fafbbcd7f8 100644 --- a/drivers/video/fbdev/wm8505fb.c +++ b/drivers/video/fbdev/wm8505fb.c @@ -162,7 +162,7 @@ static ssize_t contrast_show(struct device *dev, struct fb_info *info = dev_get_drvdata(dev); struct wm8505fb_info *fbi = to_wm8505fb_info(info); - return sprintf(buf, "%d\n", fbi->contrast); + return sprintf(buf, "%u\n", fbi->contrast); } static ssize_t contrast_store(struct device *dev, From 7e81b9ddf2be0f691bf883acfe2b2ee6e55baa7e Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Tue, 29 Apr 2014 21:21:55 +0900 Subject: [PATCH 04/31] video: fbdev: Fix format string mismatch in gbefb.c Fix format string mismatch in gbefb_show_memsize(). Signed-off-by: Masanari Iida Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/gbefb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c index 3ec65a878ac8..4aa56ba78f32 100644 --- a/drivers/video/fbdev/gbefb.c +++ b/drivers/video/fbdev/gbefb.c @@ -1068,7 +1068,7 @@ static struct fb_ops gbefb_ops = { static ssize_t gbefb_show_memsize(struct device *dev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, "%d\n", gbe_mem_size); + return snprintf(buf, PAGE_SIZE, "%u\n", gbe_mem_size); } static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL); From 6e860a1aedb278a8ac7adc94b042b12e61a1c20f Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Tue, 15 Apr 2014 13:24:04 +0200 Subject: [PATCH 05/31] video: mmp: Remove references to CPU_MMP3 References to the Kconfig symbol CPU_MMP3 were added to the tree since v3.6. But that Kconfig symbol has never been part of the tree. So get rid of these references. Signed-off-by: Richard Weinberger Signed-off-by: Paul Bolle Reviewed-by: Jingoo Han Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/mmp/Kconfig | 2 +- drivers/video/fbdev/mmp/hw/Kconfig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/mmp/Kconfig b/drivers/video/fbdev/mmp/Kconfig index d4a4ffc24749..429cf7836f40 100644 --- a/drivers/video/fbdev/mmp/Kconfig +++ b/drivers/video/fbdev/mmp/Kconfig @@ -1,6 +1,6 @@ menuconfig MMP_DISP tristate "Marvell MMP Display Subsystem support" - depends on CPU_PXA910 || CPU_MMP2 || CPU_MMP3 || CPU_PXA988 + depends on CPU_PXA910 || CPU_MMP2 || CPU_PXA988 help Marvell Display Subsystem support. diff --git a/drivers/video/fbdev/mmp/hw/Kconfig b/drivers/video/fbdev/mmp/hw/Kconfig index 02f109a20cd0..99f0506afc99 100644 --- a/drivers/video/fbdev/mmp/hw/Kconfig +++ b/drivers/video/fbdev/mmp/hw/Kconfig @@ -2,12 +2,12 @@ if MMP_DISP config MMP_DISP_CONTROLLER bool "mmp display controller hw support" - depends on CPU_PXA910 || CPU_MMP2 || CPU_MMP3 || CPU_PXA988 + depends on CPU_PXA910 || CPU_MMP2 || CPU_PXA988 default n help Marvell MMP display hw controller support this controller is used on Marvell PXA910, - MMP2, MMP3, PXA988 chips + MMP2, PXA988 chips config MMP_DISP_SPI bool "mmp display controller spi port" From c150a2803d6df8d35e9d86236c256347e7e14bf6 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Tue, 15 Apr 2014 13:24:38 +0200 Subject: [PATCH 06/31] video: mmp: Remove references to CPU_PXA988 References to the Kconfig symbol CPU_PXA988 were added to the tree in v3.9. But that Kconfig symbol has never been part of the tree. So get rid of these references. Signed-off-by: Richard Weinberger Signed-off-by: Paul Bolle Reviewed-by: Jingoo Han Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/mmp/Kconfig | 2 +- drivers/video/fbdev/mmp/hw/Kconfig | 6 ++--- drivers/video/fbdev/mmp/hw/mmp_ctrl.h | 32 --------------------------- 3 files changed, 4 insertions(+), 36 deletions(-) diff --git a/drivers/video/fbdev/mmp/Kconfig b/drivers/video/fbdev/mmp/Kconfig index 429cf7836f40..f56a7e2e8136 100644 --- a/drivers/video/fbdev/mmp/Kconfig +++ b/drivers/video/fbdev/mmp/Kconfig @@ -1,6 +1,6 @@ menuconfig MMP_DISP tristate "Marvell MMP Display Subsystem support" - depends on CPU_PXA910 || CPU_MMP2 || CPU_PXA988 + depends on CPU_PXA910 || CPU_MMP2 help Marvell Display Subsystem support. diff --git a/drivers/video/fbdev/mmp/hw/Kconfig b/drivers/video/fbdev/mmp/hw/Kconfig index 99f0506afc99..c735d133895c 100644 --- a/drivers/video/fbdev/mmp/hw/Kconfig +++ b/drivers/video/fbdev/mmp/hw/Kconfig @@ -2,12 +2,12 @@ if MMP_DISP config MMP_DISP_CONTROLLER bool "mmp display controller hw support" - depends on CPU_PXA910 || CPU_MMP2 || CPU_PXA988 + depends on CPU_PXA910 || CPU_MMP2 default n help Marvell MMP display hw controller support - this controller is used on Marvell PXA910, - MMP2, PXA988 chips + this controller is used on Marvell PXA910 and + MMP2 chips config MMP_DISP_SPI bool "mmp display controller spi port" diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.h b/drivers/video/fbdev/mmp/hw/mmp_ctrl.h index 53301cfdb1ae..56fdeab34355 100644 --- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.h +++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.h @@ -167,11 +167,7 @@ struct lcd_regs { PN2_IOPAD_CONTROL) : LCD_TOP_CTRL) /* dither configure */ -#ifdef CONFIG_CPU_PXA988 -#define LCD_DITHER_CTRL (0x01EC) -#else #define LCD_DITHER_CTRL (0x00A0) -#endif #define DITHER_TBL_INDEX_SEL(s) ((s) << 16) #define DITHER_MODE2(m) ((m) << 12) @@ -186,15 +182,6 @@ struct lcd_regs { #define DITHER_EN1 (1) /* dither table data was fixed by video bpp of input and output*/ -#ifdef CONFIG_CPU_PXA988 -#define DITHER_TB_4X4_INDEX0 (0x6e4ca280) -#define DITHER_TB_4X4_INDEX1 (0x5d7f91b3) -#define DITHER_TB_4X8_INDEX0 (0xb391a280) -#define DITHER_TB_4X8_INDEX1 (0x7f5d6e4c) -#define DITHER_TB_4X8_INDEX2 (0x80a291b3) -#define DITHER_TB_4X8_INDEX3 (0x4c6e5d7f) -#define LCD_DITHER_TBL_DATA (0x01F0) -#else #define DITHER_TB_4X4_INDEX0 (0x3b19f7d5) #define DITHER_TB_4X4_INDEX1 (0x082ac4e6) #define DITHER_TB_4X8_INDEX0 (0xf7d508e6) @@ -202,7 +189,6 @@ struct lcd_regs { #define DITHER_TB_4X8_INDEX2 (0xc4e6d5f7) #define DITHER_TB_4X8_INDEX3 (0x082a193b) #define LCD_DITHER_TBL_DATA (0x00A4) -#endif /* Video Frame 0&1 start address registers */ #define LCD_SPU_DMA_START_ADDR_Y0 0x00C0 @@ -933,16 +919,9 @@ struct lcd_regs { #define LCD_PN2_SQULN2_CTRL (0x02F0) #define ALL_LAYER_ALPHA_SEL (0x02F4) -/* pxa988 has different MASTER_CTRL from MMP3/MMP2 */ -#ifdef CONFIG_CPU_PXA988 -#define TIMING_MASTER_CONTROL (0x01F4) -#define MASTER_ENH(id) (1 << ((id) + 5)) -#define MASTER_ENV(id) (1 << ((id) + 6)) -#else #define TIMING_MASTER_CONTROL (0x02F8) #define MASTER_ENH(id) (1 << (id)) #define MASTER_ENV(id) (1 << ((id) + 4)) -#endif #define DSI_START_SEL_SHIFT(id) (((id) << 1) + 8) #define timing_master_config(path, dsi_id, lcd_id) \ @@ -1312,19 +1291,8 @@ struct dsi_regs { #define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_MASK (0xff) #define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_SHIFT 0 -/* - * DSI timings - * PXA988 has diffrent ESC CLK with MMP2/MMP3 - * it will be used in dsi_set_dphy() in pxa688_phy.c - * as low power mode clock. - */ -#ifdef CONFIG_CPU_PXA988 -#define DSI_ESC_CLK 52 /* Unit: Mhz */ -#define DSI_ESC_CLK_T 19 /* Unit: ns */ -#else #define DSI_ESC_CLK 66 /* Unit: Mhz */ #define DSI_ESC_CLK_T 15 /* Unit: ns */ -#endif /* LVDS */ /* LVDS_PHY_CTRL */ From a513ad2d6de2dbf28465e4eae7d355a926944871 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 14 Apr 2014 11:09:29 +0300 Subject: [PATCH 07/31] video: mmpfb: cleanup some static checker warnings in probe() Sparse complains about using zero instead of NULL for pointers. Probably, if we enabled the warning, then GCC would complain about the unused initializers. I've just removed them. Smatch complains that we first check if "fbi" is NULL and then dereference it in the error handling. It turns out that "fbi" can't be NULL so I've removed the check. Signed-off-by: Dan Carpenter Reviewed-by: Jingoo Han Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/mmp/fb/mmpfb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c index 7ab31eb76a8c..910fcc6ecece 100644 --- a/drivers/video/fbdev/mmp/fb/mmpfb.c +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c @@ -554,8 +554,8 @@ static void fb_info_clear(struct fb_info *info) static int mmpfb_probe(struct platform_device *pdev) { struct mmp_buffer_driver_mach_info *mi; - struct fb_info *info = 0; - struct mmpfb_info *fbi = 0; + struct fb_info *info; + struct mmpfb_info *fbi; int ret, modes_num; mi = pdev->dev.platform_data; @@ -569,10 +569,6 @@ static int mmpfb_probe(struct platform_device *pdev) if (info == NULL) return -ENOMEM; fbi = info->par; - if (!fbi) { - ret = -EINVAL; - goto failed; - } /* init fb */ fbi->fb_info = info; @@ -667,7 +663,6 @@ failed_free_buff: fbi->fb_start_dma); failed_destroy_mutex: mutex_destroy(&fbi->access_ok); -failed: dev_err(fbi->dev, "mmp-fb: frame buffer device init failed\n"); framebuffer_release(info); From 9b22b8c52f9b389a9349d6c9111e5ef806a0d728 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Tue, 8 Apr 2014 13:53:10 +0900 Subject: [PATCH 08/31] video: pxa3xx-gcu: use devm_ioremap_resource() Use devm_ioremap_resource() because devm_request_and_ioremap() is obsoleted by devm_ioremap_resource(). Signed-off-by: Jingoo Han Cc: Daniel Mack Cc: Dan Carpenter Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/pxa3xx-gcu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 417f9a27eb7d..4df3657fe221 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -612,11 +612,9 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) /* handle IO resources */ r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - priv->mmio_base = devm_request_and_ioremap(dev, r); - if (IS_ERR(priv->mmio_base)) { - dev_err(dev, "failed to map I/O memory\n"); + priv->mmio_base = devm_ioremap_resource(dev, r); + if (IS_ERR(priv->mmio_base)) return PTR_ERR(priv->mmio_base); - } /* enable the clock */ priv->clk = devm_clk_get(dev, NULL); From 81fe17b94bc84f2cb7fdfacf6b8de6c5bb101a50 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 24 Apr 2014 10:32:58 +0200 Subject: [PATCH 09/31] fbdev: Fix tmiofb driver dependencies The tmiofb driver should not depend on MFD_CORE but on MFD_TMIO. Without the tmio_core driver, tmiofb has no platform device to bind to and is thus useless. Signed-off-by: Jean Delvare Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index e1f47272fdea..c7ce485dfd1b 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -1993,7 +1993,7 @@ config FB_SH_MOBILE_HDMI config FB_TMIO tristate "Toshiba Mobile IO FrameBuffer support" - depends on FB && MFD_CORE + depends on FB && (MFD_TMIO || COMPILE_TEST) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT From ee3468739ed83d862dbbd90397aff5258f8f2c8e Mon Sep 17 00:00:00 2001 From: Brian W Hart Date: Thu, 1 May 2014 14:32:35 -0500 Subject: [PATCH 10/31] fbdev/fb.h: silence warning with -Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Silence the warning when building with -Wsign-compare when fb.h is included: include/linux/fb.h: In function ‘__fb_pad_aligned_buffer’: include/linux/fb.h:650:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (j = 0; j < s_pitch; j++) ^ Signed-off-by: Brian W Hart Signed-off-by: Tomi Valkeinen --- include/linux/fb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/fb.h b/include/linux/fb.h index 506242979eea..b6bfda99add3 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -642,7 +642,7 @@ static inline void unlock_fb_info(struct fb_info *info) static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) { - int i, j; + u32 i, j; d_pitch -= s_pitch; From 423431a3b5e20d82be6b7db9b72725e1f72e469e Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Apr 2014 13:28:17 +0100 Subject: [PATCH 11/31] video: sh_mobile_lcdcfb depends on meram The sh_mobile_lcdcfb driver calls interfaces provided by the corresponding "meram" helper. This fails if meram is a module but lcdcfb is built-in. To work around it, this uses special Kconfig magic to only allow lcdcfb to be built if a) both are modules, b) meram is built-in, or c) meram is disabled and the helpers stubbed out Changing meram from 'y' to 'm' now forces clcd to be a module as well, which seems to be the desired behavior. Signed-off-by: Arnd Bergmann Signed-off-by: Peter Griffin Cc: Simon Horman Cc: Magnus Damm Cc: linux-sh@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index c7ce485dfd1b..758685e8046d 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -1971,6 +1971,7 @@ config FB_W100 config FB_SH_MOBILE_LCDC tristate "SuperH Mobile LCDC framebuffer support" depends on FB && (SUPERH || ARCH_SHMOBILE) && HAVE_CLK + depends on FB_SH_MOBILE_MERAM || !FB_SH_MOBILE_MERAM select FB_SYS_FILLRECT select FB_SYS_COPYAREA select FB_SYS_IMAGEBLIT From f7200b6834700abf1cb2686ea1d1d6ef2cd66a2f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Apr 2014 13:28:19 +0100 Subject: [PATCH 12/31] video: clarify I2C dependencies We can only use I2C support in frame buffer drivers if Either I2C is built-in, or both I2C and the driver itself are loadable modules. Fix this dependency for MB862XX and CyberPro frame buffers. Signed-off-by: Arnd Bergmann Signed-off-by: Peter Griffin Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: Russell King Cc: Anatolij Gustschin Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 758685e8046d..a8c9b2de28bd 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -360,6 +360,7 @@ config FB_CYBER2000_DDC config FB_CYBER2000_I2C bool "CyberPro 2000/2010/5000 I2C support" depends on FB_CYBER2000 && I2C && ARCH_NETWINDER + depends on I2C=y || FB_CYBER2000=m select I2C_ALGOBIT help Enable support for the I2C video decoder interface on the @@ -2296,6 +2297,7 @@ endchoice config FB_MB862XX_I2C bool "Support I2C bus on MB862XX GDC" depends on FB_MB862XX && I2C + depends on FB_MB862XX=m || I2C=y default y help Selecting this option adds Coral-P(A)/Lime GDC I2C bus adapter From 81c44c2b2ce358b1c5fe0065dc5d2e2010f39f1b Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Apr 2014 13:28:20 +0100 Subject: [PATCH 13/31] video/omap: fix modular build The framebuffer layer can be a loadable module, which forces omapfb to be a module as well. However, this breaks the lcd drivers, which are linked into the omapfb driver but each have their own module_init() function. To solve this, we split out the lcd drivers into separate modules and export omapfb_register_panel, which is the only interface required between the main omapfb driver and the lcd panel drivers. We also have to introduce a new Kconfig symbol for H3, since that lcd driver has a dependency on TPS65010, which we can express better in Kconfig than Makefile syntax. Signed-off-by: Arnd Bergmann Signed-off-by: Peter Griffin Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: linux-omap@vger.kernel.org Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap/Kconfig | 9 +++++++++ drivers/video/fbdev/omap/Makefile | 21 +++++++++++---------- drivers/video/fbdev/omap/omapfb_main.c | 1 + include/linux/omap-dma.h | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/omap/Kconfig b/drivers/video/fbdev/omap/Kconfig index 0bc3a936ce2b..18c4cb0d5690 100644 --- a/drivers/video/fbdev/omap/Kconfig +++ b/drivers/video/fbdev/omap/Kconfig @@ -39,6 +39,15 @@ config FB_OMAP_LCD_MIPID the Mobile Industry Processor Interface DBI-C/DCS specification. (Supported LCDs: Philips LPH8923, Sharp LS041Y3) +config FB_OMAP_LCD_H3 + bool "TPS65010 LCD controller on OMAP-H3" + depends on MACH_OMAP_H3 + depends on TPS65010 + default y + help + Say Y here if you want to have support for the LCD on the + H3 board. + config FB_OMAP_DMA_TUNE bool "Set DMA SDRAM access priority high" depends on FB_OMAP diff --git a/drivers/video/fbdev/omap/Makefile b/drivers/video/fbdev/omap/Makefile index 1927faffb5bc..732e0718be53 100644 --- a/drivers/video/fbdev/omap/Makefile +++ b/drivers/video/fbdev/omap/Makefile @@ -10,17 +10,18 @@ objs-y$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += sossi.o objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o -objs-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o -objs-y$(CONFIG_MACH_OMAP_H3) += lcd_h3.o -objs-y$(CONFIG_MACH_OMAP_PALMTE) += lcd_palmte.o -objs-y$(CONFIG_MACH_OMAP_PALMTT) += lcd_palmtt.o -objs-y$(CONFIG_MACH_OMAP_PALMZ71) += lcd_palmz71.o -objs-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1610.o -objs-$(CONFIG_ARCH_OMAP15XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1510.o -objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o +lcds-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o +lcds-y$(CONFIG_FB_OMAP_LCD_H3) += lcd_h3.o +lcds-y$(CONFIG_MACH_OMAP_PALMTE) += lcd_palmte.o +lcds-y$(CONFIG_MACH_OMAP_PALMTT) += lcd_palmtt.o +lcds-y$(CONFIG_MACH_OMAP_PALMZ71) += lcd_palmz71.o +lcds-$(CONFIG_ARCH_OMAP16XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1610.o +lcds-$(CONFIG_ARCH_OMAP15XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1510.o +lcds-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o -objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o -objs-y$(CONFIG_MACH_HERALD) += lcd_htcherald.o +lcds-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o +lcds-y$(CONFIG_MACH_HERALD) += lcd_htcherald.o omapfb-objs := $(objs-yy) +obj-$(CONFIG_FB_OMAP) += $(lcds-yy) diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c index e4fc6d9b5371..d8d028d98711 100644 --- a/drivers/video/fbdev/omap/omapfb_main.c +++ b/drivers/video/fbdev/omap/omapfb_main.c @@ -1823,6 +1823,7 @@ void omapfb_register_panel(struct lcd_panel *panel) if (fbdev_pdev != NULL) omapfb_do_probe(fbdev_pdev, fbdev_panel); } +EXPORT_SYMBOL_GPL(omapfb_register_panel); /* Called when the device is being detached from the driver */ static int omapfb_remove(struct platform_device *pdev) diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h index 41a13e70f41f..0a1a2e2d5c21 100644 --- a/include/linux/omap-dma.h +++ b/include/linux/omap-dma.h @@ -393,7 +393,7 @@ extern int omap_modify_dma_chain_params(int chain_id, extern int omap_dma_chain_status(int chain_id); #endif -#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP) +#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP) #include #else static inline int omap_lcd_dma_running(void) From fabd3152fb424cab804b18c0afdb59e96fe7c657 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Apr 2014 13:28:21 +0100 Subject: [PATCH 14/31] video/mbx: fix building debugfs support The mbx framebuffer debugfs support apparently hasn't been able to build for a long time, at least since 2006 when the u.generic_ip field in the inode was removed. This fixes the obvious bug, and also makes it possible to build the driver as a module when debugfs support is enabled, by simply including the C file. It's ugly, but it won't make the driver any worse than it already is, and doesn't require a more invasive change that might break it further. Signed-off-by: Arnd Bergmann Signed-off-by: Peter Griffin Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: Raphael Assenat Cc: Mike Rapoport Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/mbx/Makefile | 3 +-- drivers/video/fbdev/mbx/mbxdebugfs.c | 2 +- drivers/video/fbdev/mbx/mbxfb.c | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/mbx/Makefile b/drivers/video/fbdev/mbx/Makefile index 16c1165cf9c7..d7ae5a9bb376 100644 --- a/drivers/video/fbdev/mbx/Makefile +++ b/drivers/video/fbdev/mbx/Makefile @@ -1,4 +1,3 @@ # Makefile for the 2700G controller driver. -obj-$(CONFIG_FB_MBX) += mbxfb.o -obj-$(CONFIG_FB_MBX_DEBUG) += mbxfbdebugfs.o +obj-y += mbxfb.o diff --git a/drivers/video/fbdev/mbx/mbxdebugfs.c b/drivers/video/fbdev/mbx/mbxdebugfs.c index 4449f249b0e7..e3bc00a75296 100644 --- a/drivers/video/fbdev/mbx/mbxdebugfs.c +++ b/drivers/video/fbdev/mbx/mbxdebugfs.c @@ -17,7 +17,7 @@ struct mbxfb_debugfs_data { static int open_file_generic(struct inode *inode, struct file *file) { - file->private_data = inode->u.generic_ip; + file->private_data = inode->i_private; return 0; } diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c index f0a5392f5fd3..2bd52ed8832c 100644 --- a/drivers/video/fbdev/mbx/mbxfb.c +++ b/drivers/video/fbdev/mbx/mbxfb.c @@ -877,6 +877,8 @@ static int mbxfb_resume(struct platform_device *dev) #ifndef CONFIG_FB_MBX_DEBUG #define mbxfb_debugfs_init(x) do {} while(0) #define mbxfb_debugfs_remove(x) do {} while(0) +#else +#include "mbxdebugfs.c" #endif #define res_size(_r) (((_r)->end - (_r)->start) + 1) From 23e51f87f3533bc566aa0d29848ae33df5562f7b Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Apr 2014 13:28:22 +0100 Subject: [PATCH 15/31] video: export fb_prepare_logo Some drivers that may be loadable modules use the fb_prepare_logo function, so we have to export it. Found during randconfig builds with mmpfb. Signed-off-by: Arnd Bergmann Signed-off-by: Peter Griffin Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/core/fbmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index b6d5008f361f..479fe2a5269c 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -674,6 +674,7 @@ int fb_show_logo(struct fb_info *info, int rotate) int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; } int fb_show_logo(struct fb_info *info, int rotate) { return 0; } #endif /* CONFIG_LOGO */ +EXPORT_SYMBOL(fb_prepare_logo); EXPORT_SYMBOL(fb_show_logo); static void *fb_seq_start(struct seq_file *m, loff_t *pos) From 3cdd15371739f403aad6f84233983f4e1cb9c5df Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Apr 2014 13:28:23 +0100 Subject: [PATCH 16/31] video: atmel needs FB_BACKLIGHT The atmel frame buffer driver doesn't build if FB_BACKLIGHT is disabled, so select it here as we do for lots of other drivers. Signed-off-by: Arnd Bergmann Signed-off-by: Peter Griffin Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index a8c9b2de28bd..ff4e9884d0bf 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -967,6 +967,7 @@ config FB_S1D13XXX config FB_ATMEL tristate "AT91/AT32 LCD Controller support" depends on FB && HAVE_FB_ATMEL + select FB_BACKLIGHT select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT From e3e11f516398c4274bedea54102505e64f3be558 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 24 Apr 2014 13:28:27 +0100 Subject: [PATCH 17/31] video/nuc900: allow modular build The frame buffer core may be a loadable module, and in this case, the nuc900 driver cannot be built-in. Turning it into a tristate option lets Kconfig work out the dependency and avoid broken builds. Signed-off-by: Arnd Bergmann Signed-off-by: Peter Griffin Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: Wan ZongShun Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index ff4e9884d0bf..1cea2a8eaacb 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2065,7 +2065,7 @@ config FB_S3C2410_DEBUG through sysfs config FB_NUC900 - bool "NUC900 LCD framebuffer support" + tristate "NUC900 LCD framebuffer support" depends on FB && ARCH_W90X900 select FB_CFB_FILLRECT select FB_CFB_COPYAREA From c58f66165d74cf48cd63f3ede137e1d2b7843f88 Mon Sep 17 00:00:00 2001 From: Denis Carikli Date: Fri, 14 Mar 2014 10:12:45 +0100 Subject: [PATCH 18/31] video: mx3fb: Use devm_kzalloc Replace kzalloc by devm_kzalloc and remove the kfree() calls. Signed-off-by: Denis Carikli Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/mx3fb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c index 142e860fb527..ee95de80a487 100644 --- a/drivers/video/fbdev/mx3fb.c +++ b/drivers/video/fbdev/mx3fb.c @@ -1496,7 +1496,7 @@ static int mx3fb_probe(struct platform_device *pdev) if (!sdc_reg) return -EINVAL; - mx3fb = kzalloc(sizeof(*mx3fb), GFP_KERNEL); + mx3fb = devm_kzalloc(&pdev->dev, sizeof(*mx3fb), GFP_KERNEL); if (!mx3fb) return -ENOMEM; @@ -1542,7 +1542,6 @@ ersdc0: dmaengine_put(); iounmap(mx3fb->reg_base); eremap: - kfree(mx3fb); dev_err(dev, "mx3fb: failed to register fb\n"); return ret; } @@ -1561,7 +1560,6 @@ static int mx3fb_remove(struct platform_device *dev) dmaengine_put(); iounmap(mx3fb->reg_base); - kfree(mx3fb); return 0; } From 5fb7652bebeac56769b8ae4d98990f4c508319cd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 8 Apr 2014 12:00:56 +0200 Subject: [PATCH 19/31] video: exynos: Add a dependency to the menu All drivers under menu EXYNOS_VIDEO depend on either ARCH_S5PV210 or ARCH_EXYNOS, so add these as dependencies to the menu itself. This avoids presenting an empty and useless menu on other architectures. Then drivers under the menu only need a dependency if they depend on one of the supported architectures specifically. Signed-off-by: Jean Delvare Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: Kukjin Kim Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/exynos/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/exynos/Kconfig b/drivers/video/fbdev/exynos/Kconfig index fcf2d48ac6d1..1f16b4678c71 100644 --- a/drivers/video/fbdev/exynos/Kconfig +++ b/drivers/video/fbdev/exynos/Kconfig @@ -4,6 +4,7 @@ menuconfig EXYNOS_VIDEO bool "Exynos Video driver support" + depends on ARCH_S5PV210 || ARCH_EXYNOS help This enables support for EXYNOS Video device. @@ -15,7 +16,6 @@ if EXYNOS_VIDEO config EXYNOS_MIPI_DSI bool "EXYNOS MIPI DSI driver support." - depends on ARCH_S5PV210 || ARCH_EXYNOS select GENERIC_PHY help This enables support for MIPI-DSI device. From 632de707b7194b95d60888e31325e21f7458aa64 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 23 Apr 2014 12:42:10 +0200 Subject: [PATCH 20/31] video: Kconfig: Add a dependency to the Goldfish framebuffer driver All other Goldfish drivers depend on GOLDFISH, I see no reason why the framebuffer driver would be an exception. Signed-off-by: Jean Delvare Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 1cea2a8eaacb..96f0f42d53bc 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2172,7 +2172,7 @@ config FB_XILINX config FB_GOLDFISH tristate "Goldfish Framebuffer" - depends on FB && HAS_DMA + depends on FB && HAS_DMA && (GOLDFISH || COMPILE_TEST) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT From 7a966fbd78683fe4ff7f019fd80fc08d9753880b Mon Sep 17 00:00:00 2001 From: Masami Ichikawa Date: Wed, 23 Apr 2014 23:35:22 +0900 Subject: [PATCH 21/31] fbcon: Fix memory leak in con2fb_release_oldinfo() kmemleak reported a memory leak as below. unreferenced object 0xffff8800dab6d8d8 (size 96): comm "swapper/0", pid 1, jiffies 4294877598 (age 38.483s) hex dump (first 32 bytes): 00 00 00 00 00 01 00 00 08 00 00 00 10 00 00 00 ................ 07 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................ backtrace: [] kmemleak_alloc+0x4e/0xb0 [] __kmalloc+0x280/0x320 [] soft_cursor+0x231/0x290 [] bit_cursor+0x613/0x650 [] fbcon_cursor+0x13b/0x1c0 [] hide_cursor+0x28/0xa0 [] redraw_screen+0x168/0x240 [] fbcon_prepare_logo+0x381/0x420 [] fbcon_init+0x34e/0x590 [] visual_init+0xb8/0x120 [] do_bind_con_driver+0x163/0x380 [] do_take_over_console+0x114/0x1c0 [] do_fbcon_takeover+0x63/0xd0 [] fbcon_event_notify+0x68d/0x7e0 [] notifier_call_chain+0x4c/0x70 [] __blocking_notifier_call_chain+0x4d/0x70 This memory leak cause is, fbcon_ops's cursor_src is allocated in soft_cursor() but not released in con2fb_release_oldinfo(). so, cursor_src is needed to be released when oldinfo is going to be released. Signed-off-by: Masami Ichikawa Signed-off-by: Tomi Valkeinen --- drivers/video/console/fbcon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index f447734b09b4..57b1d44acbfe 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -748,6 +748,7 @@ static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo, fbcon_del_cursor_timer(oldinfo); kfree(ops->cursor_state.mask); kfree(ops->cursor_data); + kfree(ops->cursor_src); kfree(ops->fontbuffer); kfree(oldinfo->fbcon_par); oldinfo->fbcon_par = NULL; From 34bdb666f4b225471f1b57f8c5313feda8ff3c92 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Fri, 25 Apr 2014 22:15:11 +0200 Subject: [PATCH 22/31] fbdev: fbmem: remove positive test on unsigned values fb_image.dx, fb_image.dy and fbconf2bmap.framebuffer are __u32 Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: Andrew Morton Signed-off-by: Fabian Frederick Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/core/fbmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 479fe2a5269c..b5e85f6c1c26 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -433,7 +433,7 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, image->dx += image->width + 8; } } else if (rotate == FB_ROTATE_UD) { - for (x = 0; x < num && image->dx >= 0; x++) { + for (x = 0; x < num; x++) { info->fbops->fb_imageblit(info, image); image->dx -= image->width + 8; } @@ -445,7 +445,7 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, image->dy += image->height + 8; } } else if (rotate == FB_ROTATE_CCW) { - for (x = 0; x < num && image->dy >= 0; x++) { + for (x = 0; x < num; x++) { info->fbops->fb_imageblit(info, image); image->dy -= image->height + 8; } @@ -1180,7 +1180,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd, return -EFAULT; if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) return -EINVAL; - if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) + if (con2fb.framebuffer >= FB_MAX) return -EINVAL; if (!registered_fb[con2fb.framebuffer]) request_module("fb%d", con2fb.framebuffer); From dc42715fafed88f44e01eadb965fafa3ceea72bc Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Tue, 13 May 2014 14:58:21 +0200 Subject: [PATCH 23/31] video: of: display_timing: remove two unsafe error messages The error message would try to dereference the pointer that just has been tested to be NULL. As those messages don't really add any value without the info that the np could provide, just remove them. Signed-off-by: Lucas Stach Signed-off-by: Tomi Valkeinen --- drivers/video/of_display_timing.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index ba5b40f581f6..3dc93cfacd47 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -115,10 +115,8 @@ int of_get_display_timing(struct device_node *np, const char *name, { struct device_node *timing_np; - if (!np) { - pr_err("%s: no devicenode given\n", of_node_full_name(np)); + if (!np) return -EINVAL; - } timing_np = of_get_child_by_name(np, name); if (!timing_np) { @@ -142,10 +140,8 @@ struct display_timings *of_get_display_timings(struct device_node *np) struct device_node *native_mode; struct display_timings *disp; - if (!np) { - pr_err("%s: no device node given\n", of_node_full_name(np)); + if (!np) return NULL; - } timings_np = of_get_child_by_name(np, "display-timings"); if (!timings_np) { From 7ceb1892c04c6c27765cc6139d6057b72dc86e95 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Sat, 10 May 2014 01:52:44 +0300 Subject: [PATCH 24/31] video: omap: delete support for early fbmem allocation Commit 1e434f9318efc3dddc0c0b8d2071712668154c2b (OMAPFB: remove early mem alloc from old omapfb) deleted the support for early fbmem allocation from the platform code, but some code still remains in the driver side. Delete this code now, as it repotedly causes build issues on !MMU. The patch was tested on Amstrad E3 and Nokia 770 and framebuffer functionality is not affected. Signed-off-by: Aaro Koskinen Acked-by: Tony Lindgren Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/omap/lcdc.c | 67 +-------------------------------- 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/drivers/video/fbdev/omap/lcdc.c b/drivers/video/fbdev/omap/lcdc.c index b52f62595f65..6efa2591eaa8 100644 --- a/drivers/video/fbdev/omap/lcdc.c +++ b/drivers/video/fbdev/omap/lcdc.c @@ -74,7 +74,6 @@ static struct omap_lcd_controller { void (*dma_callback)(void *data); void *dma_callback_data; - int fbmem_allocated; dma_addr_t vram_phys; void *vram_virt; unsigned long vram_size; @@ -611,42 +610,6 @@ static void lcdc_dma_handler(u16 status, void *data) lcdc.dma_callback(lcdc.dma_callback_data); } -static int mmap_kern(void) -{ - struct vm_struct *kvma; - struct vm_area_struct vma; - pgprot_t pgprot; - unsigned long vaddr; - - kvma = get_vm_area(lcdc.vram_size, VM_IOREMAP); - if (kvma == NULL) { - dev_err(lcdc.fbdev->dev, "can't get kernel vm area\n"); - return -ENOMEM; - } - vma.vm_mm = &init_mm; - - vaddr = (unsigned long)kvma->addr; - vma.vm_start = vaddr; - vma.vm_end = vaddr + lcdc.vram_size; - - pgprot = pgprot_writecombine(pgprot_kernel); - if (io_remap_pfn_range(&vma, vaddr, - lcdc.vram_phys >> PAGE_SHIFT, - lcdc.vram_size, pgprot) < 0) { - dev_err(lcdc.fbdev->dev, "kernel mmap for FB memory failed\n"); - return -EAGAIN; - } - - lcdc.vram_virt = (void *)vaddr; - - return 0; -} - -static void unmap_kern(void) -{ - vunmap(lcdc.vram_virt); -} - static int alloc_palette_ram(void) { lcdc.palette_virt = dma_alloc_writecombine(lcdc.fbdev->dev, @@ -703,8 +666,6 @@ static void free_fbmem(void) static int setup_fbmem(struct omapfb_mem_desc *req_md) { - int r; - if (!req_md->region_cnt) { dev_err(lcdc.fbdev->dev, "no memory regions defined\n"); return -EINVAL; @@ -715,31 +676,7 @@ static int setup_fbmem(struct omapfb_mem_desc *req_md) req_md->region_cnt = 1; } - if (req_md->region[0].paddr == 0) { - lcdc.fbmem_allocated = 1; - if ((r = alloc_fbmem(&req_md->region[0])) < 0) - return r; - return 0; - } - - lcdc.vram_phys = req_md->region[0].paddr; - lcdc.vram_size = req_md->region[0].size; - - if ((r = mmap_kern()) < 0) - return r; - - dev_dbg(lcdc.fbdev->dev, "vram at %08x size %08lx mapped to 0x%p\n", - lcdc.vram_phys, lcdc.vram_size, lcdc.vram_virt); - - return 0; -} - -static void cleanup_fbmem(void) -{ - if (lcdc.fbmem_allocated) - free_fbmem(); - else - unmap_kern(); + return alloc_fbmem(&req_md->region[0]); } static int omap_lcdc_init(struct omapfb_device *fbdev, int ext_mode, @@ -833,7 +770,7 @@ static void omap_lcdc_cleanup(void) { if (!lcdc.ext_mode) free_palette_ram(); - cleanup_fbmem(); + free_fbmem(); omap_free_lcd_dma(); free_irq(OMAP_LCDC_IRQ, lcdc.fbdev); clk_disable(lcdc.lcd_ck); From 7edaa761ee81bf28804e45d405f163dea26bfa7f Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Mon, 12 May 2014 08:34:14 +0200 Subject: [PATCH 25/31] video: mx3fb: Add backlight control support This patch add backlight control support to allow dimming the backlight using the internal PWM. Currently the brightness is set fixed to a maximum of 255. Signed-off-by: Alexander Stein Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/Kconfig | 1 + drivers/video/fbdev/mx3fb.c | 81 +++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 96f0f42d53bc..59c98bfd5a8a 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2336,6 +2336,7 @@ config FB_MX3 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select BACKLIGHT_CLASS_DEVICE default y help This is a framebuffer device for the i.MX31 LCD Controller. So diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c index ee95de80a487..c645a0a0c341 100644 --- a/drivers/video/fbdev/mx3fb.c +++ b/drivers/video/fbdev/mx3fb.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -241,6 +242,7 @@ struct mx3fb_data { void __iomem *reg_base; spinlock_t lock; struct device *dev; + struct backlight_device *bl; uint32_t h_start_width; uint32_t v_start_width; @@ -271,6 +273,71 @@ struct mx3fb_info { struct fb_var_screeninfo cur_var; /* current var info */ }; +static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value); +static u32 sdc_get_brightness(struct mx3fb_data *mx3fb); + +static int mx3fb_bl_get_brightness(struct backlight_device *bl) +{ + struct mx3fb_data *fbd = bl_get_data(bl); + + return sdc_get_brightness(fbd); +} + +static int mx3fb_bl_update_status(struct backlight_device *bl) +{ + struct mx3fb_data *fbd = bl_get_data(bl); + int brightness = bl->props.brightness; + + if (bl->props.power != FB_BLANK_UNBLANK) + brightness = 0; + if (bl->props.fb_blank != FB_BLANK_UNBLANK) + brightness = 0; + + fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness; + + sdc_set_brightness(fbd, fbd->backlight_level); + + return 0; +} + +static const struct backlight_ops mx3fb_lcdc_bl_ops = { + .update_status = mx3fb_bl_update_status, + .get_brightness = mx3fb_bl_get_brightness, +}; + +static void mx3fb_init_backlight(struct mx3fb_data *fbd) +{ + struct backlight_properties props; + struct backlight_device *bl; + + if (fbd->bl) + return; + + memset(&props, 0, sizeof(struct backlight_properties)); + props.max_brightness = 0xff; + props.type = BACKLIGHT_RAW; + sdc_set_brightness(fbd, fbd->backlight_level); + + bl = backlight_device_register("mx3fb-bl", fbd->dev, fbd, + &mx3fb_lcdc_bl_ops, &props); + if (IS_ERR(bl)) { + dev_err(fbd->dev, "error %ld on backlight register\n", + PTR_ERR(bl)); + return; + } + + fbd->bl = bl; + bl->props.power = FB_BLANK_UNBLANK; + bl->props.fb_blank = FB_BLANK_UNBLANK; + bl->props.brightness = mx3fb_bl_get_brightness(bl); +} + +static void mx3fb_exit_backlight(struct mx3fb_data *fbd) +{ + if (fbd->bl) + backlight_device_unregister(fbd->bl); +} + static void mx3fb_dma_done(void *); /* Used fb-mode and bpp. Can be set on kernel command line, therefore file-static. */ @@ -628,6 +695,16 @@ static int sdc_set_global_alpha(struct mx3fb_data *mx3fb, bool enable, uint8_t a return 0; } +static u32 sdc_get_brightness(struct mx3fb_data *mx3fb) +{ + u32 brightness; + + brightness = mx3fb_read_reg(mx3fb, SDC_PWM_CTRL); + brightness = (brightness >> 16) & 0xFF; + + return brightness; +} + static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value) { dev_dbg(mx3fb->dev, "%s: value = %d\n", __func__, value); @@ -1534,6 +1611,8 @@ static int mx3fb_probe(struct platform_device *pdev) if (ret < 0) goto eisdc0; + mx3fb_init_backlight(mx3fb); + return 0; eisdc0: @@ -1556,6 +1635,8 @@ static int mx3fb_remove(struct platform_device *dev) chan = &mx3_fbi->idmac_channel->dma_chan; release_fbi(fbi); + mx3fb_exit_backlight(mx3fb); + dma_release_channel(chan); dmaengine_put(); From 3f513f4cc4f9620fb47b30de573d71091ea68026 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Sat, 17 May 2014 08:32:49 +0200 Subject: [PATCH 26/31] video: delete unneeded call to platform_get_drvdata Platform_get_drvdata is an accessor function, and has no purpose if its result is not used. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; type T; @@ - T x = platform_get_drvdata(...); ... when != x // Signed-off-by: Julia Lawall Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/bf54x-lq043fb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/video/fbdev/bf54x-lq043fb.c b/drivers/video/fbdev/bf54x-lq043fb.c index e2c42ad8515a..adbef542c998 100644 --- a/drivers/video/fbdev/bf54x-lq043fb.c +++ b/drivers/video/fbdev/bf54x-lq043fb.c @@ -717,8 +717,6 @@ static int bfin_bf54x_remove(struct platform_device *pdev) #ifdef CONFIG_PM static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state) { - struct fb_info *fbinfo = platform_get_drvdata(pdev); - bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN); disable_dma(CH_EPPI0); bfin_write_EPPI0_STATUS(0xFFFF); From 80c68c1e2e801a14d718f2ab9690398a864aa37c Mon Sep 17 00:00:00 2001 From: Boris BREZILLON Date: Fri, 9 May 2014 15:53:12 +0200 Subject: [PATCH 27/31] video: of: display_timing: fix default native-mode setting Set native mode to the first child node of the display-timings node and not the first child node of the display-timings parent node. Signed-off-by: Boris BREZILLON Signed-off-by: Tomi Valkeinen --- drivers/video/of_display_timing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 3dc93cfacd47..987edf110038 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -160,7 +160,7 @@ struct display_timings *of_get_display_timings(struct device_node *np) entry = of_parse_phandle(timings_np, "native-mode", 0); /* assume first child as native mode if none provided */ if (!entry) - entry = of_get_next_child(np, NULL); + entry = of_get_next_child(timings_np, NULL); /* if there is no child, it is useless to go on */ if (!entry) { pr_err("%s: no timing specifications given\n", From 972754cfaee94d6e25acf94a497bc0a864d91b7e Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Thu, 15 May 2014 06:58:24 -0400 Subject: [PATCH 28/31] matroxfb: perform a dummy read of M_STATUS I had occasional screen corruption with the matrox framebuffer driver and I found out that the reason for the corruption is that the hardware blitter accesses the videoram while it is being written to. The matrox driver has a macro WaitTillIdle() that should wait until the blitter is idle, but it sometimes doesn't work. I added a dummy read mga_inl(M_STATUS) to WaitTillIdle() to fix the problem. The dummy read will flush the write buffer in the PCI chipset, and the next read of M_STATUS will return the hardware status. Since applying this patch, I had no screen corruption at all. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/matrox/matroxfb_base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/matrox/matroxfb_base.h b/drivers/video/fbdev/matrox/matroxfb_base.h index 556d96ce40bf..89a8a89a5eb2 100644 --- a/drivers/video/fbdev/matrox/matroxfb_base.h +++ b/drivers/video/fbdev/matrox/matroxfb_base.h @@ -698,7 +698,7 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv); #define mga_fifo(n) do {} while ((mga_inl(M_FIFOSTATUS) & 0xFF) < (n)) -#define WaitTillIdle() do {} while (mga_inl(M_STATUS) & 0x10000) +#define WaitTillIdle() do { mga_inl(M_STATUS); do {} while (mga_inl(M_STATUS) & 0x10000); } while (0) /* code speedup */ #ifdef CONFIG_FB_MATROX_MILLENIUM From d9a5f87c8fb49010d4fc1e41e263072b7e9916b1 Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Tue, 20 May 2014 23:35:59 +0200 Subject: [PATCH 29/31] video: fbdev: grvga.c: Fix for possible null pointer dereference There is otherwise a risk of a possible null pointer dereference. Was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/grvga.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/grvga.c b/drivers/video/fbdev/grvga.c index c078701f15f6..2db5bb1a33e8 100644 --- a/drivers/video/fbdev/grvga.c +++ b/drivers/video/fbdev/grvga.c @@ -514,9 +514,10 @@ free_fb: static int grvga_remove(struct platform_device *device) { struct fb_info *info = dev_get_drvdata(&device->dev); - struct grvga_par *par = info->par; + struct grvga_par *par; if (info) { + par = info->par; unregister_framebuffer(info); fb_dealloc_cmap(&info->cmap); From 0c641bff31af7326b51cd39739cfc3a2c060f456 Mon Sep 17 00:00:00 2001 From: Rickard Strandqvist Date: Tue, 20 May 2014 23:37:32 +0200 Subject: [PATCH 30/31] video: fbdev: s3fb.c: Fix for possible null pointer dereference There is otherwise a risk of a possible null pointer dereference. Was largely found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/s3fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c index 9a3f8f1c6aab..c43b969e1e23 100644 --- a/drivers/video/fbdev/s3fb.c +++ b/drivers/video/fbdev/s3fb.c @@ -1401,9 +1401,10 @@ err_enable_device: static void s3_pci_remove(struct pci_dev *dev) { struct fb_info *info = pci_get_drvdata(dev); - struct s3fb_info __maybe_unused *par = info->par; + struct s3fb_info __maybe_unused *par; if (info) { + par = info->par; #ifdef CONFIG_MTRR if (par->mtrr_reg >= 0) { From fbc6c4a13bbfb420eedfdb26a0a859f9c07e8a7b Mon Sep 17 00:00:00 2001 From: Zhichuang SUN Date: Wed, 21 May 2014 14:13:30 +0800 Subject: [PATCH 31/31] drivers/video/fbdev/fb-puv3.c: Add header files for function unifb_mmap Function unifb_mmap calls functions which are defined in linux/mm.h and asm/pgtable.h The related error (for unicore32 with unicore32_defconfig): CC drivers/video/fbdev/fb-puv3.o drivers/video/fbdev/fb-puv3.c: In function 'unifb_mmap': drivers/video/fbdev/fb-puv3.c:646: error: implicit declaration of function 'vm_iomap_memory' drivers/video/fbdev/fb-puv3.c:646: error: implicit declaration of function 'pgprot_noncached' Signed-off-by: Zhichuang Sun Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: Jingoo Han Cc: Daniel Vetter Cc: Joe Perches Cc: Laurent Pinchart Cc: linux-fbdev@vger.kernel.org Acked-by: Xuetao Guan Signed-off-by: Tomi Valkeinen --- drivers/video/fbdev/fb-puv3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/fb-puv3.c b/drivers/video/fbdev/fb-puv3.c index 6db9ebd042a3..88fa2e70a0bb 100644 --- a/drivers/video/fbdev/fb-puv3.c +++ b/drivers/video/fbdev/fb-puv3.c @@ -18,8 +18,10 @@ #include #include #include +#include #include +#include #include /* Platform_data reserved for unifb registers. */