Commit 644f2639 authored by Linus Torvalds's avatar Linus Torvalds

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
  ...
parents 35773c93 85ebd164
......@@ -10273,18 +10273,16 @@ F: arch/arm/boot/dts/*am5*
F: arch/arm/boot/dts/*dra7*
OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2)
M: Tomi Valkeinen <tomi.valkeinen@ti.com>
L: linux-omap@vger.kernel.org
L: linux-fbdev@vger.kernel.org
S: Maintained
S: Orphan
F: drivers/video/fbdev/omap2/
F: Documentation/arm/OMAP/DSS
OMAP FRAMEBUFFER SUPPORT
M: Tomi Valkeinen <tomi.valkeinen@ti.com>
L: linux-fbdev@vger.kernel.org
L: linux-omap@vger.kernel.org
S: Maintained
S: Orphan
F: drivers/video/fbdev/omap/
OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT
......
......@@ -2,7 +2,6 @@ config DRM_SHMOBILE
tristate "DRM Support for SH Mobile"
depends on DRM && ARM
depends on ARCH_SHMOBILE || COMPILE_TEST
depends on FB_SH_MOBILE_MERAM || !FB_SH_MOBILE_MERAM
select BACKLIGHT_CLASS_DEVICE
select BACKLIGHT_LCD_SUPPORT
select DRM_KMS_HELPER
......
......@@ -21,8 +21,6 @@
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_plane_helper.h>
#include <video/sh_mobile_meram.h>
#include "shmob_drm_backlight.h"
#include "shmob_drm_crtc.h"
#include "shmob_drm_drv.h"
......@@ -47,20 +45,12 @@ static int shmob_drm_clk_on(struct shmob_drm_device *sdev)
if (ret < 0)
return ret;
}
#if 0
if (sdev->meram_dev && sdev->meram_dev->pdev)
pm_runtime_get_sync(&sdev->meram_dev->pdev->dev);
#endif
return 0;
}
static void shmob_drm_clk_off(struct shmob_drm_device *sdev)
{
#if 0
if (sdev->meram_dev && sdev->meram_dev->pdev)
pm_runtime_put_sync(&sdev->meram_dev->pdev->dev);
#endif
if (sdev->clock)
clk_disable_unprepare(sdev->clock);
}
......@@ -269,12 +259,6 @@ static void shmob_drm_crtc_stop(struct shmob_drm_crtc *scrtc)
if (!scrtc->started)
return;
/* Disable the MERAM cache. */
if (scrtc->cache) {
sh_mobile_meram_cache_free(sdev->meram, scrtc->cache);
scrtc->cache = NULL;
}
/* Stop the LCDC. */
shmob_drm_crtc_start_stop(scrtc, false);
......@@ -305,7 +289,6 @@ static void shmob_drm_crtc_compute_base(struct shmob_drm_crtc *scrtc,
{
struct drm_crtc *crtc = &scrtc->crtc;
struct drm_framebuffer *fb = crtc->primary->fb;
struct shmob_drm_device *sdev = crtc->dev->dev_private;
struct drm_gem_cma_object *gem;
unsigned int bpp;
......@@ -321,11 +304,6 @@ static void shmob_drm_crtc_compute_base(struct shmob_drm_crtc *scrtc,
+ y / (bpp == 4 ? 2 : 1) * fb->pitches[1]
+ x * (bpp == 16 ? 2 : 1);
}
if (scrtc->cache)
sh_mobile_meram_cache_update(sdev->meram, scrtc->cache,
scrtc->dma[0], scrtc->dma[1],
&scrtc->dma[0], &scrtc->dma[1]);
}
static void shmob_drm_crtc_update_base(struct shmob_drm_crtc *scrtc)
......@@ -372,9 +350,7 @@ static int shmob_drm_crtc_mode_set(struct drm_crtc *crtc,
{
struct shmob_drm_crtc *scrtc = to_shmob_crtc(crtc);
struct shmob_drm_device *sdev = crtc->dev->dev_private;
const struct sh_mobile_meram_cfg *mdata = sdev->pdata->meram;
const struct shmob_drm_format_info *format;
void *cache;
format = shmob_drm_format_info(crtc->primary->fb->format->format);
if (format == NULL) {
......@@ -386,24 +362,6 @@ static int shmob_drm_crtc_mode_set(struct drm_crtc *crtc,
scrtc->format = format;
scrtc->line_size = crtc->primary->fb->pitches[0];
if (sdev->meram) {
/* Enable MERAM cache if configured. We need to de-init
* configured ICBs before we can re-initialize them.
*/
if (scrtc->cache) {
sh_mobile_meram_cache_free(sdev->meram, scrtc->cache);
scrtc->cache = NULL;
}
cache = sh_mobile_meram_cache_alloc(sdev->meram, mdata,
crtc->primary->fb->pitches[0],
adjusted_mode->vdisplay,
format->meram,
&scrtc->line_size);
if (!IS_ERR(cache))
scrtc->cache = cache;
}
shmob_drm_crtc_compute_base(scrtc, x, y);
return 0;
......
......@@ -28,7 +28,6 @@ struct shmob_drm_crtc {
int dpms;
const struct shmob_drm_format_info *format;
void *cache;
unsigned long dma[2];
unsigned int line_size;
bool started;
......
......@@ -23,7 +23,6 @@
struct clk;
struct device;
struct drm_device;
struct sh_mobile_meram_info;
struct shmob_drm_device {
struct device *dev;
......@@ -31,7 +30,6 @@ struct shmob_drm_device {
void __iomem *mmio;
struct clk *clock;
struct sh_mobile_meram_info *meram;
u32 lddckr;
u32 ldmt1r;
......
......@@ -18,8 +18,6 @@
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <video/sh_mobile_meram.h>
#include "shmob_drm_crtc.h"
#include "shmob_drm_drv.h"
#include "shmob_drm_kms.h"
......@@ -35,55 +33,46 @@ static const struct shmob_drm_format_info shmob_drm_format_infos[] = {
.bpp = 16,
.yuv = false,
.lddfr = LDDFR_PKF_RGB16,
.meram = SH_MOBILE_MERAM_PF_RGB,
}, {
.fourcc = DRM_FORMAT_RGB888,
.bpp = 24,
.yuv = false,
.lddfr = LDDFR_PKF_RGB24,
.meram = SH_MOBILE_MERAM_PF_RGB,
}, {
.fourcc = DRM_FORMAT_ARGB8888,
.bpp = 32,
.yuv = false,
.lddfr = LDDFR_PKF_ARGB32,
.meram = SH_MOBILE_MERAM_PF_RGB,
}, {
.fourcc = DRM_FORMAT_NV12,
.bpp = 12,
.yuv = true,
.lddfr = LDDFR_CC | LDDFR_YF_420,
.meram = SH_MOBILE_MERAM_PF_NV,
}, {
.fourcc = DRM_FORMAT_NV21,
.bpp = 12,
.yuv = true,
.lddfr = LDDFR_CC | LDDFR_YF_420,
.meram = SH_MOBILE_MERAM_PF_NV,
}, {
.fourcc = DRM_FORMAT_NV16,
.bpp = 16,
.yuv = true,
.lddfr = LDDFR_CC | LDDFR_YF_422,
.meram = SH_MOBILE_MERAM_PF_NV,
}, {
.fourcc = DRM_FORMAT_NV61,
.bpp = 16,
.yuv = true,
.lddfr = LDDFR_CC | LDDFR_YF_422,
.meram = SH_MOBILE_MERAM_PF_NV,
}, {
.fourcc = DRM_FORMAT_NV24,
.bpp = 24,
.yuv = true,
.lddfr = LDDFR_CC | LDDFR_YF_444,
.meram = SH_MOBILE_MERAM_PF_NV24,
}, {
.fourcc = DRM_FORMAT_NV42,
.bpp = 24,
.yuv = true,
.lddfr = LDDFR_CC | LDDFR_YF_444,
.meram = SH_MOBILE_MERAM_PF_NV24,
},
};
......
......@@ -24,7 +24,6 @@ struct shmob_drm_format_info {
unsigned int bpp;
bool yuv;
u32 lddfr;
unsigned int meram;
};
const struct shmob_drm_format_info *shmob_drm_format_info(u32 fourcc);
......
......@@ -17,8 +17,6 @@
#include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h>
#include <video/sh_mobile_meram.h>
#include "shmob_drm_drv.h"
#include "shmob_drm_kms.h"
#include "shmob_drm_plane.h"
......
......@@ -27,7 +27,12 @@
#include <linux/via-core.h>
#include <linux/via-gpio.h>
#include <linux/via_i2c.h>
#ifdef CONFIG_X86
#include <asm/olpc.h>
#else
#define machine_is_olpc(x) 0
#endif
#include "via-camera.h"
......
......@@ -1437,7 +1437,7 @@ config FB_SIS_315
config FB_VIA
tristate "VIA UniChrome (Pro) and Chrome9 display support"
depends on FB && PCI && X86 && GPIOLIB && I2C
depends on FB && PCI && GPIOLIB && I2C && (X86 || COMPILE_TEST)
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
......@@ -1888,7 +1888,6 @@ config FB_W100
config FB_SH_MOBILE_LCDC
tristate "SuperH Mobile LCDC framebuffer support"
depends on FB && (SUPERH || ARCH_RENESAS) && HAVE_CLK
depends on FB_SH_MOBILE_MERAM || !FB_SH_MOBILE_MERAM
select FB_SYS_FILLRECT
select FB_SYS_COPYAREA
select FB_SYS_IMAGEBLIT
......@@ -2253,39 +2252,6 @@ config FB_BROADSHEET
and could also have been called by other names when coupled with
a bridge adapter.
config FB_AUO_K190X
tristate "AUO-K190X EPD controller support"
depends on FB
select FB_SYS_FILLRECT
select FB_SYS_COPYAREA
select FB_SYS_IMAGEBLIT
select FB_SYS_FOPS
select FB_DEFERRED_IO
help
Provides support for epaper controllers from the K190X series
of AUO. These controllers can be used to drive epaper displays
from Sipix.
This option enables the common support, shared by the individual
controller drivers. You will also have to enable the driver
for the controller type used in your device.
config FB_AUO_K1900
tristate "AUO-K1900 EPD controller support"
depends on FB && FB_AUO_K190X
help
This driver implements support for the AUO K1900 epd-controller.
This controller can drive Sipix epaper displays but can only do
serial updates, reducing the number of possible frames per second.
config FB_AUO_K1901
tristate "AUO-K1901 EPD controller support"
depends on FB && FB_AUO_K190X
help
This driver implements support for the AUO K1901 epd-controller.
This controller can drive Sipix epaper displays and supports
concurrent updates, making higher frames per second possible.
config FB_JZ4740
tristate "JZ4740 LCD framebuffer support"
depends on FB && MACH_JZ4740
......@@ -2346,18 +2312,6 @@ source "drivers/video/fbdev/omap/Kconfig"
source "drivers/video/fbdev/omap2/Kconfig"
source "drivers/video/fbdev/mmp/Kconfig"
config FB_SH_MOBILE_MERAM
tristate "SuperH Mobile MERAM read ahead support"
depends on (SUPERH || ARCH_SHMOBILE)
select GENERIC_ALLOCATOR
---help---
Enable MERAM support for the SuperH controller.
This will allow for caching of the framebuffer to provide more
reliable access under heavy main memory bus traffic situations.
Up to 4 memory channels can be configured, allowing 4 RGB or
2 YCbCr framebuffers to be configured.
config FB_SSD1307
tristate "Solomon SSD1307 framebuffer support"
depends on FB && I2C
......
......@@ -100,9 +100,6 @@ obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o
obj-$(CONFIG_FB_MAXINE) += maxinefb.o
obj-$(CONFIG_FB_METRONOME) += metronomefb.o
obj-$(CONFIG_FB_BROADSHEET) += broadsheetfb.o
obj-$(CONFIG_FB_AUO_K190X) += auo_k190x.o
obj-$(CONFIG_FB_AUO_K1900) += auo_k1900fb.o
obj-$(CONFIG_FB_AUO_K1901) += auo_k1901fb.o
obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o
obj-$(CONFIG_FB_SH7760) += sh7760fb.o
obj-$(CONFIG_FB_IMX) += imxfb.o
......@@ -116,7 +113,6 @@ obj-$(CONFIG_FB_SM501) += sm501fb.o
obj-$(CONFIG_FB_UDL) += udlfb.o
obj-$(CONFIG_FB_SMSCUFX) += smscufx.o
obj-$(CONFIG_FB_XILINX) += xilinxfb.o
obj-$(CONFIG_FB_SH_MOBILE_MERAM) += sh_mobile_meram.o
obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o
obj-$(CONFIG_FB_OMAP) += omap/
obj-y += omap2/
......
......@@ -2442,7 +2442,7 @@ static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
(void)aty_ld_pll(POWER_MANAGEMENT);
aty_st_le32(BUS_CNTL1, 0x00000010);
aty_st_le32(MEM_POWER_MISC, 0x0c830000);
mdelay(100);
msleep(100);
/* Switch PCI power management to D2 */
pci_set_power_state(pdev, PCI_D2);
......
......@@ -2678,17 +2678,17 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
* it, we'll restore the dynamic clocks state on wakeup
*/
radeon_pm_disable_dynamic_mode(rinfo);
mdelay(50);
msleep(50);
radeon_pm_save_regs(rinfo, 1);
if (rinfo->is_mobility && !(rinfo->pm_mode & radeon_pm_d2)) {
/* Switch off LVDS interface */
mdelay(1);
usleep_range(1000, 2000);
OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_BL_MOD_EN));
mdelay(1);
usleep_range(1000, 2000);
OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_EN | LVDS_ON));
OUTREG(LVDS_PLL_CNTL, (INREG(LVDS_PLL_CNTL) & ~30000) | 0x20000);
mdelay(20);
msleep(20);
OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON));
}
pci_disable_device(pdev);
......
......@@ -464,7 +464,7 @@ static int au1100fb_drv_probe(struct platform_device *dev)
PAGE_ALIGN(fbdev->fb_len),
&fbdev->fb_phys, GFP_KERNEL);
if (!fbdev->fb_mem) {
print_err("fail to allocate frambuffer (size: %dK))",
print_err("fail to allocate framebuffer (size: %dK))",
fbdev->fb_len / 1024);
return -ENOMEM;
}
......
......@@ -1696,7 +1696,7 @@ static int au1200fb_drv_probe(struct platform_device *dev)
&fbdev->fb_phys, GFP_KERNEL,
DMA_ATTR_NON_CONSISTENT);
if (!fbdev->fb_mem) {
print_err("fail to allocate frambuffer (size: %dK))",
print_err("fail to allocate framebuffer (size: %dK))",
fbdev->fb_len / 1024);
ret = -ENOMEM;
goto failed;
......
/*
* auok190xfb.c -- FB driver for AUO-K1900 controllers
*
* Copyright (C) 2011, 2012 Heiko Stuebner <heiko@sntech.de>
*
* based on broadsheetfb.c
*
* Copyright (C) 2008, Jaya Kumar
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven.
*
* This driver is written to be used with the AUO-K1900 display controller.
*
* It is intended to be architecture independent. A board specific driver
* must be used to perform all the physical IO interactions.
*
* The controller supports different update modes:
* mode0+1 16 step gray (4bit)
* mode2 4 step gray (2bit) - FIXME: add strange refresh
* mode3 2 step gray (1bit) - FIXME: add strange refresh
* mode4 handwriting mode (strange behaviour)
* mode5 automatic selection of update mode
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/list.h>
#include <linux/firmware.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <video/auo_k190xfb.h>
#include "auo_k190x.h"
/*
* AUO-K1900 specific commands
*/
#define AUOK1900_CMD_PARTIALDISP 0x1001
#define AUOK1900_CMD_ROTATION 0x1006
#define AUOK1900_CMD_LUT_STOP 0x1009
#define AUOK1900_INIT_TEMP_AVERAGE (1 << 13)
#define AUOK1900_INIT_ROTATE(_x) ((_x & 0x3) << 10)
#define AUOK1900_INIT_RESOLUTION(_res) ((_res & 0x7) << 2)
static void auok1900_init(struct auok190xfb_par *par)
{
struct device *dev = par->info->device;
struct auok190x_board *board = par->board;
u16 init_param = 0;
pm_runtime_get_sync(dev);
init_param |= AUOK1900_INIT_TEMP_AVERAGE;
init_param |= AUOK1900_INIT_ROTATE(par->rotation);
init_param |= AUOK190X_INIT_INVERSE_WHITE;
init_param |= AUOK190X_INIT_FORMAT0;
init_param |= AUOK1900_INIT_RESOLUTION(par->resolution);
init_param |= AUOK190X_INIT_SHIFT_RIGHT;
auok190x_send_cmdargs(par, AUOK190X_CMD_INIT, 1, &init_param);
/* let the controller finish */
board->wait_for_rdy(par);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
}
static void auok1900_update_region(struct auok190xfb_par *par, int mode,
u16 y1, u16 y2)
{
struct device *dev = par->info->device;
unsigned char *buf = (unsigned char *)par->info->screen_base;
int xres = par->info->var.xres;
int line_length = par->info->fix.line_length;
u16 args[4];
pm_runtime_get_sync(dev);
mutex_lock(&(par->io_lock));
/* y1 and y2 must be a multiple of 2 so drop the lowest bit */
y1 &= 0xfffe;
y2 &= 0xfffe;
dev_dbg(dev, "update (x,y,w,h,mode)=(%d,%d,%d,%d,%d)\n",
1, y1+1, xres, y2-y1, mode);
/* to FIX handle different partial update modes */
args[0] = mode | 1;
args[1] = y1 + 1;
args[2] = xres;
args[3] = y2 - y1;
buf += y1 * line_length;
auok190x_send_cmdargs_pixels(par, AUOK1900_CMD_PARTIALDISP, 4, args,
((y2 - y1) * line_length)/2, (u16 *) buf);
auok190x_send_command(par, AUOK190X_CMD_DATA_STOP);
par->update_cnt++;
mutex_unlock(&(par->io_lock));
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
}
static void auok1900fb_dpy_update_pages(struct auok190xfb_par *par,
u16 y1, u16 y2)
{
int mode;
if (par->update_mode < 0) {
mode = AUOK190X_UPDATE_MODE(1);
par->last_mode = -1;
} else {
mode = AUOK190X_UPDATE_MODE(par->update_mode);
par->last_mode = par->update_mode;
}
if (par->flash)
mode |= AUOK190X_UPDATE_NONFLASH;
auok1900_update_region(par, mode, y1, y2);
}
static void auok1900fb_dpy_update(struct auok190xfb_par *par)
{
int mode;
if (par->update_mode < 0) {
mode = AUOK190X_UPDATE_MODE(0);
par->last_mode = -1;
} else {
mode = AUOK190X_UPDATE_MODE(par->update_mode);
par->last_mode = par->update_mode;
}
if (par->flash)
mode |= AUOK190X_UPDATE_NONFLASH;
auok1900_update_region(par, mode, 0, par->info->var.yres);
par->update_cnt = 0;
}
static bool auok1900fb_need_refresh(struct auok190xfb_par *par)
{
return (par->update_cnt > 10);
}
static int auok1900fb_probe(struct platform_device *pdev)
{
struct auok190x_init_data init;
struct auok190x_board *board;
/* pick up board specific routines */
board = pdev->dev.platform_data;
if (!board)
return -EINVAL;
/* fill temporary init struct for common init */
init.id = "auo_k1900fb";
init.board = board;
init.update_partial = auok1900fb_dpy_update_pages;
init.update_all = auok1900fb_dpy_update;
init.need_refresh = auok1900fb_need_refresh;
init.init = auok1900_init;
return auok190x_common_probe(pdev, &init);
}
static int auok1900fb_remove(struct platform_device *pdev)
{
return auok190x_common_remove(pdev);
}
static struct platform_driver auok1900fb_driver = {
.probe = auok1900fb_probe,
.remove = auok1900fb_remove,
.driver = {
.name = "auo_k1900fb",
.pm = &auok190x_pm,
},
};
module_platform_driver(auok1900fb_driver);
MODULE_DESCRIPTION("framebuffer driver for the AUO-K1900 EPD controller");
MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
MODULE_LICENSE("GPL");
/*
* auok190xfb.c -- FB driver for AUO-K1901 controllers
*
* Copyright (C) 2011, 2012 Heiko Stuebner <heiko@sntech.de>
*
* based on broadsheetfb.c
*
* Copyright (C) 2008, Jaya Kumar
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven.
*
* This driver is written to be used with the AUO-K1901 display controller.
*
* It is intended to be architecture independent. A board specific driver
* must be used to perform all the physical IO interactions.
*
* The controller supports different update modes:
* mode0+1 16 step gray (4bit)
* mode2+3 4 step gray (2bit)
* mode4+5 2 step gray (1bit)
* - mode4 is described as "without LUT"
* mode7 automatic selection of update mode
*
* The most interesting difference to the K1900 is the ability to do screen
* updates in an asynchronous fashion. Where the K1900 needs to wait for the
* current update to complete, the K1901 can process later updates already.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/list.h>
#include <linux/firmware.h>
#include <linux/gpio.h>
#include <linux/pm_runtime.h>
#include <video/auo_k190xfb.h>
#include "auo_k190x.h"
/*
* AUO-K1901 specific commands
*/
#define AUOK1901_CMD_LUT_INTERFACE 0x0005
#define AUOK1901_CMD_DMA_START 0x1001
#define AUOK1901_CMD_CURSOR_START 0x1007
#define AUOK1901_CMD_CURSOR_STOP AUOK190X_CMD_DATA_STOP
#define AUOK1901_CMD_DDMA_START 0x1009
#define AUOK1901_INIT_GATE_PULSE_LOW (0 << 14)
#define AUOK1901_INIT_GATE_PULSE_HIGH (1 << 14)
#define AUOK1901_INIT_SINGLE_GATE (0 << 13)
#define AUOK1901_INIT_DOUBLE_GATE (1 << 13)
/* Bits to pixels
* Mode 15-12 11-8 7-4 3-0
* format2 2 T 1 T
* format3 1 T 2 T
* format4 T 2 T 1
* format5 T 1 T 2
*
* halftone modes:
* format6 2 2 1 1
* format7 1 1 2 2
*/
#define AUOK1901_INIT_FORMAT2 (1 << 7)
#define AUOK1901_INIT_FORMAT3 ((1 << 7) | (1 << 6))
#define AUOK1901_INIT_FORMAT4 (1 << 8)
#define AUOK1901_INIT_FORMAT5 ((1 << 8) | (1 << 6))
#define AUOK1901_INIT_FORMAT6 ((1 << 8) | (1 << 7))
#define AUOK1901_INIT_FORMAT7 ((1 << 8) | (1 << 7) | (1 << 6))
/* res[4] to bit 10
* res[3-0] to bits 5-2
*/
#define AUOK1901_INIT_RESOLUTION(_res) (((_res & (1 << 4)) << 6) \
| ((_res & 0xf) << 2))
/*
* portrait / landscape orientation in AUOK1901_CMD_DMA_START
*/
#define AUOK1901_DMA_ROTATE90(_rot) ((_rot & 1) << 13)
/*
* equivalent to 1 << 11, needs the ~ to have same rotation like K1900
*/
#define AUOK1901_DDMA_ROTATE180(_rot) ((~_rot & 2) << 10)
static void auok1901_init(struct auok190xfb_par *par)
{
struct device *dev = par->info->device;
struct auok190x_board *board = par->board;
u16 init_param = 0;
pm_runtime_get_sync(dev);
init_param |= AUOK190X_INIT_INVERSE_WHITE;
init_param |= AUOK190X_INIT_FORMAT0;
init_param |= AUOK1901_INIT_RESOLUTION(par->resolution);
init_param |= AUOK190X_INIT_SHIFT_LEFT;
auok190x_send_cmdargs(par, AUOK190X_CMD_INIT, 1, &init_param);
/* let the controller finish */
board->wait_for_rdy(par);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
}
static void auok1901_update_region(struct auok190xfb_par *par, int mode,
u16 y1, u16 y2)
{
struct device *dev = par->info->device;
unsigned char *buf = (unsigned char *)par->info->screen_base;
int xres = par->info->var.xres;
int line_length = par->info->fix.line_length;
u16 args[5];
pm_runtime_get_sync(dev);
mutex_lock(&(par->io_lock));
/* y1 and y2 must be a multiple of 2 so drop the lowest bit */
y1 &= 0xfffe;
y2 &= 0xfffe;
dev_dbg(dev, "update (x,y,w,h,mode)=(%d,%d,%d,%d,%d)\n",
1, y1+1, xres, y2-y1, mode);
/* K1901: first transfer the region data */
args[0] = AUOK1901_DMA_ROTATE90(par->rotation) | 1;
args[1] = y1 + 1;
args[2] = xres;
args[3] = y2 - y1;
buf += y1 * line_length;
auok190x_send_cmdargs_pixels_nowait(par, AUOK1901_CMD_DMA_START, 4,
args, ((y2 - y1) * line_length)/2,
(u16 *) buf);
auok190x_send_command_nowait(par, AUOK190X_CMD_DATA_STOP);
/* K1901: second tell the controller to update the region with mode */
args[0] = mode | AUOK1901_DDMA_ROTATE180(par->rotation);
args[1] = 1;
args[2] = y1 + 1;
args[3] = xres;
args[4] = y2 - y1;
auok190x_send_cmdargs_nowait(par, AUOK1901_CMD_DDMA_START, 5, args);
par->update_cnt++;
mutex_unlock(&(par->io_lock));
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
}
static void auok1901fb_dpy_update_pages(struct auok190xfb_par *par,
u16 y1, u16 y2)
{
int mode;
if (par->update_mode < 0) {
mode = AUOK190X_UPDATE_MODE(1);
par->last_mode = -1;
} else {
mode = AUOK190X_UPDATE_MODE(par->update_mode);
par->last_mode = par->update_mode;
}
if (par->flash)
mode |= AUOK190X_UPDATE_NONFLASH;
auok1901_update_region(par, mode, y1, y2);
}
static void auok1901fb_dpy_update(struct auok190xfb_par *par)
{
int mode;
/* When doing full updates, wait for the controller to be ready
* This will hopefully catch some hangs of the K1901
*/
par->board->wait_for_rdy(par);
if (par->update_mode < 0) {
mode = AUOK190X_UPDATE_MODE(0);
par->last_mode = -1;
} else {
mode = AUOK190X_UPDATE_MODE(par->update_mode);
par->last_mode = par->update_mode;
}
if (par->flash)
mode |= AUOK190X_UPDATE_NONFLASH;
auok1901_update_region(par, mode, 0, par->info->var.yres);
par->update_cnt = 0;
}
static bool auok1901fb_need_refresh(struct auok190xfb_par *par)
{
return (par->update_cnt > 10);
}
static int auok1901fb_probe(struct platform_device *pdev)
{
struct auok190x_init_data init;
struct auok190x_board *board;
/* pick up board specific routines */
board = pdev->dev.platform_data;
if (!board)
return -EINVAL;
/* fill temporary init struct for common init */
init.id = "auo_k1901fb";
init.board = board;
init.update_partial = auok1901fb_dpy_update_pages;
init.update_all = auok1901fb_dpy_update;
init.need_refresh = auok1901fb_need_refresh;
init.init = auok1901_init;
return auok190x_common_probe(pdev, &init);
}
static int auok1901fb_remove(struct platform_device *pdev)
{
return auok190x_common_remove(pdev);
}
static struct platform_driver auok1901fb_driver = {
.probe = auok1901fb_probe,
.remove = auok1901fb_remove,
.driver = {
.name = "auo_k1901fb",
.pm = &auok190x_pm,
},
};
module_platform_driver(auok1901fb_driver);
MODULE_DESCRIPTION("framebuffer driver for the AUO-K1901 EPD controller");
MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
MODULE_LICENSE("GPL");
This diff is collapsed.
/*
* Private common definitions for AUO-K190X framebuffer drivers
*
* Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/*
* I80 interface specific defines
*/
#define AUOK190X_I80_CS 0x01
#define AUOK190X_I80_DC 0x02
#define AUOK190X_I80_WR 0x03
#define AUOK190X_I80_OE 0x04
/*
* AUOK190x commands, common to both controllers
*/
#define AUOK190X_CMD_INIT 0x0000
#define AUOK190X_CMD_STANDBY 0x0001
#define AUOK190X_CMD_WAKEUP 0x0002
#define AUOK190X_CMD_TCON_RESET 0x0003
#define AUOK190X_CMD_DATA_STOP 0x1002
#define AUOK190X_CMD_LUT_START 0x1003
#define AUOK190X_CMD_DISP_REFRESH 0x1004
#define AUOK190X_CMD_DISP_RESET 0x1005
#define AUOK190X_CMD_PRE_DISPLAY_START 0x100D
#define AUOK190X_CMD_PRE_DISPLAY_STOP 0x100F
#define AUOK190X_CMD_FLASH_W 0x2000
#define AUOK190X_CMD_FLASH_E 0x2001
#define AUOK190X_CMD_FLASH_STS 0x2002
#define AUOK190X_CMD_FRAMERATE 0x3000
#define AUOK190X_CMD_READ_VERSION 0x4000
#define AUOK190X_CMD_READ_STATUS 0x4001
#define AUOK190X_CMD_READ_LUT 0x4003
#define AUOK190X_CMD_DRIVERTIMING 0x5000
#define AUOK190X_CMD_LBALANCE 0x5001
#define AUOK190X_CMD_AGINGMODE 0x6000
#define AUOK190X_CMD_AGINGEXIT 0x6001
/*
* Common settings for AUOK190X_CMD_INIT
*/
#define AUOK190X_INIT_DATA_FILTER (0 << 12)
#define AUOK190X_INIT_DATA_BYPASS (1 << 12)
#define AUOK190X_INIT_INVERSE_WHITE (0 << 9)
#define AUOK190X_INIT_INVERSE_BLACK (1 << 9)
#define AUOK190X_INIT_SCAN_DOWN (0 << 1)
#define AUOK190X_INIT_SCAN_UP (1 << 1)
#define AUOK190X_INIT_SHIFT_LEFT (0 << 0)
#define AUOK190X_INIT_SHIFT_RIGHT (1 << 0)
/* Common bits to pixels
* Mode 15-12 11-8 7-4 3-0
* format0 4 3 2 1
* format1 3 4 1 2
*/
#define AUOK190X_INIT_FORMAT0 0
#define AUOK190X_INIT_FORMAT1 (1 << 6)
/*
* settings for AUOK190X_CMD_RESET
*/
#define AUOK190X_RESET_TCON (0 << 0)
#define AUOK190X_RESET_NORMAL (1 << 0)
#define AUOK190X_RESET_PON (1 << 1)
/*
* AUOK190X_CMD_VERSION
*/
#define AUOK190X_VERSION_TEMP_MASK (0x1ff)
#define AUOK190X_VERSION_EPD_MASK (0xff)
#define AUOK190X_VERSION_SIZE_INT(_val) ((_val & 0xfc00) >> 10)
#define AUOK190X_VERSION_SIZE_FLOAT(_val) ((_val & 0x3c0) >> 6)
#define AUOK190X_VERSION_MODEL(_val) (_val & 0x3f)
#define AUOK190X_VERSION_LUT(_val) (_val & 0xff)
#define AUOK190X_VERSION_TCON(_val) ((_val & 0xff00) >> 8)
/*
* update modes for CMD_PARTIALDISP on K1900 and CMD_DDMA on K1901
*/
#define AUOK190X_UPDATE_MODE(_res) ((_res & 0x7) << 12)
#define AUOK190X_UPDATE_NONFLASH (1 << 15)
/*
* track panel specific parameters for common init
*/
struct auok190x_init_data {
char *id;
struct auok190x_board *board;
void (*update_partial)(struct auok190xfb_par *par, u16 y1, u16 y2);
void (*update_all)(struct auok190xfb_par *par);
bool (*need_refresh)(struct auok190xfb_par *par);
void (*init)(struct auok190xfb_par *par);
};
extern void auok190x_send_command_nowait(struct auok190xfb_par *par, u16 data);
extern int auok190x_send_command(struct auok190xfb_par *par, u16 data);
extern void auok190x_send_cmdargs_nowait(struct auok190xfb_par *par, u16 cmd,
int argc, u16 *argv);
extern int auok190x_send_cmdargs(struct auok190xfb_par *par, u16 cmd,
int argc, u16 *argv);
extern void auok190x_send_cmdargs_pixels_nowait(struct auok190xfb_par *par,
u16 cmd, int argc, u16 *argv,
int size, u16 *data);
extern int auok190x_send_cmdargs_pixels(struct auok190xfb_par *par, u16 cmd,
int argc, u16 *argv, int size,
u16 *data);
extern int auok190x_read_cmdargs(struct auok190xfb_par *par, u16 cmd,
int argc, u16 *argv);
extern int auok190x_common_probe(struct platform_device *pdev,
struct auok190x_init_data *init);
extern int auok190x_common_remove(struct platform_device *pdev);
extern const struct dev_pm_ops auok190x_pm;
......@@ -37,7 +37,7 @@ static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs
}
/* this is to find and return the vmalloc-ed fb pages */
static int fb_deferred_io_fault(struct vm_fault *vmf)
static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)
{
unsigned long offset;
struct page *page;
......@@ -90,7 +90,7 @@ int fb_deferred_io_fsync(struct file *file, loff_t start, loff_t end, int datasy
EXPORT_SYMBOL_GPL(fb_deferred_io_fsync);
/* vm_ops->page_mkwrite handler */
static int fb_deferred_io_mkwrite(struct vm_fault *vmf)
static vm_fault_t fb_deferred_io_mkwrite(struct vm_fault *vmf)
{
struct page *page = vmf->page;
struct fb_info *info = vmf->vma->vm_private_data;
......
......@@ -495,10 +495,9 @@ static int modes_setup(struct mmpfb_info *fbi)
/* put videomode list to info structure */
videomodes = kcalloc(videomode_num, sizeof(struct fb_videomode),
GFP_KERNEL);
if (!videomodes) {
dev_err(fbi->dev, "can't malloc video modes\n");
if (!videomodes)
return -ENOMEM;
}
for (i = 0; i < videomode_num; i++)
mmpmode_to_fbmode(&videomodes[i], &mmp_modes[i]);
fb_videomode_to_modelist(videomodes, videomode_num, &info->modelist);
......
......@@ -406,12 +406,10 @@ static int path_init(struct mmphw_path_plat *path_plat,
dev_info(ctrl->dev, "%s: %s\n", __func__, config->name);
/* init driver data */
path_info = kzalloc(sizeof(struct mmp_path_info), GFP_KERNEL);
if (!path_info) {
dev_err(ctrl->dev, "%s: unable to alloc path_info for %s\n",
__func__, config->name);
path_info = kzalloc(sizeof(*path_info), GFP_KERNEL);
if (!path_info)
return 0;
}
path_info->name = config->name;
path_info->id = path_plat->id;
path_info->dev = ctrl->dev;
......
......@@ -1548,7 +1548,7 @@ MODULE_PARM_DESC(noaccel,
"(default=0)");
module_param(noscale, int, 0);
MODULE_PARM_DESC(noscale,
"Disables screen scaleing. (0 or 1=disable) "
"Disables screen scaling. (0 or 1=disable) "
"(default=0, do scaling)");
module_param(paneltweak, int, 0);
MODULE_PARM_DESC(paneltweak,
......
......@@ -197,3 +197,7 @@ static struct platform_driver ams_delta_panel_driver = {
};
module_platform_driver(ams_delta_panel_driver);
MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>");
MODULE_DESCRIPTION("LCD panel support for the Amstrad E3 (Delta) videophone");
MODULE_LICENSE("GPL");
......@@ -89,3 +89,7 @@ static struct platform_driver h3_panel_driver = {
};
module_platform_driver(h3_panel_driver);
MODULE_AUTHOR("Imre Deak");
MODULE_DESCRIPTION("LCD panel support for the TI OMAP H3 board");
MODULE_LICENSE("GPL");
......@@ -66,3 +66,7 @@ static struct platform_driver htcherald_panel_driver = {
};
module_platform_driver(htcherald_panel_driver);
MODULE_AUTHOR("Cory Maccarrone");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD panel support for the HTC Herald");
......@@ -73,3 +73,7 @@ static struct platform_driver innovator1510_panel_driver = {
};
module_platform_driver(innovator1510_panel_driver);
MODULE_AUTHOR("Imre Deak");
MODULE_DESCRIPTION("LCD panel support for the TI OMAP1510 Innovator board");
MODULE_LICENSE("GPL");
......@@ -106,3 +106,7 @@ static struct platform_driver innovator1610_panel_driver = {
};
module_platform_driver(innovator1610_panel_driver);
MODULE_AUTHOR("Imre Deak");
MODULE_DESCRIPTION("LCD panel support for the TI OMAP1610 Innovator board");
MODULE_LICENSE("GPL");
......@@ -93,3 +93,7 @@ static struct platform_driver osk_panel_driver = {
};
module_platform_driver(osk_panel_driver);
MODULE_AUTHOR("Imre Deak");
MODULE_DESCRIPTION("LCD panel support for the TI OMAP OSK board");
MODULE_LICENSE("GPL");
......@@ -59,3 +59,7 @@ static struct platform_driver palmte_panel_driver = {
};
module_platform_driver(palmte_panel_driver);
MODULE_AUTHOR("Romain Goyet <r.goyet@gmail.com>, Laurent Gonzalez <palmte.linux@free.fr>");
MODULE_DESCRIPTION("LCD panel support for the Palm Tungsten E");
MODULE_LICENSE("GPL");
......@@ -72,3 +72,7 @@ static struct platform_driver palmtt_panel_driver = {
};
module_platform_driver(palmtt_panel_driver);
MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
MODULE_DESCRIPTION("LCD panel support for Palm Tungsten|T");
MODULE_LICENSE("GPL");
......@@ -66,3 +66,7 @@ static struct platform_driver palmz71_panel_driver = {
};
module_platform_driver(palmz71_panel_driver);
MODULE_AUTHOR("Romain Goyet, Laurent Gonzalez, Marek Vasut");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD panel support for the Palm Zire71");
......@@ -1645,7 +1645,7 @@ static int omapfb_do_probe(struct platform_device *pdev,
goto cleanup;
}
fbdev = kzalloc(sizeof(struct omapfb_device), GFP_KERNEL);
fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
if (fbdev == NULL) {
dev_err(&pdev->dev,
"unable to allocate memory for device info\n");
......
......@@ -5,6 +5,7 @@ menuconfig FB_OMAP2
tristate "OMAP2+ frame buffer support"
depends on FB
depends on DRM_OMAP = n
depends on GPIOLIB
select FB_OMAP2_DSS
select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
......
......@@ -387,8 +387,7 @@ static void dsicm_get_resolution(struct omap_dss_device *dssdev,
static ssize_t dsicm_num_errors_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct panel_drv_data *ddata = dev_get_drvdata(dev);
struct omap_dss_device *in = ddata->in;
u8 errors = 0;
int r;
......@@ -419,8 +418,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
static ssize_t dsicm_hw_revision_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct panel_drv_data *ddata = dev_get_drvdata(dev);
struct omap_dss_device *in = ddata->in;
u8 id1, id2, id3;
int r;
......@@ -451,8 +449,7 @@ static ssize_t dsicm_store_ulps(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct panel_drv_data *ddata = dev_get_drvdata(dev);
struct omap_dss_device *in = ddata->in;
unsigned long t;
int r;
......@@ -486,8 +483,7 @@ static ssize_t dsicm_show_ulps(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct panel_drv_data *ddata = dev_get_drvdata(dev);
unsigned t;
mutex_lock(&ddata->lock);
......@@ -501,8 +497,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct panel_drv_data *ddata = dev_get_drvdata(dev);
struct omap_dss_device *in = ddata->in;
unsigned long t;
int r;
......@@ -533,8 +528,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct panel_drv_data *ddata = dev_get_drvdata(dev);
unsigned t;
mutex_lock(&ddata->lock);
......
......@@ -2115,12 +2115,10 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
if (ret)
s = "color-tft";
for (i = 0; lcd_types[i]; i++)
if (!strcmp(s, lcd_types[i]))
break;
if (!i || !lcd_types[i]) {
i = match_string(lcd_types, -1, s);
if (i < 0) {
dev_err(dev, "lcd-type %s is unknown\n", s);
return -EINVAL;
return i;
}
info->lcd_conn |= LCD_CONN_TYPE(i);
info->lcd_conn |= LCD_CONN_WIDTH(bus_width);
......
......@@ -1892,11 +1892,11 @@ static int savage_init_hw(struct savagefb_par *par)
vga_out8(0x3d4, 0x66, par);
cr66 = vga_in8(0x3d5, par);
vga_out8(0x3d5, cr66 | 0x02, par);
mdelay(10);
usleep_range(10000, 11000);
vga_out8(0x3d4, 0x66, par);
vga_out8(0x3d5, cr66 & ~0x02, par); /* clear reset flag */
mdelay(10);
usleep_range(10000, 11000);
/*
......@@ -1906,11 +1906,11 @@ static int savage_init_hw(struct savagefb_par *par)
vga_out8(0x3d4, 0x3f, par);
cr3f = vga_in8(0x3d5, par);
vga_out8(0x3d5, cr3f | 0x08, par);
mdelay(10);
usleep_range(10000, 11000);
vga_out8(0x3d4, 0x3f, par);
vga_out8(0x3d5, cr3f & ~0x08, par); /* clear reset flags */
mdelay(10);
usleep_range(10000, 11000);
/* Savage ramdac speeds */
par->numClocks = 4;
......
......@@ -29,7 +29,6 @@
#include <linux/vmalloc.h>
#include <video/sh_mobile_lcdc.h>
#include <video/sh_mobile_meram.h>
#include "sh_mobile_lcdcfb.h"
......@@ -217,7 +216,6 @@ struct sh_mobile_lcdc_priv {
struct notifier_block notifier;
int started;
int forced_fourcc; /* 2 channel LCDC must share fourcc setting */
struct sh_mobile_meram_info *meram_dev;
};
/* -----------------------------------------------------------------------------
......@@ -346,16 +344,12 @@ static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
if (priv->dot_clk)
clk_prepare_enable(priv->dot_clk);
pm_runtime_get_sync(priv->dev);
if (priv->meram_dev && priv->meram_dev->pdev)
pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
}
}
static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
{
if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
if (priv->meram_dev && priv->meram_dev->pdev)
pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
pm_runtime_put(priv->dev);
if (priv->dot_clk)
clk_disable_unprepare(priv->dot_clk);
......@@ -1073,7 +1067,6 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
{
struct sh_mobile_meram_info *mdev = priv->meram_dev;
struct sh_mobile_lcdc_chan *ch;
unsigned long tmp;
int ret;
......@@ -1106,9 +1099,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
/* Compute frame buffer base address and pitch for each channel. */
for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
int pixelformat;
void *cache;
ch = &priv->ch[k];
if (!ch->enabled)
continue;
......@@ -1117,45 +1107,6 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
ch->base_addr_c = ch->dma_handle
+ ch->xres_virtual * ch->yres_virtual;
ch->line_size = ch->pitch;
/* Enable MERAM if possible. */
if (mdev == NULL || ch->cfg->meram_cfg == NULL)
continue;
/* Free the allocated MERAM cache. */
if (ch->cache) {
sh_mobile_meram_cache_free(mdev, ch->cache);
ch->cache = NULL;
}
switch (ch->format->fourcc) {
case V4L2_PIX_FMT_NV12:
case V4L2_PIX_FMT_NV21:
case V4L2_PIX_FMT_NV16:
case V4L2_PIX_FMT_NV61:
pixelformat = SH_MOBILE_MERAM_PF_NV;
break;
case V4L2_PIX_FMT_NV24:
case V4L2_PIX_FMT_NV42:
pixelformat = SH_MOBILE_MERAM_PF_NV24;
break;
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_BGR24:
case V4L2_PIX_FMT_BGR32:
default:
pixelformat = SH_MOBILE_MERAM_PF_RGB;
break;
}
cache = sh_mobile_meram_cache_alloc(mdev, ch->cfg->meram_cfg,
ch->pitch, ch->yres, pixelformat,
&ch->line_size);
if (!IS_ERR(cache)) {
sh_mobile_meram_cache_update(mdev, cache,
ch->base_addr_y, ch->base_addr_c,
&ch->base_addr_y, &ch->base_addr_c);
ch->cache = cache;
}
}
for (k = 0; k < ARRAY_SIZE(priv->overlays); ++k) {
......@@ -1223,13 +1174,6 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
}
sh_mobile_lcdc_display_off(ch);
/* Free the MERAM cache. */
if (ch->cache) {
sh_mobile_meram_cache_free(priv->meram_dev, ch->cache);
ch->cache = NULL;
}
}
/* stop the lcdc */
......@@ -1851,11 +1795,6 @@ static int sh_mobile_lcdc_pan(struct fb_var_screeninfo *var,
base_addr_c = ch->dma_handle + ch->xres_virtual * ch->yres_virtual
+ c_offset;
if (ch->cache)
sh_mobile_meram_cache_update(priv->meram_dev, ch->cache,
base_addr_y, base_addr_c,
&base_addr_y, &base_addr_c);
ch->base_addr_y = base_addr_y;
ch->base_addr_c = base_addr_c;
ch->pan_y_offset = y_offset;
......@@ -2149,10 +2088,8 @@ sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch)
if (info->fbdefio) {
ch->sglist = vmalloc(sizeof(struct scatterlist) *
ch->fb_size >> PAGE_SHIFT);
if (!ch->sglist) {
dev_err(ch->lcdc->dev, "cannot allocate sglist\n");
if (!ch->sglist)
return -ENOMEM;
}
}
info->bl_dev = ch->bl;
......@@ -2354,8 +2291,7 @@ static int sh_mobile_lcdc_resume(struct device *dev)
static int sh_mobile_lcdc_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev);
/* turn off LCDC hardware */
lcdc_write(priv, _LDCNT1R, 0);
......@@ -2365,8 +2301,7 @@ static int sh_mobile_lcdc_runtime_suspend(struct device *dev)
static int sh_mobile_lcdc_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
struct sh_mobile_lcdc_priv *priv = dev_get_drvdata(dev);
__sh_mobile_lcdc_start(priv);
......@@ -2718,13 +2653,11 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev)
}
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(&pdev->dev, "cannot allocate device data\n");
if (!priv)
return -ENOMEM;
}
priv->dev = &pdev->dev;
priv->meram_dev = pdata->meram_dev;
for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
mutex_init(&priv->ch[i].open_lock);
platform_set_drvdata(pdev, priv);
......
......@@ -61,7 +61,6 @@ struct sh_mobile_lcdc_chan {
unsigned long *reg_offs;
unsigned long ldmt1r_value;
unsigned long enabled; /* ME and SE in LDCNT2R */
void *cache;
struct mutex open_lock; /* protects the use counter */
int use_count;
......
This diff is collapsed.
......@@ -1932,8 +1932,7 @@ static int sm501fb_probe(struct platform_device *pdev)
int ret;
/* allocate our framebuffers */
info = kzalloc(sizeof(struct sm501fb_info), GFP_KERNEL);
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
dev_err(dev, "failed to allocate state\n");
return -ENOMEM;
......
......@@ -33,6 +33,12 @@
#include <linux/console.h>
#include <linux/timer.h>
#ifdef CONFIG_X86
#include <asm/olpc.h>
#else
#define machine_is_olpc(x) 0
#endif
#include "debug.h"
#include "viafbdev.h"
......
......@@ -20,7 +20,6 @@
*/
#include <linux/via-core.h>
#include <asm/olpc.h>
#include "global.h"
#include "via_clock.h"
......
......@@ -17,7 +17,6 @@
#include <linux/platform_device.h>
#include <linux/list.h>
#include <linux/pm.h>
#include <asm/olpc.h>
/*
* The default port config.
......
......@@ -25,7 +25,7 @@
#include <linux/kernel.h>
#include <linux/via-core.h>
#include <asm/olpc.h>
#include "via_clock.h"
#include "global.h"
#include "debug.h"
......
......@@ -25,7 +25,6 @@
#include <linux/stat.h>
#include <linux/via-core.h>
#include <linux/via_i2c.h>
#include <asm/olpc.h>
#define _MASTER_FILE
#include "global.h"
......
......@@ -18,9 +18,6 @@
#include <drm/drm_mode.h>
struct sh_mobile_meram_cfg;
struct sh_mobile_meram_info;
enum shmob_drm_clk_source {
SHMOB_DRM_CLK_BUS,
SHMOB_DRM_CLK_PERIPHERAL,
......@@ -93,7 +90,6 @@ struct shmob_drm_platform_data {
struct shmob_drm_interface_data iface;
struct shmob_drm_panel_data panel;
struct shmob_drm_backlight_data backlight;
const struct sh_mobile_meram_cfg *meram;
};
#endif /* __SHMOB_DRM_H__ */
/*
* Definitions for AUO-K190X framebuffer drivers
*
* Copyright (C) 2012 Heiko Stuebner <heiko@sntech.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _LINUX_VIDEO_AUO_K190XFB_H_
#define _LINUX_VIDEO_AUO_K190XFB_H_
/* Controller standby command needs a param */
#define AUOK190X_QUIRK_STANDBYPARAM (1 << 0)
/* Controller standby is completely broken */
#define AUOK190X_QUIRK_STANDBYBROKEN (1 << 1)
/*
* Resolutions for the displays
*/
#define AUOK190X_RESOLUTION_800_600 0
#define AUOK190X_RESOLUTION_1024_768 1
#define AUOK190X_RESOLUTION_600_800 4
#define AUOK190X_RESOLUTION_768_1024 5
/*
* struct used by auok190x. board specific stuff comes from *board
*/
struct auok190xfb_par {
struct fb_info *info;
struct auok190x_board *board;
struct regulator *regulator;
struct mutex io_lock;
struct delayed_work work;
wait_queue_head_t waitq;
int resolution;
int rotation;
int consecutive_threshold;
int update_cnt;
/* panel and controller informations */
int epd_type;
int panel_size_int;
int panel_size_float;
int panel_model;
int tcon_version;
int lut_version;
/* individual controller callbacks */
void (*update_partial)(struct auok190xfb_par *par, u16 y1, u16 y2);
void (*update_all)(struct auok190xfb_par *par);
bool (*need_refresh)(struct auok190xfb_par *par);
void (*init)(struct auok190xfb_par *par);
void (*recover)(struct auok190xfb_par *par);
int update_mode; /* mode to use for updates */
int last_mode; /* update mode last used */
int flash;
/* power management */
int autosuspend_delay;
bool standby;
bool manual_standby;
};
/**
* Board specific platform-data
* @init: initialize the controller interface
* @cleanup: cleanup the controller interface
* @wait_for_rdy: wait until the controller is not busy anymore
* @set_ctl: change an interface control
* @set_hdb: write a value to the data register
* @get_hdb: read a value from the data register
* @setup_irq: method to setup the irq handling on the busy gpio
* @gpio_nsleep: sleep gpio
* @gpio_nrst: reset gpio
* @gpio_nbusy: busy gpio
* @resolution: one of the AUOK190X_RESOLUTION constants
* @rotation: rotation of the framebuffer
* @quirks: controller quirks to honor
* @fps: frames per second for defio
*/
struct auok190x_board {
int (*init)(struct auok190xfb_par *);
void (*cleanup)(struct auok190xfb_par *);
int (*wait_for_rdy)(struct auok190xfb_par *);
void (*set_ctl)(struct auok190xfb_par *, unsigned char, u8);
void (*set_hdb)(struct auok190xfb_par *, u16);
u16 (*get_hdb)(struct auok190xfb_par *);
int (*setup_irq)(struct fb_info *);
int gpio_nsleep;
int gpio_nrst;
int gpio_nbusy;
int resolution;
int quirks;
int fps;
};
#endif
......@@ -3,7 +3,6 @@
#define __ASM_SH_MOBILE_LCDC_H__
#include <linux/fb.h>
#include <video/sh_mobile_meram.h>
/* Register definitions */
#define _LDDCKR 0x410
......@@ -184,7 +183,6 @@ struct sh_mobile_lcdc_chan_cfg {
struct sh_mobile_lcdc_panel_cfg panel_cfg;
struct sh_mobile_lcdc_bl_info bl_info;
struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
const struct sh_mobile_meram_cfg *meram_cfg;
struct platform_device *tx_dev; /* HDMI/DSI transmitter device */
};
......@@ -193,7 +191,6 @@ struct sh_mobile_lcdc_info {
int clock_source;
struct sh_mobile_lcdc_chan_cfg ch[2];
struct sh_mobile_lcdc_overlay_cfg overlays[4];
struct sh_mobile_meram_info *meram_dev;
};
#endif /* __ASM_SH_MOBILE_LCDC_H__ */
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __VIDEO_SH_MOBILE_MERAM_H__
#define __VIDEO_SH_MOBILE_MERAM_H__
/* For sh_mobile_meram_info.addr_mode */
enum {
SH_MOBILE_MERAM_MODE0 = 0,
SH_MOBILE_MERAM_MODE1
};
enum {
SH_MOBILE_MERAM_PF_NV = 0,
SH_MOBILE_MERAM_PF_RGB,
SH_MOBILE_MERAM_PF_NV24
};
struct sh_mobile_meram_priv;
/*
* struct sh_mobile_meram_info - MERAM platform data
* @reserved_icbs: Bitmask of reserved ICBs (for instance used through UIO)
*/
struct sh_mobile_meram_info {
int addr_mode;
u32 reserved_icbs;
struct sh_mobile_meram_priv *priv;
struct platform_device *pdev;
};
/* icb config */
struct sh_mobile_meram_icb_cfg {
unsigned int meram_size; /* MERAM Buffer Size to use */
};
struct sh_mobile_meram_cfg {
struct sh_mobile_meram_icb_cfg icb[2];
};
#if defined(CONFIG_FB_SH_MOBILE_MERAM) || \
defined(CONFIG_FB_SH_MOBILE_MERAM_MODULE)
unsigned long sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev,
size_t size);
void sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
unsigned long mem, size_t size);
void *sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
const struct sh_mobile_meram_cfg *cfg,
unsigned int xres, unsigned int yres,
unsigned int pixelformat,
unsigned int *pitch);
void sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data);
void sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
unsigned long base_addr_y,
unsigned long base_addr_c,
unsigned long *icb_addr_y,
unsigned long *icb_addr_c);
#else
static inline unsigned long
sh_mobile_meram_alloc(struct sh_mobile_meram_info *meram_dev, size_t size)
{
return 0;
}
static inline void
sh_mobile_meram_free(struct sh_mobile_meram_info *meram_dev,
unsigned long mem, size_t size)
{
}
static inline void *
sh_mobile_meram_cache_alloc(struct sh_mobile_meram_info *dev,
const struct sh_mobile_meram_cfg *cfg,
unsigned int xres, unsigned int yres,
unsigned int pixelformat,
unsigned int *pitch)
{
return ERR_PTR(-ENODEV);
}
static inline void
sh_mobile_meram_cache_free(struct sh_mobile_meram_info *dev, void *data)
{
}
static inline void
sh_mobile_meram_cache_update(struct sh_mobile_meram_info *dev, void *data,
unsigned long base_addr_y,
unsigned long base_addr_c,
unsigned long *icb_addr_y,
unsigned long *icb_addr_c)
{
}
#endif
#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment