Merge tag 'fbdev-v4.18' of git://github.com/bzolnier/linux

Pull fbdev updates from Bartlomiej Zolnierkiewicz:
"There is nothing really major here, few small fixes, some cleanups and
dead drivers removal:

- mark omapfb drivers as orphans in MAINTAINERS file (Tomi Valkeinen)

- add missing module license tags to omap/omapfb driver (Arnd
Bergmann)

- add missing GPIOLIB dependendy to omap2/omapfb driver (Arnd
Bergmann)

- convert savagefb, aty128fb & radeonfb drivers to use msleep & co.
(Jia-Ju Bai)

- allow COMPILE_TEST build for viafb driver (media part was reviewed
by media subsystem Maintainer)

- remove unused MERAM support from sh_mobile_lcdcfb and shmob-drm
drivers (drm parts were acked by shmob-drm driver Maintainer)

- remove unused auo_k190xfb drivers

- misc cleanups (Souptick Joarder, Wolfram Sang, Markus Elfring, Andy
Shevchenko, Colin Ian King)"

* tag 'fbdev-v4.18' of git://github.com/bzolnier/linux: (26 commits)
fb_omap2: add gpiolib dependency
video/omap: add module license tags
MAINTAINERS: make omapfb orphan
video: fbdev: pxafb: match_string() conversion fixup
video: fbdev: nvidia: fix spelling mistake: "scaleing" -> "scaling"
video: fbdev: fix spelling mistake: "frambuffer" -> "framebuffer"
video: fbdev: pxafb: Convert to use match_string() helper
video: fbdev: via: allow COMPILE_TEST build
video: fbdev: remove unused sh_mobile_meram driver
drm: shmobile: remove unused MERAM support
video: fbdev: sh_mobile_lcdcfb: remove unused MERAM support
video: fbdev: remove unused auo_k190xfb drivers
video: omap: Improve a size determination in omapfb_do_probe()
video: sm501fb: Improve a size determination in sm501fb_probe()
video: fbdev-MMP: Improve a size determination in path_init()
video: fbdev-MMP: Delete an error message for a failed memory allocation in two functions
video: auo_k190x: Delete an error message for a failed memory allocation in auok190x_common_probe()
video: sh_mobile_lcdcfb: Delete an error message for a failed memory allocation in two functions
video: sh_mobile_meram: Delete an error message for a failed memory allocation in sh_mobile_meram_probe()
video: fbdev: sh_mobile_meram: Drop SUPERH platform dependency
...

+2 -4
MAINTAINERS
··· 10273 10273 F: arch/arm/boot/dts/*dra7* 10274 10274 10275 10275 OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2) 10276 - M: Tomi Valkeinen <tomi.valkeinen@ti.com> 10277 10276 L: linux-omap@vger.kernel.org 10278 10277 L: linux-fbdev@vger.kernel.org 10279 - S: Maintained 10278 + S: Orphan 10280 10279 F: drivers/video/fbdev/omap2/ 10281 10280 F: Documentation/arm/OMAP/DSS 10282 10281 10283 10282 OMAP FRAMEBUFFER SUPPORT 10284 - M: Tomi Valkeinen <tomi.valkeinen@ti.com> 10285 10283 L: linux-fbdev@vger.kernel.org 10286 10284 L: linux-omap@vger.kernel.org 10287 - S: Maintained 10285 + S: Orphan 10288 10286 F: drivers/video/fbdev/omap/ 10289 10287 10290 10288 OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT
-1
drivers/gpu/drm/shmobile/Kconfig
··· 2 2 tristate "DRM Support for SH Mobile" 3 3 depends on DRM && ARM 4 4 depends on ARCH_SHMOBILE || COMPILE_TEST 5 - depends on FB_SH_MOBILE_MERAM || !FB_SH_MOBILE_MERAM 6 5 select BACKLIGHT_CLASS_DEVICE 7 6 select BACKLIGHT_LCD_SUPPORT 8 7 select DRM_KMS_HELPER
-42
drivers/gpu/drm/shmobile/shmob_drm_crtc.c
··· 21 21 #include <drm/drm_gem_cma_helper.h> 22 22 #include <drm/drm_plane_helper.h> 23 23 24 - #include <video/sh_mobile_meram.h> 25 - 26 24 #include "shmob_drm_backlight.h" 27 25 #include "shmob_drm_crtc.h" 28 26 #include "shmob_drm_drv.h" ··· 45 47 if (ret < 0) 46 48 return ret; 47 49 } 48 - #if 0 49 - if (sdev->meram_dev && sdev->meram_dev->pdev) 50 - pm_runtime_get_sync(&sdev->meram_dev->pdev->dev); 51 - #endif 52 50 53 51 return 0; 54 52 } 55 53 56 54 static void shmob_drm_clk_off(struct shmob_drm_device *sdev) 57 55 { 58 - #if 0 59 - if (sdev->meram_dev && sdev->meram_dev->pdev) 60 - pm_runtime_put_sync(&sdev->meram_dev->pdev->dev); 61 - #endif 62 56 if (sdev->clock) 63 57 clk_disable_unprepare(sdev->clock); 64 58 } ··· 259 269 if (!scrtc->started) 260 270 return; 261 271 262 - /* Disable the MERAM cache. */ 263 - if (scrtc->cache) { 264 - sh_mobile_meram_cache_free(sdev->meram, scrtc->cache); 265 - scrtc->cache = NULL; 266 - } 267 - 268 272 /* Stop the LCDC. */ 269 273 shmob_drm_crtc_start_stop(scrtc, false); 270 274 ··· 289 305 { 290 306 struct drm_crtc *crtc = &scrtc->crtc; 291 307 struct drm_framebuffer *fb = crtc->primary->fb; 292 - struct shmob_drm_device *sdev = crtc->dev->dev_private; 293 308 struct drm_gem_cma_object *gem; 294 309 unsigned int bpp; 295 310 ··· 304 321 + y / (bpp == 4 ? 2 : 1) * fb->pitches[1] 305 322 + x * (bpp == 16 ? 2 : 1); 306 323 } 307 - 308 - if (scrtc->cache) 309 - sh_mobile_meram_cache_update(sdev->meram, scrtc->cache, 310 - scrtc->dma[0], scrtc->dma[1], 311 - &scrtc->dma[0], &scrtc->dma[1]); 312 324 } 313 325 314 326 static void shmob_drm_crtc_update_base(struct shmob_drm_crtc *scrtc) ··· 350 372 { 351 373 struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc); 352 374 struct shmob_drm_device *sdev = crtc->dev->dev_private; 353 - const struct sh_mobile_meram_cfg *mdata = sdev->pdata->meram; 354 375 const struct shmob_drm_format_info *format; 355 - void *cache; 356 376 357 377 format = shmob_drm_format_info(crtc->primary->fb->format->format); 358 378 if (format == NULL) { ··· 361 385 362 386 scrtc->format = format; 363 387 scrtc->line_size = crtc->primary->fb->pitches[0]; 364 - 365 - if (sdev->meram) { 366 - /* Enable MERAM cache if configured. We need to de-init 367 - * configured ICBs before we can re-initialize them. 368 - */ 369 - if (scrtc->cache) { 370 - sh_mobile_meram_cache_free(sdev->meram, scrtc->cache); 371 - scrtc->cache = NULL; 372 - } 373 - 374 - cache = sh_mobile_meram_cache_alloc(sdev->meram, mdata, 375 - crtc->primary->fb->pitches[0], 376 - adjusted_mode->vdisplay, 377 - format->meram, 378 - &scrtc->line_size); 379 - if (!IS_ERR(cache)) 380 - scrtc->cache = cache; 381 - } 382 388 383 389 shmob_drm_crtc_compute_base(scrtc, x, y); 384 390
-1
drivers/gpu/drm/shmobile/shmob_drm_crtc.h
··· 28 28 int dpms; 29 29 30 30 const struct shmob_drm_format_info *format; 31 - void *cache; 32 31 unsigned long dma[2]; 33 32 unsigned int line_size; 34 33 bool started;
-2
drivers/gpu/drm/shmobile/shmob_drm_drv.h
··· 23 23 struct clk; 24 24 struct device; 25 25 struct drm_device; 26 - struct sh_mobile_meram_info; 27 26 28 27 struct shmob_drm_device { 29 28 struct device *dev; ··· 30 31 31 32 void __iomem *mmio; 32 33 struct clk *clock; 33 - struct sh_mobile_meram_info *meram; 34 34 u32 lddckr; 35 35 u32 ldmt1r; 36 36
-11
drivers/gpu/drm/shmobile/shmob_drm_kms.c
··· 18 18 #include <drm/drm_gem_cma_helper.h> 19 19 #include <drm/drm_gem_framebuffer_helper.h> 20 20 21 - #include <video/sh_mobile_meram.h> 22 - 23 21 #include "shmob_drm_crtc.h" 24 22 #include "shmob_drm_drv.h" 25 23 #include "shmob_drm_kms.h" ··· 33 35 .bpp = 16, 34 36 .yuv = false, 35 37 .lddfr = LDDFR_PKF_RGB16, 36 - .meram = SH_MOBILE_MERAM_PF_RGB, 37 38 }, { 38 39 .fourcc = DRM_FORMAT_RGB888, 39 40 .bpp = 24, 40 41 .yuv = false, 41 42 .lddfr = LDDFR_PKF_RGB24, 42 - .meram = SH_MOBILE_MERAM_PF_RGB, 43 43 }, { 44 44 .fourcc = DRM_FORMAT_ARGB8888, 45 45 .bpp = 32, 46 46 .yuv = false, 47 47 .lddfr = LDDFR_PKF_ARGB32, 48 - .meram = SH_MOBILE_MERAM_PF_RGB, 49 48 }, { 50 49 .fourcc = DRM_FORMAT_NV12, 51 50 .bpp = 12, 52 51 .yuv = true, 53 52 .lddfr = LDDFR_CC | LDDFR_YF_420, 54 - .meram = SH_MOBILE_MERAM_PF_NV, 55 53 }, { 56 54 .fourcc = DRM_FORMAT_NV21, 57 55 .bpp = 12, 58 56 .yuv = true, 59 57 .lddfr = LDDFR_CC | LDDFR_YF_420, 60 - .meram = SH_MOBILE_MERAM_PF_NV, 61 58 }, { 62 59 .fourcc = DRM_FORMAT_NV16, 63 60 .bpp = 16, 64 61 .yuv = true, 65 62 .lddfr = LDDFR_CC | LDDFR_YF_422, 66 - .meram = SH_MOBILE_MERAM_PF_NV, 67 63 }, { 68 64 .fourcc = DRM_FORMAT_NV61, 69 65 .bpp = 16, 70 66 .yuv = true, 71 67 .lddfr = LDDFR_CC | LDDFR_YF_422, 72 - .meram = SH_MOBILE_MERAM_PF_NV, 73 68 }, { 74 69 .fourcc = DRM_FORMAT_NV24, 75 70 .bpp = 24, 76 71 .yuv = true, 77 72 .lddfr = LDDFR_CC | LDDFR_YF_444, 78 - .meram = SH_MOBILE_MERAM_PF_NV24, 79 73 }, { 80 74 .fourcc = DRM_FORMAT_NV42, 81 75 .bpp = 24, 82 76 .yuv = true, 83 77 .lddfr = LDDFR_CC | LDDFR_YF_444, 84 - .meram = SH_MOBILE_MERAM_PF_NV24, 85 78 }, 86 79 }; 87 80
-1
drivers/gpu/drm/shmobile/shmob_drm_kms.h
··· 24 24 unsigned int bpp; 25 25 bool yuv; 26 26 u32 lddfr; 27 - unsigned int meram; 28 27 }; 29 28 30 29 const struct shmob_drm_format_info *shmob_drm_format_info(u32 fourcc);
-2
drivers/gpu/drm/shmobile/shmob_drm_plane.c
··· 17 17 #include <drm/drm_fb_cma_helper.h> 18 18 #include <drm/drm_gem_cma_helper.h> 19 19 20 - #include <video/sh_mobile_meram.h> 21 - 22 20 #include "shmob_drm_drv.h" 23 21 #include "shmob_drm_kms.h" 24 22 #include "shmob_drm_plane.h"
+5
drivers/media/platform/via-camera.c
··· 27 27 #include <linux/via-core.h> 28 28 #include <linux/via-gpio.h> 29 29 #include <linux/via_i2c.h> 30 + 31 + #ifdef CONFIG_X86 30 32 #include <asm/olpc.h> 33 + #else 34 + #define machine_is_olpc(x) 0 35 + #endif 31 36 32 37 #include "via-camera.h" 33 38
+1 -47
drivers/video/fbdev/Kconfig
··· 1437 1437 1438 1438 config FB_VIA 1439 1439 tristate "VIA UniChrome (Pro) and Chrome9 display support" 1440 - depends on FB && PCI && X86 && GPIOLIB && I2C 1440 + depends on FB && PCI && GPIOLIB && I2C && (X86 || COMPILE_TEST) 1441 1441 select FB_CFB_FILLRECT 1442 1442 select FB_CFB_COPYAREA 1443 1443 select FB_CFB_IMAGEBLIT ··· 1888 1888 config FB_SH_MOBILE_LCDC 1889 1889 tristate "SuperH Mobile LCDC framebuffer support" 1890 1890 depends on FB && (SUPERH || ARCH_RENESAS) && HAVE_CLK 1891 - depends on FB_SH_MOBILE_MERAM || !FB_SH_MOBILE_MERAM 1892 1891 select FB_SYS_FILLRECT 1893 1892 select FB_SYS_COPYAREA 1894 1893 select FB_SYS_IMAGEBLIT ··· 2252 2253 and could also have been called by other names when coupled with 2253 2254 a bridge adapter. 2254 2255 2255 - config FB_AUO_K190X 2256 - tristate "AUO-K190X EPD controller support" 2257 - depends on FB 2258 - select FB_SYS_FILLRECT 2259 - select FB_SYS_COPYAREA 2260 - select FB_SYS_IMAGEBLIT 2261 - select FB_SYS_FOPS 2262 - select FB_DEFERRED_IO 2263 - help 2264 - Provides support for epaper controllers from the K190X series 2265 - of AUO. These controllers can be used to drive epaper displays 2266 - from Sipix. 2267 - 2268 - This option enables the common support, shared by the individual 2269 - controller drivers. You will also have to enable the driver 2270 - for the controller type used in your device. 2271 - 2272 - config FB_AUO_K1900 2273 - tristate "AUO-K1900 EPD controller support" 2274 - depends on FB && FB_AUO_K190X 2275 - help 2276 - This driver implements support for the AUO K1900 epd-controller. 2277 - This controller can drive Sipix epaper displays but can only do 2278 - serial updates, reducing the number of possible frames per second. 2279 - 2280 - config FB_AUO_K1901 2281 - tristate "AUO-K1901 EPD controller support" 2282 - depends on FB && FB_AUO_K190X 2283 - help 2284 - This driver implements support for the AUO K1901 epd-controller. 2285 - This controller can drive Sipix epaper displays and supports 2286 - concurrent updates, making higher frames per second possible. 2287 - 2288 2256 config FB_JZ4740 2289 2257 tristate "JZ4740 LCD framebuffer support" 2290 2258 depends on FB && MACH_JZ4740 ··· 2311 2345 source "drivers/video/fbdev/omap/Kconfig" 2312 2346 source "drivers/video/fbdev/omap2/Kconfig" 2313 2347 source "drivers/video/fbdev/mmp/Kconfig" 2314 - 2315 - config FB_SH_MOBILE_MERAM 2316 - tristate "SuperH Mobile MERAM read ahead support" 2317 - depends on (SUPERH || ARCH_SHMOBILE) 2318 - select GENERIC_ALLOCATOR 2319 - ---help--- 2320 - Enable MERAM support for the SuperH controller. 2321 - 2322 - This will allow for caching of the framebuffer to provide more 2323 - reliable access under heavy main memory bus traffic situations. 2324 - Up to 4 memory channels can be configured, allowing 4 RGB or 2325 - 2 YCbCr framebuffers to be configured. 2326 2348 2327 2349 config FB_SSD1307 2328 2350 tristate "Solomon SSD1307 framebuffer support"
-4
drivers/video/fbdev/Makefile
··· 100 100 obj-$(CONFIG_FB_MAXINE) += maxinefb.o 101 101 obj-$(CONFIG_FB_METRONOME) += metronomefb.o 102 102 obj-$(CONFIG_FB_BROADSHEET) += broadsheetfb.o 103 - obj-$(CONFIG_FB_AUO_K190X) += auo_k190x.o 104 - obj-$(CONFIG_FB_AUO_K1900) += auo_k1900fb.o 105 - obj-$(CONFIG_FB_AUO_K1901) += auo_k1901fb.o 106 103 obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o 107 104 obj-$(CONFIG_FB_SH7760) += sh7760fb.o 108 105 obj-$(CONFIG_FB_IMX) += imxfb.o ··· 113 116 obj-$(CONFIG_FB_UDL) += udlfb.o 114 117 obj-$(CONFIG_FB_SMSCUFX) += smscufx.o 115 118 obj-$(CONFIG_FB_XILINX) += xilinxfb.o 116 - obj-$(CONFIG_FB_SH_MOBILE_MERAM) += sh_mobile_meram.o 117 119 obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o 118 120 obj-$(CONFIG_FB_OMAP) += omap/ 119 121 obj-y += omap2/
+1 -1
drivers/video/fbdev/aty/aty128fb.c
··· 2442 2442 (void)aty_ld_pll(POWER_MANAGEMENT); 2443 2443 aty_st_le32(BUS_CNTL1, 0x00000010); 2444 2444 aty_st_le32(MEM_POWER_MISC, 0x0c830000); 2445 - mdelay(100); 2445 + msleep(100); 2446 2446 2447 2447 /* Switch PCI power management to D2 */ 2448 2448 pci_set_power_state(pdev, PCI_D2);
+4 -4
drivers/video/fbdev/aty/radeon_pm.c
··· 2678 2678 * it, we'll restore the dynamic clocks state on wakeup 2679 2679 */ 2680 2680 radeon_pm_disable_dynamic_mode(rinfo); 2681 - mdelay(50); 2681 + msleep(50); 2682 2682 radeon_pm_save_regs(rinfo, 1); 2683 2683 2684 2684 if (rinfo->is_mobility && !(rinfo->pm_mode & radeon_pm_d2)) { 2685 2685 /* Switch off LVDS interface */ 2686 - mdelay(1); 2686 + usleep_range(1000, 2000); 2687 2687 OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_BL_MOD_EN)); 2688 - mdelay(1); 2688 + usleep_range(1000, 2000); 2689 2689 OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_EN | LVDS_ON)); 2690 2690 OUTREG(LVDS_PLL_CNTL, (INREG(LVDS_PLL_CNTL) & ~30000) | 0x20000); 2691 - mdelay(20); 2691 + msleep(20); 2692 2692 OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON)); 2693 2693 } 2694 2694 pci_disable_device(pdev);
+1 -1
drivers/video/fbdev/au1100fb.c
··· 464 464 PAGE_ALIGN(fbdev->fb_len), 465 465 &fbdev->fb_phys, GFP_KERNEL); 466 466 if (!fbdev->fb_mem) { 467 - print_err("fail to allocate frambuffer (size: %dK))", 467 + print_err("fail to allocate framebuffer (size: %dK))", 468 468 fbdev->fb_len / 1024); 469 469 return -ENOMEM; 470 470 }
+1 -1
drivers/video/fbdev/au1200fb.c
··· 1696 1696 &fbdev->fb_phys, GFP_KERNEL, 1697 1697 DMA_ATTR_NON_CONSISTENT); 1698 1698 if (!fbdev->fb_mem) { 1699 - print_err("fail to allocate frambuffer (size: %dK))", 1699 + print_err("fail to allocate framebuffer (size: %dK))", 1700 1700 fbdev->fb_len / 1024); 1701 1701 ret = -ENOMEM; 1702 1702 goto failed;
-204
drivers/video/fbdev/auo_k1900fb.c
··· 1 - /* 2 - * auok190xfb.c -- FB driver for AUO-K1900 controllers 3 - * 4 - * Copyright (C) 2011, 2012 Heiko Stuebner <heiko@sntech.de> 5 - * 6 - * based on broadsheetfb.c 7 - * 8 - * Copyright (C) 2008, Jaya Kumar 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - * 14 - * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. 15 - * 16 - * This driver is written to be used with the AUO-K1900 display controller. 17 - * 18 - * It is intended to be architecture independent. A board specific driver 19 - * must be used to perform all the physical IO interactions. 20 - * 21 - * The controller supports different update modes: 22 - * mode0+1 16 step gray (4bit) 23 - * mode2 4 step gray (2bit) - FIXME: add strange refresh 24 - * mode3 2 step gray (1bit) - FIXME: add strange refresh 25 - * mode4 handwriting mode (strange behaviour) 26 - * mode5 automatic selection of update mode 27 - */ 28 - 29 - #include <linux/module.h> 30 - #include <linux/kernel.h> 31 - #include <linux/errno.h> 32 - #include <linux/string.h> 33 - #include <linux/mm.h> 34 - #include <linux/slab.h> 35 - #include <linux/delay.h> 36 - #include <linux/interrupt.h> 37 - #include <linux/fb.h> 38 - #include <linux/init.h> 39 - #include <linux/platform_device.h> 40 - #include <linux/list.h> 41 - #include <linux/firmware.h> 42 - #include <linux/gpio.h> 43 - #include <linux/pm_runtime.h> 44 - 45 - #include <video/auo_k190xfb.h> 46 - 47 - #include "auo_k190x.h" 48 - 49 - /* 50 - * AUO-K1900 specific commands 51 - */ 52 - 53 - #define AUOK1900_CMD_PARTIALDISP 0x1001 54 - #define AUOK1900_CMD_ROTATION 0x1006 55 - #define AUOK1900_CMD_LUT_STOP 0x1009 56 - 57 - #define AUOK1900_INIT_TEMP_AVERAGE (1 << 13) 58 - #define AUOK1900_INIT_ROTATE(_x) ((_x & 0x3) << 10) 59 - #define AUOK1900_INIT_RESOLUTION(_res) ((_res & 0x7) << 2) 60 - 61 - static void auok1900_init(struct auok190xfb_par *par) 62 - { 63 - struct device *dev = par->info->device; 64 - struct auok190x_board *board = par->board; 65 - u16 init_param = 0; 66 - 67 - pm_runtime_get_sync(dev); 68 - 69 - init_param |= AUOK1900_INIT_TEMP_AVERAGE; 70 - init_param |= AUOK1900_INIT_ROTATE(par->rotation); 71 - init_param |= AUOK190X_INIT_INVERSE_WHITE; 72 - init_param |= AUOK190X_INIT_FORMAT0; 73 - init_param |= AUOK1900_INIT_RESOLUTION(par->resolution); 74 - init_param |= AUOK190X_INIT_SHIFT_RIGHT; 75 - 76 - auok190x_send_cmdargs(par, AUOK190X_CMD_INIT, 1, &init_param); 77 - 78 - /* let the controller finish */ 79 - board->wait_for_rdy(par); 80 - 81 - pm_runtime_mark_last_busy(dev); 82 - pm_runtime_put_autosuspend(dev); 83 - } 84 - 85 - static void auok1900_update_region(struct auok190xfb_par *par, int mode, 86 - u16 y1, u16 y2) 87 - { 88 - struct device *dev = par->info->device; 89 - unsigned char *buf = (unsigned char *)par->info->screen_base; 90 - int xres = par->info->var.xres; 91 - int line_length = par->info->fix.line_length; 92 - u16 args[4]; 93 - 94 - pm_runtime_get_sync(dev); 95 - 96 - mutex_lock(&(par->io_lock)); 97 - 98 - /* y1 and y2 must be a multiple of 2 so drop the lowest bit */ 99 - y1 &= 0xfffe; 100 - y2 &= 0xfffe; 101 - 102 - dev_dbg(dev, "update (x,y,w,h,mode)=(%d,%d,%d,%d,%d)\n", 103 - 1, y1+1, xres, y2-y1, mode); 104 - 105 - /* to FIX handle different partial update modes */ 106 - args[0] = mode | 1; 107 - args[1] = y1 + 1; 108 - args[2] = xres; 109 - args[3] = y2 - y1; 110 - buf += y1 * line_length; 111 - auok190x_send_cmdargs_pixels(par, AUOK1900_CMD_PARTIALDISP, 4, args, 112 - ((y2 - y1) * line_length)/2, (u16 *) buf); 113 - auok190x_send_command(par, AUOK190X_CMD_DATA_STOP); 114 - 115 - par->update_cnt++; 116 - 117 - mutex_unlock(&(par->io_lock)); 118 - 119 - pm_runtime_mark_last_busy(dev); 120 - pm_runtime_put_autosuspend(dev); 121 - } 122 - 123 - static void auok1900fb_dpy_update_pages(struct auok190xfb_par *par, 124 - u16 y1, u16 y2) 125 - { 126 - int mode; 127 - 128 - if (par->update_mode < 0) { 129 - mode = AUOK190X_UPDATE_MODE(1); 130 - par->last_mode = -1; 131 - } else { 132 - mode = AUOK190X_UPDATE_MODE(par->update_mode); 133 - par->last_mode = par->update_mode; 134 - } 135 - 136 - if (par->flash) 137 - mode |= AUOK190X_UPDATE_NONFLASH; 138 - 139 - auok1900_update_region(par, mode, y1, y2); 140 - } 141 - 142 - static void auok1900fb_dpy_update(struct auok190xfb_par *par) 143 - { 144 - int mode; 145 - 146 - if (par->update_mode < 0) { 147 - mode = AUOK190X_UPDATE_MODE(0); 148 - par->last_mode = -1; 149 - } else { 150 - mode = AUOK190X_UPDATE_MODE(par->update_mode); 151 - par->last_mode = par->update_mode; 152 - } 153 - 154 - if (par->flash) 155 - mode |= AUOK190X_UPDATE_NONFLASH; 156 - 157 - auok1900_update_region(par, mode, 0, par->info->var.yres); 158 - par->update_cnt = 0; 159 - } 160 - 161 - static bool auok1900fb_need_refresh(struct auok190xfb_par *par) 162 - { 163 - return (par->update_cnt > 10); 164 - } 165 - 166 - static int auok1900fb_probe(struct platform_device *pdev) 167 - { 168 - struct auok190x_init_data init; 169 - struct auok190x_board *board; 170 - 171 - /* pick up board specific routines */ 172 - board = pdev->dev.platform_data; 173 - if (!board) 174 - return -EINVAL; 175 - 176 - /* fill temporary init struct for common init */ 177 - init.id = "auo_k1900fb"; 178 - init.board = board; 179 - init.update_partial = auok1900fb_dpy_update_pages; 180 - init.update_all = auok1900fb_dpy_update; 181 - init.need_refresh = auok1900fb_need_refresh; 182 - init.init = auok1900_init; 183 - 184 - return auok190x_common_probe(pdev, &init); 185 - } 186 - 187 - static int auok1900fb_remove(struct platform_device *pdev) 188 - { 189 - return auok190x_common_remove(pdev); 190 - } 191 - 192 - static struct platform_driver auok1900fb_driver = { 193 - .probe = auok1900fb_probe, 194 - .remove = auok1900fb_remove, 195 - .driver = { 196 - .name = "auo_k1900fb", 197 - .pm = &auok190x_pm, 198 - }, 199 - }; 200 - module_platform_driver(auok1900fb_driver); 201 - 202 - MODULE_DESCRIPTION("framebuffer driver for the AUO-K1900 EPD controller"); 203 - MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); 204 - MODULE_LICENSE("GPL");
-257
drivers/video/fbdev/auo_k1901fb.c
··· 1 - /* 2 - * auok190xfb.c -- FB driver for AUO-K1901 controllers 3 - * 4 - * Copyright (C) 2011, 2012 Heiko Stuebner <heiko@sntech.de> 5 - * 6 - * based on broadsheetfb.c 7 - * 8 - * Copyright (C) 2008, Jaya Kumar 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - * 14 - * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. 15 - * 16 - * This driver is written to be used with the AUO-K1901 display controller. 17 - * 18 - * It is intended to be architecture independent. A board specific driver 19 - * must be used to perform all the physical IO interactions. 20 - * 21 - * The controller supports different update modes: 22 - * mode0+1 16 step gray (4bit) 23 - * mode2+3 4 step gray (2bit) 24 - * mode4+5 2 step gray (1bit) 25 - * - mode4 is described as "without LUT" 26 - * mode7 automatic selection of update mode 27 - * 28 - * The most interesting difference to the K1900 is the ability to do screen 29 - * updates in an asynchronous fashion. Where the K1900 needs to wait for the 30 - * current update to complete, the K1901 can process later updates already. 31 - */ 32 - 33 - #include <linux/module.h> 34 - #include <linux/kernel.h> 35 - #include <linux/errno.h> 36 - #include <linux/string.h> 37 - #include <linux/mm.h> 38 - #include <linux/slab.h> 39 - #include <linux/delay.h> 40 - #include <linux/interrupt.h> 41 - #include <linux/fb.h> 42 - #include <linux/init.h> 43 - #include <linux/platform_device.h> 44 - #include <linux/list.h> 45 - #include <linux/firmware.h> 46 - #include <linux/gpio.h> 47 - #include <linux/pm_runtime.h> 48 - 49 - #include <video/auo_k190xfb.h> 50 - 51 - #include "auo_k190x.h" 52 - 53 - /* 54 - * AUO-K1901 specific commands 55 - */ 56 - 57 - #define AUOK1901_CMD_LUT_INTERFACE 0x0005 58 - #define AUOK1901_CMD_DMA_START 0x1001 59 - #define AUOK1901_CMD_CURSOR_START 0x1007 60 - #define AUOK1901_CMD_CURSOR_STOP AUOK190X_CMD_DATA_STOP 61 - #define AUOK1901_CMD_DDMA_START 0x1009 62 - 63 - #define AUOK1901_INIT_GATE_PULSE_LOW (0 << 14) 64 - #define AUOK1901_INIT_GATE_PULSE_HIGH (1 << 14) 65 - #define AUOK1901_INIT_SINGLE_GATE (0 << 13) 66 - #define AUOK1901_INIT_DOUBLE_GATE (1 << 13) 67 - 68 - /* Bits to pixels 69 - * Mode 15-12 11-8 7-4 3-0 70 - * format2 2 T 1 T 71 - * format3 1 T 2 T 72 - * format4 T 2 T 1 73 - * format5 T 1 T 2 74 - * 75 - * halftone modes: 76 - * format6 2 2 1 1 77 - * format7 1 1 2 2 78 - */ 79 - #define AUOK1901_INIT_FORMAT2 (1 << 7) 80 - #define AUOK1901_INIT_FORMAT3 ((1 << 7) | (1 << 6)) 81 - #define AUOK1901_INIT_FORMAT4 (1 << 8) 82 - #define AUOK1901_INIT_FORMAT5 ((1 << 8) | (1 << 6)) 83 - #define AUOK1901_INIT_FORMAT6 ((1 << 8) | (1 << 7)) 84 - #define AUOK1901_INIT_FORMAT7 ((1 << 8) | (1 << 7) | (1 << 6)) 85 - 86 - /* res[4] to bit 10 87 - * res[3-0] to bits 5-2 88 - */ 89 - #define AUOK1901_INIT_RESOLUTION(_res) (((_res & (1 << 4)) << 6) \ 90 - | ((_res & 0xf) << 2)) 91 - 92 - /* 93 - * portrait / landscape orientation in AUOK1901_CMD_DMA_START 94 - */ 95 - #define AUOK1901_DMA_ROTATE90(_rot) ((_rot & 1) << 13) 96 - 97 - /* 98 - * equivalent to 1 << 11, needs the ~ to have same rotation like K1900 99 - */ 100 - #define AUOK1901_DDMA_ROTATE180(_rot) ((~_rot & 2) << 10) 101 - 102 - static void auok1901_init(struct auok190xfb_par *par) 103 - { 104 - struct device *dev = par->info->device; 105 - struct auok190x_board *board = par->board; 106 - u16 init_param = 0; 107 - 108 - pm_runtime_get_sync(dev); 109 - 110 - init_param |= AUOK190X_INIT_INVERSE_WHITE; 111 - init_param |= AUOK190X_INIT_FORMAT0; 112 - init_param |= AUOK1901_INIT_RESOLUTION(par->resolution); 113 - init_param |= AUOK190X_INIT_SHIFT_LEFT; 114 - 115 - auok190x_send_cmdargs(par, AUOK190X_CMD_INIT, 1, &init_param); 116 - 117 - /* let the controller finish */ 118 - board->wait_for_rdy(par); 119 - 120 - pm_runtime_mark_last_busy(dev); 121 - pm_runtime_put_autosuspend(dev); 122 - } 123 - 124 - static void auok1901_update_region(struct auok190xfb_par *par, int mode, 125 - u16 y1, u16 y2) 126 - { 127 - struct device *dev = par->info->device; 128 - unsigned char *buf = (unsigned char *)par->info->screen_base; 129 - int xres = par->info->var.xres; 130 - int line_length = par->info->fix.line_length; 131 - u16 args[5]; 132 - 133 - pm_runtime_get_sync(dev); 134 - 135 - mutex_lock(&(par->io_lock)); 136 - 137 - /* y1 and y2 must be a multiple of 2 so drop the lowest bit */ 138 - y1 &= 0xfffe; 139 - y2 &= 0xfffe; 140 - 141 - dev_dbg(dev, "update (x,y,w,h,mode)=(%d,%d,%d,%d,%d)\n", 142 - 1, y1+1, xres, y2-y1, mode); 143 - 144 - /* K1901: first transfer the region data */ 145 - args[0] = AUOK1901_DMA_ROTATE90(par->rotation) | 1; 146 - args[1] = y1 + 1; 147 - args[2] = xres; 148 - args[3] = y2 - y1; 149 - buf += y1 * line_length; 150 - auok190x_send_cmdargs_pixels_nowait(par, AUOK1901_CMD_DMA_START, 4, 151 - args, ((y2 - y1) * line_length)/2, 152 - (u16 *) buf); 153 - auok190x_send_command_nowait(par, AUOK190X_CMD_DATA_STOP); 154 - 155 - /* K1901: second tell the controller to update the region with mode */ 156 - args[0] = mode | AUOK1901_DDMA_ROTATE180(par->rotation); 157 - args[1] = 1; 158 - args[2] = y1 + 1; 159 - args[3] = xres; 160 - args[4] = y2 - y1; 161 - auok190x_send_cmdargs_nowait(par, AUOK1901_CMD_DDMA_START, 5, args); 162 - 163 - par->update_cnt++; 164 - 165 - mutex_unlock(&(par->io_lock)); 166 - 167 - pm_runtime_mark_last_busy(dev); 168 - pm_runtime_put_autosuspend(dev); 169 - } 170 - 171 - static void auok1901fb_dpy_update_pages(struct auok190xfb_par *par, 172 - u16 y1, u16 y2) 173 - { 174 - int mode; 175 - 176 - if (par->update_mode < 0) { 177 - mode = AUOK190X_UPDATE_MODE(1); 178 - par->last_mode = -1; 179 - } else { 180 - mode = AUOK190X_UPDATE_MODE(par->update_mode); 181 - par->last_mode = par->update_mode; 182 - } 183 - 184 - if (par->flash) 185 - mode |= AUOK190X_UPDATE_NONFLASH; 186 - 187 - auok1901_update_region(par, mode, y1, y2); 188 - } 189 - 190 - static void auok1901fb_dpy_update(struct auok190xfb_par *par) 191 - { 192 - int mode; 193 - 194 - /* When doing full updates, wait for the controller to be ready 195 - * This will hopefully catch some hangs of the K1901 196 - */ 197 - par->board->wait_for_rdy(par); 198 - 199 - if (par->update_mode < 0) { 200 - mode = AUOK190X_UPDATE_MODE(0); 201 - par->last_mode = -1; 202 - } else { 203 - mode = AUOK190X_UPDATE_MODE(par->update_mode); 204 - par->last_mode = par->update_mode; 205 - } 206 - 207 - if (par->flash) 208 - mode |= AUOK190X_UPDATE_NONFLASH; 209 - 210 - auok1901_update_region(par, mode, 0, par->info->var.yres); 211 - par->update_cnt = 0; 212 - } 213 - 214 - static bool auok1901fb_need_refresh(struct auok190xfb_par *par) 215 - { 216 - return (par->update_cnt > 10); 217 - } 218 - 219 - static int auok1901fb_probe(struct platform_device *pdev) 220 - { 221 - struct auok190x_init_data init; 222 - struct auok190x_board *board; 223 - 224 - /* pick up board specific routines */ 225 - board = pdev->dev.platform_data; 226 - if (!board) 227 - return -EINVAL; 228 - 229 - /* fill temporary init struct for common init */ 230 - init.id = "auo_k1901fb"; 231 - init.board = board; 232 - init.update_partial = auok1901fb_dpy_update_pages; 233 - init.update_all = auok1901fb_dpy_update; 234 - init.need_refresh = auok1901fb_need_refresh; 235 - init.init = auok1901_init; 236 - 237 - return auok190x_common_probe(pdev, &init); 238 - } 239 - 240 - static int auok1901fb_remove(struct platform_device *pdev) 241 - { 242 - return auok190x_common_remove(pdev); 243 - } 244 - 245 - static struct platform_driver auok1901fb_driver = { 246 - .probe = auok1901fb_probe, 247 - .remove = auok1901fb_remove, 248 - .driver = { 249 - .name = "auo_k1901fb", 250 - .pm = &auok190x_pm, 251 - }, 252 - }; 253 - module_platform_driver(auok1901fb_driver); 254 - 255 - MODULE_DESCRIPTION("framebuffer driver for the AUO-K1901 EPD controller"); 256 - MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); 257 - MODULE_LICENSE("GPL");
-1195
drivers/video/fbdev/auo_k190x.c
··· 1 - /* 2 - * Common code for AUO-K190X framebuffer drivers 3 - * 4 - * Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - #include <linux/module.h> 12 - #include <linux/sched/mm.h> 13 - #include <linux/kernel.h> 14 - #include <linux/gpio.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/pm_runtime.h> 17 - #include <linux/fb.h> 18 - #include <linux/delay.h> 19 - #include <linux/uaccess.h> 20 - #include <linux/vmalloc.h> 21 - #include <linux/regulator/consumer.h> 22 - 23 - #include <video/auo_k190xfb.h> 24 - 25 - #include "auo_k190x.h" 26 - 27 - struct panel_info { 28 - int w; 29 - int h; 30 - }; 31 - 32 - /* table of panel specific parameters to be indexed into by the board drivers */ 33 - static struct panel_info panel_table[] = { 34 - /* standard 6" */ 35 - [AUOK190X_RESOLUTION_800_600] = { 36 - .w = 800, 37 - .h = 600, 38 - }, 39 - /* standard 9" */ 40 - [AUOK190X_RESOLUTION_1024_768] = { 41 - .w = 1024, 42 - .h = 768, 43 - }, 44 - [AUOK190X_RESOLUTION_600_800] = { 45 - .w = 600, 46 - .h = 800, 47 - }, 48 - [AUOK190X_RESOLUTION_768_1024] = { 49 - .w = 768, 50 - .h = 1024, 51 - }, 52 - }; 53 - 54 - /* 55 - * private I80 interface to the board driver 56 - */ 57 - 58 - static void auok190x_issue_data(struct auok190xfb_par *par, u16 data) 59 - { 60 - par->board->set_ctl(par, AUOK190X_I80_WR, 0); 61 - par->board->set_hdb(par, data); 62 - par->board->set_ctl(par, AUOK190X_I80_WR, 1); 63 - } 64 - 65 - static void auok190x_issue_cmd(struct auok190xfb_par *par, u16 data) 66 - { 67 - par->board->set_ctl(par, AUOK190X_I80_DC, 0); 68 - auok190x_issue_data(par, data); 69 - par->board->set_ctl(par, AUOK190X_I80_DC, 1); 70 - } 71 - 72 - /** 73 - * Conversion of 16bit color to 4bit grayscale 74 - * does roughly (0.3 * R + 0.6 G + 0.1 B) / 2 75 - */ 76 - static inline int rgb565_to_gray4(u16 data, struct fb_var_screeninfo *var) 77 - { 78 - return ((((data & 0xF800) >> var->red.offset) * 77 + 79 - ((data & 0x07E0) >> (var->green.offset + 1)) * 151 + 80 - ((data & 0x1F) >> var->blue.offset) * 28) >> 8 >> 1); 81 - } 82 - 83 - static int auok190x_issue_pixels_rgb565(struct auok190xfb_par *par, int size, 84 - u16 *data) 85 - { 86 - struct fb_var_screeninfo *var = &par->info->var; 87 - struct device *dev = par->info->device; 88 - int i; 89 - u16 tmp; 90 - 91 - if (size & 7) { 92 - dev_err(dev, "issue_pixels: size %d must be a multiple of 8\n", 93 - size); 94 - return -EINVAL; 95 - } 96 - 97 - for (i = 0; i < (size >> 2); i++) { 98 - par->board->set_ctl(par, AUOK190X_I80_WR, 0); 99 - 100 - tmp = (rgb565_to_gray4(data[4*i], var) & 0x000F); 101 - tmp |= (rgb565_to_gray4(data[4*i+1], var) << 4) & 0x00F0; 102 - tmp |= (rgb565_to_gray4(data[4*i+2], var) << 8) & 0x0F00; 103 - tmp |= (rgb565_to_gray4(data[4*i+3], var) << 12) & 0xF000; 104 - 105 - par->board->set_hdb(par, tmp); 106 - par->board->set_ctl(par, AUOK190X_I80_WR, 1); 107 - } 108 - 109 - return 0; 110 - } 111 - 112 - static int auok190x_issue_pixels_gray8(struct auok190xfb_par *par, int size, 113 - u16 *data) 114 - { 115 - struct device *dev = par->info->device; 116 - int i; 117 - u16 tmp; 118 - 119 - if (size & 3) { 120 - dev_err(dev, "issue_pixels: size %d must be a multiple of 4\n", 121 - size); 122 - return -EINVAL; 123 - } 124 - 125 - for (i = 0; i < (size >> 1); i++) { 126 - par->board->set_ctl(par, AUOK190X_I80_WR, 0); 127 - 128 - /* simple reduction of 8bit staticgray to 4bit gray 129 - * combines 4 * 4bit pixel values into a 16bit value 130 - */ 131 - tmp = (data[2*i] & 0xF0) >> 4; 132 - tmp |= (data[2*i] & 0xF000) >> 8; 133 - tmp |= (data[2*i+1] & 0xF0) << 4; 134 - tmp |= (data[2*i+1] & 0xF000); 135 - 136 - par->board->set_hdb(par, tmp); 137 - par->board->set_ctl(par, AUOK190X_I80_WR, 1); 138 - } 139 - 140 - return 0; 141 - } 142 - 143 - static int auok190x_issue_pixels(struct auok190xfb_par *par, int size, 144 - u16 *data) 145 - { 146 - struct fb_info *info = par->info; 147 - struct device *dev = par->info->device; 148 - 149 - if (info->var.bits_per_pixel == 8 && info->var.grayscale) 150 - auok190x_issue_pixels_gray8(par, size, data); 151 - else if (info->var.bits_per_pixel == 16) 152 - auok190x_issue_pixels_rgb565(par, size, data); 153 - else 154 - dev_err(dev, "unsupported color mode (bits: %d, gray: %d)\n", 155 - info->var.bits_per_pixel, info->var.grayscale); 156 - 157 - return 0; 158 - } 159 - 160 - static u16 auok190x_read_data(struct auok190xfb_par *par) 161 - { 162 - u16 data; 163 - 164 - par->board->set_ctl(par, AUOK190X_I80_OE, 0); 165 - data = par->board->get_hdb(par); 166 - par->board->set_ctl(par, AUOK190X_I80_OE, 1); 167 - 168 - return data; 169 - } 170 - 171 - /* 172 - * Command interface for the controller drivers 173 - */ 174 - 175 - void auok190x_send_command_nowait(struct auok190xfb_par *par, u16 data) 176 - { 177 - par->board->set_ctl(par, AUOK190X_I80_CS, 0); 178 - auok190x_issue_cmd(par, data); 179 - par->board->set_ctl(par, AUOK190X_I80_CS, 1); 180 - } 181 - EXPORT_SYMBOL_GPL(auok190x_send_command_nowait); 182 - 183 - void auok190x_send_cmdargs_nowait(struct auok190xfb_par *par, u16 cmd, 184 - int argc, u16 *argv) 185 - { 186 - int i; 187 - 188 - par->board->set_ctl(par, AUOK190X_I80_CS, 0); 189 - auok190x_issue_cmd(par, cmd); 190 - 191 - for (i = 0; i < argc; i++) 192 - auok190x_issue_data(par, argv[i]); 193 - par->board->set_ctl(par, AUOK190X_I80_CS, 1); 194 - } 195 - EXPORT_SYMBOL_GPL(auok190x_send_cmdargs_nowait); 196 - 197 - int auok190x_send_command(struct auok190xfb_par *par, u16 data) 198 - { 199 - int ret; 200 - 201 - ret = par->board->wait_for_rdy(par); 202 - if (ret) 203 - return ret; 204 - 205 - auok190x_send_command_nowait(par, data); 206 - return 0; 207 - } 208 - EXPORT_SYMBOL_GPL(auok190x_send_command); 209 - 210 - int auok190x_send_cmdargs(struct auok190xfb_par *par, u16 cmd, 211 - int argc, u16 *argv) 212 - { 213 - int ret; 214 - 215 - ret = par->board->wait_for_rdy(par); 216 - if (ret) 217 - return ret; 218 - 219 - auok190x_send_cmdargs_nowait(par, cmd, argc, argv); 220 - return 0; 221 - } 222 - EXPORT_SYMBOL_GPL(auok190x_send_cmdargs); 223 - 224 - int auok190x_read_cmdargs(struct auok190xfb_par *par, u16 cmd, 225 - int argc, u16 *argv) 226 - { 227 - int i, ret; 228 - 229 - ret = par->board->wait_for_rdy(par); 230 - if (ret) 231 - return ret; 232 - 233 - par->board->set_ctl(par, AUOK190X_I80_CS, 0); 234 - auok190x_issue_cmd(par, cmd); 235 - 236 - for (i = 0; i < argc; i++) 237 - argv[i] = auok190x_read_data(par); 238 - par->board->set_ctl(par, AUOK190X_I80_CS, 1); 239 - 240 - return 0; 241 - } 242 - EXPORT_SYMBOL_GPL(auok190x_read_cmdargs); 243 - 244 - void auok190x_send_cmdargs_pixels_nowait(struct auok190xfb_par *par, u16 cmd, 245 - int argc, u16 *argv, int size, u16 *data) 246 - { 247 - int i; 248 - 249 - par->board->set_ctl(par, AUOK190X_I80_CS, 0); 250 - 251 - auok190x_issue_cmd(par, cmd); 252 - 253 - for (i = 0; i < argc; i++) 254 - auok190x_issue_data(par, argv[i]); 255 - 256 - auok190x_issue_pixels(par, size, data); 257 - 258 - par->board->set_ctl(par, AUOK190X_I80_CS, 1); 259 - } 260 - EXPORT_SYMBOL_GPL(auok190x_send_cmdargs_pixels_nowait); 261 - 262 - int auok190x_send_cmdargs_pixels(struct auok190xfb_par *par, u16 cmd, 263 - int argc, u16 *argv, int size, u16 *data) 264 - { 265 - int ret; 266 - 267 - ret = par->board->wait_for_rdy(par); 268 - if (ret) 269 - return ret; 270 - 271 - auok190x_send_cmdargs_pixels_nowait(par, cmd, argc, argv, size, data); 272 - 273 - return 0; 274 - } 275 - EXPORT_SYMBOL_GPL(auok190x_send_cmdargs_pixels); 276 - 277 - /* 278 - * fbdefio callbacks - common on both controllers. 279 - */ 280 - 281 - static void auok190xfb_dpy_first_io(struct fb_info *info) 282 - { 283 - /* tell runtime-pm that we wish to use the device in a short time */ 284 - pm_runtime_get(info->device); 285 - } 286 - 287 - /* this is called back from the deferred io workqueue */ 288 - static void auok190xfb_dpy_deferred_io(struct fb_info *info, 289 - struct list_head *pagelist) 290 - { 291 - struct fb_deferred_io *fbdefio = info->fbdefio; 292 - struct auok190xfb_par *par = info->par; 293 - u16 line_length = info->fix.line_length; 294 - u16 yres = info->var.yres; 295 - u16 y1 = 0, h = 0; 296 - int prev_index = -1; 297 - struct page *cur; 298 - int h_inc; 299 - int threshold; 300 - 301 - if (!list_empty(pagelist)) 302 - /* the device resume should've been requested through first_io, 303 - * if the resume did not finish until now, wait for it. 304 - */ 305 - pm_runtime_barrier(info->device); 306 - else 307 - /* We reached this via the fsync or some other way. 308 - * In either case the first_io function did not run, 309 - * so we runtime_resume the device here synchronously. 310 - */ 311 - pm_runtime_get_sync(info->device); 312 - 313 - /* Do a full screen update every n updates to prevent 314 - * excessive darkening of the Sipix display. 315 - * If we do this, there is no need to walk the pages. 316 - */ 317 - if (par->need_refresh(par)) { 318 - par->update_all(par); 319 - goto out; 320 - } 321 - 322 - /* height increment is fixed per page */ 323 - h_inc = DIV_ROUND_UP(PAGE_SIZE , line_length); 324 - 325 - /* calculate number of pages from pixel height */ 326 - threshold = par->consecutive_threshold / h_inc; 327 - if (threshold < 1) 328 - threshold = 1; 329 - 330 - /* walk the written page list and swizzle the data */ 331 - list_for_each_entry(cur, &fbdefio->pagelist, lru) { 332 - if (prev_index < 0) { 333 - /* just starting so assign first page */ 334 - y1 = (cur->index << PAGE_SHIFT) / line_length; 335 - h = h_inc; 336 - } else if ((cur->index - prev_index) <= threshold) { 337 - /* page is within our threshold for single updates */ 338 - h += h_inc * (cur->index - prev_index); 339 - } else { 340 - /* page not consecutive, issue previous update first */ 341 - par->update_partial(par, y1, y1 + h); 342 - 343 - /* start over with our non consecutive page */ 344 - y1 = (cur->index << PAGE_SHIFT) / line_length; 345 - h = h_inc; 346 - } 347 - prev_index = cur->index; 348 - } 349 - 350 - /* if we still have any pages to update we do so now */ 351 - if (h >= yres) 352 - /* its a full screen update, just do it */ 353 - par->update_all(par); 354 - else 355 - par->update_partial(par, y1, min((u16) (y1 + h), yres)); 356 - 357 - out: 358 - pm_runtime_mark_last_busy(info->device); 359 - pm_runtime_put_autosuspend(info->device); 360 - } 361 - 362 - /* 363 - * framebuffer operations 364 - */ 365 - 366 - /* 367 - * this is the slow path from userspace. they can seek and write to 368 - * the fb. it's inefficient to do anything less than a full screen draw 369 - */ 370 - static ssize_t auok190xfb_write(struct fb_info *info, const char __user *buf, 371 - size_t count, loff_t *ppos) 372 - { 373 - struct auok190xfb_par *par = info->par; 374 - unsigned long p = *ppos; 375 - void *dst; 376 - int err = 0; 377 - unsigned long total_size; 378 - 379 - if (info->state != FBINFO_STATE_RUNNING) 380 - return -EPERM; 381 - 382 - total_size = info->fix.smem_len; 383 - 384 - if (p > total_size) 385 - return -EFBIG; 386 - 387 - if (count > total_size) { 388 - err = -EFBIG; 389 - count = total_size; 390 - } 391 - 392 - if (count + p > total_size) { 393 - if (!err) 394 - err = -ENOSPC; 395 - 396 - count = total_size - p; 397 - } 398 - 399 - dst = (void *)(info->screen_base + p); 400 - 401 - if (copy_from_user(dst, buf, count)) 402 - err = -EFAULT; 403 - 404 - if (!err) 405 - *ppos += count; 406 - 407 - par->update_all(par); 408 - 409 - return (err) ? err : count; 410 - } 411 - 412 - static void auok190xfb_fillrect(struct fb_info *info, 413 - const struct fb_fillrect *rect) 414 - { 415 - struct auok190xfb_par *par = info->par; 416 - 417 - sys_fillrect(info, rect); 418 - 419 - par->update_all(par); 420 - } 421 - 422 - static void auok190xfb_copyarea(struct fb_info *info, 423 - const struct fb_copyarea *area) 424 - { 425 - struct auok190xfb_par *par = info->par; 426 - 427 - sys_copyarea(info, area); 428 - 429 - par->update_all(par); 430 - } 431 - 432 - static void auok190xfb_imageblit(struct fb_info *info, 433 - const struct fb_image *image) 434 - { 435 - struct auok190xfb_par *par = info->par; 436 - 437 - sys_imageblit(info, image); 438 - 439 - par->update_all(par); 440 - } 441 - 442 - static int auok190xfb_check_var(struct fb_var_screeninfo *var, 443 - struct fb_info *info) 444 - { 445 - struct device *dev = info->device; 446 - struct auok190xfb_par *par = info->par; 447 - struct panel_info *panel = &panel_table[par->resolution]; 448 - int size; 449 - 450 - /* 451 - * Color depth 452 - */ 453 - 454 - if (var->bits_per_pixel == 8 && var->grayscale == 1) { 455 - /* 456 - * For 8-bit grayscale, R, G, and B offset are equal. 457 - */ 458 - var->red.length = 8; 459 - var->red.offset = 0; 460 - var->red.msb_right = 0; 461 - 462 - var->green.length = 8; 463 - var->green.offset = 0; 464 - var->green.msb_right = 0; 465 - 466 - var->blue.length = 8; 467 - var->blue.offset = 0; 468 - var->blue.msb_right = 0; 469 - 470 - var->transp.length = 0; 471 - var->transp.offset = 0; 472 - var->transp.msb_right = 0; 473 - } else if (var->bits_per_pixel == 16) { 474 - var->red.length = 5; 475 - var->red.offset = 11; 476 - var->red.msb_right = 0; 477 - 478 - var->green.length = 6; 479 - var->green.offset = 5; 480 - var->green.msb_right = 0; 481 - 482 - var->blue.length = 5; 483 - var->blue.offset = 0; 484 - var->blue.msb_right = 0; 485 - 486 - var->transp.length = 0; 487 - var->transp.offset = 0; 488 - var->transp.msb_right = 0; 489 - } else { 490 - dev_warn(dev, "unsupported color mode (bits: %d, grayscale: %d)\n", 491 - info->var.bits_per_pixel, info->var.grayscale); 492 - return -EINVAL; 493 - } 494 - 495 - /* 496 - * Dimensions 497 - */ 498 - 499 - switch (var->rotate) { 500 - case FB_ROTATE_UR: 501 - case FB_ROTATE_UD: 502 - var->xres = panel->w; 503 - var->yres = panel->h; 504 - break; 505 - case FB_ROTATE_CW: 506 - case FB_ROTATE_CCW: 507 - var->xres = panel->h; 508 - var->yres = panel->w; 509 - break; 510 - default: 511 - dev_dbg(dev, "Invalid rotation request\n"); 512 - return -EINVAL; 513 - } 514 - 515 - var->xres_virtual = var->xres; 516 - var->yres_virtual = var->yres; 517 - 518 - /* 519 - * Memory limit 520 - */ 521 - 522 - size = var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8; 523 - if (size > info->fix.smem_len) { 524 - dev_err(dev, "Memory limit exceeded, requested %dK\n", 525 - size >> 10); 526 - return -ENOMEM; 527 - } 528 - 529 - return 0; 530 - } 531 - 532 - static int auok190xfb_set_fix(struct fb_info *info) 533 - { 534 - struct fb_fix_screeninfo *fix = &info->fix; 535 - struct fb_var_screeninfo *var = &info->var; 536 - 537 - fix->line_length = var->xres_virtual * var->bits_per_pixel / 8; 538 - 539 - fix->type = FB_TYPE_PACKED_PIXELS; 540 - fix->accel = FB_ACCEL_NONE; 541 - fix->visual = (var->grayscale) ? FB_VISUAL_STATIC_PSEUDOCOLOR 542 - : FB_VISUAL_TRUECOLOR; 543 - fix->xpanstep = 0; 544 - fix->ypanstep = 0; 545 - fix->ywrapstep = 0; 546 - 547 - return 0; 548 - } 549 - 550 - static int auok190xfb_set_par(struct fb_info *info) 551 - { 552 - struct auok190xfb_par *par = info->par; 553 - 554 - par->rotation = info->var.rotate; 555 - auok190xfb_set_fix(info); 556 - 557 - /* reinit the controller to honor the rotation */ 558 - par->init(par); 559 - 560 - /* wait for init to complete */ 561 - par->board->wait_for_rdy(par); 562 - 563 - return 0; 564 - } 565 - 566 - static struct fb_ops auok190xfb_ops = { 567 - .owner = THIS_MODULE, 568 - .fb_read = fb_sys_read, 569 - .fb_write = auok190xfb_write, 570 - .fb_fillrect = auok190xfb_fillrect, 571 - .fb_copyarea = auok190xfb_copyarea, 572 - .fb_imageblit = auok190xfb_imageblit, 573 - .fb_check_var = auok190xfb_check_var, 574 - .fb_set_par = auok190xfb_set_par, 575 - }; 576 - 577 - /* 578 - * Controller-functions common to both K1900 and K1901 579 - */ 580 - 581 - static int auok190x_read_temperature(struct auok190xfb_par *par) 582 - { 583 - struct device *dev = par->info->device; 584 - u16 data[4]; 585 - int temp; 586 - 587 - pm_runtime_get_sync(dev); 588 - 589 - mutex_lock(&(par->io_lock)); 590 - 591 - auok190x_read_cmdargs(par, AUOK190X_CMD_READ_VERSION, 4, data); 592 - 593 - mutex_unlock(&(par->io_lock)); 594 - 595 - pm_runtime_mark_last_busy(dev); 596 - pm_runtime_put_autosuspend(dev); 597 - 598 - /* sanitize and split of half-degrees for now */ 599 - temp = ((data[0] & AUOK190X_VERSION_TEMP_MASK) >> 1); 600 - 601 - /* handle positive and negative temperatures */ 602 - if (temp >= 201) 603 - return (255 - temp + 1) * (-1); 604 - else 605 - return temp; 606 - } 607 - 608 - static void auok190x_identify(struct auok190xfb_par *par) 609 - { 610 - struct device *dev = par->info->device; 611 - u16 data[4]; 612 - 613 - pm_runtime_get_sync(dev); 614 - 615 - mutex_lock(&(par->io_lock)); 616 - 617 - auok190x_read_cmdargs(par, AUOK190X_CMD_READ_VERSION, 4, data); 618 - 619 - mutex_unlock(&(par->io_lock)); 620 - 621 - par->epd_type = data[1] & AUOK190X_VERSION_TEMP_MASK; 622 - 623 - par->panel_size_int = AUOK190X_VERSION_SIZE_INT(data[2]); 624 - par->panel_size_float = AUOK190X_VERSION_SIZE_FLOAT(data[2]); 625 - par->panel_model = AUOK190X_VERSION_MODEL(data[2]); 626 - 627 - par->tcon_version = AUOK190X_VERSION_TCON(data[3]); 628 - par->lut_version = AUOK190X_VERSION_LUT(data[3]); 629 - 630 - dev_dbg(dev, "panel %d.%din, model 0x%x, EPD 0x%x TCON-rev 0x%x, LUT-rev 0x%x", 631 - par->panel_size_int, par->panel_size_float, par->panel_model, 632 - par->epd_type, par->tcon_version, par->lut_version); 633 - 634 - pm_runtime_mark_last_busy(dev); 635 - pm_runtime_put_autosuspend(dev); 636 - } 637 - 638 - /* 639 - * Sysfs functions 640 - */ 641 - 642 - static ssize_t update_mode_show(struct device *dev, 643 - struct device_attribute *attr, char *buf) 644 - { 645 - struct fb_info *info = dev_get_drvdata(dev); 646 - struct auok190xfb_par *par = info->par; 647 - 648 - return sprintf(buf, "%d\n", par->update_mode); 649 - } 650 - 651 - static ssize_t update_mode_store(struct device *dev, 652 - struct device_attribute *attr, 653 - const char *buf, size_t count) 654 - { 655 - struct fb_info *info = dev_get_drvdata(dev); 656 - struct auok190xfb_par *par = info->par; 657 - int mode, ret; 658 - 659 - ret = kstrtoint(buf, 10, &mode); 660 - if (ret) 661 - return ret; 662 - 663 - par->update_mode = mode; 664 - 665 - /* if we enter a better mode, do a full update */ 666 - if (par->last_mode > 1 && mode < par->last_mode) 667 - par->update_all(par); 668 - 669 - return count; 670 - } 671 - 672 - static ssize_t flash_show(struct device *dev, struct device_attribute *attr, 673 - char *buf) 674 - { 675 - struct fb_info *info = dev_get_drvdata(dev); 676 - struct auok190xfb_par *par = info->par; 677 - 678 - return sprintf(buf, "%d\n", par->flash); 679 - } 680 - 681 - static ssize_t flash_store(struct device *dev, struct device_attribute *attr, 682 - const char *buf, size_t count) 683 - { 684 - struct fb_info *info = dev_get_drvdata(dev); 685 - struct auok190xfb_par *par = info->par; 686 - int flash, ret; 687 - 688 - ret = kstrtoint(buf, 10, &flash); 689 - if (ret) 690 - return ret; 691 - 692 - if (flash > 0) 693 - par->flash = 1; 694 - else 695 - par->flash = 0; 696 - 697 - return count; 698 - } 699 - 700 - static ssize_t temp_show(struct device *dev, struct device_attribute *attr, 701 - char *buf) 702 - { 703 - struct fb_info *info = dev_get_drvdata(dev); 704 - struct auok190xfb_par *par = info->par; 705 - int temp; 706 - 707 - temp = auok190x_read_temperature(par); 708 - return sprintf(buf, "%d\n", temp); 709 - } 710 - 711 - static DEVICE_ATTR_RW(update_mode); 712 - static DEVICE_ATTR_RW(flash); 713 - static DEVICE_ATTR(temp, 0644, temp_show, NULL); 714 - 715 - static struct attribute *auok190x_attributes[] = { 716 - &dev_attr_update_mode.attr, 717 - &dev_attr_flash.attr, 718 - &dev_attr_temp.attr, 719 - NULL 720 - }; 721 - 722 - static const struct attribute_group auok190x_attr_group = { 723 - .attrs = auok190x_attributes, 724 - }; 725 - 726 - static int auok190x_power(struct auok190xfb_par *par, bool on) 727 - { 728 - struct auok190x_board *board = par->board; 729 - int ret; 730 - 731 - if (on) { 732 - /* We should maintain POWER up for at least 80ms before set 733 - * RST_N and SLP_N to high (TCON spec 20100803_v35 p59) 734 - */ 735 - ret = regulator_enable(par->regulator); 736 - if (ret) 737 - return ret; 738 - 739 - msleep(200); 740 - gpio_set_value(board->gpio_nrst, 1); 741 - gpio_set_value(board->gpio_nsleep, 1); 742 - msleep(200); 743 - } else { 744 - regulator_disable(par->regulator); 745 - gpio_set_value(board->gpio_nrst, 0); 746 - gpio_set_value(board->gpio_nsleep, 0); 747 - } 748 - 749 - return 0; 750 - } 751 - 752 - /* 753 - * Recovery - powercycle the controller 754 - */ 755 - 756 - static void auok190x_recover(struct auok190xfb_par *par) 757 - { 758 - struct device *dev = par->info->device; 759 - 760 - auok190x_power(par, 0); 761 - msleep(100); 762 - auok190x_power(par, 1); 763 - 764 - /* after powercycling the device, it's always active */ 765 - pm_runtime_set_active(dev); 766 - par->standby = 0; 767 - 768 - par->init(par); 769 - 770 - /* wait for init to complete */ 771 - par->board->wait_for_rdy(par); 772 - } 773 - 774 - /* 775 - * Power-management 776 - */ 777 - static int __maybe_unused auok190x_runtime_suspend(struct device *dev) 778 - { 779 - struct platform_device *pdev = to_platform_device(dev); 780 - struct fb_info *info = platform_get_drvdata(pdev); 781 - struct auok190xfb_par *par = info->par; 782 - struct auok190x_board *board = par->board; 783 - u16 standby_param; 784 - 785 - /* take and keep the lock until we are resumed, as the controller 786 - * will never reach the non-busy state when in standby mode 787 - */ 788 - mutex_lock(&(par->io_lock)); 789 - 790 - if (par->standby) { 791 - dev_warn(dev, "already in standby, runtime-pm pairing mismatch\n"); 792 - mutex_unlock(&(par->io_lock)); 793 - return 0; 794 - } 795 - 796 - /* according to runtime_pm.txt runtime_suspend only means, that the 797 - * device will not process data and will not communicate with the CPU 798 - * As we hold the lock, this stays true even without standby 799 - */ 800 - if (board->quirks & AUOK190X_QUIRK_STANDBYBROKEN) { 801 - dev_dbg(dev, "runtime suspend without standby\n"); 802 - goto finish; 803 - } else if (board->quirks & AUOK190X_QUIRK_STANDBYPARAM) { 804 - /* for some TCON versions STANDBY expects a parameter (0) but 805 - * it seems the real tcon version has to be determined yet. 806 - */ 807 - dev_dbg(dev, "runtime suspend with additional empty param\n"); 808 - standby_param = 0; 809 - auok190x_send_cmdargs(par, AUOK190X_CMD_STANDBY, 1, 810 - &standby_param); 811 - } else { 812 - dev_dbg(dev, "runtime suspend without param\n"); 813 - auok190x_send_command(par, AUOK190X_CMD_STANDBY); 814 - } 815 - 816 - msleep(64); 817 - 818 - finish: 819 - par->standby = 1; 820 - 821 - return 0; 822 - } 823 - 824 - static int __maybe_unused auok190x_runtime_resume(struct device *dev) 825 - { 826 - struct platform_device *pdev = to_platform_device(dev); 827 - struct fb_info *info = platform_get_drvdata(pdev); 828 - struct auok190xfb_par *par = info->par; 829 - struct auok190x_board *board = par->board; 830 - 831 - if (!par->standby) { 832 - dev_warn(dev, "not in standby, runtime-pm pairing mismatch\n"); 833 - return 0; 834 - } 835 - 836 - if (board->quirks & AUOK190X_QUIRK_STANDBYBROKEN) { 837 - dev_dbg(dev, "runtime resume without standby\n"); 838 - } else { 839 - /* when in standby, controller is always busy 840 - * and only accepts the wakeup command 841 - */ 842 - dev_dbg(dev, "runtime resume from standby\n"); 843 - auok190x_send_command_nowait(par, AUOK190X_CMD_WAKEUP); 844 - 845 - msleep(160); 846 - 847 - /* wait for the controller to be ready and release the lock */ 848 - board->wait_for_rdy(par); 849 - } 850 - 851 - par->standby = 0; 852 - 853 - mutex_unlock(&(par->io_lock)); 854 - 855 - return 0; 856 - } 857 - 858 - static int __maybe_unused auok190x_suspend(struct device *dev) 859 - { 860 - struct platform_device *pdev = to_platform_device(dev); 861 - struct fb_info *info = platform_get_drvdata(pdev); 862 - struct auok190xfb_par *par = info->par; 863 - struct auok190x_board *board = par->board; 864 - int ret; 865 - 866 - dev_dbg(dev, "suspend\n"); 867 - if (board->quirks & AUOK190X_QUIRK_STANDBYBROKEN) { 868 - /* suspend via powering off the ic */ 869 - dev_dbg(dev, "suspend with broken standby\n"); 870 - 871 - auok190x_power(par, 0); 872 - } else { 873 - dev_dbg(dev, "suspend using sleep\n"); 874 - 875 - /* the sleep state can only be entered from the standby state. 876 - * pm_runtime_get_noresume gets called before the suspend call. 877 - * So the devices usage count is >0 but it is not necessarily 878 - * active. 879 - */ 880 - if (!pm_runtime_status_suspended(dev)) { 881 - ret = auok190x_runtime_suspend(dev); 882 - if (ret < 0) { 883 - dev_err(dev, "auok190x_runtime_suspend failed with %d\n", 884 - ret); 885 - return ret; 886 - } 887 - par->manual_standby = 1; 888 - } 889 - 890 - gpio_direction_output(board->gpio_nsleep, 0); 891 - } 892 - 893 - msleep(100); 894 - 895 - return 0; 896 - } 897 - 898 - static int __maybe_unused auok190x_resume(struct device *dev) 899 - { 900 - struct platform_device *pdev = to_platform_device(dev); 901 - struct fb_info *info = platform_get_drvdata(pdev); 902 - struct auok190xfb_par *par = info->par; 903 - struct auok190x_board *board = par->board; 904 - 905 - dev_dbg(dev, "resume\n"); 906 - if (board->quirks & AUOK190X_QUIRK_STANDBYBROKEN) { 907 - dev_dbg(dev, "resume with broken standby\n"); 908 - 909 - auok190x_power(par, 1); 910 - 911 - par->init(par); 912 - } else { 913 - dev_dbg(dev, "resume from sleep\n"); 914 - 915 - /* device should be in runtime suspend when we were suspended 916 - * and pm_runtime_put_sync gets called after this function. 917 - * So there is no need to touch the standby mode here at all. 918 - */ 919 - gpio_direction_output(board->gpio_nsleep, 1); 920 - msleep(100); 921 - 922 - /* an additional init call seems to be necessary after sleep */ 923 - auok190x_runtime_resume(dev); 924 - par->init(par); 925 - 926 - /* if we were runtime-suspended before, suspend again*/ 927 - if (!par->manual_standby) 928 - auok190x_runtime_suspend(dev); 929 - else 930 - par->manual_standby = 0; 931 - } 932 - 933 - return 0; 934 - } 935 - 936 - const struct dev_pm_ops auok190x_pm = { 937 - SET_RUNTIME_PM_OPS(auok190x_runtime_suspend, auok190x_runtime_resume, 938 - NULL) 939 - SET_SYSTEM_SLEEP_PM_OPS(auok190x_suspend, auok190x_resume) 940 - }; 941 - EXPORT_SYMBOL_GPL(auok190x_pm); 942 - 943 - /* 944 - * Common probe and remove code 945 - */ 946 - 947 - int auok190x_common_probe(struct platform_device *pdev, 948 - struct auok190x_init_data *init) 949 - { 950 - struct auok190x_board *board = init->board; 951 - struct auok190xfb_par *par; 952 - struct fb_info *info; 953 - struct panel_info *panel; 954 - int videomemorysize, ret; 955 - unsigned char *videomemory; 956 - 957 - /* check board contents */ 958 - if (!board->init || !board->cleanup || !board->wait_for_rdy 959 - || !board->set_ctl || !board->set_hdb || !board->get_hdb 960 - || !board->setup_irq) 961 - return -EINVAL; 962 - 963 - info = framebuffer_alloc(sizeof(struct auok190xfb_par), &pdev->dev); 964 - if (!info) 965 - return -ENOMEM; 966 - 967 - par = info->par; 968 - par->info = info; 969 - par->board = board; 970 - par->recover = auok190x_recover; 971 - par->update_partial = init->update_partial; 972 - par->update_all = init->update_all; 973 - par->need_refresh = init->need_refresh; 974 - par->init = init->init; 975 - 976 - /* init update modes */ 977 - par->update_cnt = 0; 978 - par->update_mode = -1; 979 - par->last_mode = -1; 980 - par->flash = 0; 981 - 982 - par->regulator = regulator_get(info->device, "vdd"); 983 - if (IS_ERR(par->regulator)) { 984 - ret = PTR_ERR(par->regulator); 985 - dev_err(info->device, "Failed to get regulator: %d\n", ret); 986 - goto err_reg; 987 - } 988 - 989 - ret = board->init(par); 990 - if (ret) { 991 - dev_err(info->device, "board init failed, %d\n", ret); 992 - goto err_board; 993 - } 994 - 995 - ret = gpio_request(board->gpio_nsleep, "AUOK190x sleep"); 996 - if (ret) { 997 - dev_err(info->device, "could not request sleep gpio, %d\n", 998 - ret); 999 - goto err_gpio1; 1000 - } 1001 - 1002 - ret = gpio_direction_output(board->gpio_nsleep, 0); 1003 - if (ret) { 1004 - dev_err(info->device, "could not set sleep gpio, %d\n", ret); 1005 - goto err_gpio2; 1006 - } 1007 - 1008 - ret = gpio_request(board->gpio_nrst, "AUOK190x reset"); 1009 - if (ret) { 1010 - dev_err(info->device, "could not request reset gpio, %d\n", 1011 - ret); 1012 - goto err_gpio2; 1013 - } 1014 - 1015 - ret = gpio_direction_output(board->gpio_nrst, 0); 1016 - if (ret) { 1017 - dev_err(info->device, "could not set reset gpio, %d\n", ret); 1018 - goto err_gpio3; 1019 - } 1020 - 1021 - ret = auok190x_power(par, 1); 1022 - if (ret) { 1023 - dev_err(info->device, "could not power on the device, %d\n", 1024 - ret); 1025 - goto err_gpio3; 1026 - } 1027 - 1028 - mutex_init(&par->io_lock); 1029 - 1030 - init_waitqueue_head(&par->waitq); 1031 - 1032 - ret = par->board->setup_irq(par->info); 1033 - if (ret) { 1034 - dev_err(info->device, "could not setup ready-irq, %d\n", ret); 1035 - goto err_irq; 1036 - } 1037 - 1038 - /* wait for init to complete */ 1039 - par->board->wait_for_rdy(par); 1040 - 1041 - /* 1042 - * From here on the controller can talk to us 1043 - */ 1044 - 1045 - /* initialise fix, var, resolution and rotation */ 1046 - 1047 - strlcpy(info->fix.id, init->id, 16); 1048 - info->var.bits_per_pixel = 8; 1049 - info->var.grayscale = 1; 1050 - 1051 - panel = &panel_table[board->resolution]; 1052 - 1053 - par->resolution = board->resolution; 1054 - par->rotation = 0; 1055 - 1056 - /* videomemory handling */ 1057 - 1058 - videomemorysize = roundup((panel->w * panel->h) * 2, PAGE_SIZE); 1059 - videomemory = vzalloc(videomemorysize); 1060 - if (!videomemory) { 1061 - ret = -ENOMEM; 1062 - goto err_irq; 1063 - } 1064 - 1065 - info->screen_base = (char *)videomemory; 1066 - info->fix.smem_len = videomemorysize; 1067 - 1068 - info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; 1069 - info->fbops = &auok190xfb_ops; 1070 - 1071 - ret = auok190xfb_check_var(&info->var, info); 1072 - if (ret) 1073 - goto err_defio; 1074 - 1075 - auok190xfb_set_fix(info); 1076 - 1077 - /* deferred io init */ 1078 - 1079 - info->fbdefio = devm_kzalloc(info->device, 1080 - sizeof(struct fb_deferred_io), 1081 - GFP_KERNEL); 1082 - if (!info->fbdefio) { 1083 - dev_err(info->device, "Failed to allocate memory\n"); 1084 - ret = -ENOMEM; 1085 - goto err_defio; 1086 - } 1087 - 1088 - dev_dbg(info->device, "targeting %d frames per second\n", board->fps); 1089 - info->fbdefio->delay = HZ / board->fps; 1090 - info->fbdefio->first_io = auok190xfb_dpy_first_io, 1091 - info->fbdefio->deferred_io = auok190xfb_dpy_deferred_io, 1092 - fb_deferred_io_init(info); 1093 - 1094 - /* color map */ 1095 - 1096 - ret = fb_alloc_cmap(&info->cmap, 256, 0); 1097 - if (ret < 0) { 1098 - dev_err(info->device, "Failed to allocate colormap\n"); 1099 - goto err_cmap; 1100 - } 1101 - 1102 - /* controller init */ 1103 - 1104 - par->consecutive_threshold = 100; 1105 - par->init(par); 1106 - auok190x_identify(par); 1107 - 1108 - platform_set_drvdata(pdev, info); 1109 - 1110 - ret = register_framebuffer(info); 1111 - if (ret < 0) 1112 - goto err_regfb; 1113 - 1114 - ret = sysfs_create_group(&info->device->kobj, &auok190x_attr_group); 1115 - if (ret) 1116 - goto err_sysfs; 1117 - 1118 - dev_info(info->device, "fb%d: %dx%d using %dK of video memory\n", 1119 - info->node, info->var.xres, info->var.yres, 1120 - videomemorysize >> 10); 1121 - 1122 - /* increase autosuspend_delay when we use alternative methods 1123 - * for runtime_pm 1124 - */ 1125 - par->autosuspend_delay = (board->quirks & AUOK190X_QUIRK_STANDBYBROKEN) 1126 - ? 1000 : 200; 1127 - 1128 - pm_runtime_set_active(info->device); 1129 - pm_runtime_enable(info->device); 1130 - pm_runtime_set_autosuspend_delay(info->device, par->autosuspend_delay); 1131 - pm_runtime_use_autosuspend(info->device); 1132 - 1133 - return 0; 1134 - 1135 - err_sysfs: 1136 - unregister_framebuffer(info); 1137 - err_regfb: 1138 - fb_dealloc_cmap(&info->cmap); 1139 - err_cmap: 1140 - fb_deferred_io_cleanup(info); 1141 - err_defio: 1142 - vfree((void *)info->screen_base); 1143 - err_irq: 1144 - auok190x_power(par, 0); 1145 - err_gpio3: 1146 - gpio_free(board->gpio_nrst); 1147 - err_gpio2: 1148 - gpio_free(board->gpio_nsleep); 1149 - err_gpio1: 1150 - board->cleanup(par); 1151 - err_board: 1152 - regulator_put(par->regulator); 1153 - err_reg: 1154 - framebuffer_release(info); 1155 - 1156 - return ret; 1157 - } 1158 - EXPORT_SYMBOL_GPL(auok190x_common_probe); 1159 - 1160 - int auok190x_common_remove(struct platform_device *pdev) 1161 - { 1162 - struct fb_info *info = platform_get_drvdata(pdev); 1163 - struct auok190xfb_par *par = info->par; 1164 - struct auok190x_board *board = par->board; 1165 - 1166 - pm_runtime_disable(info->device); 1167 - 1168 - sysfs_remove_group(&info->device->kobj, &auok190x_attr_group); 1169 - 1170 - unregister_framebuffer(info); 1171 - 1172 - fb_dealloc_cmap(&info->cmap); 1173 - 1174 - fb_deferred_io_cleanup(info); 1175 - 1176 - vfree((void *)info->screen_base); 1177 - 1178 - auok190x_power(par, 0); 1179 - 1180 - gpio_free(board->gpio_nrst); 1181 - gpio_free(board->gpio_nsleep); 1182 - 1183 - board->cleanup(par); 1184 - 1185 - regulator_put(par->regulator); 1186 - 1187 - framebuffer_release(info); 1188 - 1189 - return 0; 1190 - } 1191 - EXPORT_SYMBOL_GPL(auok190x_common_remove); 1192 - 1193 - MODULE_DESCRIPTION("Common code for AUO-K190X controllers"); 1194 - MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); 1195 - MODULE_LICENSE("GPL");
-129
drivers/video/fbdev/auo_k190x.h
··· 1 - /* 2 - * Private common definitions for AUO-K190X framebuffer drivers 3 - * 4 - * Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - /* 12 - * I80 interface specific defines 13 - */ 14 - 15 - #define AUOK190X_I80_CS 0x01 16 - #define AUOK190X_I80_DC 0x02 17 - #define AUOK190X_I80_WR 0x03 18 - #define AUOK190X_I80_OE 0x04 19 - 20 - /* 21 - * AUOK190x commands, common to both controllers 22 - */ 23 - 24 - #define AUOK190X_CMD_INIT 0x0000 25 - #define AUOK190X_CMD_STANDBY 0x0001 26 - #define AUOK190X_CMD_WAKEUP 0x0002 27 - #define AUOK190X_CMD_TCON_RESET 0x0003 28 - #define AUOK190X_CMD_DATA_STOP 0x1002 29 - #define AUOK190X_CMD_LUT_START 0x1003 30 - #define AUOK190X_CMD_DISP_REFRESH 0x1004 31 - #define AUOK190X_CMD_DISP_RESET 0x1005 32 - #define AUOK190X_CMD_PRE_DISPLAY_START 0x100D 33 - #define AUOK190X_CMD_PRE_DISPLAY_STOP 0x100F 34 - #define AUOK190X_CMD_FLASH_W 0x2000 35 - #define AUOK190X_CMD_FLASH_E 0x2001 36 - #define AUOK190X_CMD_FLASH_STS 0x2002 37 - #define AUOK190X_CMD_FRAMERATE 0x3000 38 - #define AUOK190X_CMD_READ_VERSION 0x4000 39 - #define AUOK190X_CMD_READ_STATUS 0x4001 40 - #define AUOK190X_CMD_READ_LUT 0x4003 41 - #define AUOK190X_CMD_DRIVERTIMING 0x5000 42 - #define AUOK190X_CMD_LBALANCE 0x5001 43 - #define AUOK190X_CMD_AGINGMODE 0x6000 44 - #define AUOK190X_CMD_AGINGEXIT 0x6001 45 - 46 - /* 47 - * Common settings for AUOK190X_CMD_INIT 48 - */ 49 - 50 - #define AUOK190X_INIT_DATA_FILTER (0 << 12) 51 - #define AUOK190X_INIT_DATA_BYPASS (1 << 12) 52 - #define AUOK190X_INIT_INVERSE_WHITE (0 << 9) 53 - #define AUOK190X_INIT_INVERSE_BLACK (1 << 9) 54 - #define AUOK190X_INIT_SCAN_DOWN (0 << 1) 55 - #define AUOK190X_INIT_SCAN_UP (1 << 1) 56 - #define AUOK190X_INIT_SHIFT_LEFT (0 << 0) 57 - #define AUOK190X_INIT_SHIFT_RIGHT (1 << 0) 58 - 59 - /* Common bits to pixels 60 - * Mode 15-12 11-8 7-4 3-0 61 - * format0 4 3 2 1 62 - * format1 3 4 1 2 63 - */ 64 - 65 - #define AUOK190X_INIT_FORMAT0 0 66 - #define AUOK190X_INIT_FORMAT1 (1 << 6) 67 - 68 - /* 69 - * settings for AUOK190X_CMD_RESET 70 - */ 71 - 72 - #define AUOK190X_RESET_TCON (0 << 0) 73 - #define AUOK190X_RESET_NORMAL (1 << 0) 74 - #define AUOK190X_RESET_PON (1 << 1) 75 - 76 - /* 77 - * AUOK190X_CMD_VERSION 78 - */ 79 - 80 - #define AUOK190X_VERSION_TEMP_MASK (0x1ff) 81 - #define AUOK190X_VERSION_EPD_MASK (0xff) 82 - #define AUOK190X_VERSION_SIZE_INT(_val) ((_val & 0xfc00) >> 10) 83 - #define AUOK190X_VERSION_SIZE_FLOAT(_val) ((_val & 0x3c0) >> 6) 84 - #define AUOK190X_VERSION_MODEL(_val) (_val & 0x3f) 85 - #define AUOK190X_VERSION_LUT(_val) (_val & 0xff) 86 - #define AUOK190X_VERSION_TCON(_val) ((_val & 0xff00) >> 8) 87 - 88 - /* 89 - * update modes for CMD_PARTIALDISP on K1900 and CMD_DDMA on K1901 90 - */ 91 - 92 - #define AUOK190X_UPDATE_MODE(_res) ((_res & 0x7) << 12) 93 - #define AUOK190X_UPDATE_NONFLASH (1 << 15) 94 - 95 - /* 96 - * track panel specific parameters for common init 97 - */ 98 - 99 - struct auok190x_init_data { 100 - char *id; 101 - struct auok190x_board *board; 102 - 103 - void (*update_partial)(struct auok190xfb_par *par, u16 y1, u16 y2); 104 - void (*update_all)(struct auok190xfb_par *par); 105 - bool (*need_refresh)(struct auok190xfb_par *par); 106 - void (*init)(struct auok190xfb_par *par); 107 - }; 108 - 109 - 110 - extern void auok190x_send_command_nowait(struct auok190xfb_par *par, u16 data); 111 - extern int auok190x_send_command(struct auok190xfb_par *par, u16 data); 112 - extern void auok190x_send_cmdargs_nowait(struct auok190xfb_par *par, u16 cmd, 113 - int argc, u16 *argv); 114 - extern int auok190x_send_cmdargs(struct auok190xfb_par *par, u16 cmd, 115 - int argc, u16 *argv); 116 - extern void auok190x_send_cmdargs_pixels_nowait(struct auok190xfb_par *par, 117 - u16 cmd, int argc, u16 *argv, 118 - int size, u16 *data); 119 - extern int auok190x_send_cmdargs_pixels(struct auok190xfb_par *par, u16 cmd, 120 - int argc, u16 *argv, int size, 121 - u16 *data); 122 - extern int auok190x_read_cmdargs(struct auok190xfb_par *par, u16 cmd, 123 - int argc, u16 *argv); 124 - 125 - extern int auok190x_common_probe(struct platform_device *pdev, 126 - struct auok190x_init_data *init); 127 - extern int auok190x_common_remove(struct platform_device *pdev); 128 - 129 - extern const struct dev_pm_ops auok190x_pm;
+2 -2
drivers/video/fbdev/core/fb_defio.c
··· 37 37 } 38 38 39 39 /* this is to find and return the vmalloc-ed fb pages */ 40 - static int fb_deferred_io_fault(struct vm_fault *vmf) 40 + static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf) 41 41 { 42 42 unsigned long offset; 43 43 struct page *page; ··· 90 90 EXPORT_SYMBOL_GPL(fb_deferred_io_fsync); 91 91 92 92 /* vm_ops->page_mkwrite handler */ 93 - static int fb_deferred_io_mkwrite(struct vm_fault *vmf) 93 + static vm_fault_t fb_deferred_io_mkwrite(struct vm_fault *vmf) 94 94 { 95 95 struct page *page = vmf->page; 96 96 struct fb_info *info = vmf->vma->vm_private_data;
+2 -3
drivers/video/fbdev/mmp/fb/mmpfb.c
··· 495 495 /* put videomode list to info structure */ 496 496 videomodes = kcalloc(videomode_num, sizeof(struct fb_videomode), 497 497 GFP_KERNEL); 498 - if (!videomodes) { 499 - dev_err(fbi->dev, "can't malloc video modes\n"); 498 + if (!videomodes) 500 499 return -ENOMEM; 501 - } 500 + 502 501 for (i = 0; i < videomode_num; i++) 503 502 mmpmode_to_fbmode(&videomodes[i], &mmp_modes[i]); 504 503 fb_videomode_to_modelist(videomodes, videomode_num, &info->modelist);
+3 -5
drivers/video/fbdev/mmp/hw/mmp_ctrl.c
··· 406 406 dev_info(ctrl->dev, "%s: %s\n", __func__, config->name); 407 407 408 408 /* init driver data */ 409 - path_info = kzalloc(sizeof(struct mmp_path_info), GFP_KERNEL); 410 - if (!path_info) { 411 - dev_err(ctrl->dev, "%s: unable to alloc path_info for %s\n", 412 - __func__, config->name); 409 + path_info = kzalloc(sizeof(*path_info), GFP_KERNEL); 410 + if (!path_info) 413 411 return 0; 414 - } 412 + 415 413 path_info->name = config->name; 416 414 path_info->id = path_plat->id; 417 415 path_info->dev = ctrl->dev;
+1 -1
drivers/video/fbdev/nvidia/nvidia.c
··· 1548 1548 "(default=0)"); 1549 1549 module_param(noscale, int, 0); 1550 1550 MODULE_PARM_DESC(noscale, 1551 - "Disables screen scaleing. (0 or 1=disable) " 1551 + "Disables screen scaling. (0 or 1=disable) " 1552 1552 "(default=0, do scaling)"); 1553 1553 module_param(paneltweak, int, 0); 1554 1554 MODULE_PARM_DESC(paneltweak,
+4
drivers/video/fbdev/omap/lcd_ams_delta.c
··· 197 197 }; 198 198 199 199 module_platform_driver(ams_delta_panel_driver); 200 + 201 + MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); 202 + MODULE_DESCRIPTION("LCD panel support for the Amstrad E3 (Delta) videophone"); 203 + MODULE_LICENSE("GPL");
+4
drivers/video/fbdev/omap/lcd_h3.c
··· 89 89 }; 90 90 91 91 module_platform_driver(h3_panel_driver); 92 + 93 + MODULE_AUTHOR("Imre Deak"); 94 + MODULE_DESCRIPTION("LCD panel support for the TI OMAP H3 board"); 95 + MODULE_LICENSE("GPL");
+4
drivers/video/fbdev/omap/lcd_htcherald.c
··· 66 66 }; 67 67 68 68 module_platform_driver(htcherald_panel_driver); 69 + 70 + MODULE_AUTHOR("Cory Maccarrone"); 71 + MODULE_LICENSE("GPL"); 72 + MODULE_DESCRIPTION("LCD panel support for the HTC Herald");
+4
drivers/video/fbdev/omap/lcd_inn1510.c
··· 73 73 }; 74 74 75 75 module_platform_driver(innovator1510_panel_driver); 76 + 77 + MODULE_AUTHOR("Imre Deak"); 78 + MODULE_DESCRIPTION("LCD panel support for the TI OMAP1510 Innovator board"); 79 + MODULE_LICENSE("GPL");
+4
drivers/video/fbdev/omap/lcd_inn1610.c
··· 106 106 }; 107 107 108 108 module_platform_driver(innovator1610_panel_driver); 109 + 110 + MODULE_AUTHOR("Imre Deak"); 111 + MODULE_DESCRIPTION("LCD panel support for the TI OMAP1610 Innovator board"); 112 + MODULE_LICENSE("GPL");
+4
drivers/video/fbdev/omap/lcd_osk.c
··· 93 93 }; 94 94 95 95 module_platform_driver(osk_panel_driver); 96 + 97 + MODULE_AUTHOR("Imre Deak"); 98 + MODULE_DESCRIPTION("LCD panel support for the TI OMAP OSK board"); 99 + MODULE_LICENSE("GPL");
+4
drivers/video/fbdev/omap/lcd_palmte.c
··· 59 59 }; 60 60 61 61 module_platform_driver(palmte_panel_driver); 62 + 63 + MODULE_AUTHOR("Romain Goyet <r.goyet@gmail.com>, Laurent Gonzalez <palmte.linux@free.fr>"); 64 + MODULE_DESCRIPTION("LCD panel support for the Palm Tungsten E"); 65 + MODULE_LICENSE("GPL");
+4
drivers/video/fbdev/omap/lcd_palmtt.c
··· 72 72 }; 73 73 74 74 module_platform_driver(palmtt_panel_driver); 75 + 76 + MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); 77 + MODULE_DESCRIPTION("LCD panel support for Palm Tungsten|T"); 78 + MODULE_LICENSE("GPL");
+4
drivers/video/fbdev/omap/lcd_palmz71.c
··· 66 66 }; 67 67 68 68 module_platform_driver(palmz71_panel_driver); 69 + 70 + MODULE_AUTHOR("Romain Goyet, Laurent Gonzalez, Marek Vasut"); 71 + MODULE_LICENSE("GPL"); 72 + MODULE_DESCRIPTION("LCD panel support for the Palm Zire71");
+1 -1
drivers/video/fbdev/omap/omapfb_main.c
··· 1645 1645 goto cleanup; 1646 1646 } 1647 1647 1648 - fbdev = kzalloc(sizeof(struct omapfb_device), GFP_KERNEL); 1648 + fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); 1649 1649 if (fbdev == NULL) { 1650 1650 dev_err(&pdev->dev, 1651 1651 "unable to allocate memory for device info\n");
+1
drivers/video/fbdev/omap2/omapfb/Kconfig
··· 5 5 tristate "OMAP2+ frame buffer support" 6 6 depends on FB 7 7 depends on DRM_OMAP = n 8 + depends on GPIOLIB 8 9 9 10 select FB_OMAP2_DSS 10 11 select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
+6 -12
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
··· 387 387 static ssize_t dsicm_num_errors_show(struct device *dev, 388 388 struct device_attribute *attr, char *buf) 389 389 { 390 - struct platform_device *pdev = to_platform_device(dev); 391 - struct panel_drv_data *ddata = platform_get_drvdata(pdev); 390 + struct panel_drv_data *ddata = dev_get_drvdata(dev); 392 391 struct omap_dss_device *in = ddata->in; 393 392 u8 errors = 0; 394 393 int r; ··· 418 419 static ssize_t dsicm_hw_revision_show(struct device *dev, 419 420 struct device_attribute *attr, char *buf) 420 421 { 421 - struct platform_device *pdev = to_platform_device(dev); 422 - struct panel_drv_data *ddata = platform_get_drvdata(pdev); 422 + struct panel_drv_data *ddata = dev_get_drvdata(dev); 423 423 struct omap_dss_device *in = ddata->in; 424 424 u8 id1, id2, id3; 425 425 int r; ··· 449 451 struct device_attribute *attr, 450 452 const char *buf, size_t count) 451 453 { 452 - struct platform_device *pdev = to_platform_device(dev); 453 - struct panel_drv_data *ddata = platform_get_drvdata(pdev); 454 + struct panel_drv_data *ddata = dev_get_drvdata(dev); 454 455 struct omap_dss_device *in = ddata->in; 455 456 unsigned long t; 456 457 int r; ··· 483 486 struct device_attribute *attr, 484 487 char *buf) 485 488 { 486 - struct platform_device *pdev = to_platform_device(dev); 487 - struct panel_drv_data *ddata = platform_get_drvdata(pdev); 489 + struct panel_drv_data *ddata = dev_get_drvdata(dev); 488 490 unsigned t; 489 491 490 492 mutex_lock(&ddata->lock); ··· 497 501 struct device_attribute *attr, 498 502 const char *buf, size_t count) 499 503 { 500 - struct platform_device *pdev = to_platform_device(dev); 501 - struct panel_drv_data *ddata = platform_get_drvdata(pdev); 504 + struct panel_drv_data *ddata = dev_get_drvdata(dev); 502 505 struct omap_dss_device *in = ddata->in; 503 506 unsigned long t; 504 507 int r; ··· 528 533 struct device_attribute *attr, 529 534 char *buf) 530 535 { 531 - struct platform_device *pdev = to_platform_device(dev); 532 - struct panel_drv_data *ddata = platform_get_drvdata(pdev); 536 + struct panel_drv_data *ddata = dev_get_drvdata(dev); 533 537 unsigned t; 534 538 535 539 mutex_lock(&ddata->lock);
+3 -5
drivers/video/fbdev/pxafb.c
··· 2115 2115 if (ret) 2116 2116 s = "color-tft"; 2117 2117 2118 - for (i = 0; lcd_types[i]; i++) 2119 - if (!strcmp(s, lcd_types[i])) 2120 - break; 2121 - if (!i || !lcd_types[i]) { 2118 + i = match_string(lcd_types, -1, s); 2119 + if (i < 0) { 2122 2120 dev_err(dev, "lcd-type %s is unknown\n", s); 2123 - return -EINVAL; 2121 + return i; 2124 2122 } 2125 2123 info->lcd_conn |= LCD_CONN_TYPE(i); 2126 2124 info->lcd_conn |= LCD_CONN_WIDTH(bus_width);
+4 -4
drivers/video/fbdev/savage/savagefb_driver.c
··· 1892 1892 vga_out8(0x3d4, 0x66, par); 1893 1893 cr66 = vga_in8(0x3d5, par); 1894 1894 vga_out8(0x3d5, cr66 | 0x02, par); 1895 - mdelay(10); 1895 + usleep_range(10000, 11000); 1896 1896 1897 1897 vga_out8(0x3d4, 0x66, par); 1898 1898 vga_out8(0x3d5, cr66 & ~0x02, par); /* clear reset flag */ 1899 - mdelay(10); 1899 + usleep_range(10000, 11000); 1900 1900 1901 1901 1902 1902 /* ··· 1906 1906 vga_out8(0x3d4, 0x3f, par); 1907 1907 cr3f = vga_in8(0x3d5, par); 1908 1908 vga_out8(0x3d5, cr3f | 0x08, par); 1909 - mdelay(10); 1909 + usleep_range(10000, 11000); 1910 1910 1911 1911 vga_out8(0x3d4, 0x3f, par); 1912 1912 vga_out8(0x3d5, cr3f & ~0x08, par); /* clear reset flags */ 1913 - mdelay(10); 1913 + usleep_range(10000, 11000); 1914 1914 1915 1915 /* Savage ramdac speeds */ 1916 1916 par->numClocks = 4;
+5 -72
drivers/video/fbdev/sh_mobile_lcdcfb.c
··· 29 29 #include <linux/vmalloc.h> 30 30 31 31 #include <video/sh_mobile_lcdc.h> 32 - #include <video/sh_mobile_meram.h> 33 32 34 33 #include "sh_mobile_lcdcfb.h" 35 34 ··· 216 217 struct notifier_block notifier; 217 218 int started; 218 219 int forced_fourcc; /* 2 channel LCDC must share fourcc setting */ 219 - struct sh_mobile_meram_info *meram_dev; 220 220 }; 221 221 222 222 /* ----------------------------------------------------------------------------- ··· 344 346 if (priv->dot_clk) 345 347 clk_prepare_enable(priv->dot_clk); 346 348 pm_runtime_get_sync(priv->dev); 347 - if (priv->meram_dev && priv->meram_dev->pdev) 348 - pm_runtime_get_sync(&priv->meram_dev->pdev->dev); 349 349 } 350 350 } 351 351 352 352 static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv) 353 353 { 354 354 if (atomic_sub_return(1, &priv->hw_usecnt) == -1) { 355 - if (priv->meram_dev && priv->meram_dev->pdev) 356 - pm_runtime_put_sync(&priv->meram_dev->pdev->dev); 357 355 pm_runtime_put(priv->dev); 358 356 if (priv->dot_clk) 359 357 clk_disable_unprepare(priv->dot_clk); ··· 1067 1073 1068 1074 static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) 1069 1075 { 1070 - struct sh_mobile_meram_info *mdev = priv->meram_dev; 1071 1076 struct sh_mobile_lcdc_chan *ch; 1072 1077 unsigned long tmp; 1073 1078 int ret; ··· 1099 1106 1100 1107 /* Compute frame buffer base address and pitch for each channel. */ 1101 1108 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { 1102 - int pixelformat; 1103 - void *cache; 1104 - 1105 1109 ch = &priv->ch[k]; 1106 1110 if (!ch->enabled) 1107 1111 continue; ··· 1107 1117 ch->base_addr_c = ch->dma_handle 1108 1118 + ch->xres_virtual * ch->yres_virtual; 1109 1119 ch->line_size = ch->pitch; 1110 - 1111 - /* Enable MERAM if possible. */ 1112 - if (mdev == NULL || ch->cfg->meram_cfg == NULL) 1113 - continue; 1114 - 1115 - /* Free the allocated MERAM cache. */ 1116 - if (ch->cache) { 1117 - sh_mobile_meram_cache_free(mdev, ch->cache); 1118 - ch->cache = NULL; 1119 - } 1120 - 1121 - switch (ch->format->fourcc) { 1122 - case V4L2_PIX_FMT_NV12: 1123 - case V4L2_PIX_FMT_NV21: 1124 - case V4L2_PIX_FMT_NV16: 1125 - case V4L2_PIX_FMT_NV61: 1126 - pixelformat = SH_MOBILE_MERAM_PF_NV; 1127 - break; 1128 - case V4L2_PIX_FMT_NV24: 1129 - case V4L2_PIX_FMT_NV42: 1130 - pixelformat = SH_MOBILE_MERAM_PF_NV24; 1131 - break; 1132 - case V4L2_PIX_FMT_RGB565: 1133 - case V4L2_PIX_FMT_BGR24: 1134 - case V4L2_PIX_FMT_BGR32: 1135 - default: 1136 - pixelformat = SH_MOBILE_MERAM_PF_RGB; 1137 - break; 1138 - } 1139 - 1140 - cache = sh_mobile_meram_cache_alloc(mdev, ch->cfg->meram_cfg, 1141 - ch->pitch, ch->yres, pixelformat, 1142 - &ch->line_size); 1143 - if (!IS_ERR(cache)) { 1144 - sh_mobile_meram_cache_update(mdev, cache, 1145 - ch->base_addr_y, ch->base_addr_c, 1146 - &ch->base_addr_y, &ch->base_addr_c); 1147 - ch->cache = cache; 1148 - } 1149 1120 } 1150 1121 1151 1122 for (k = 0; k < ARRAY_SIZE(priv->overlays); ++k) { ··· 1174 1223 } 1175 1224 1176 1225 sh_mobile_lcdc_display_off(ch); 1177 - 1178 - /* Free the MERAM cache. */ 1179 - if (ch->cache) { 1180 - sh_mobile_meram_cache_free(priv->meram_dev, ch->cache); 1181 - ch->cache = NULL; 1182 - } 1183 - 1184 1226 } 1185 1227 1186 1228 /* stop the lcdc */ ··· 1795 1851 base_addr_c = ch->dma_handle + ch->xres_virtual * ch->yres_virtual 1796 1852 + c_offset; 1797 1853 1798 - if (ch->cache) 1799 - sh_mobile_meram_cache_update(priv->meram_dev, ch->cache, 1800 - base_addr_y, base_addr_c, 1801 - &base_addr_y, &base_addr_c); 1802 - 1803 1854 ch->base_addr_y = base_addr_y; 1804 1855 ch->base_addr_c = base_addr_c; 1805 1856 ch->pan_y_offset = y_offset; ··· 2088 2149 if (info->fbdefio) { 2089 2150 ch->sglist = vmalloc(sizeof(struct scatterlist) * 2090 2151 ch->fb_size >> PAGE_SHIFT); 2091 - if (!ch->sglist) { 2092 - dev_err(ch->lcdc->dev, "cannot allocate sglist\n"); 2152 + if (!ch->sglist) 2093 2153 return -ENOMEM; 2094 - } 2095 2154 } 2096 2155 2097 2156 info->bl_dev = ch->bl; ··· 2291 2354 2292 2355 static int sh_mobile_lcdc_runtime_suspend(struct device *dev) 2293 2356 { 2294 - struct platform_device *pdev = to_platform_device(dev); 2295 - struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); 2357 + struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev); 2296 2358 2297 2359 /* turn off LCDC hardware */ 2298 2360 lcdc_write(priv, _LDCNT1R, 0); ··· 2301 2365 2302 2366 static int sh_mobile_lcdc_runtime_resume(struct device *dev) 2303 2367 { 2304 - struct platform_device *pdev = to_platform_device(dev); 2305 - struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev); 2368 + struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev); 2306 2369 2307 2370 __sh_mobile_lcdc_start(priv); 2308 2371 ··· 2653 2718 } 2654 2719 2655 2720 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 2656 - if (!priv) { 2657 - dev_err(&pdev->dev, "cannot allocate device data\n"); 2721 + if (!priv) 2658 2722 return -ENOMEM; 2659 - } 2660 2723 2661 2724 priv->dev = &pdev->dev; 2662 - priv->meram_dev = pdata->meram_dev; 2725 + 2663 2726 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) 2664 2727 mutex_init(&priv->ch[i].open_lock); 2665 2728 platform_set_drvdata(pdev, priv);
-1
drivers/video/fbdev/sh_mobile_lcdcfb.h
··· 61 61 unsigned long *reg_offs; 62 62 unsigned long ldmt1r_value; 63 63 unsigned long enabled; /* ME and SE in LDCNT2R */ 64 - void *cache; 65 64 66 65 struct mutex open_lock; /* protects the use counter */ 67 66 int use_count;
-758
drivers/video/fbdev/sh_mobile_meram.c
··· 1 - /* 2 - * SuperH Mobile MERAM Driver for SuperH Mobile LCDC Driver 3 - * 4 - * Copyright (c) 2011 Damian Hobson-Garcia <dhobsong@igel.co.jp> 5 - * Takanari Hayama <taki@igel.co.jp> 6 - * 7 - * This file is subject to the terms and conditions of the GNU General Public 8 - * License. See the file "COPYING" in the main directory of this archive 9 - * for more details. 10 - */ 11 - 12 - #include <linux/device.h> 13 - #include <linux/err.h> 14 - #include <linux/export.h> 15 - #include <linux/genalloc.h> 16 - #include <linux/io.h> 17 - #include <linux/kernel.h> 18 - #include <linux/module.h> 19 - #include <linux/platform_device.h> 20 - #include <linux/pm_runtime.h> 21 - #include <linux/slab.h> 22 - 23 - #include <video/sh_mobile_meram.h> 24 - 25 - /* ----------------------------------------------------------------------------- 26 - * MERAM registers 27 - */ 28 - 29 - #define MEVCR1 0x4 30 - #define MEVCR1_RST (1 << 31) 31 - #define MEVCR1_WD (1 << 30) 32 - #define MEVCR1_AMD1 (1 << 29) 33 - #define MEVCR1_AMD0 (1 << 28) 34 - #define MEQSEL1 0x40 35 - #define MEQSEL2 0x44 36 - 37 - #define MExxCTL 0x400 38 - #define MExxCTL_BV (1 << 31) 39 - #define MExxCTL_BSZ_SHIFT 28 40 - #define MExxCTL_MSAR_MASK (0x7ff << MExxCTL_MSAR_SHIFT) 41 - #define MExxCTL_MSAR_SHIFT 16 42 - #define MExxCTL_NXT_MASK (0x1f << MExxCTL_NXT_SHIFT) 43 - #define MExxCTL_NXT_SHIFT 11 44 - #define MExxCTL_WD1 (1 << 10) 45 - #define MExxCTL_WD0 (1 << 9) 46 - #define MExxCTL_WS (1 << 8) 47 - #define MExxCTL_CB (1 << 7) 48 - #define MExxCTL_WBF (1 << 6) 49 - #define MExxCTL_WF (1 << 5) 50 - #define MExxCTL_RF (1 << 4) 51 - #define MExxCTL_CM (1 << 3) 52 - #define MExxCTL_MD_READ (1 << 0) 53 - #define MExxCTL_MD_WRITE (2 << 0) 54 - #define MExxCTL_MD_ICB_WB (3 << 0) 55 - #define MExxCTL_MD_ICB (4 << 0) 56 - #define MExxCTL_MD_FB (7 << 0) 57 - #define MExxCTL_MD_MASK (7 << 0) 58 - #define MExxBSIZE 0x404 59 - #define MExxBSIZE_RCNT_SHIFT 28 60 - #define MExxBSIZE_YSZM1_SHIFT 16 61 - #define MExxBSIZE_XSZM1_SHIFT 0 62 - #define MExxMNCF 0x408 63 - #define MExxMNCF_KWBNM_SHIFT 28 64 - #define MExxMNCF_KRBNM_SHIFT 24 65 - #define MExxMNCF_BNM_SHIFT 16 66 - #define MExxMNCF_XBV (1 << 15) 67 - #define MExxMNCF_CPL_YCBCR444 (1 << 12) 68 - #define MExxMNCF_CPL_YCBCR420 (2 << 12) 69 - #define MExxMNCF_CPL_YCBCR422 (3 << 12) 70 - #define MExxMNCF_CPL_MSK (3 << 12) 71 - #define MExxMNCF_BL (1 << 2) 72 - #define MExxMNCF_LNM_SHIFT 0 73 - #define MExxSARA 0x410 74 - #define MExxSARB 0x414 75 - #define MExxSBSIZE 0x418 76 - #define MExxSBSIZE_HDV (1 << 31) 77 - #define MExxSBSIZE_HSZ16 (0 << 28) 78 - #define MExxSBSIZE_HSZ32 (1 << 28) 79 - #define MExxSBSIZE_HSZ64 (2 << 28) 80 - #define MExxSBSIZE_HSZ128 (3 << 28) 81 - #define MExxSBSIZE_SBSIZZ_SHIFT 0 82 - 83 - #define MERAM_MExxCTL_VAL(next, addr) \ 84 - ((((next) << MExxCTL_NXT_SHIFT) & MExxCTL_NXT_MASK) | \ 85 - (((addr) << MExxCTL_MSAR_SHIFT) & MExxCTL_MSAR_MASK)) 86 - #define MERAM_MExxBSIZE_VAL(rcnt, yszm1, xszm1) \ 87 - (((rcnt) << MExxBSIZE_RCNT_SHIFT) | \ 88 - ((yszm1) << MExxBSIZE_YSZM1_SHIFT) | \ 89 - ((xszm1) << MExxBSIZE_XSZM1_SHIFT)) 90 - 91 - static const unsigned long common_regs[] = { 92 - MEVCR1, 93 - MEQSEL1, 94 - MEQSEL2, 95 - }; 96 - #define MERAM_REGS_SIZE ARRAY_SIZE(common_regs) 97 - 98 - static const unsigned long icb_regs[] = { 99 - MExxCTL, 100 - MExxBSIZE, 101 - MExxMNCF, 102 - MExxSARA, 103 - MExxSARB, 104 - MExxSBSIZE, 105 - }; 106 - #define ICB_REGS_SIZE ARRAY_SIZE(icb_regs) 107 - 108 - /* 109 - * sh_mobile_meram_icb - MERAM ICB information 110 - * @regs: Registers cache 111 - * @index: ICB index 112 - * @offset: MERAM block offset 113 - * @size: MERAM block size in KiB 114 - * @cache_unit: Bytes to cache per ICB 115 - * @pixelformat: Video pixel format of the data stored in the ICB 116 - * @current_reg: Which of Start Address Register A (0) or B (1) is in use 117 - */ 118 - struct sh_mobile_meram_icb { 119 - unsigned long regs[ICB_REGS_SIZE]; 120 - unsigned int index; 121 - unsigned long offset; 122 - unsigned int size; 123 - 124 - unsigned int cache_unit; 125 - unsigned int pixelformat; 126 - unsigned int current_reg; 127 - }; 128 - 129 - #define MERAM_ICB_NUM 32 130 - 131 - struct sh_mobile_meram_fb_plane { 132 - struct sh_mobile_meram_icb *marker; 133 - struct sh_mobile_meram_icb *cache; 134 - }; 135 - 136 - struct sh_mobile_meram_fb_cache { 137 - unsigned int nplanes; 138 - struct sh_mobile_meram_fb_plane planes[2]; 139 - }; 140 - 141 - /* 142 - * sh_mobile_meram_priv - MERAM device 143 - * @base: Registers base address 144 - * @meram: MERAM physical address 145 - * @regs: Registers cache 146 - * @lock: Protects used_icb and icbs 147 - * @used_icb: Bitmask of used ICBs 148 - * @icbs: ICBs 149 - * @pool: Allocation pool to manage the MERAM 150 - */ 151 - struct sh_mobile_meram_priv { 152 - void __iomem *base; 153 - unsigned long meram; 154 - unsigned long regs[MERAM_REGS_SIZE]; 155 - 156 - struct mutex lock; 157 - unsigned long used_icb; 158 - struct sh_mobile_meram_icb icbs[MERAM_ICB_NUM]; 159 - 160 - struct gen_pool *pool; 161 - }; 162 - 163 - /* settings */ 164 - #define MERAM_GRANULARITY 1024 165 - #define MERAM_SEC_LINE 15 166 - #define MERAM_LINE_WIDTH 2048 167 - 168 - /* ----------------------------------------------------------------------------- 169 - * Registers access 170 - */ 171 - 172 - #define MERAM_ICB_OFFSET(base, idx, off) ((base) + (off) + (idx) * 0x20) 173 - 174 - static inline void meram_write_icb(void __iomem *base, unsigned int idx, 175 - unsigned int off, unsigned long val) 176 - { 177 - iowrite32(val, MERAM_ICB_OFFSET(base, idx, off)); 178 - } 179 - 180 - static inline unsigned long meram_read_icb(void __iomem *base, unsigned int idx, 181 - unsigned int off) 182 - { 183 - return ioread32(MERAM_ICB_OFFSET(base, idx, off)); 184 - } 185 - 186 - static inline void meram_write_reg(void __iomem *base, unsigned int off, 187 - unsigned long val) 188 - { 189 - iowrite32(val, base + off); 190 - } 191 - 192 - static inline unsigned long meram_read_reg(void __iomem *base, unsigned int off) 193 - { 194 - return ioread32(base + off); 195 - } 196 - 197 - /* ----------------------------------------------------------------------------- 198 - * MERAM allocation and free 199 - */ 200 - 201 - static unsigned long meram_alloc(struct sh_mobile_meram_priv *priv, size_t size) 202 - { 203 - return gen_pool_alloc(priv->pool, size); 204 - } 205 - 206 - static void meram_free(struct sh_mobile_meram_priv *priv, unsigned long mem, 207 - size_t size) 208 - { 209 - gen_pool_free(priv->pool, mem, size); 210 - } 211 - 212 - /* ----------------------------------------------------------------------------- 213 - * LCDC cache planes allocation, init, cleanup and free 214 - */ 215 - 216 - /* Allocate ICBs and MERAM for a plane. */ 217 - static int meram_plane_alloc(struct sh_mobile_meram_priv *priv, 218 - struct sh_mobile_meram_fb_plane *plane, 219 - size_t size) 220 - { 221 - unsigned long mem; 222 - unsigned long idx; 223 - 224 - idx = find_first_zero_bit(&priv->used_icb, 28); 225 - if (idx == 28) 226 - return -ENOMEM; 227 - plane->cache = &priv->icbs[idx]; 228 - 229 - idx = find_next_zero_bit(&priv->used_icb, 32, 28); 230 - if (idx == 32) 231 - return -ENOMEM; 232 - plane->marker = &priv->icbs[idx]; 233 - 234 - mem = meram_alloc(priv, size * 1024); 235 - if (mem == 0) 236 - return -ENOMEM; 237 - 238 - __set_bit(plane->marker->index, &priv->used_icb); 239 - __set_bit(plane->cache->index, &priv->used_icb); 240 - 241 - plane->marker->offset = mem - priv->meram; 242 - plane->marker->size = size; 243 - 244 - return 0; 245 - } 246 - 247 - /* Free ICBs and MERAM for a plane. */ 248 - static void meram_plane_free(struct sh_mobile_meram_priv *priv, 249 - struct sh_mobile_meram_fb_plane *plane) 250 - { 251 - meram_free(priv, priv->meram + plane->marker->offset, 252 - plane->marker->size * 1024); 253 - 254 - __clear_bit(plane->marker->index, &priv->used_icb); 255 - __clear_bit(plane->cache->index, &priv->used_icb); 256 - } 257 - 258 - /* Is this a YCbCr(NV12, NV16 or NV24) colorspace? */ 259 - static int is_nvcolor(int cspace) 260 - { 261 - if (cspace == SH_MOBILE_MERAM_PF_NV || 262 - cspace == SH_MOBILE_MERAM_PF_NV24) 263 - return 1; 264 - return 0; 265 - } 266 - 267 - /* Set the next address to fetch. */ 268 - static void meram_set_next_addr(struct sh_mobile_meram_priv *priv, 269 - struct sh_mobile_meram_fb_cache *cache, 270 - unsigned long base_addr_y, 271 - unsigned long base_addr_c) 272 - { 273 - struct sh_mobile_meram_icb *icb = cache->planes[0].marker; 274 - unsigned long target; 275 - 276 - icb->current_reg ^= 1; 277 - target = icb->current_reg ? MExxSARB : MExxSARA; 278 - 279 - /* set the next address to fetch */ 280 - meram_write_icb(priv->base, cache->planes[0].cache->index, target, 281 - base_addr_y); 282 - meram_write_icb(priv->base, cache->planes[0].marker->index, target, 283 - base_addr_y + cache->planes[0].marker->cache_unit); 284 - 285 - if (cache->nplanes == 2) { 286 - meram_write_icb(priv->base, cache->planes[1].cache->index, 287 - target, base_addr_c); 288 - meram_write_icb(priv->base, cache->planes[1].marker->index, 289 - target, base_addr_c + 290 - cache->planes[1].marker->cache_unit); 291 - } 292 - } 293 - 294 - /* Get the next ICB address. */ 295 - static void 296 - meram_get_next_icb_addr(struct sh_mobile_meram_info *pdata, 297 - struct sh_mobile_meram_fb_cache *cache, 298 - unsigned long *icb_addr_y, unsigned long *icb_addr_c) 299 - { 300 - struct sh_mobile_meram_icb *icb = cache->planes[0].marker; 301 - unsigned long icb_offset; 302 - 303 - if (pdata->addr_mode == SH_MOBILE_MERAM_MODE0) 304 - icb_offset = 0x80000000 | (icb->current_reg << 29); 305 - else 306 - icb_offset = 0xc0000000 | (icb->current_reg << 23); 307 - 308 - *icb_addr_y = icb_offset | (cache->planes[0].marker->index << 24); 309 - if (cache->nplanes == 2) 310 - *icb_addr_c = icb_offset 311 - | (cache->planes[1].marker->index << 24); 312 - } 313 - 314 - #define MERAM_CALC_BYTECOUNT(x, y) \ 315 - (((x) * (y) + (MERAM_LINE_WIDTH - 1)) & ~(MERAM_LINE_WIDTH - 1)) 316 - 317 - /* Initialize MERAM. */ 318 - static int meram_plane_init(struct sh_mobile_meram_priv *priv, 319 - struct sh_mobile_meram_fb_plane *plane, 320 - unsigned int xres, unsigned int yres, 321 - unsigned int *out_pitch) 322 - { 323 - struct sh_mobile_meram_icb *marker = plane->marker; 324 - unsigned long total_byte_count = MERAM_CALC_BYTECOUNT(xres, yres); 325 - unsigned long bnm; 326 - unsigned int lcdc_pitch; 327 - unsigned int xpitch; 328 - unsigned int line_cnt; 329 - unsigned int save_lines; 330 - 331 - /* adjust pitch to 1024, 2048, 4096 or 8192 */ 332 - lcdc_pitch = (xres - 1) | 1023; 333 - lcdc_pitch = lcdc_pitch | (lcdc_pitch >> 1); 334 - lcdc_pitch = lcdc_pitch | (lcdc_pitch >> 2); 335 - lcdc_pitch += 1; 336 - 337 - /* derive settings */ 338 - if (lcdc_pitch == 8192 && yres >= 1024) { 339 - lcdc_pitch = xpitch = MERAM_LINE_WIDTH; 340 - line_cnt = total_byte_count >> 11; 341 - *out_pitch = xres; 342 - save_lines = plane->marker->size / 16 / MERAM_SEC_LINE; 343 - save_lines *= MERAM_SEC_LINE; 344 - } else { 345 - xpitch = xres; 346 - line_cnt = yres; 347 - *out_pitch = lcdc_pitch; 348 - save_lines = plane->marker->size / (lcdc_pitch >> 10) / 2; 349 - save_lines &= 0xff; 350 - } 351 - bnm = (save_lines - 1) << 16; 352 - 353 - /* TODO: we better to check if we have enough MERAM buffer size */ 354 - 355 - /* set up ICB */ 356 - meram_write_icb(priv->base, plane->cache->index, MExxBSIZE, 357 - MERAM_MExxBSIZE_VAL(0x0, line_cnt - 1, xpitch - 1)); 358 - meram_write_icb(priv->base, plane->marker->index, MExxBSIZE, 359 - MERAM_MExxBSIZE_VAL(0xf, line_cnt - 1, xpitch - 1)); 360 - 361 - meram_write_icb(priv->base, plane->cache->index, MExxMNCF, bnm); 362 - meram_write_icb(priv->base, plane->marker->index, MExxMNCF, bnm); 363 - 364 - meram_write_icb(priv->base, plane->cache->index, MExxSBSIZE, xpitch); 365 - meram_write_icb(priv->base, plane->marker->index, MExxSBSIZE, xpitch); 366 - 367 - /* save a cache unit size */ 368 - plane->cache->cache_unit = xres * save_lines; 369 - plane->marker->cache_unit = xres * save_lines; 370 - 371 - /* 372 - * Set MERAM for framebuffer 373 - * 374 - * we also chain the cache_icb and the marker_icb. 375 - * we also split the allocated MERAM buffer between two ICBs. 376 - */ 377 - meram_write_icb(priv->base, plane->cache->index, MExxCTL, 378 - MERAM_MExxCTL_VAL(plane->marker->index, marker->offset) 379 - | MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM | 380 - MExxCTL_MD_FB); 381 - meram_write_icb(priv->base, plane->marker->index, MExxCTL, 382 - MERAM_MExxCTL_VAL(plane->cache->index, marker->offset + 383 - plane->marker->size / 2) | 384 - MExxCTL_WD1 | MExxCTL_WD0 | MExxCTL_WS | MExxCTL_CM | 385 - MExxCTL_MD_FB); 386 - 387 - return 0; 388 - } 389 - 390 - static void meram_plane_cleanup(struct sh_mobile_meram_priv *priv, 391 - struct sh_mobile_meram_fb_plane *plane) 392 - { 393 - /* disable ICB */ 394 - meram_write_icb(priv->base, plane->cache->index, MExxCTL, 395 - MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF); 396 - meram_write_icb(priv->base, plane->marker->index, MExxCTL, 397 - MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF); 398 - 399 - plane->cache->cache_unit = 0; 400 - plane->marker->cache_unit = 0; 401 - } 402 - 403 - /* ----------------------------------------------------------------------------- 404 - * MERAM operations 405 - */ 406 - 407 - unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *pdata, 408 - size_t size) 409 - { 410 - struct sh_mobile_meram_priv *priv = pdata->priv; 411 - 412 - return meram_alloc(priv, size); 413 - } 414 - EXPORT_SYMBOL_GPL(sh_mobile_meram_alloc); 415 - 416 - void sh_mobile_meram_free(struct sh_mobile_meram_info *pdata, unsigned long mem, 417 - size_t size) 418 - { 419 - struct sh_mobile_meram_priv *priv = pdata->priv; 420 - 421 - meram_free(priv, mem, size); 422 - } 423 - EXPORT_SYMBOL_GPL(sh_mobile_meram_free); 424 - 425 - /* Allocate memory for the ICBs and mark them as used. */ 426 - static struct sh_mobile_meram_fb_cache * 427 - meram_cache_alloc(struct sh_mobile_meram_priv *priv, 428 - const struct sh_mobile_meram_cfg *cfg, 429 - int pixelformat) 430 - { 431 - unsigned int nplanes = is_nvcolor(pixelformat) ? 2 : 1; 432 - struct sh_mobile_meram_fb_cache *cache; 433 - int ret; 434 - 435 - cache = kzalloc(sizeof(*cache), GFP_KERNEL); 436 - if (cache == NULL) 437 - return ERR_PTR(-ENOMEM); 438 - 439 - cache->nplanes = nplanes; 440 - 441 - ret = meram_plane_alloc(priv, &cache->planes[0], 442 - cfg->icb[0].meram_size); 443 - if (ret < 0) 444 - goto error; 445 - 446 - cache->planes[0].marker->current_reg = 1; 447 - cache->planes[0].marker->pixelformat = pixelformat; 448 - 449 - if (cache->nplanes == 1) 450 - return cache; 451 - 452 - ret = meram_plane_alloc(priv, &cache->planes[1], 453 - cfg->icb[1].meram_size); 454 - if (ret < 0) { 455 - meram_plane_free(priv, &cache->planes[0]); 456 - goto error; 457 - } 458 - 459 - return cache; 460 - 461 - error: 462 - kfree(cache); 463 - return ERR_PTR(-ENOMEM); 464 - } 465 - 466 - void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *pdata, 467 - const struct sh_mobile_meram_cfg *cfg, 468 - unsigned int xres, unsigned int yres, 469 - unsigned int pixelformat, unsigned int *pitch) 470 - { 471 - struct sh_mobile_meram_fb_cache *cache; 472 - struct sh_mobile_meram_priv *priv = pdata->priv; 473 - struct platform_device *pdev = pdata->pdev; 474 - unsigned int nplanes = is_nvcolor(pixelformat) ? 2 : 1; 475 - unsigned int out_pitch; 476 - 477 - if (priv == NULL) 478 - return ERR_PTR(-ENODEV); 479 - 480 - if (pixelformat != SH_MOBILE_MERAM_PF_NV && 481 - pixelformat != SH_MOBILE_MERAM_PF_NV24 && 482 - pixelformat != SH_MOBILE_MERAM_PF_RGB) 483 - return ERR_PTR(-EINVAL); 484 - 485 - dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres, 486 - !pixelformat ? "yuv" : "rgb"); 487 - 488 - /* we can't handle wider than 8192px */ 489 - if (xres > 8192) { 490 - dev_err(&pdev->dev, "width exceeding the limit (> 8192)."); 491 - return ERR_PTR(-EINVAL); 492 - } 493 - 494 - if (cfg->icb[0].meram_size == 0) 495 - return ERR_PTR(-EINVAL); 496 - 497 - if (nplanes == 2 && cfg->icb[1].meram_size == 0) 498 - return ERR_PTR(-EINVAL); 499 - 500 - mutex_lock(&priv->lock); 501 - 502 - /* We now register the ICBs and allocate the MERAM regions. */ 503 - cache = meram_cache_alloc(priv, cfg, pixelformat); 504 - if (IS_ERR(cache)) { 505 - dev_err(&pdev->dev, "MERAM allocation failed (%ld).", 506 - PTR_ERR(cache)); 507 - goto err; 508 - } 509 - 510 - /* initialize MERAM */ 511 - meram_plane_init(priv, &cache->planes[0], xres, yres, &out_pitch); 512 - *pitch = out_pitch; 513 - if (pixelformat == SH_MOBILE_MERAM_PF_NV) 514 - meram_plane_init(priv, &cache->planes[1], 515 - xres, (yres + 1) / 2, &out_pitch); 516 - else if (pixelformat == SH_MOBILE_MERAM_PF_NV24) 517 - meram_plane_init(priv, &cache->planes[1], 518 - 2 * xres, (yres + 1) / 2, &out_pitch); 519 - 520 - err: 521 - mutex_unlock(&priv->lock); 522 - return cache; 523 - } 524 - EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_alloc); 525 - 526 - void 527 - sh_mobile_meram_cache_free(struct sh_mobile_meram_info *pdata, void *data) 528 - { 529 - struct sh_mobile_meram_fb_cache *cache = data; 530 - struct sh_mobile_meram_priv *priv = pdata->priv; 531 - 532 - mutex_lock(&priv->lock); 533 - 534 - /* Cleanup and free. */ 535 - meram_plane_cleanup(priv, &cache->planes[0]); 536 - meram_plane_free(priv, &cache->planes[0]); 537 - 538 - if (cache->nplanes == 2) { 539 - meram_plane_cleanup(priv, &cache->planes[1]); 540 - meram_plane_free(priv, &cache->planes[1]); 541 - } 542 - 543 - kfree(cache); 544 - 545 - mutex_unlock(&priv->lock); 546 - } 547 - EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_free); 548 - 549 - void 550 - sh_mobile_meram_cache_update(struct sh_mobile_meram_info *pdata, void *data, 551 - unsigned long base_addr_y, 552 - unsigned long base_addr_c, 553 - unsigned long *icb_addr_y, 554 - unsigned long *icb_addr_c) 555 - { 556 - struct sh_mobile_meram_fb_cache *cache = data; 557 - struct sh_mobile_meram_priv *priv = pdata->priv; 558 - 559 - mutex_lock(&priv->lock); 560 - 561 - meram_set_next_addr(priv, cache, base_addr_y, base_addr_c); 562 - meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c); 563 - 564 - mutex_unlock(&priv->lock); 565 - } 566 - EXPORT_SYMBOL_GPL(sh_mobile_meram_cache_update); 567 - 568 - /* ----------------------------------------------------------------------------- 569 - * Power management 570 - */ 571 - 572 - #ifdef CONFIG_PM 573 - static int sh_mobile_meram_suspend(struct device *dev) 574 - { 575 - struct platform_device *pdev = to_platform_device(dev); 576 - struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); 577 - unsigned int i, j; 578 - 579 - for (i = 0; i < MERAM_REGS_SIZE; i++) 580 - priv->regs[i] = meram_read_reg(priv->base, common_regs[i]); 581 - 582 - for (i = 0; i < 32; i++) { 583 - if (!test_bit(i, &priv->used_icb)) 584 - continue; 585 - for (j = 0; j < ICB_REGS_SIZE; j++) { 586 - priv->icbs[i].regs[j] = 587 - meram_read_icb(priv->base, i, icb_regs[j]); 588 - /* Reset ICB on resume */ 589 - if (icb_regs[j] == MExxCTL) 590 - priv->icbs[i].regs[j] |= 591 - MExxCTL_WBF | MExxCTL_WF | MExxCTL_RF; 592 - } 593 - } 594 - return 0; 595 - } 596 - 597 - static int sh_mobile_meram_resume(struct device *dev) 598 - { 599 - struct platform_device *pdev = to_platform_device(dev); 600 - struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); 601 - unsigned int i, j; 602 - 603 - for (i = 0; i < 32; i++) { 604 - if (!test_bit(i, &priv->used_icb)) 605 - continue; 606 - for (j = 0; j < ICB_REGS_SIZE; j++) 607 - meram_write_icb(priv->base, i, icb_regs[j], 608 - priv->icbs[i].regs[j]); 609 - } 610 - 611 - for (i = 0; i < MERAM_REGS_SIZE; i++) 612 - meram_write_reg(priv->base, common_regs[i], priv->regs[i]); 613 - return 0; 614 - } 615 - #endif /* CONFIG_PM */ 616 - 617 - static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops, 618 - sh_mobile_meram_suspend, 619 - sh_mobile_meram_resume, NULL); 620 - 621 - /* ----------------------------------------------------------------------------- 622 - * Probe/remove and driver init/exit 623 - */ 624 - 625 - static int sh_mobile_meram_probe(struct platform_device *pdev) 626 - { 627 - struct sh_mobile_meram_priv *priv; 628 - struct sh_mobile_meram_info *pdata = pdev->dev.platform_data; 629 - struct resource *regs; 630 - struct resource *meram; 631 - unsigned int i; 632 - int error; 633 - 634 - if (!pdata) { 635 - dev_err(&pdev->dev, "no platform data defined\n"); 636 - return -EINVAL; 637 - } 638 - 639 - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 640 - meram = platform_get_resource(pdev, IORESOURCE_MEM, 1); 641 - if (regs == NULL || meram == NULL) { 642 - dev_err(&pdev->dev, "cannot get platform resources\n"); 643 - return -ENOENT; 644 - } 645 - 646 - priv = kzalloc(sizeof(*priv), GFP_KERNEL); 647 - if (!priv) { 648 - dev_err(&pdev->dev, "cannot allocate device data\n"); 649 - return -ENOMEM; 650 - } 651 - 652 - /* Initialize private data. */ 653 - mutex_init(&priv->lock); 654 - priv->used_icb = pdata->reserved_icbs; 655 - 656 - for (i = 0; i < MERAM_ICB_NUM; ++i) 657 - priv->icbs[i].index = i; 658 - 659 - pdata->priv = priv; 660 - pdata->pdev = pdev; 661 - 662 - /* Request memory regions and remap the registers. */ 663 - if (!request_mem_region(regs->start, resource_size(regs), pdev->name)) { 664 - dev_err(&pdev->dev, "MERAM registers region already claimed\n"); 665 - error = -EBUSY; 666 - goto err_req_regs; 667 - } 668 - 669 - if (!request_mem_region(meram->start, resource_size(meram), 670 - pdev->name)) { 671 - dev_err(&pdev->dev, "MERAM memory region already claimed\n"); 672 - error = -EBUSY; 673 - goto err_req_meram; 674 - } 675 - 676 - priv->base = ioremap_nocache(regs->start, resource_size(regs)); 677 - if (!priv->base) { 678 - dev_err(&pdev->dev, "ioremap failed\n"); 679 - error = -EFAULT; 680 - goto err_ioremap; 681 - } 682 - 683 - priv->meram = meram->start; 684 - 685 - /* Create and initialize the MERAM memory pool. */ 686 - priv->pool = gen_pool_create(ilog2(MERAM_GRANULARITY), -1); 687 - if (priv->pool == NULL) { 688 - error = -ENOMEM; 689 - goto err_genpool; 690 - } 691 - 692 - error = gen_pool_add(priv->pool, meram->start, resource_size(meram), 693 - -1); 694 - if (error < 0) 695 - goto err_genpool; 696 - 697 - /* initialize ICB addressing mode */ 698 - if (pdata->addr_mode == SH_MOBILE_MERAM_MODE1) 699 - meram_write_reg(priv->base, MEVCR1, MEVCR1_AMD1); 700 - 701 - platform_set_drvdata(pdev, priv); 702 - pm_runtime_enable(&pdev->dev); 703 - 704 - dev_info(&pdev->dev, "sh_mobile_meram initialized."); 705 - 706 - return 0; 707 - 708 - err_genpool: 709 - if (priv->pool) 710 - gen_pool_destroy(priv->pool); 711 - iounmap(priv->base); 712 - err_ioremap: 713 - release_mem_region(meram->start, resource_size(meram)); 714 - err_req_meram: 715 - release_mem_region(regs->start, resource_size(regs)); 716 - err_req_regs: 717 - mutex_destroy(&priv->lock); 718 - kfree(priv); 719 - 720 - return error; 721 - } 722 - 723 - 724 - static int sh_mobile_meram_remove(struct platform_device *pdev) 725 - { 726 - struct sh_mobile_meram_priv *priv = platform_get_drvdata(pdev); 727 - struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 728 - struct resource *meram = platform_get_resource(pdev, IORESOURCE_MEM, 1); 729 - 730 - pm_runtime_disable(&pdev->dev); 731 - 732 - gen_pool_destroy(priv->pool); 733 - 734 - iounmap(priv->base); 735 - release_mem_region(meram->start, resource_size(meram)); 736 - release_mem_region(regs->start, resource_size(regs)); 737 - 738 - mutex_destroy(&priv->lock); 739 - 740 - kfree(priv); 741 - 742 - return 0; 743 - } 744 - 745 - static struct platform_driver sh_mobile_meram_driver = { 746 - .driver = { 747 - .name = "sh_mobile_meram", 748 - .pm = &sh_mobile_meram_dev_pm_ops, 749 - }, 750 - .probe = sh_mobile_meram_probe, 751 - .remove = sh_mobile_meram_remove, 752 - }; 753 - 754 - module_platform_driver(sh_mobile_meram_driver); 755 - 756 - MODULE_DESCRIPTION("SuperH Mobile MERAM driver"); 757 - MODULE_AUTHOR("Damian Hobson-Garcia / Takanari Hayama"); 758 - MODULE_LICENSE("GPL v2");
+1 -2
drivers/video/fbdev/sm501fb.c
··· 1932 1932 int ret; 1933 1933 1934 1934 /* allocate our framebuffers */ 1935 - 1936 - info = kzalloc(sizeof(struct sm501fb_info), GFP_KERNEL); 1935 + info = kzalloc(sizeof(*info), GFP_KERNEL); 1937 1936 if (!info) { 1938 1937 dev_err(dev, "failed to allocate state\n"); 1939 1938 return -ENOMEM;
+6
drivers/video/fbdev/via/global.h
··· 33 33 #include <linux/console.h> 34 34 #include <linux/timer.h> 35 35 36 + #ifdef CONFIG_X86 37 + #include <asm/olpc.h> 38 + #else 39 + #define machine_is_olpc(x) 0 40 + #endif 41 + 36 42 #include "debug.h" 37 43 38 44 #include "viafbdev.h"
-1
drivers/video/fbdev/via/hw.c
··· 20 20 */ 21 21 22 22 #include <linux/via-core.h> 23 - #include <asm/olpc.h> 24 23 #include "global.h" 25 24 #include "via_clock.h" 26 25
-1
drivers/video/fbdev/via/via-core.c
··· 17 17 #include <linux/platform_device.h> 18 18 #include <linux/list.h> 19 19 #include <linux/pm.h> 20 - #include <asm/olpc.h> 21 20 22 21 /* 23 22 * The default port config.
+1 -1
drivers/video/fbdev/via/via_clock.c
··· 25 25 26 26 #include <linux/kernel.h> 27 27 #include <linux/via-core.h> 28 - #include <asm/olpc.h> 28 + 29 29 #include "via_clock.h" 30 30 #include "global.h" 31 31 #include "debug.h"
-1
drivers/video/fbdev/via/viafbdev.c
··· 25 25 #include <linux/stat.h> 26 26 #include <linux/via-core.h> 27 27 #include <linux/via_i2c.h> 28 - #include <asm/olpc.h> 29 28 30 29 #define _MASTER_FILE 31 30 #include "global.h"
-4
include/linux/platform_data/shmob_drm.h
··· 18 18 19 19 #include <drm/drm_mode.h> 20 20 21 - struct sh_mobile_meram_cfg; 22 - struct sh_mobile_meram_info; 23 - 24 21 enum shmob_drm_clk_source { 25 22 SHMOB_DRM_CLK_BUS, 26 23 SHMOB_DRM_CLK_PERIPHERAL, ··· 90 93 struct shmob_drm_interface_data iface; 91 94 struct shmob_drm_panel_data panel; 92 95 struct shmob_drm_backlight_data backlight; 93 - const struct sh_mobile_meram_cfg *meram; 94 96 }; 95 97 96 98 #endif /* __SHMOB_DRM_H__ */
-107
include/video/auo_k190xfb.h
··· 1 - /* 2 - * Definitions for AUO-K190X framebuffer drivers 3 - * 4 - * Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - #ifndef _LINUX_VIDEO_AUO_K190XFB_H_ 12 - #define _LINUX_VIDEO_AUO_K190XFB_H_ 13 - 14 - /* Controller standby command needs a param */ 15 - #define AUOK190X_QUIRK_STANDBYPARAM (1 << 0) 16 - 17 - /* Controller standby is completely broken */ 18 - #define AUOK190X_QUIRK_STANDBYBROKEN (1 << 1) 19 - 20 - /* 21 - * Resolutions for the displays 22 - */ 23 - #define AUOK190X_RESOLUTION_800_600 0 24 - #define AUOK190X_RESOLUTION_1024_768 1 25 - #define AUOK190X_RESOLUTION_600_800 4 26 - #define AUOK190X_RESOLUTION_768_1024 5 27 - 28 - /* 29 - * struct used by auok190x. board specific stuff comes from *board 30 - */ 31 - struct auok190xfb_par { 32 - struct fb_info *info; 33 - struct auok190x_board *board; 34 - 35 - struct regulator *regulator; 36 - 37 - struct mutex io_lock; 38 - struct delayed_work work; 39 - wait_queue_head_t waitq; 40 - int resolution; 41 - int rotation; 42 - int consecutive_threshold; 43 - int update_cnt; 44 - 45 - /* panel and controller informations */ 46 - int epd_type; 47 - int panel_size_int; 48 - int panel_size_float; 49 - int panel_model; 50 - int tcon_version; 51 - int lut_version; 52 - 53 - /* individual controller callbacks */ 54 - void (*update_partial)(struct auok190xfb_par *par, u16 y1, u16 y2); 55 - void (*update_all)(struct auok190xfb_par *par); 56 - bool (*need_refresh)(struct auok190xfb_par *par); 57 - void (*init)(struct auok190xfb_par *par); 58 - void (*recover)(struct auok190xfb_par *par); 59 - 60 - int update_mode; /* mode to use for updates */ 61 - int last_mode; /* update mode last used */ 62 - int flash; 63 - 64 - /* power management */ 65 - int autosuspend_delay; 66 - bool standby; 67 - bool manual_standby; 68 - }; 69 - 70 - /** 71 - * Board specific platform-data 72 - * @init: initialize the controller interface 73 - * @cleanup: cleanup the controller interface 74 - * @wait_for_rdy: wait until the controller is not busy anymore 75 - * @set_ctl: change an interface control 76 - * @set_hdb: write a value to the data register 77 - * @get_hdb: read a value from the data register 78 - * @setup_irq: method to setup the irq handling on the busy gpio 79 - * @gpio_nsleep: sleep gpio 80 - * @gpio_nrst: reset gpio 81 - * @gpio_nbusy: busy gpio 82 - * @resolution: one of the AUOK190X_RESOLUTION constants 83 - * @rotation: rotation of the framebuffer 84 - * @quirks: controller quirks to honor 85 - * @fps: frames per second for defio 86 - */ 87 - struct auok190x_board { 88 - int (*init)(struct auok190xfb_par *); 89 - void (*cleanup)(struct auok190xfb_par *); 90 - int (*wait_for_rdy)(struct auok190xfb_par *); 91 - 92 - void (*set_ctl)(struct auok190xfb_par *, unsigned char, u8); 93 - void (*set_hdb)(struct auok190xfb_par *, u16); 94 - u16 (*get_hdb)(struct auok190xfb_par *); 95 - 96 - int (*setup_irq)(struct fb_info *); 97 - 98 - int gpio_nsleep; 99 - int gpio_nrst; 100 - int gpio_nbusy; 101 - 102 - int resolution; 103 - int quirks; 104 - int fps; 105 - }; 106 - 107 - #endif
-3
include/video/sh_mobile_lcdc.h
··· 3 3 #define __ASM_SH_MOBILE_LCDC_H__ 4 4 5 5 #include <linux/fb.h> 6 - #include <video/sh_mobile_meram.h> 7 6 8 7 /* Register definitions */ 9 8 #define _LDDCKR 0x410 ··· 183 184 struct sh_mobile_lcdc_panel_cfg panel_cfg; 184 185 struct sh_mobile_lcdc_bl_info bl_info; 185 186 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 186 - const struct sh_mobile_meram_cfg *meram_cfg; 187 187 188 188 struct platform_device *tx_dev; /* HDMI/DSI transmitter device */ 189 189 }; ··· 191 193 int clock_source; 192 194 struct sh_mobile_lcdc_chan_cfg ch[2]; 193 195 struct sh_mobile_lcdc_overlay_cfg overlays[4]; 194 - struct sh_mobile_meram_info *meram_dev; 195 196 }; 196 197 197 198 #endif /* __ASM_SH_MOBILE_LCDC_H__ */
-95
include/video/sh_mobile_meram.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __VIDEO_SH_MOBILE_MERAM_H__ 3 - #define __VIDEO_SH_MOBILE_MERAM_H__ 4 - 5 - /* For sh_mobile_meram_info.addr_mode */ 6 - enum { 7 - SH_MOBILE_MERAM_MODE0 = 0, 8 - SH_MOBILE_MERAM_MODE1 9 - }; 10 - 11 - enum { 12 - SH_MOBILE_MERAM_PF_NV = 0, 13 - SH_MOBILE_MERAM_PF_RGB, 14 - SH_MOBILE_MERAM_PF_NV24 15 - }; 16 - 17 - 18 - struct sh_mobile_meram_priv; 19 - 20 - /* 21 - * struct sh_mobile_meram_info - MERAM platform data 22 - * @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO) 23 - */ 24 - struct sh_mobile_meram_info { 25 - int addr_mode; 26 - u32 reserved_icbs; 27 - struct sh_mobile_meram_priv *priv; 28 - struct platform_device *pdev; 29 - }; 30 - 31 - /* icb config */ 32 - struct sh_mobile_meram_icb_cfg { 33 - unsigned int meram_size; /* MERAM Buffer Size to use */ 34 - }; 35 - 36 - struct sh_mobile_meram_cfg { 37 - struct sh_mobile_meram_icb_cfg icb[2]; 38 - }; 39 - 40 - #if defined(CONFIG_FB_SH_MOBILE_MERAM) || \ 41 - defined(CONFIG_FB_SH_MOBILE_MERAM_MODULE) 42 - unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev, 43 - size_t size); 44 - void sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev, 45 - unsigned long mem, size_t size); 46 - void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev, 47 - const struct sh_mobile_meram_cfg *cfg, 48 - unsigned int xres, unsigned int yres, 49 - unsigned int pixelformat, 50 - unsigned int *pitch); 51 - void sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data); 52 - void sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data, 53 - unsigned long base_addr_y, 54 - unsigned long base_addr_c, 55 - unsigned long *icb_addr_y, 56 - unsigned long *icb_addr_c); 57 - #else 58 - static inline unsigned long 59 - sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev, size_t size) 60 - { 61 - return 0; 62 - } 63 - 64 - static inline void 65 - sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev, 66 - unsigned long mem, size_t size) 67 - { 68 - } 69 - 70 - static inline void * 71 - sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev, 72 - const struct sh_mobile_meram_cfg *cfg, 73 - unsigned int xres, unsigned int yres, 74 - unsigned int pixelformat, 75 - unsigned int *pitch) 76 - { 77 - return ERR_PTR(-ENODEV); 78 - } 79 - 80 - static inline void 81 - sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data) 82 - { 83 - } 84 - 85 - static inline void 86 - sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data, 87 - unsigned long base_addr_y, 88 - unsigned long base_addr_c, 89 - unsigned long *icb_addr_y, 90 - unsigned long *icb_addr_c) 91 - { 92 - } 93 - #endif 94 - 95 - #endif /* __VIDEO_SH_MOBILE_MERAM_H__ */