From 3b8720e63f4a1fc6f422a49ecbaa3b59c86d5aaf Mon Sep 17 00:00:00 2001 From: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Sun, 21 Jul 2019 22:19:56 +0200 Subject: fbdev: Ditch fb_edid_add_monspecs It's dead code ever since commit 34280340b1dc74c521e636f45cd728f9abf56ee2 Author: Geert Uytterhoeven <geert+renesas@glider.be> Date: Fri Dec 4 17:01:43 2015 +0100 fbdev: Remove unused SH-Mobile HDMI driver Also with this gone we can remove the cea_modes db. This entire thing is massively incomplete anyway, compared to the CEA parsing that drm_edid.c does. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Tavis Ormandy <taviso@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190721201956.941-1-daniel.vetter@ffwll.ch --- drivers/video/fbdev/core/fbmon.c | 96 --------------------------------------- drivers/video/fbdev/core/modedb.c | 57 ----------------------- 2 files changed, 153 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c index 3558a70a6664..8e2e19f3bf44 100644 --- a/drivers/video/fbdev/core/fbmon.c +++ b/drivers/video/fbdev/core/fbmon.c @@ -999,98 +999,6 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) DPRINTK("========================================\n"); } -/** - * fb_edid_add_monspecs() - add monitor video modes from E-EDID data - * @edid: 128 byte array with an E-EDID block - * @spacs: monitor specs to be extended - */ -void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) -{ - unsigned char *block; - struct fb_videomode *m; - int num = 0, i; - u8 svd[64], edt[(128 - 4) / DETAILED_TIMING_DESCRIPTION_SIZE]; - u8 pos = 4, svd_n = 0; - - if (!edid) - return; - - if (!edid_checksum(edid)) - return; - - if (edid[0] != 0x2 || - edid[2] < 4 || edid[2] > 128 - DETAILED_TIMING_DESCRIPTION_SIZE) - return; - - DPRINTK(" Short Video Descriptors\n"); - - 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) { - 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; - } - - block = edid + edid[2]; - - DPRINTK(" Extended Detailed Timings\n"); - - for (i = 0; i < (128 - edid[2]) / DETAILED_TIMING_DESCRIPTION_SIZE; - i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) - if (PIXEL_CLOCK != 0) - edt[num++] = block - edid; - - /* Yikes, EDID data is totally useless */ - if (!(num + svd_n)) - return; - - m = kcalloc(specs->modedb_len + num + svd_n, - sizeof(struct fb_videomode), - GFP_KERNEL); - - if (!m) - return; - - memcpy(m, specs->modedb, specs->modedb_len * sizeof(struct fb_videomode)); - - for (i = specs->modedb_len; i < specs->modedb_len + num; i++) { - get_detailed_timing(edid + edt[i - specs->modedb_len], &m[i]); - if (i == specs->modedb_len) - m[i].flag |= FB_MODE_IS_FIRST; - pr_debug("Adding %ux%u@%u\n", m[i].xres, m[i].yres, m[i].refresh); - } - - for (i = specs->modedb_len + num; i < specs->modedb_len + num + svd_n; i++) { - int idx = svd[i - specs->modedb_len - num]; - if (!idx || idx >= ARRAY_SIZE(cea_modes)) { - pr_warn("Reserved SVD code %d\n", idx); - } else if (!cea_modes[idx].xres) { - pr_warn("Unimplemented SVD code %d\n", idx); - } else { - memcpy(&m[i], cea_modes + idx, sizeof(m[i])); - pr_debug("Adding SVD #%d: %ux%u@%u\n", idx, - m[i].xres, m[i].yres, m[i].refresh); - } - } - - kfree(specs->modedb); - specs->modedb = m; - specs->modedb_len = specs->modedb_len + num + svd_n; -} - /* * VESA Generalized Timing Formula (GTF) */ @@ -1500,9 +1408,6 @@ int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) { } -void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs) -{ -} void fb_destroy_modedb(struct fb_videomode *modedb) { } @@ -1610,7 +1515,6 @@ EXPORT_SYMBOL(fb_firmware_edid); EXPORT_SYMBOL(fb_parse_edid); EXPORT_SYMBOL(fb_edid_to_monspecs); -EXPORT_SYMBOL(fb_edid_add_monspecs); EXPORT_SYMBOL(fb_get_mode); EXPORT_SYMBOL(fb_validate_mode); EXPORT_SYMBOL(fb_destroy_modedb); diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c index ac049871704d..6473e0dfe146 100644 --- a/drivers/video/fbdev/core/modedb.c +++ b/drivers/video/fbdev/core/modedb.c @@ -289,63 +289,6 @@ static const struct fb_videomode modedb[] = { }; #ifdef CONFIG_FB_MODE_HELPERS -const struct fb_videomode cea_modes[65] = { - /* #1: 640x480p@59.94/60Hz */ - [1] = { - NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2, 0, - FB_VMODE_NONINTERLACED, 0, - }, - /* #3: 720x480p@59.94/60Hz */ - [3] = { - NULL, 60, 720, 480, 37037, 60, 16, 30, 9, 62, 6, 0, - FB_VMODE_NONINTERLACED, 0, - }, - /* #5: 1920x1080i@59.94/60Hz */ - [5] = { - NULL, 60, 1920, 1080, 13763, 148, 88, 15, 2, 44, 5, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_INTERLACED, 0, - }, - /* #7: 720(1440)x480iH@59.94/60Hz */ - [7] = { - NULL, 60, 1440, 480, 18554/*37108*/, 114, 38, 15, 4, 124, 3, 0, - FB_VMODE_INTERLACED, 0, - }, - /* #9: 720(1440)x240pH@59.94/60Hz */ - [9] = { - NULL, 60, 1440, 240, 18554, 114, 38, 16, 4, 124, 3, 0, - FB_VMODE_NONINTERLACED, 0, - }, - /* #18: 720x576pH@50Hz */ - [18] = { - NULL, 50, 720, 576, 37037, 68, 12, 39, 5, 64, 5, 0, - FB_VMODE_NONINTERLACED, 0, - }, - /* #19: 1280x720p@50Hz */ - [19] = { - NULL, 50, 1280, 720, 13468, 220, 440, 20, 5, 40, 5, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED, 0, - }, - /* #20: 1920x1080i@50Hz */ - [20] = { - NULL, 50, 1920, 1080, 13480, 148, 528, 15, 5, 528, 5, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_INTERLACED, 0, - }, - /* #32: 1920x1080p@23.98/24Hz */ - [32] = { - NULL, 24, 1920, 1080, 13468, 148, 638, 36, 4, 44, 5, - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - FB_VMODE_NONINTERLACED, 0, - }, - /* #35: (2880)x480p4x@59.94/60Hz */ - [35] = { - NULL, 60, 2880, 480, 9250, 240, 64, 30, 9, 248, 6, 0, - FB_VMODE_NONINTERLACED, 0, - }, -}; - const struct fb_videomode vesa_modes[] = { /* 0 640x350-85 VESA */ { NULL, 85, 640, 350, 31746, 96, 32, 60, 32, 64, 3, -- cgit v1.2.3 From a74cefd915124a16a2956773c30addc58e344047 Mon Sep 17 00:00:00 2001 From: Colin Ian King <colin.king@canonical.com> Date: Mon, 24 Jun 2019 23:37:24 +0100 Subject: fbmem: remove redundant assignment to err Variable err is initialized to a value that is never read and it is re-assigned later. The initialization is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190624223724.13629-1-colin.king@canonical.com --- drivers/video/fbdev/core/fbmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 64dd732021d8..00fe0efeaee9 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1957,7 +1957,7 @@ int fb_new_modelist(struct fb_info *info) struct list_head *pos, *n; struct fb_modelist *modelist; struct fb_videomode *m, mode; - int err = 1; + int err; list_for_each_safe(pos, n, &info->modelist) { modelist = list_entry(pos, struct fb_modelist, list); -- cgit v1.2.3 From 5ae01cba59c63e042080ebccf2bd3406288beaa6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> Date: Tue, 25 Jun 2019 14:13:21 +0200 Subject: au1200fb: don't use DMA_ATTR_NON_CONSISTENT au1200fb allocates DMA memory using DMA_ATTR_NON_CONSISTENT, but never calls dma_cache_sync to synchronize the memory between the CPU and the device. If it was use on a not cache coherent bus that would be fatal, but as far as I can tell from the naming and the mips platform implementation it always is used in cache coherent systems. Remove the DMA_ATTR_NON_CONSISTENT flag, which is a no-op in that case. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Manuel Lauss <manuel.lauss@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190625121321.10197-1-hch@lst.de --- drivers/video/fbdev/au1200fb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 26caffb02b7e..265d3b45efd0 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c @@ -1234,7 +1234,7 @@ static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) struct au1200fb_device *fbdev = info->par; return dma_mmap_attrs(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys, - fbdev->fb_len, DMA_ATTR_NON_CONSISTENT); + fbdev->fb_len, 0); } static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) @@ -1692,8 +1692,7 @@ static int au1200fb_drv_probe(struct platform_device *dev) fbdev->fb_mem = dmam_alloc_attrs(&dev->dev, PAGE_ALIGN(fbdev->fb_len), - &fbdev->fb_phys, GFP_KERNEL, - DMA_ATTR_NON_CONSISTENT); + &fbdev->fb_phys, GFP_KERNEL, 0); if (!fbdev->fb_mem) { print_err("fail to allocate framebuffer (size: %dK))", fbdev->fb_len / 1024); -- cgit v1.2.3 From b519294ee13aee030d6defd009998c84060ab205 Mon Sep 17 00:00:00 2001 From: Souptick Joarder <jrdr.linux@gmail.com> Date: Wed, 10 Jul 2019 23:33:15 +0530 Subject: video: fbdev: nvidia: Remove extra return Minor cleanup to remove extra return statement. Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Cc: Antonino Daplas <adaplas@gmail.com> Cc: Sabyasachi Gupta <sabyasachi.linux@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/1562781795-3494-1-git-send-email-jrdr.linux@gmail.com --- drivers/video/fbdev/nvidia/nv_backlight.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/nvidia/nv_backlight.c b/drivers/video/fbdev/nvidia/nv_backlight.c index e705a7872301..2ce53529f636 100644 --- a/drivers/video/fbdev/nvidia/nv_backlight.c +++ b/drivers/video/fbdev/nvidia/nv_backlight.c @@ -123,8 +123,6 @@ void nvidia_bl_init(struct nvidia_par *par) printk("nvidia: Backlight initialized (%s)\n", name); - return; - error: return; } -- cgit v1.2.3 From 9b9f35e7c6594b109ee4d70c3fd19a82ff88e8a6 Mon Sep 17 00:00:00 2001 From: Souptick Joarder <jrdr.linux@gmail.com> Date: Wed, 10 Jul 2019 23:46:26 +0530 Subject: video: fbdev: nvidia: Remove dead code This is dead code since 3.15. If there is no plan to use it further, this can be removed forever. Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Cc: Antonino Daplas <adaplas@gmail.com> Cc: Sabyasachi Gupta <sabyasachi.linux@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/1562782586-3994-1-git-send-email-jrdr.linux@gmail.com --- drivers/video/fbdev/nvidia/nv_setup.c | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/nvidia/nv_setup.c b/drivers/video/fbdev/nvidia/nv_setup.c index b17acd290360..2fa68669613a 100644 --- a/drivers/video/fbdev/nvidia/nv_setup.c +++ b/drivers/video/fbdev/nvidia/nv_setup.c @@ -119,34 +119,10 @@ u8 NVReadMiscOut(struct nvidia_par *par) { return (VGA_RD08(par->PVIO, VGA_MIS_R)); } -#if 0 -void NVEnablePalette(struct nvidia_par *par) -{ - volatile u8 tmp; - - tmp = VGA_RD08(par->PCIO, par->IOBase + 0x0a); - VGA_WR08(par->PCIO, VGA_ATT_IW, 0x00); - par->paletteEnabled = 1; -} -void NVDisablePalette(struct nvidia_par *par) -{ - volatile u8 tmp; - - tmp = VGA_RD08(par->PCIO, par->IOBase + 0x0a); - VGA_WR08(par->PCIO, VGA_ATT_IW, 0x20); - par->paletteEnabled = 0; -} -#endif /* 0 */ void NVWriteDacMask(struct nvidia_par *par, u8 value) { VGA_WR08(par->PDIO, VGA_PEL_MSK, value); } -#if 0 -u8 NVReadDacMask(struct nvidia_par *par) -{ - return (VGA_RD08(par->PDIO, VGA_PEL_MSK)); -} -#endif /* 0 */ void NVWriteDacReadAddr(struct nvidia_par *par, u8 value) { VGA_WR08(par->PDIO, VGA_PEL_IR, value); -- cgit v1.2.3 From 8cbff03bb090d537063c935058ab6fceb8ee30f5 Mon Sep 17 00:00:00 2001 From: Fuqian Huang <huangfq.daxian@gmail.com> Date: Mon, 15 Jul 2019 11:20:17 +0800 Subject: video: fbdev-MMP: Remove call to memset after dma_alloc_coherent In commit 518a2f1925c3 ("dma-mapping: zero memory returned from dma_alloc_*"), dma_alloc_coherent has already zeroed the memory. So memset is not needed. Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190715032017.7311-1-huangfq.daxian@gmail.com --- drivers/video/fbdev/mmp/fb/mmpfb.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c index e5b56f2199df..47bc7c59bbd8 100644 --- a/drivers/video/fbdev/mmp/fb/mmpfb.c +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c @@ -612,7 +612,6 @@ static int mmpfb_probe(struct platform_device *pdev) ret = -ENOMEM; goto failed_destroy_mutex; } - memset(fbi->fb_start, 0, fbi->fb_size); dev_info(fbi->dev, "fb %dk allocated\n", fbi->fb_size/1024); /* fb power on */ -- cgit v1.2.3 From ed1dc7d565788eb2b378360c79d7060ad2d41770 Mon Sep 17 00:00:00 2001 From: Marko Kohtala <marko.kohtala@okoko.fi> Date: Tue, 18 Jun 2019 10:41:06 +0300 Subject: video: ssd1307fb: Use screen_buffer instead of screen_base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sparse reported incorrect type due to different address spaces. The screen_base is __iomem, but the memory is not from a device so we can use screen_buffer instead and avoid some type casts. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-2-marko.kohtala@okoko.fi --- drivers/video/fbdev/ssd1307fb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index b674948e3bb8..0597f24bd5be 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -149,7 +149,7 @@ static inline int ssd1307fb_write_cmd(struct i2c_client *client, u8 cmd) static void ssd1307fb_update_display(struct ssd1307fb_par *par) { struct ssd1307fb_array *array; - u8 *vmem = par->info->screen_base; + u8 *vmem = par->info->screen_buffer; int i, j, k; array = ssd1307fb_alloc_array(par->width * par->height / 8, @@ -212,7 +212,7 @@ static ssize_t ssd1307fb_write(struct fb_info *info, const char __user *buf, struct ssd1307fb_par *par = info->par; unsigned long total_size; unsigned long p = *ppos; - u8 __iomem *dst; + void *dst; total_size = info->fix.smem_len; @@ -225,7 +225,7 @@ static ssize_t ssd1307fb_write(struct fb_info *info, const char __user *buf, if (!count) return -EINVAL; - dst = (void __force *) (info->screen_base + p); + dst = info->screen_buffer + p; if (copy_from_user(dst, buf, count)) return -EFAULT; @@ -546,7 +546,7 @@ static int ssd1307fb_probe(struct i2c_client *client, struct fb_deferred_io *ssd1307fb_defio; u32 vmem_size; struct ssd1307fb_par *par; - u8 *vmem; + void *vmem; int ret; if (!node) { @@ -654,7 +654,7 @@ static int ssd1307fb_probe(struct i2c_client *client, info->var.blue.length = 1; info->var.blue.offset = 0; - info->screen_base = (u8 __force __iomem *)vmem; + info->screen_buffer = vmem; info->fix.smem_start = __pa(vmem); info->fix.smem_len = vmem_size; -- cgit v1.2.3 From 6bc9431111be1d4c23ceb0b7c10c0ce09d1c9e9d Mon Sep 17 00:00:00 2001 From: Marko Kohtala <marko.kohtala@okoko.fi> Date: Tue, 18 Jun 2019 10:41:07 +0300 Subject: video: ssd1307fb: Remove unneeded semicolons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit coccicheck reported unneeded semicolons. Remove them. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-3-marko.kohtala@okoko.fi --- drivers/video/fbdev/ssd1307fb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 0597f24bd5be..c03940b03f95 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -312,7 +312,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) dev_dbg(&par->client->dev, "Using PWM%d with a %dns period.\n", par->pwm->pwm, par->pwm_period); - }; + } /* Set initial contrast */ ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CONTRAST); @@ -328,7 +328,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SEG_REMAP_ON); if (ret < 0) return ret; - }; + } /* Set COM direction */ com_invdir = 0xc0 | (par->com_invdir & 0x1) << 3; @@ -713,7 +713,7 @@ panel_init_error: if (par->device_info->need_pwm) { pwm_disable(par->pwm); pwm_put(par->pwm); - }; + } regulator_enable_error: if (par->vbat_reg) regulator_disable(par->vbat_reg); @@ -737,7 +737,7 @@ static int ssd1307fb_remove(struct i2c_client *client) if (par->device_info->need_pwm) { pwm_disable(par->pwm); pwm_put(par->pwm); - }; + } fb_deferred_io_cleanup(info); __free_pages(__va(info->fix.smem_start), get_order(info->fix.smem_len)); framebuffer_release(info); -- cgit v1.2.3 From dd9782834dd9dde3624ff1acea8859f3d3e792d4 Mon Sep 17 00:00:00 2001 From: Marko Kohtala <marko.kohtala@okoko.fi> Date: Tue, 18 Jun 2019 10:41:08 +0300 Subject: video: ssd1307fb: Start page range at page_offset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The page_offset was only applied to the end of the page range. This caused the display updates to cause a scrolling effect on the display because the amount of data written to the display did not match the range display expected. Fixes: 301bc0675b67 ("video: ssd1307fb: Make use of horizontal addressing mode") Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-4-marko.kohtala@okoko.fi --- drivers/video/fbdev/ssd1307fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index c03940b03f95..4f911480f2eb 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -432,7 +432,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) if (ret < 0) return ret; - ret = ssd1307fb_write_cmd(par->client, 0x0); + ret = ssd1307fb_write_cmd(par->client, par->page_offset); if (ret < 0) return ret; -- cgit v1.2.3 From b0020d8af991a904de57dbd9a7bc7a61982a6a8c Mon Sep 17 00:00:00 2001 From: Marko Kohtala <marko.kohtala@okoko.fi> Date: Tue, 18 Jun 2019 10:41:09 +0300 Subject: video: ssd1307fb: Handle width and height that are not multiple of 8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some displays have dimensions that are not multiple of eight, for example height of 36, but the driver divided the dimensions by 8. Defining display to the next multiple of 8 is not good as then the display registers get configured to dimensions that do not match. This contradicts intructions by some display manufacturers. Use DIV_ROUND_UP to multiple of 8 when needed so correct values can be used. The ssd1307fb_update_display bit reordering receives a simplification in the process. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-5-marko.kohtala@okoko.fi --- drivers/video/fbdev/ssd1307fb.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 4f911480f2eb..8e0720444467 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -150,10 +150,11 @@ static void ssd1307fb_update_display(struct ssd1307fb_par *par) { struct ssd1307fb_array *array; u8 *vmem = par->info->screen_buffer; + unsigned int line_length = par->info->fix.line_length; + unsigned int pages = DIV_ROUND_UP(par->height, 8); int i, j, k; - array = ssd1307fb_alloc_array(par->width * par->height / 8, - SSD1307FB_DATA); + array = ssd1307fb_alloc_array(par->width * pages, SSD1307FB_DATA); if (!array) return; @@ -186,22 +187,24 @@ static void ssd1307fb_update_display(struct ssd1307fb_par *par) * (5) A4 B4 C4 D4 E4 F4 G4 H4 */ - for (i = 0; i < (par->height / 8); i++) { + for (i = 0; i < pages; i++) { for (j = 0; j < par->width; j++) { + int m = 8; u32 array_idx = i * par->width + j; array->data[array_idx] = 0; - for (k = 0; k < 8; k++) { - u32 page_length = par->width * i; - u32 index = page_length + (par->width * k + j) / 8; - u8 byte = *(vmem + index); - u8 bit = byte & (1 << (j % 8)); - bit = bit >> (j % 8); + /* Last page may be partial */ + if (i + 1 == pages && par->height % 8) + m = par->height % 8; + for (k = 0; k < m; k++) { + u8 byte = vmem[(8 * i + k) * line_length + + j / 8]; + u8 bit = (byte >> (j % 8)) & 1; array->data[array_idx] |= bit << k; } } } - ssd1307fb_write_array(par->client, array, par->width * par->height / 8); + ssd1307fb_write_array(par->client, array, par->width * pages); kfree(array); } @@ -437,7 +440,8 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) return ret; ret = ssd1307fb_write_cmd(par->client, - par->page_offset + (par->height / 8) - 1); + par->page_offset + + DIV_ROUND_UP(par->height, 8) - 1); if (ret < 0) return ret; @@ -615,7 +619,7 @@ static int ssd1307fb_probe(struct i2c_client *client, par->dclk_div = par->device_info->default_dclk_div; par->dclk_frq = par->device_info->default_dclk_frq; - vmem_size = par->width * par->height / 8; + vmem_size = DIV_ROUND_UP(par->width, 8) * par->height; vmem = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, get_order(vmem_size)); @@ -638,7 +642,7 @@ static int ssd1307fb_probe(struct i2c_client *client, info->fbops = &ssd1307fb_ops; info->fix = ssd1307fb_fix; - info->fix.line_length = par->width / 8; + info->fix.line_length = DIV_ROUND_UP(par->width, 8); info->fbdefio = ssd1307fb_defio; info->var = ssd1307fb_var; -- cgit v1.2.3 From de6786bee48e6f29846b7b220ecfea32364117d4 Mon Sep 17 00:00:00 2001 From: Marko Kohtala <marko.kohtala@okoko.fi> Date: Tue, 18 Jun 2019 10:41:11 +0300 Subject: video: ssd1307fb: Add devicetree configuration of display setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Various displays have differences that only mean initializing the display driver IC with different fixed register values. Defining these in devicetree offers easier way to adapt the driver to new displays than requiring a patch to the kernel. This adds devicetree properties needed to make the initialization match the example setup as offered by Densitron for their 128x36 display. It also makes some old one bit parameter handling a little cleaner. Signed-off-by: Marko Kohtala <marko.kohtala@okoko.fi> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Airlie <airlied@linux.ie> Cc: Michal Vokáč <michal.vokac@ysoft.com> [b.zolnierkie: fix parenthesis alignment] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190618074111.9309-7-marko.kohtala@okoko.fi --- drivers/video/fbdev/ssd1307fb.c | 81 +++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 16 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 8e0720444467..78ca7ffc40c2 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -28,6 +28,7 @@ #define SSD1307FB_SET_COL_RANGE 0x21 #define SSD1307FB_SET_PAGE_RANGE 0x22 #define SSD1307FB_CONTRAST 0x81 +#define SSD1307FB_SET_LOOKUP_TABLE 0x91 #define SSD1307FB_CHARGE_PUMP 0x8d #define SSD1307FB_SEG_REMAP_ON 0xa1 #define SSD1307FB_DISPLAY_OFF 0xae @@ -36,6 +37,7 @@ #define SSD1307FB_START_PAGE_ADDRESS 0xb0 #define SSD1307FB_SET_DISPLAY_OFFSET 0xd3 #define SSD1307FB_SET_CLOCK_FREQ 0xd5 +#define SSD1307FB_SET_AREA_COLOR_MODE 0xd8 #define SSD1307FB_SET_PRECHARGE_PERIOD 0xd9 #define SSD1307FB_SET_COM_PINS_CONFIG 0xda #define SSD1307FB_SET_VCOMH 0xdb @@ -58,10 +60,14 @@ struct ssd1307fb_deviceinfo { }; struct ssd1307fb_par { - u32 com_invdir; - u32 com_lrremap; + unsigned area_color_enable : 1; + unsigned com_invdir : 1; + unsigned com_lrremap : 1; + unsigned com_seq : 1; + unsigned lookup_table_set : 1; + unsigned low_power : 1; + unsigned seg_remap : 1; u32 com_offset; - u32 com_seq; u32 contrast; u32 dclk_div; u32 dclk_frq; @@ -69,6 +75,7 @@ struct ssd1307fb_par { struct i2c_client *client; u32 height; struct fb_info *info; + u8 lookup_table[4]; u32 page_offset; u32 prechargep1; u32 prechargep2; @@ -76,7 +83,6 @@ struct ssd1307fb_par { u32 pwm_period; struct gpio_desc *reset; struct regulator *vbat_reg; - u32 seg_remap; u32 vcomh; u32 width; }; @@ -98,6 +104,9 @@ static const struct fb_fix_screeninfo ssd1307fb_fix = { static const struct fb_var_screeninfo ssd1307fb_var = { .bits_per_pixel = 1, + .red = { .length = 1 }, + .green = { .length = 1 }, + .blue = { .length = 1 }, }; static struct ssd1307fb_array *ssd1307fb_alloc_array(u32 len, u8 type) @@ -334,7 +343,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) } /* Set COM direction */ - com_invdir = 0xc0 | (par->com_invdir & 0x1) << 3; + com_invdir = 0xc0 | par->com_invdir << 3; ret = ssd1307fb_write_cmd(par->client, com_invdir); if (ret < 0) return ret; @@ -367,6 +376,22 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) if (ret < 0) return ret; + /* Set Set Area Color Mode ON/OFF & Low Power Display Mode */ + if (par->area_color_enable || par->low_power) { + u32 mode; + + ret = ssd1307fb_write_cmd(par->client, + SSD1307FB_SET_AREA_COLOR_MODE); + if (ret < 0) + return ret; + + mode = (par->area_color_enable ? 0x30 : 0) | + (par->low_power ? 5 : 0); + ret = ssd1307fb_write_cmd(par->client, mode); + if (ret < 0) + return ret; + } + /* Set precharge period in number of ticks from the internal clock */ ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PRECHARGE_PERIOD); if (ret < 0) @@ -382,8 +407,7 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) if (ret < 0) return ret; - compins = 0x02 | !(par->com_seq & 0x1) << 4 - | (par->com_lrremap & 0x1) << 5; + compins = 0x02 | !par->com_seq << 4 | par->com_lrremap << 5; ret = ssd1307fb_write_cmd(par->client, compins); if (ret < 0) return ret; @@ -407,6 +431,28 @@ static int ssd1307fb_init(struct ssd1307fb_par *par) if (ret < 0) return ret; + /* Set lookup table */ + if (par->lookup_table_set) { + int i; + + ret = ssd1307fb_write_cmd(par->client, + SSD1307FB_SET_LOOKUP_TABLE); + if (ret < 0) + return ret; + + for (i = 0; i < ARRAY_SIZE(par->lookup_table); ++i) { + u8 val = par->lookup_table[i]; + + if (val < 31 || val > 63) + dev_warn(&par->client->dev, + "lookup table index %d value out of range 31 <= %d <= 63\n", + i, val); + ret = ssd1307fb_write_cmd(par->client, val); + if (ret < 0) + return ret; + } + } + /* Switch to horizontal addressing mode */ ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_ADDRESS_MODE); if (ret < 0) @@ -607,17 +653,27 @@ static int ssd1307fb_probe(struct i2c_client *client, if (of_property_read_u32(node, "solomon,prechargep2", &par->prechargep2)) par->prechargep2 = 2; + if (!of_property_read_u8_array(node, "solomon,lookup-table", + par->lookup_table, + ARRAY_SIZE(par->lookup_table))) + par->lookup_table_set = 1; + par->seg_remap = !of_property_read_bool(node, "solomon,segment-no-remap"); par->com_seq = of_property_read_bool(node, "solomon,com-seq"); par->com_lrremap = of_property_read_bool(node, "solomon,com-lrremap"); par->com_invdir = of_property_read_bool(node, "solomon,com-invdir"); + par->area_color_enable = + of_property_read_bool(node, "solomon,area-color-enable"); + par->low_power = of_property_read_bool(node, "solomon,low-power"); par->contrast = 127; par->vcomh = par->device_info->default_vcomh; /* Setup display timing */ - par->dclk_div = par->device_info->default_dclk_div; - par->dclk_frq = par->device_info->default_dclk_frq; + if (of_property_read_u32(node, "solomon,dclk-div", &par->dclk_div)) + par->dclk_div = par->device_info->default_dclk_div; + if (of_property_read_u32(node, "solomon,dclk-frq", &par->dclk_frq)) + par->dclk_frq = par->device_info->default_dclk_frq; vmem_size = DIV_ROUND_UP(par->width, 8) * par->height; @@ -651,13 +707,6 @@ static int ssd1307fb_probe(struct i2c_client *client, info->var.yres = par->height; info->var.yres_virtual = par->height; - info->var.red.length = 1; - info->var.red.offset = 0; - info->var.green.length = 1; - info->var.green.offset = 0; - info->var.blue.length = 1; - info->var.blue.offset = 0; - info->screen_buffer = vmem; info->fix.smem_start = __pa(vmem); info->fix.smem_len = vmem_size; -- cgit v1.2.3 From 4faba50edbcc1df467f8f308893edc3fdd95536e Mon Sep 17 00:00:00 2001 From: Douglas Anderson <dianders@chromium.org> Date: Mon, 22 Jul 2019 11:24:36 -0700 Subject: video: of: display_timing: Add of_node_put() in of_get_display_timing() From code inspection it can be seen that of_get_display_timing() is lacking an of_node_put(). Add it. Fixes: ffa3fd21de8a ("videomode: implement public of_get_display_timing()") Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: David Airlie <airlied@linux.ie> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190722182439.44844-2-dianders@chromium.org --- drivers/video/of_display_timing.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index f5c1c469c0af..5eedae0799f0 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -119,6 +119,7 @@ int of_get_display_timing(const struct device_node *np, const char *name, struct display_timing *dt) { struct device_node *timing_np; + int ret; if (!np) return -EINVAL; @@ -129,7 +130,11 @@ int of_get_display_timing(const struct device_node *np, const char *name, return -ENOENT; } - return of_parse_display_timing(timing_np, dt); + ret = of_parse_display_timing(timing_np, dt); + + of_node_put(timing_np); + + return ret; } EXPORT_SYMBOL_GPL(of_get_display_timing); -- cgit v1.2.3 From 892e8ba38f28d68a17122a9e14cf36ea756aa6b8 Mon Sep 17 00:00:00 2001 From: Douglas Anderson <dianders@chromium.org> Date: Mon, 22 Jul 2019 11:24:37 -0700 Subject: video: of: display_timing: Don't yell if no timing node is present There may be cases (like in panel-simple.c) where we have a sane fallback if no timings are specified in the device tree. Let's get rid of the unconditional pr_err(). We can add error messages in individual drivers if it makes sense. NOTE: we'll still print errors if the node is present but there are problems parsing the timings. Fixes: b8a2948fa2b3 ("drm/panel: simple: Add ability to override typical timing") Reported-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: David Airlie <airlied@linux.ie> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190722182439.44844-3-dianders@chromium.org --- drivers/video/of_display_timing.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c index 5eedae0799f0..abc9ada798ee 100644 --- a/drivers/video/of_display_timing.c +++ b/drivers/video/of_display_timing.c @@ -125,10 +125,8 @@ int of_get_display_timing(const struct device_node *np, const char *name, return -EINVAL; timing_np = of_get_child_by_name(np, name); - if (!timing_np) { - pr_err("%pOF: could not find node '%s'\n", np, name); + if (!timing_np) return -ENOENT; - } ret = of_parse_display_timing(timing_np, dt); -- cgit v1.2.3 From 4a6e4ae254e0ad5940067b4576a94ca51d6cea9e Mon Sep 17 00:00:00 2001 From: Douglas Anderson <dianders@chromium.org> Date: Mon, 22 Jul 2019 11:24:39 -0700 Subject: video: amba-clcd: Spout an error if of_get_display_timing() gives an error In the patch ("video: of: display_timing: Don't yell if no timing node is present") we'll stop spouting an error directly in of_get_display_timing() if no node is present. Presumably amba-clcd should take charge of spouting its own error now. NOTE: we'll print two errors if the node was present but there were problems parsing the timing node (one in of_parse_display_timing() and this new one). Since this is a fatal error for the driver's probe (and presumably someone will be debugging), this should be OK. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: David Airlie <airlied@linux.ie> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190722182439.44844-5-dianders@chromium.org --- drivers/video/fbdev/amba-clcd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index 89324e42a033..7de43be6ef2c 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c @@ -561,8 +561,10 @@ static int clcdfb_of_get_dpi_panel_mode(struct device_node *node, struct videomode video; err = of_get_display_timing(node, "panel-timing", &timing); - if (err) + if (err) { + pr_err("%pOF: problems parsing panel-timing (%d)\n", node, err); return err; + } videomode_from_timing(&timing, &video); -- cgit v1.2.3 From e7642f35851da14b78be7a38b0bb0d4068254859 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg <sam@ravnborg.org> Date: Thu, 25 Jul 2019 16:32:24 +0200 Subject: backlight: drop EARLY_EVENT_BLANK support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was no users left - so drop the code to support EARLY_EVENT_BLANK. This patch removes the support in backlight, and drop the notifier in fbmem. That EARLY_EVENT_BLANK is not used can be verified that no driver set any of: lcd_ops.early_set_power() lcd_ops.r_early_set_power() Noticed while browsing backlight code for other reasons. v2: - Fix changelog to say "EARLY_EVENT_BLANK" (Daniel) Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Lee Jones <lee.jones@linaro.org> Cc: Daniel Thompson <daniel.thompson@linaro.org> Cc: Jingoo Han <jingoohan1@gmail.com> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl> Cc: Peter Rosin <peda@axentia.se> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: Lee Jones <lee.jones@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190725143224.GB31803@ravnborg.org --- drivers/video/backlight/lcd.c | 8 -------- drivers/video/fbdev/core/fbmem.c | 12 +----------- include/linux/fb.h | 4 ---- include/linux/lcd.h | 10 ---------- 4 files changed, 1 insertion(+), 33 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c index d6b653aa4ee9..78b033358625 100644 --- a/drivers/video/backlight/lcd.c +++ b/drivers/video/backlight/lcd.c @@ -39,14 +39,6 @@ static int fb_notifier_callback(struct notifier_block *self, if (event == FB_EVENT_BLANK) { if (ld->ops->set_power) ld->ops->set_power(ld, *(int *)evdata->data); - } else if (event == FB_EARLY_EVENT_BLANK) { - if (ld->ops->early_set_power) - ld->ops->early_set_power(ld, - *(int *)evdata->data); - } else if (event == FB_R_EARLY_EVENT_BLANK) { - if (ld->ops->r_early_set_power) - ld->ops->r_early_set_power(ld, - *(int *)evdata->data); } else { if (ld->ops->set_mode) ld->ops->set_mode(ld, evdata->data); diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 00fe0efeaee9..e6a1c805064f 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1058,7 +1058,7 @@ int fb_blank(struct fb_info *info, int blank) { struct fb_event event; - int ret = -EINVAL, early_ret; + int ret = -EINVAL; if (blank > FB_BLANK_POWERDOWN) blank = FB_BLANK_POWERDOWN; @@ -1066,21 +1066,11 @@ fb_blank(struct fb_info *info, int blank) event.info = info; event.data = ␣ - early_ret = fb_notifier_call_chain(FB_EARLY_EVENT_BLANK, &event); - if (info->fbops->fb_blank) ret = info->fbops->fb_blank(blank, info); if (!ret) fb_notifier_call_chain(FB_EVENT_BLANK, &event); - else { - /* - * if fb_blank is failed then revert effects of - * the early blank event. - */ - if (!early_ret) - fb_notifier_call_chain(FB_R_EARLY_EVENT_BLANK, &event); - } return ret; } diff --git a/include/linux/fb.h b/include/linux/fb.h index 50948e519897..756706b666a1 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -135,10 +135,6 @@ struct fb_cursor_user { /* A display blank is requested */ #define FB_EVENT_BLANK 0x09 -/* A hardware display blank early change occurred */ -#define FB_EARLY_EVENT_BLANK 0x10 -/* A hardware display blank revert early change occurred */ -#define FB_R_EARLY_EVENT_BLANK 0x11 struct fb_event { struct fb_info *info; diff --git a/include/linux/lcd.h b/include/linux/lcd.h index 851eee8fff25..238fb1dfed98 100644 --- a/include/linux/lcd.h +++ b/include/linux/lcd.h @@ -41,16 +41,6 @@ struct lcd_ops { /* Get the LCD panel power status (0: full on, 1..3: controller power on, flat panel power off, 4: full off), see FB_BLANK_XXX */ int (*get_power)(struct lcd_device *); - /* - * Enable or disable power to the LCD(0: on; 4: off, see FB_BLANK_XXX) - * and this callback would be called proir to fb driver's callback. - * - * P.S. note that if early_set_power is not NULL then early fb notifier - * would be registered. - */ - int (*early_set_power)(struct lcd_device *, int power); - /* revert the effects of the early blank event. */ - int (*r_early_set_power)(struct lcd_device *, int power); /* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */ int (*set_power)(struct lcd_device *, int power); /* Get the current contrast setting (0-max_contrast) */ -- cgit v1.2.3 From 1e938755fa51673210cd2998230610086fcb5cd6 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Date: Fri, 16 Aug 2019 15:22:27 +0300 Subject: video: omapfb2: Make standard and custom panel drivers mutually exclusive Standard DRM panel drivers for several panels used by omapfb2 are now available. Their module name clashes with the modules from drivers/video/fbdev/omap2/omapfb/displays, part of the deprecated omapfb2 fbdev driver. As omapfb2 can only be compiled when the omapdrm driver is disabled, and the DRM panel drivers are useless in that case, make the omapfb2 panels depend on the standard DRM panels being disabled to fix the name clash. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: dc2e1e5b279966 ("drm/panel: Add driver for the Toppoly TD043MTEA1 panel") Fixes: 415b8dd0871188 ("drm/panel: Add driver for the Toppoly TD028TTEC1 panel") Fixes: 1c8fc3f0c5d280 ("drm/panel: Add driver for the Sony ACX565AKM panel") Fixes: c9cf4c2a3bd35f ("drm/panel: Add driver for the Sharp LS037V7DW01 panel") Fixes: df439abe650177 ("drm/panel: Add driver for the NEC NL8048HL11 panel") Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> [added tags] Link: https://patchwork.freedesktop.org/patch/msgid/20190816122228.9475-2-laurent.pinchart@ideasonboard.com --- drivers/video/fbdev/omap2/omapfb/displays/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/omap2/omapfb/displays/Kconfig b/drivers/video/fbdev/omap2/omapfb/displays/Kconfig index 8c1c5a4cfe18..744416dc530e 100644 --- a/drivers/video/fbdev/omap2/omapfb/displays/Kconfig +++ b/drivers/video/fbdev/omap2/omapfb/displays/Kconfig @@ -49,6 +49,7 @@ config FB_OMAP2_PANEL_DSI_CM config FB_OMAP2_PANEL_SONY_ACX565AKM tristate "ACX565AKM Panel" depends on SPI && BACKLIGHT_CLASS_DEVICE + depends on DRM_PANEL_SONY_ACX565AKM = n help This is the LCD panel used on Nokia N900 @@ -61,18 +62,21 @@ config FB_OMAP2_PANEL_LGPHILIPS_LB035Q02 config FB_OMAP2_PANEL_SHARP_LS037V7DW01 tristate "Sharp LS037V7DW01 LCD Panel" depends on BACKLIGHT_CLASS_DEVICE + depends on DRM_PANEL_SHARP_LS037V7DW01 = n help LCD Panel used in TI's SDP3430 and EVM boards config FB_OMAP2_PANEL_TPO_TD028TTEC1 tristate "TPO TD028TTEC1 LCD Panel" depends on SPI + depends on DRM_PANEL_TPO_TD028TTEC1 = n help LCD panel used in Openmoko. config FB_OMAP2_PANEL_TPO_TD043MTEA1 tristate "TPO TD043MTEA1 LCD Panel" depends on SPI + depends on DRM_PANEL_TPO_TD043MTEA1 = n help LCD Panel used in OMAP3 Pandora @@ -80,6 +84,7 @@ config FB_OMAP2_PANEL_NEC_NL8048HL11 tristate "NEC NL8048HL11 Panel" depends on SPI depends on BACKLIGHT_CLASS_DEVICE + depends on DRM_PANEL_NEC_NL8048HL11 = n help This NEC NL8048HL11 panel is TFT LCD used in the Zoom2/3/3630 sdp boards. -- cgit v1.2.3 From 51677dfcc17f88ed754143df670ff064eae67f84 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> Date: Sun, 21 Jul 2019 15:19:18 +0200 Subject: efifb: BGRT: Improve efifb_bgrt_sanity_check For various reasons, at least with x86 EFI firmwares, the xoffset and yoffset in the BGRT info are not always reliable. Extensive testing has shown that when the info is correct, the BGRT image is always exactly centered horizontally (the yoffset variable is more variable and not always predictable). This commit simplifies / improves the bgrt_sanity_check to simply check that the BGRT image is exactly centered horizontally and skips (re)drawing it when it is not. This fixes the BGRT image sometimes being drawn in the wrong place. Cc: stable@vger.kernel.org Fixes: 88fe4ceb2447 ("efifb: BGRT: Do not copy the boot graphics for non native resolutions") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Cc: Peter Jones <pjones@redhat.com>, Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190721131918.10115-1-hdegoede@redhat.com --- drivers/video/fbdev/efifb.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index 04a22663b4fb..51d97ec4f58f 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -122,28 +122,13 @@ static void efifb_copy_bmp(u8 *src, u32 *dst, int width, struct screen_info *si) */ static bool efifb_bgrt_sanity_check(struct screen_info *si, u32 bmp_width) { - static const int default_resolutions[][2] = { - { 800, 600 }, - { 1024, 768 }, - { 1280, 1024 }, - }; - u32 i, right_margin; - - for (i = 0; i < ARRAY_SIZE(default_resolutions); i++) { - if (default_resolutions[i][0] == si->lfb_width && - default_resolutions[i][1] == si->lfb_height) - break; - } - /* If not a default resolution used for textmode, this should be fine */ - if (i >= ARRAY_SIZE(default_resolutions)) - return true; - - /* If the right margin is 5 times smaller then the left one, reject */ - right_margin = si->lfb_width - (bgrt_tab.image_offset_x + bmp_width); - if (right_margin < (bgrt_tab.image_offset_x / 5)) - return false; + /* + * All x86 firmwares horizontally center the image (the yoffset + * calculations differ between boards, but xoffset is predictable). + */ + u32 expected_xoffset = (si->lfb_width - bmp_width) / 2; - return true; + return bgrt_tab.image_offset_x == expected_xoffset; } #else static bool efifb_bgrt_sanity_check(struct screen_info *si, u32 bmp_width) -- cgit v1.2.3 From dbb4a75b9c405dbd0a53698a6d21626145138193 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" <gustavo@embeddedor.com> Date: Mon, 22 Jul 2019 15:33:58 -0500 Subject: video: fbdev: pvr2fb: remove unnecessary comparison of unsigned integer with < 0 There is no need to compare *var->xoffset* or *var->yoffset* with < 0 because such variables are of type unsigned, making it impossible to hold a negative value. Fix this by removing such comparisons. Addresses-Coverity-ID: 1451964 ("Unsigned compared against 0") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190722203358.GA29111@embeddedor --- drivers/video/fbdev/pvr2fb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/pvr2fb.c b/drivers/video/fbdev/pvr2fb.c index 7ff4b6b84282..0a3b2b7c7891 100644 --- a/drivers/video/fbdev/pvr2fb.c +++ b/drivers/video/fbdev/pvr2fb.c @@ -458,13 +458,11 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) set_color_bitfields(var); if (var->vmode & FB_VMODE_YWRAP) { - if (var->xoffset || var->yoffset < 0 || - var->yoffset >= var->yres_virtual) { + if (var->xoffset || var->yoffset >= var->yres_virtual) { var->xoffset = var->yoffset = 0; } else { if (var->xoffset > var->xres_virtual - var->xres || - var->yoffset > var->yres_virtual - var->yres || - var->xoffset < 0 || var->yoffset < 0) + var->yoffset > var->yres_virtual - var->yres) var->xoffset = var->yoffset = 0; } } else { -- cgit v1.2.3 From 70fc43c0998d52714c80a96d5e74f8b126e1f8b4 Mon Sep 17 00:00:00 2001 From: Chuhong Yuan <hslester96@gmail.com> Date: Wed, 24 Jul 2019 21:17:44 +0800 Subject: video: fbdev: sm712fb: Use dev_get_drvdata Instead of using to_pci_dev + pci_get_drvdata, use dev_get_drvdata to make code simpler. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Cc: Teddy Wang <teddy.wang@siliconmotion.com> [b.zolnierkie: fix patch summary] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190724131744.1709-1-hslester96@gmail.com --- drivers/video/fbdev/sm712fb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c index 7b1b0d8d27a7..207d0add684b 100644 --- a/drivers/video/fbdev/sm712fb.c +++ b/drivers/video/fbdev/sm712fb.c @@ -1694,10 +1694,8 @@ static void smtcfb_pci_remove(struct pci_dev *pdev) static int __maybe_unused smtcfb_pci_suspend(struct device *device) { - struct pci_dev *pdev = to_pci_dev(device); - struct smtcfb_info *sfb; + struct smtcfb_info *sfb = dev_get_drvdata(device); - sfb = pci_get_drvdata(pdev); /* set the hw in sleep mode use external clock and self memory refresh * so that we can turn off internal PLLs later on @@ -1717,10 +1715,8 @@ static int __maybe_unused smtcfb_pci_suspend(struct device *device) static int __maybe_unused smtcfb_pci_resume(struct device *device) { - struct pci_dev *pdev = to_pci_dev(device); - struct smtcfb_info *sfb; + struct smtcfb_info *sfb = dev_get_drvdata(device); - sfb = pci_get_drvdata(pdev); /* reinit hardware */ sm7xx_init_hw(); -- cgit v1.2.3 From af70a48698cad800b2e7e71256fb373707b08959 Mon Sep 17 00:00:00 2001 From: Chuhong Yuan <hslester96@gmail.com> Date: Wed, 24 Jul 2019 21:19:00 +0800 Subject: video: fbdev: radeonfb: Use dev_get_drvdata Instead of using to_pci_dev + pci_get_drvdata, use dev_get_drvdata to make code simpler. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> [b.zolnierkie: fix patch summary and intendation] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190724131900.2039-1-hslester96@gmail.com --- drivers/video/fbdev/aty/radeon_base.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c index 6f891d82eebe..4ca07866f2f6 100644 --- a/drivers/video/fbdev/aty/radeon_base.c +++ b/drivers/video/fbdev/aty/radeon_base.c @@ -2217,8 +2217,7 @@ static ssize_t radeon_show_edid1(struct file *filp, struct kobject *kobj, char *buf, loff_t off, size_t count) { struct device *dev = container_of(kobj, struct device, kobj); - struct pci_dev *pdev = to_pci_dev(dev); - struct fb_info *info = pci_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); struct radeonfb_info *rinfo = info->par; return radeon_show_one_edid(buf, off, count, rinfo->mon1_EDID); @@ -2230,8 +2229,7 @@ static ssize_t radeon_show_edid2(struct file *filp, struct kobject *kobj, char *buf, loff_t off, size_t count) { struct device *dev = container_of(kobj, struct device, kobj); - struct pci_dev *pdev = to_pci_dev(dev); - struct fb_info *info = pci_get_drvdata(pdev); + struct fb_info *info = dev_get_drvdata(dev); struct radeonfb_info *rinfo = info->par; return radeon_show_one_edid(buf, off, count, rinfo->mon2_EDID); -- cgit v1.2.3 From cc0c3e39e51b8d0c450e23b2dbfc655ac64ff683 Mon Sep 17 00:00:00 2001 From: Anders Roxell <anders.roxell@linaro.org> Date: Tue, 30 Jul 2019 17:25:30 +0200 Subject: video: fbdev: sh_mobile_lcdcfb: Mark expected switch fall-through MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that -Wimplicit-fallthrough is passed to GCC by default, the following warnings shows up: ../drivers/video/fbdev/sh_mobile_lcdcfb.c: In function ‘sh_mobile_lcdc_channel_fb_init’: ../drivers/video/fbdev/sh_mobile_lcdcfb.c:2086:22: warning: this statement may fall through [-Wimplicit-fallthrough=] info->fix.ypanstep = 2; ~~~~~~~~~~~~~~~~~~~^~~ ../drivers/video/fbdev/sh_mobile_lcdcfb.c:2087:2: note: here case V4L2_PIX_FMT_NV16: ^~~~ ../drivers/video/fbdev/sh_mobile_lcdcfb.c: In function ‘sh_mobile_lcdc_overlay_fb_init’: ../drivers/video/fbdev/sh_mobile_lcdcfb.c:1596:22: warning: this statement may fall through [-Wimplicit-fallthrough=] info->fix.ypanstep = 2; ~~~~~~~~~~~~~~~~~~~^~~ ../drivers/video/fbdev/sh_mobile_lcdcfb.c:1597:2: note: here case V4L2_PIX_FMT_NV16: ^~~~ Rework to address a warnings due to the enablement of -Wimplicit-fallthrough. Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Cc: Gustavo A. R. Silva <gustavo@embeddedor.com> [b.zolnierkie: fix patch summary] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190730152530.3055-1-anders.roxell@linaro.org --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index ac0bcac9a865..c249763dbf0b 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -1594,6 +1594,7 @@ sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl) case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV21: info->fix.ypanstep = 2; + /* Fall through */ case V4L2_PIX_FMT_NV16: case V4L2_PIX_FMT_NV61: info->fix.xpanstep = 2; @@ -2084,6 +2085,7 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch, case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV21: info->fix.ypanstep = 2; + /* Fall through */ case V4L2_PIX_FMT_NV16: case V4L2_PIX_FMT_NV61: info->fix.xpanstep = 2; -- cgit v1.2.3 From efbd44abaf742127a7bb2f9afcac7a526c52eccb Mon Sep 17 00:00:00 2001 From: Souptick Joarder <jrdr.linux@gmail.com> Date: Wed, 31 Jul 2019 00:44:13 +0530 Subject: video: fbdev: aty[128]fb: Remove dead code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is dead code since 3.15. If there is no plan to use it further, this can be removed forever. Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: David S. Miller <davem@davemloft.net> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: "Ville Syrjälä" <syrjala@sci.fi> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> [b.zolnierkie: fix patch summary] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/1564514053-4571-1-git-send-email-jrdr.linux@gmail.com --- drivers/video/fbdev/aty/aty128fb.c | 18 ------------------ drivers/video/fbdev/aty/atyfb_base.c | 29 ----------------------------- 2 files changed, 47 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 8504e19437ff..fc1e45d44719 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -487,11 +487,6 @@ static int aty128_encode_var(struct fb_var_screeninfo *var, const struct aty128fb_par *par); static int aty128_decode_var(struct fb_var_screeninfo *var, struct aty128fb_par *par); -#if 0 -static void aty128_get_pllinfo(struct aty128fb_par *par, void __iomem *bios); -static void __iomem *aty128_map_ROM(struct pci_dev *pdev, - const struct aty128fb_par *par); -#endif static void aty128_timings(struct aty128fb_par *par); static void aty128_init_engine(struct aty128fb_par *par); static void aty128_reset_engine(const struct aty128fb_par *par); @@ -1665,19 +1660,6 @@ static void aty128_st_pal(u_int regno, u_int red, u_int green, u_int blue, struct aty128fb_par *par) { if (par->chip_gen == rage_M3) { -#if 0 - /* Note: For now, on M3, we set palette on both heads, which may - * be useless. Can someone with a M3 check this ? - * - * This code would still be useful if using the second CRTC to - * do mirroring - */ - - aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) | - DAC_PALETTE_ACCESS_CNTL); - aty_st_8(PALETTE_INDEX, regno); - aty_st_le32(PALETTE_DATA, (red<<16)|(green<<8)|blue); -#endif aty_st_le32(DAC_CNTL, aty_ld_le32(DAC_CNTL) & ~DAC_PALETTE_ACCESS_CNTL); } diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index 72bcfbe42e49..6dda5d885a03 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -1188,19 +1188,6 @@ static int aty_crtc_to_var(const struct crtc *crtc, (c_sync ? FB_SYNC_COMP_HIGH_ACT : 0); switch (pix_width) { -#if 0 - case CRTC_PIX_WIDTH_4BPP: - bpp = 4; - var->red.offset = 0; - var->red.length = 8; - var->green.offset = 0; - var->green.length = 8; - var->blue.offset = 0; - var->blue.length = 8; - var->transp.offset = 0; - var->transp.length = 0; - break; -#endif case CRTC_PIX_WIDTH_8BPP: bpp = 8; var->red.offset = 0; @@ -1466,11 +1453,6 @@ static int atyfb_set_par(struct fb_info *info) var->bits_per_pixel, par->crtc.vxres * var->bits_per_pixel / 8); #endif /* CONFIG_BOOTX_TEXT */ -#if 0 - /* switch to accelerator mode */ - if (!(par->crtc.gen_cntl & CRTC_EXT_DISP_EN)) - aty_st_le32(CRTC_GEN_CNTL, par->crtc.gen_cntl | CRTC_EXT_DISP_EN, par); -#endif #ifdef DEBUG { /* dump non shadow CRTC, pll, LCD registers */ @@ -2395,17 +2377,6 @@ static int aty_init(struct fb_info *info) case CLK_IBMRGB514: par->pll_ops = &aty_pll_ibm514; break; -#endif -#if 0 /* dead code */ - case CLK_STG1703: - par->pll_ops = &aty_pll_stg1703; - break; - case CLK_CH8398: - par->pll_ops = &aty_pll_ch8398; - break; - case CLK_ATT20C408: - par->pll_ops = &aty_pll_att20c408; - break; #endif default: PRINTKI("aty_init: CLK type not implemented yet!"); -- cgit v1.2.3 From 2012f7762e8d800fbb3e33af409921bc8bade761 Mon Sep 17 00:00:00 2001 From: Souptick Joarder <jrdr.linux@gmail.com> Date: Wed, 31 Jul 2019 01:03:20 +0530 Subject: video: fbdev: viafb: Remove dead code This is dead code since 3.15. If there is no plan to use it further, this can be removed forever. Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> [b.zolnierkie: fix patch summary] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/1564515200-5020-1-git-send-email-jrdr.linux@gmail.com --- drivers/video/fbdev/via/via-core.c | 43 -------------------------------------- 1 file changed, 43 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/via/via-core.c b/drivers/video/fbdev/via/via-core.c index e2b2062673da..ffa2ca2d3f5e 100644 --- a/drivers/video/fbdev/via/via-core.c +++ b/drivers/video/fbdev/via/via-core.c @@ -221,49 +221,6 @@ void viafb_release_dma(void) } EXPORT_SYMBOL_GPL(viafb_release_dma); - -#if 0 -/* - * Copy a single buffer from FB memory, synchronously. This code works - * but is not currently used. - */ -void viafb_dma_copy_out(unsigned int offset, dma_addr_t paddr, int len) -{ - unsigned long flags; - int csr; - - mutex_lock(&viafb_dma_lock); - init_completion(&viafb_dma_completion); - /* - * Program the controller. - */ - spin_lock_irqsave(&global_dev.reg_lock, flags); - viafb_mmio_write(VDMA_CSR0, VDMA_C_ENABLE|VDMA_C_DONE); - /* Enable ints; must happen after CSR0 write! */ - viafb_mmio_write(VDMA_MR0, VDMA_MR_TDIE); - viafb_mmio_write(VDMA_MARL0, (int) (paddr & 0xfffffff0)); - viafb_mmio_write(VDMA_MARH0, (int) ((paddr >> 28) & 0xfff)); - /* Data sheet suggests DAR0 should be <<4, but it lies */ - viafb_mmio_write(VDMA_DAR0, offset); - viafb_mmio_write(VDMA_DQWCR0, len >> 4); - viafb_mmio_write(VDMA_TMR0, 0); - viafb_mmio_write(VDMA_DPRL0, 0); - viafb_mmio_write(VDMA_DPRH0, 0); - viafb_mmio_write(VDMA_PMR0, 0); - csr = viafb_mmio_read(VDMA_CSR0); - viafb_mmio_write(VDMA_CSR0, VDMA_C_ENABLE|VDMA_C_START); - spin_unlock_irqrestore(&global_dev.reg_lock, flags); - /* - * Now we just wait until the interrupt handler says - * we're done. - */ - wait_for_completion_interruptible(&viafb_dma_completion); - viafb_mmio_write(VDMA_MR0, 0); /* Reset int enable */ - mutex_unlock(&viafb_dma_lock); -} -EXPORT_SYMBOL_GPL(viafb_dma_copy_out); -#endif - /* * Do a scatter/gather DMA copy from FB memory. You must have done * a successful call to viafb_request_dma() first. -- cgit v1.2.3 From 06b1f4b9f2a050e84f34f507bbd5f9983eeb0a06 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" <gustavo@embeddedor.com> Date: Wed, 7 Aug 2019 11:13:12 -0500 Subject: video: fbdev/mmp/core: Use struct_size() in kzalloc() One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct mmp_path { ... struct mmp_overlay overlays[0]; }; size = sizeof(struct mmp_path) + count * sizeof(struct mmp_overlay); instance = kzalloc(size, GFP_KERNEL) Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kzalloc(struct_size(instance, overlays, count), GFP_KERNEL) Notice that, in this case, variable size is not necessary, hence it is removed. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190807161312.GA26835@embeddedor --- drivers/video/fbdev/mmp/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/mmp/core.c b/drivers/video/fbdev/mmp/core.c index 0ffc1b7b7052..154127256a2c 100644 --- a/drivers/video/fbdev/mmp/core.c +++ b/drivers/video/fbdev/mmp/core.c @@ -153,13 +153,11 @@ EXPORT_SYMBOL_GPL(mmp_get_path); struct mmp_path *mmp_register_path(struct mmp_path_info *info) { int i; - size_t size; struct mmp_path *path = NULL; struct mmp_panel *panel; - size = sizeof(struct mmp_path) - + sizeof(struct mmp_overlay) * info->overlay_num; - path = kzalloc(size, GFP_KERNEL); + path = kzalloc(struct_size(path, overlays, info->overlay_num), + GFP_KERNEL); if (!path) return NULL; -- cgit v1.2.3 From df5eff6d2a44c8f01b0dcd61b0ed5715116e10b4 Mon Sep 17 00:00:00 2001 From: Nishka Dasgupta <nishkadg.linux@gmail.com> Date: Mon, 19 Aug 2019 13:22:36 +0530 Subject: udlfb: Make dlfb_ops constant Static structure dlfb_ops, of type fb_ops, is not used except to be copied into another variable. Hence make dlfb_ops constant to protect it from unintended modification. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Cc: Bernie Thompson <bernie@plugable.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190819075236.1051-1-nishkadg.linux@gmail.com --- drivers/video/fbdev/udlfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/video') diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index c328e8265cb1..fe373b63ddd6 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1183,7 +1183,7 @@ static int dlfb_ops_blank(int blank_mode, struct fb_info *info) return 0; } -static struct fb_ops dlfb_ops = { +static const struct fb_ops dlfb_ops = { .owner = THIS_MODULE, .fb_read = fb_sys_read, .fb_write = dlfb_ops_write, -- cgit v1.2.3