diff options
Diffstat (limited to 'drivers/video/fbdev')
-rw-r--r-- | drivers/video/fbdev/amba-clcd.c | 23 | ||||
-rw-r--r-- | drivers/video/fbdev/atmel_lcdfb.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/chipsfb.c | 2 | ||||
-rw-r--r-- | drivers/video/fbdev/da8xx-fb.c | 2 |
4 files changed, 22 insertions, 7 deletions
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index beadd3edaa17..a7b6217ac87b 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/amba/bus.h> | 25 | #include <linux/amba/bus.h> |
26 | #include <linux/amba/clcd.h> | 26 | #include <linux/amba/clcd.h> |
27 | #include <linux/bitops.h> | ||
27 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
28 | #include <linux/hardirq.h> | 29 | #include <linux/hardirq.h> |
29 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
@@ -650,6 +651,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) | |||
650 | { | 651 | { |
651 | struct device_node *endpoint; | 652 | struct device_node *endpoint; |
652 | int err; | 653 | int err; |
654 | unsigned int bpp; | ||
653 | u32 max_bandwidth; | 655 | u32 max_bandwidth; |
654 | u32 tft_r0b0g0[3]; | 656 | u32 tft_r0b0g0[3]; |
655 | 657 | ||
@@ -667,11 +669,22 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) | |||
667 | 669 | ||
668 | err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", | 670 | err = of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", |
669 | &max_bandwidth); | 671 | &max_bandwidth); |
670 | if (!err) | 672 | if (!err) { |
671 | fb->panel->bpp = 8 * max_bandwidth / (fb->panel->mode.xres * | 673 | /* |
672 | fb->panel->mode.yres * fb->panel->mode.refresh); | 674 | * max_bandwidth is in bytes per second and pixclock in |
673 | else | 675 | * pico-seconds, so the maximum allowed bits per pixel is |
674 | fb->panel->bpp = 32; | 676 | * 8 * max_bandwidth / (PICOS2KHZ(pixclock) * 1000) |
677 | * Rearrange this calculation to avoid overflow and then ensure | ||
678 | * result is a valid format. | ||
679 | */ | ||
680 | bpp = max_bandwidth / (1000 / 8) | ||
681 | / PICOS2KHZ(fb->panel->mode.pixclock); | ||
682 | bpp = rounddown_pow_of_two(bpp); | ||
683 | if (bpp > 32) | ||
684 | bpp = 32; | ||
685 | } else | ||
686 | bpp = 32; | ||
687 | fb->panel->bpp = bpp; | ||
675 | 688 | ||
676 | #ifdef CONFIG_CPU_BIG_ENDIAN | 689 | #ifdef CONFIG_CPU_BIG_ENDIAN |
677 | fb->panel->cntl |= CNTL_BEBO; | 690 | fb->panel->cntl |= CNTL_BEBO; |
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index 92640d46770a..1d8bdb92939b 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
@@ -1102,12 +1102,14 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
1102 | timings = of_get_display_timings(display_np); | 1102 | timings = of_get_display_timings(display_np); |
1103 | if (!timings) { | 1103 | if (!timings) { |
1104 | dev_err(dev, "failed to get display timings\n"); | 1104 | dev_err(dev, "failed to get display timings\n"); |
1105 | ret = -EINVAL; | ||
1105 | goto put_display_node; | 1106 | goto put_display_node; |
1106 | } | 1107 | } |
1107 | 1108 | ||
1108 | timings_np = of_find_node_by_name(display_np, "display-timings"); | 1109 | timings_np = of_find_node_by_name(display_np, "display-timings"); |
1109 | if (!timings_np) { | 1110 | if (!timings_np) { |
1110 | dev_err(dev, "failed to find display-timings node\n"); | 1111 | dev_err(dev, "failed to find display-timings node\n"); |
1112 | ret = -ENODEV; | ||
1111 | goto put_display_node; | 1113 | goto put_display_node; |
1112 | } | 1114 | } |
1113 | 1115 | ||
diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c index 206a66b61072..59abdc6a97f6 100644 --- a/drivers/video/fbdev/chipsfb.c +++ b/drivers/video/fbdev/chipsfb.c | |||
@@ -273,7 +273,7 @@ static struct chips_init_reg chips_init_xr[] = { | |||
273 | { 0xa8, 0x00 } | 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 | int i; | 278 | int i; |
279 | 279 | ||
diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 788f6b37fce7..10c876c95772 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c | |||
@@ -419,7 +419,7 @@ static void lcd_cfg_horizontal_sync(int back_porch, int pulse_width, | |||
419 | { | 419 | { |
420 | u32 reg; | 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 | reg |= (((back_porch-1) & 0xff) << 24) | 423 | reg |= (((back_porch-1) & 0xff) << 24) |
424 | | (((front_porch-1) & 0xff) << 16) | 424 | | (((front_porch-1) & 0xff) << 16) |
425 | | (((pulse_width-1) & 0x3f) << 10); | 425 | | (((pulse_width-1) & 0x3f) << 10); |