Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'fbdev-fixes-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux

Pull fbdev fixes from Tomi Valkeinen:
"Minor fbdev fixes for da8xx-fb, atmel_lcdfb, arm clcd and chipsfb"

* tag 'fbdev-fixes-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
video: da8xx-fb: preserve display width when changing HSYNC
video: of: display_timing: double free on error
drivers: video: fbdev: atmel_lcdfb.c: fix error return code
video: ARM CLCD: Fix calculation of bits-per-pixel
fbdev: Remove __init from chips_hw_init() to fix build failure

+23 -7
+18 -5
drivers/video/fbdev/amba-clcd.c
··· 24 24 #include <linux/list.h> 25 25 #include <linux/amba/bus.h> 26 26 #include <linux/amba/clcd.h> 27 + #include <linux/bitops.h> 27 28 #include <linux/clk.h> 28 29 #include <linux/hardirq.h> 29 30 #include <linux/dma-mapping.h> ··· 651 650 { 652 651 struct device_node *endpoint; 653 652 int err; 653 + unsigned int bpp; 654 654 u32 max_bandwidth; 655 655 u32 tft_r0b0g0[3]; 656 656 ··· 669 667 670 668 err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", 671 669 &max_bandwidth); 672 - if (!err) 673 - fb->panel->bpp = 8 * max_bandwidth / (fb->panel->mode.xres * 674 - fb->panel->mode.yres * fb->panel->mode.refresh); 675 - else 676 - fb->panel->bpp = 32; 670 + if (!err) { 671 + /* 672 + * max_bandwidth is in bytes per second and pixclock in 673 + * pico-seconds, so the maximum allowed bits per pixel is 674 + * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000) 675 + * Rearrange this calculation to avoid overflow and then ensure 676 + * result is a valid format. 677 + */ 678 + bpp = max_bandwidth / (1000 / 8) 679 + / PICOS2KHZ(fb->panel->mode.pixclock); 680 + bpp = rounddown_pow_of_two(bpp); 681 + if (bpp > 32) 682 + bpp = 32; 683 + } else 684 + bpp = 32; 685 + fb->panel->bpp = bpp; 677 686 678 687 #ifdef CONFIG_CPU_BIG_ENDIAN 679 688 fb->panel->cntl |= CNTL_BEBO;
+2
drivers/video/fbdev/atmel_lcdfb.c
··· 1102 1102 timings = of_get_display_timings(display_np); 1103 1103 if (!timings) { 1104 1104 dev_err(dev, "failed to get display timings\n"); 1105 + ret = -EINVAL; 1105 1106 goto put_display_node; 1106 1107 } 1107 1108 1108 1109 timings_np = of_find_node_by_name(display_np, "display-timings"); 1109 1110 if (!timings_np) { 1110 1111 dev_err(dev, "failed to find display-timings node\n"); 1112 + ret = -ENODEV; 1111 1113 goto put_display_node; 1112 1114 } 1113 1115
+1 -1
drivers/video/fbdev/chipsfb.c
··· 273 273 { 0xa8, 0x00 } 274 274 }; 275 275 276 - static void __init chips_hw_init(void) 276 + static void chips_hw_init(void) 277 277 { 278 278 int i; 279 279
+1 -1
drivers/video/fbdev/da8xx-fb.c
··· 419 419 { 420 420 u32 reg; 421 421 422 - reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0xf; 422 + reg = lcdc_read(LCD_RASTER_TIMING_0_REG) & 0x3ff; 423 423 reg |= (((back_porch-1) & 0xff) << 24) 424 424 | (((front_porch-1) & 0xff) << 16) 425 425 | (((pulse_width-1) & 0x3f) << 10);
+1
drivers/video/of_display_timing.c
··· 236 236 if (native_mode) 237 237 of_node_put(native_mode); 238 238 display_timings_release(disp); 239 + disp = NULL; 239 240 entryfail: 240 241 kfree(disp); 241 242 dispfail: