Commit d55696af authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'fbdev-main-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into next

Pull main fbdev changes from Tomi Valkeinen:
 "Mainly fixes and small improvements.  The biggest change seems to be
  backlight control support for mx3fb"

* tag 'fbdev-main-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (31 commits)
  drivers/video/fbdev/fb-puv3.c: Add header files for function unifb_mmap
  video: fbdev: s3fb.c: Fix for possible null pointer dereference
  video: fbdev: grvga.c: Fix for possible null pointer dereference
  matroxfb: perform a dummy read of M_STATUS
  video: of: display_timing: fix default native-mode setting
  video: delete unneeded call to platform_get_drvdata
  video: mx3fb: Add backlight control support
  video: omap: delete support for early fbmem allocation
  video: of: display_timing: remove two unsafe error messages
  fbdev: fbmem: remove positive test on unsigned values
  fbcon: Fix memory leak in con2fb_release_oldinfo()
  video: Kconfig: Add a dependency to the Goldfish framebuffer driver
  video: exynos: Add a dependency to the menu
  video: mx3fb: Use devm_kzalloc
  video/nuc900: allow modular build
  video: atmel needs FB_BACKLIGHT
  video: export fb_prepare_logo
  video/mbx: fix building debugfs support
  video/omap: fix modular build
  video: clarify I2C dependencies
  ...
parents 4dc4226f fbc6c4a1
......@@ -748,6 +748,7 @@ static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
fbcon_del_cursor_timer(oldinfo);
kfree(ops->cursor_state.mask);
kfree(ops->cursor_data);
kfree(ops->cursor_src);
kfree(ops->fontbuffer);
kfree(oldinfo->fbcon_par);
oldinfo->fbcon_par = NULL;
......
......@@ -360,6 +360,7 @@ config FB_CYBER2000_DDC
config FB_CYBER2000_I2C
bool "CyberPro 2000/2010/5000 I2C support"
depends on FB_CYBER2000 && I2C && ARCH_NETWINDER
depends on I2C=y || FB_CYBER2000=m
select I2C_ALGOBIT
help
Enable support for the I2C video decoder interface on the
......@@ -966,6 +967,7 @@ config FB_S1D13XXX
config FB_ATMEL
tristate "AT91/AT32 LCD Controller support"
depends on FB && HAVE_FB_ATMEL
select FB_BACKLIGHT
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
......@@ -1971,6 +1973,7 @@ config FB_W100
config FB_SH_MOBILE_LCDC
tristate "SuperH Mobile LCDC framebuffer support"
depends on FB && (SUPERH || ARCH_SHMOBILE) && HAVE_CLK
depends on FB_SH_MOBILE_MERAM || !FB_SH_MOBILE_MERAM
select FB_SYS_FILLRECT
select FB_SYS_COPYAREA
select FB_SYS_IMAGEBLIT
......@@ -1993,7 +1996,7 @@ config FB_SH_MOBILE_HDMI
config FB_TMIO
tristate "Toshiba Mobile IO FrameBuffer support"
depends on FB && MFD_CORE
depends on FB && (MFD_TMIO || COMPILE_TEST)
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
......@@ -2062,7 +2065,7 @@ config FB_S3C2410_DEBUG
through sysfs
config FB_NUC900
bool "NUC900 LCD framebuffer support"
tristate "NUC900 LCD framebuffer support"
depends on FB && ARCH_W90X900
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
......@@ -2169,7 +2172,7 @@ config FB_XILINX
config FB_GOLDFISH
tristate "Goldfish Framebuffer"
depends on FB && HAS_DMA
depends on FB && HAS_DMA && (GOLDFISH || COMPILE_TEST)
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
......@@ -2295,6 +2298,7 @@ endchoice
config FB_MB862XX_I2C
bool "Support I2C bus on MB862XX GDC"
depends on FB_MB862XX && I2C
depends on FB_MB862XX=m || I2C=y
default y
help
Selecting this option adds Coral-P(A)/Lime GDC I2C bus adapter
......@@ -2332,6 +2336,7 @@ config FB_MX3
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
select BACKLIGHT_CLASS_DEVICE
default y
help
This is a framebuffer device for the i.MX31 LCD Controller. So
......
......@@ -717,8 +717,6 @@ static int bfin_bf54x_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state)
{
struct fb_info *fbinfo = platform_get_drvdata(pdev);
bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN);
disable_dma(CH_EPPI0);
bfin_write_EPPI0_STATUS(0xFFFF);
......
......@@ -433,7 +433,7 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
image->dx += image->width + 8;
}
} else if (rotate == FB_ROTATE_UD) {
for (x = 0; x < num && image->dx >= 0; x++) {
for (x = 0; x < num; x++) {
info->fbops->fb_imageblit(info, image);
image->dx -= image->width + 8;
}
......@@ -445,7 +445,7 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
image->dy += image->height + 8;
}
} else if (rotate == FB_ROTATE_CCW) {
for (x = 0; x < num && image->dy >= 0; x++) {
for (x = 0; x < num; x++) {
info->fbops->fb_imageblit(info, image);
image->dy -= image->height + 8;
}
......@@ -674,6 +674,7 @@ int fb_show_logo(struct fb_info *info, int rotate)
int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; }
int fb_show_logo(struct fb_info *info, int rotate) { return 0; }
#endif /* CONFIG_LOGO */
EXPORT_SYMBOL(fb_prepare_logo);
EXPORT_SYMBOL(fb_show_logo);
static void *fb_seq_start(struct seq_file *m, loff_t *pos)
......@@ -1179,7 +1180,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
return -EFAULT;
if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
return -EINVAL;
if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
if (con2fb.framebuffer >= FB_MAX)
return -EINVAL;
if (!registered_fb[con2fb.framebuffer])
request_module("fb%d", con2fb.framebuffer);
......
......@@ -1012,13 +1012,20 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
while (pos < edid[2]) {
u8 len = edid[pos] & 0x1f, type = (edid[pos] >> 5) & 7;
pr_debug("Data block %u of %u bytes\n", type, len);
if (type == 2)
if (type == 2) {
for (i = pos; i < pos + len; i++) {
u8 idx = edid[pos + i] & 0x7f;
svd[svd_n++] = idx;
pr_debug("N%sative mode #%d\n",
edid[pos + i] & 0x80 ? "" : "on-n", idx);
}
} else if (type == 3 && len >= 3) {
/* Check Vendor Specific Data Block. For HDMI,
it is always 00-0C-03 for HDMI Licensing, LLC. */
if (edid[pos + 1] == 3 && edid[pos + 2] == 0xc &&
edid[pos + 3] == 0)
specs->misc |= FB_MISC_HDMI;
}
pos += len + 1;
}
......
......@@ -242,6 +242,20 @@ static struct fb_videomode known_lcd_panels[] = {
.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
.flag = 0,
},
[3] = {
/* Densitron 84-0023-001T */
.name = "Densitron_84-0023-001T",
.xres = 320,
.yres = 240,
.pixclock = KHZ2PICOS(6400),
.left_margin = 0,
.right_margin = 0,
.upper_margin = 0,
.lower_margin = 0,
.hsync_len = 30,
.vsync_len = 3,
.sync = 0,
},
};
static bool da8xx_fb_is_raster_enabled(void)
......
......@@ -4,6 +4,7 @@
menuconfig EXYNOS_VIDEO
bool "Exynos Video driver support"
depends on ARCH_S5PV210 || ARCH_EXYNOS
help
This enables support for EXYNOS Video device.
......@@ -15,7 +16,6 @@ if EXYNOS_VIDEO
config EXYNOS_MIPI_DSI
bool "EXYNOS MIPI DSI driver support."
depends on ARCH_S5PV210 || ARCH_EXYNOS
select GENERIC_PHY
help
This enables support for MIPI-DSI device.
......
......@@ -18,8 +18,10 @@
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/mm.h>
#include <asm/sizes.h>
#include <asm/pgtable.h>
#include <mach/hardware.h>
/* Platform_data reserved for unifb registers. */
......
......@@ -1068,7 +1068,7 @@ static struct fb_ops gbefb_ops = {
static ssize_t gbefb_show_memsize(struct device *dev, struct device_attribute *attr, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", gbe_mem_size);
return snprintf(buf, PAGE_SIZE, "%u\n", gbe_mem_size);
}
static DEVICE_ATTR(size, S_IRUGO, gbefb_show_memsize, NULL);
......
......@@ -514,9 +514,10 @@ static int grvga_probe(struct platform_device *dev)
static int grvga_remove(struct platform_device *device)
{
struct fb_info *info = dev_get_drvdata(&device->dev);
struct grvga_par *par = info->par;
struct grvga_par *par;
if (info) {
par = info->par;
unregister_framebuffer(info);
fb_dealloc_cmap(&info->cmap);
......
......@@ -698,7 +698,7 @@ void matroxfb_unregister_driver(struct matroxfb_driver* drv);
#define mga_fifo(n) do {} while ((mga_inl(M_FIFOSTATUS) & 0xFF) < (n))
#define WaitTillIdle() do {} while (mga_inl(M_STATUS) & 0x10000)
#define WaitTillIdle() do { mga_inl(M_STATUS); do {} while (mga_inl(M_STATUS) & 0x10000); } while (0)
/* code speedup */
#ifdef CONFIG_FB_MATROX_MILLENIUM
......
# Makefile for the 2700G controller driver.
obj-$(CONFIG_FB_MBX) += mbxfb.o
obj-$(CONFIG_FB_MBX_DEBUG) += mbxfbdebugfs.o
obj-y += mbxfb.o
......@@ -17,7 +17,7 @@ struct mbxfb_debugfs_data {
static int open_file_generic(struct inode *inode, struct file *file)
{
file->private_data = inode->u.generic_ip;
file->private_data = inode->i_private;
return 0;
}
......
......@@ -877,6 +877,8 @@ static int mbxfb_resume(struct platform_device *dev)
#ifndef CONFIG_FB_MBX_DEBUG
#define mbxfb_debugfs_init(x) do {} while(0)
#define mbxfb_debugfs_remove(x) do {} while(0)
#else
#include "mbxdebugfs.c"
#endif
#define res_size(_r) (((_r)->end - (_r)->start) + 1)
......
menuconfig MMP_DISP
tristate "Marvell MMP Display Subsystem support"
depends on CPU_PXA910 || CPU_MMP2 || CPU_MMP3 || CPU_PXA988
depends on CPU_PXA910 || CPU_MMP2
help
Marvell Display Subsystem support.
......
......@@ -554,8 +554,8 @@ static void fb_info_clear(struct fb_info *info)
static int mmpfb_probe(struct platform_device *pdev)
{
struct mmp_buffer_driver_mach_info *mi;
struct fb_info *info = 0;
struct mmpfb_info *fbi = 0;
struct fb_info *info;
struct mmpfb_info *fbi;
int ret, modes_num;
mi = pdev->dev.platform_data;
......@@ -569,10 +569,6 @@ static int mmpfb_probe(struct platform_device *pdev)
if (info == NULL)
return -ENOMEM;
fbi = info->par;
if (!fbi) {
ret = -EINVAL;
goto failed;
}
/* init fb */
fbi->fb_info = info;
......@@ -667,7 +663,6 @@ static int mmpfb_probe(struct platform_device *pdev)
fbi->fb_start_dma);
failed_destroy_mutex:
mutex_destroy(&fbi->access_ok);
failed:
dev_err(fbi->dev, "mmp-fb: frame buffer device init failed\n");
framebuffer_release(info);
......
......@@ -2,12 +2,12 @@ if MMP_DISP
config MMP_DISP_CONTROLLER
bool "mmp display controller hw support"
depends on CPU_PXA910 || CPU_MMP2 || CPU_MMP3 || CPU_PXA988
depends on CPU_PXA910 || CPU_MMP2
default n
help
Marvell MMP display hw controller support
this controller is used on Marvell PXA910,
MMP2, MMP3, PXA988 chips
this controller is used on Marvell PXA910 and
MMP2 chips
config MMP_DISP_SPI
bool "mmp display controller spi port"
......
......@@ -167,11 +167,7 @@ struct lcd_regs {
PN2_IOPAD_CONTROL) : LCD_TOP_CTRL)
/* dither configure */
#ifdef CONFIG_CPU_PXA988
#define LCD_DITHER_CTRL (0x01EC)
#else
#define LCD_DITHER_CTRL (0x00A0)
#endif
#define DITHER_TBL_INDEX_SEL(s) ((s) << 16)
#define DITHER_MODE2(m) ((m) << 12)
......@@ -186,15 +182,6 @@ struct lcd_regs {
#define DITHER_EN1 (1)
/* dither table data was fixed by video bpp of input and output*/
#ifdef CONFIG_CPU_PXA988
#define DITHER_TB_4X4_INDEX0 (0x6e4ca280)
#define DITHER_TB_4X4_INDEX1 (0x5d7f91b3)
#define DITHER_TB_4X8_INDEX0 (0xb391a280)
#define DITHER_TB_4X8_INDEX1 (0x7f5d6e4c)
#define DITHER_TB_4X8_INDEX2 (0x80a291b3)
#define DITHER_TB_4X8_INDEX3 (0x4c6e5d7f)
#define LCD_DITHER_TBL_DATA (0x01F0)
#else
#define DITHER_TB_4X4_INDEX0 (0x3b19f7d5)
#define DITHER_TB_4X4_INDEX1 (0x082ac4e6)
#define DITHER_TB_4X8_INDEX0 (0xf7d508e6)
......@@ -202,7 +189,6 @@ struct lcd_regs {
#define DITHER_TB_4X8_INDEX2 (0xc4e6d5f7)
#define DITHER_TB_4X8_INDEX3 (0x082a193b)
#define LCD_DITHER_TBL_DATA (0x00A4)
#endif
/* Video Frame 0&1 start address registers */
#define LCD_SPU_DMA_START_ADDR_Y0 0x00C0
......@@ -933,16 +919,9 @@ struct lcd_regs {
#define LCD_PN2_SQULN2_CTRL (0x02F0)
#define ALL_LAYER_ALPHA_SEL (0x02F4)
/* pxa988 has different MASTER_CTRL from MMP3/MMP2 */
#ifdef CONFIG_CPU_PXA988
#define TIMING_MASTER_CONTROL (0x01F4)
#define MASTER_ENH(id) (1 << ((id) + 5))
#define MASTER_ENV(id) (1 << ((id) + 6))
#else
#define TIMING_MASTER_CONTROL (0x02F8)
#define MASTER_ENH(id) (1 << (id))
#define MASTER_ENV(id) (1 << ((id) + 4))
#endif
#define DSI_START_SEL_SHIFT(id) (((id) << 1) + 8)
#define timing_master_config(path, dsi_id, lcd_id) \
......@@ -1312,19 +1291,8 @@ struct dsi_regs {
#define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_MASK (0xff)
#define DSI_PHY_TIME_3_CFG_CSR_TIME_REQRDY_SHIFT 0
/*
* DSI timings
* PXA988 has diffrent ESC CLK with MMP2/MMP3
* it will be used in dsi_set_dphy() in pxa688_phy.c
* as low power mode clock.
*/
#ifdef CONFIG_CPU_PXA988
#define DSI_ESC_CLK 52 /* Unit: Mhz */
#define DSI_ESC_CLK_T 19 /* Unit: ns */
#else
#define DSI_ESC_CLK 66 /* Unit: Mhz */
#define DSI_ESC_CLK_T 15 /* Unit: ns */
#endif
/* LVDS */
/* LVDS_PHY_CTRL */
......
......@@ -27,6 +27,7 @@
#include <linux/clk.h>
#include <linux/mutex.h>
#include <linux/dma/ipu-dma.h>
#include <linux/backlight.h>
#include <linux/platform_data/dma-imx.h>
#include <linux/platform_data/video-mx3fb.h>
......@@ -241,6 +242,7 @@ struct mx3fb_data {
void __iomem *reg_base;
spinlock_t lock;
struct device *dev;
struct backlight_device *bl;
uint32_t h_start_width;
uint32_t v_start_width;
......@@ -271,6 +273,71 @@ struct mx3fb_info {
struct fb_var_screeninfo cur_var; /* current var info */
};
static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value);
static u32 sdc_get_brightness(struct mx3fb_data *mx3fb);
static int mx3fb_bl_get_brightness(struct backlight_device *bl)
{
struct mx3fb_data *fbd = bl_get_data(bl);
return sdc_get_brightness(fbd);
}
static int mx3fb_bl_update_status(struct backlight_device *bl)
{
struct mx3fb_data *fbd = bl_get_data(bl);
int brightness = bl->props.brightness;
if (bl->props.power != FB_BLANK_UNBLANK)
brightness = 0;
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;
fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness;
sdc_set_brightness(fbd, fbd->backlight_level);
return 0;
}
static const struct backlight_ops mx3fb_lcdc_bl_ops = {
.update_status = mx3fb_bl_update_status,
.get_brightness = mx3fb_bl_get_brightness,
};
static void mx3fb_init_backlight(struct mx3fb_data *fbd)
{
struct backlight_properties props;
struct backlight_device *bl;
if (fbd->bl)
return;
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = 0xff;
props.type = BACKLIGHT_RAW;
sdc_set_brightness(fbd, fbd->backlight_level);
bl = backlight_device_register("mx3fb-bl", fbd->dev, fbd,
&mx3fb_lcdc_bl_ops, &props);
if (IS_ERR(bl)) {
dev_err(fbd->dev, "error %ld on backlight register\n",
PTR_ERR(bl));
return;
}
fbd->bl = bl;
bl->props.power = FB_BLANK_UNBLANK;
bl->props.fb_blank = FB_BLANK_UNBLANK;
bl->props.brightness = mx3fb_bl_get_brightness(bl);
}
static void mx3fb_exit_backlight(struct mx3fb_data *fbd)
{
if (fbd->bl)
backlight_device_unregister(fbd->bl);
}
static void mx3fb_dma_done(void *);
/* Used fb-mode and bpp. Can be set on kernel command line, therefore file-static. */
......@@ -628,6 +695,16 @@ static int sdc_set_global_alpha(struct mx3fb_data *mx3fb, bool enable, uint8_t a
return 0;
}
static u32 sdc_get_brightness(struct mx3fb_data *mx3fb)
{
u32 brightness;
brightness = mx3fb_read_reg(mx3fb, SDC_PWM_CTRL);
brightness = (brightness >> 16) & 0xFF;
return brightness;
}
static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value)
{
dev_dbg(mx3fb->dev, "%s: value = %d\n", __func__, value);
......@@ -1496,7 +1573,7 @@ static int mx3fb_probe(struct platform_device *pdev)
if (!sdc_reg)
return -EINVAL;
mx3fb = kzalloc(sizeof(*mx3fb), GFP_KERNEL);
mx3fb = devm_kzalloc(&pdev->dev, sizeof(*mx3fb), GFP_KERNEL);
if (!mx3fb)
return -ENOMEM;
......@@ -1534,6 +1611,8 @@ static int mx3fb_probe(struct platform_device *pdev)
if (ret < 0)
goto eisdc0;
mx3fb_init_backlight(mx3fb);
return 0;
eisdc0:
......@@ -1542,7 +1621,6 @@ static int mx3fb_probe(struct platform_device *pdev)
dmaengine_put();
iounmap(mx3fb->reg_base);
eremap:
kfree(mx3fb);
dev_err(dev, "mx3fb: failed to register fb\n");
return ret;
}
......@@ -1557,11 +1635,12 @@ static int mx3fb_remove(struct platform_device *dev)
chan = &mx3_fbi->idmac_channel->dma_chan;
release_fbi(fbi);
mx3fb_exit_backlight(mx3fb);
dma_release_channel(chan);
dmaengine_put();
iounmap(mx3fb->reg_base);
kfree(mx3fb);
return 0;
}
......
......@@ -39,6 +39,15 @@ config FB_OMAP_LCD_MIPID
the Mobile Industry Processor Interface DBI-C/DCS
specification. (Supported LCDs: Philips LPH8923, Sharp LS041Y3)
config FB_OMAP_LCD_H3
bool "TPS65010 LCD controller on OMAP-H3"
depends on MACH_OMAP_H3
depends on TPS65010
default y
help
Say Y here if you want to have support for the LCD on the
H3 board.
config FB_OMAP_DMA_TUNE
bool "Set DMA SDRAM access priority high"
depends on FB_OMAP
......
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