Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH 0/3] video: clps711x: New CLPS711X FB driver
From: Alexander Shiyan @ 2014-03-20 16:24 UTC (permalink / raw)
  To: linux-fbdev

This series adds a new framebuffer driver for Cirrus Logic CLPS711X
CPUs. Since all code rewritten from scratch, patch is designed as a
replacement of the old (not updated for a long time) for a new one.
The second part of the patch affects changes for the ARM CLPS711X
core subsystem, so ACK from the ARM maintainers would be useful.
Patch originally designed for apply to the video subsystem, but I
have no prejudice it and if it will be applied to the arm-soc branch,
this will also be good.

Alexander Shiyan (3):
  video: clps711x: Add new Cirrus Logic CLPS711X framebuffer driver
  video: clps711x: Switch CLPS711X boards to use new FB driver
  video: clps711x: Add bindings documentation for CLPS711X framebuffer

 .../bindings/video/cirrus,clps711x-fb.txt          |  48 +++
 arch/arm/mach-clps711x/board-autcpu12.c            |   2 +-
 arch/arm/mach-clps711x/board-edb7211.c             |   2 +-
 arch/arm/mach-clps711x/board-p720t.c               |   2 +-
 arch/arm/mach-clps711x/devices.c                   |  17 +
 arch/arm/mach-clps711x/devices.h                   |   1 +
 drivers/video/fbdev/Kconfig                        |  18 +-
 drivers/video/fbdev/Makefile                       |   2 +-
 drivers/video/fbdev/clps711x-fb.c                  | 456 +++++++++++++++++++++
 drivers/video/fbdev/clps711xfb.c                   | 315 --------------
 10 files changed, 537 insertions(+), 326 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
 create mode 100644 drivers/video/fbdev/clps711x-fb.c
 delete mode 100644 drivers/video/fbdev/clps711xfb.c

-- 
1.8.3.2


^ permalink raw reply

* [PATCH 1/3] video: clps711x: Add new Cirrus Logic CLPS711X framebuffer driver
From: Alexander Shiyan @ 2014-03-20 16:24 UTC (permalink / raw)
  To: linux-fbdev

This adds support for the framebuffer available in the Cirrus
Logic CLPS711X CPUs.
The driver have been tested with custom board equipped Cirrus Logic
EP7312 in DT and non-DT mode.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/video/fbdev/clps711x-fb.c | 456 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 456 insertions(+)
 create mode 100644 drivers/video/fbdev/clps711x-fb.c

diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
new file mode 100644
index 0000000..87fd42d
--- /dev/null
+++ b/drivers/video/fbdev/clps711x-fb.c
@@ -0,0 +1,456 @@
+/*
+ * Cirrus Logic CLPS711X FB driver
+ *
+ * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
+ * Based on driver by Russell King <rmk@arm.linux.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/clk.h>
+#include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/lcd.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <linux/mfd/syscon/clps711x.h>
+#include <linux/regulator/consumer.h>
+#include <video/of_display_timing.h>
+
+#define CLPS711X_FB_NAME	"clps711x-fb"
+#define CLPS711X_FB_BPP_MAX	(4)
+
+/* Registers relative to LCDCON */
+#define CLPS711X_LCDCON		(0x0000)
+# define LCDCON_GSEN		BIT(30)
+# define LCDCON_GSMD		BIT(31)
+#define CLPS711X_PALLSW		(0x0280)
+#define CLPS711X_PALMSW		(0x02c0)
+#define CLPS711X_FBADDR		(0x0d40)
+
+struct clps711x_fb_info {
+	struct clk		*clk;
+	void __iomem		*base;
+	struct regmap		*syscon;
+	resource_size_t		buffsize;
+	struct fb_videomode	mode;
+	struct regulator	*lcd_pwr;
+	u32			ac_prescale;
+	bool			cmap_invert;
+};
+
+static int clps711x_fb_setcolreg(u_int regno, u_int red, u_int green,
+				 u_int blue, u_int transp, struct fb_info *info)
+{
+	struct clps711x_fb_info *cfb = info->par;
+	u32 level, mask, shift;
+
+	if (regno >= BIT(info->var.bits_per_pixel))
+		return -EINVAL;
+
+	shift = 4 * (regno & 7);
+	mask  = 0xf << shift;
+	/* gray = 0.30*R + 0.58*G + 0.11*B */
+	level = (((red * 77 + green * 151 + blue * 28) >> 20) << shift) & mask;
+	if (cfb->cmap_invert)
+		level = 0xf - level;
+
+	regno = (regno < 8) ? CLPS711X_PALLSW : CLPS711X_PALMSW;
+
+	writel((readl(cfb->base + regno) & ~mask) | level, cfb->base + regno);
+
+	return 0;
+}
+
+static int clps711x_fb_check_var(struct fb_var_screeninfo *var,
+				 struct fb_info *info)
+{
+	u32 val;
+
+	if (var->bits_per_pixel < 1 ||
+	    var->bits_per_pixel > CLPS711X_FB_BPP_MAX)
+		return -EINVAL;
+
+	if (!var->pixclock)
+		return -EINVAL;
+
+	val = DIV_ROUND_UP(var->xres, 16) - 1;
+	if (val < 0x01 || val > 0x3f)
+		return -EINVAL;
+
+	val = DIV_ROUND_UP(var->yres * var->xres * var->bits_per_pixel, 128);
+	val--;
+	if (val < 0x001 || val > 0x1fff)
+		return -EINVAL;
+
+	var->transp.msb_right	= 0;
+	var->transp.offset	= 0;
+	var->transp.length	= 0;
+	var->red.msb_right	= 0;
+	var->red.offset		= 0;
+	var->red.length		= var->bits_per_pixel;
+	var->green		= var->red;
+	var->blue		= var->red;
+	var->grayscale		= var->bits_per_pixel > 1;
+
+	return 0;
+}
+
+static int clps711x_fb_set_par(struct fb_info *info)
+{
+	struct clps711x_fb_info *cfb = info->par;
+	resource_size_t size;
+	u32 lcdcon, pps;
+
+	size = (info->var.xres * info->var.yres * info->var.bits_per_pixel) / 8;
+	if (size > cfb->buffsize)
+		return -EINVAL;
+
+	switch (info->var.bits_per_pixel) {
+	case 1:
+		info->fix.visual = FB_VISUAL_MONO01;
+		break;
+	case 2:
+	case 4:
+		info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	info->fix.line_length = info->var.xres * info->var.bits_per_pixel / 8;
+	info->fix.smem_len = size;
+
+	lcdcon = (info->var.xres * info->var.yres *
+		  info->var.bits_per_pixel) / 128 - 1;
+	lcdcon |= ((info->var.xres / 16) - 1) << 13;
+	lcdcon |= (cfb->ac_prescale & 0x1f) << 25;
+
+	pps = clk_get_rate(cfb->clk) / (PICOS2KHZ(info->var.pixclock) * 1000);
+	if (pps)
+		pps--;
+	lcdcon |= (pps & 0x3f) << 19;
+
+	if (info->var.bits_per_pixel = 4)
+		lcdcon |= LCDCON_GSMD;
+	if (info->var.bits_per_pixel >= 2)
+		lcdcon |= LCDCON_GSEN;
+
+	/* LCDCON must only be changed while the LCD is disabled */
+	regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
+	writel(lcdcon, cfb->base + CLPS711X_LCDCON);
+	regmap_update_bits(cfb->syscon, SYSCON_OFFSET,
+			   SYSCON1_LCDEN, SYSCON1_LCDEN);
+
+	return 0;
+}
+
+static int clps711x_fb_blank(int blank, struct fb_info *info)
+{
+	/* Return happy */
+	return 0;
+}
+
+static struct fb_ops clps711x_fb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_setcolreg	= clps711x_fb_setcolreg,
+	.fb_check_var	= clps711x_fb_check_var,
+	.fb_set_par	= clps711x_fb_set_par,
+	.fb_blank	= clps711x_fb_blank,
+	.fb_fillrect	= sys_fillrect,
+	.fb_copyarea	= sys_copyarea,
+	.fb_imageblit	= sys_imageblit,
+};
+
+static int clps711x_lcd_check_fb(struct lcd_device *lcddev, struct fb_info *fi)
+{
+	struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
+
+	return (!fi || fi->par = cfb) ? 1 : 0;
+}
+
+static int clps711x_lcd_get_power(struct lcd_device *lcddev)
+{
+	struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
+
+	if (!IS_ERR_OR_NULL(cfb->lcd_pwr))
+		return regulator_is_enabled(cfb->lcd_pwr);
+
+	return 1;
+}
+
+static int clps711x_lcd_set_power(struct lcd_device *lcddev, int power)
+{
+	struct clps711x_fb_info *cfb = dev_get_drvdata(&lcddev->dev);
+
+	if (!IS_ERR_OR_NULL(cfb->lcd_pwr)) {
+		if (power)
+			return regulator_enable(cfb->lcd_pwr);
+		else
+			return regulator_disable(cfb->lcd_pwr);
+	}
+
+	return 0;
+}
+
+static struct lcd_ops clps711x_lcd_ops = {
+	.check_fb	= clps711x_lcd_check_fb,
+	.get_power	= clps711x_lcd_get_power,
+	.set_power	= clps711x_lcd_set_power,
+};
+
+static int clps711x_fb_get_mode(struct platform_device *pdev)
+{
+	struct fb_info *info = platform_get_drvdata(pdev);
+	bool *pinvert = dev_get_platdata(&pdev->dev);
+	struct clps711x_fb_info *cfb = info->par;
+	unsigned long pixclk;
+	unsigned int val;
+	int ret;
+
+	cfb->syscon = syscon_regmap_lookup_by_pdevname("syscon.1");
+	if (IS_ERR(cfb->syscon))
+		return PTR_ERR(cfb->syscon);
+
+	ret = regmap_read(cfb->syscon, SYSCON_OFFSET, &val);
+	if (ret)
+		return ret;
+
+	if (pinvert)
+		cfb->cmap_invert = *pinvert;
+
+	/* Get mode from LCD if active */
+	if (val & SYSCON1_LCDEN) {
+		val = readl(cfb->base + CLPS711X_LCDCON);
+
+		switch (val & (LCDCON_GSMD | LCDCON_GSEN)) {
+		case LCDCON_GSMD | LCDCON_GSEN:
+			info->var.bits_per_pixel = 4;
+			break;
+		case LCDCON_GSEN:
+			info->var.bits_per_pixel = 2;
+			break;
+		default:
+			info->var.bits_per_pixel = 1;
+			break;
+		}
+
+		cfb->mode.xres = (((val >> 13) & 0x3f) + 1) * 16;
+		cfb->mode.yres = (((val & 0x1fff) + 1) * 128) /
+				 (cfb->mode.xres * info->var.bits_per_pixel);
+		cfb->ac_prescale = (val >> 25) & 0x1f;
+		pixclk = clk_get_rate(cfb->clk) / (((val >> 19) & 0x3f) + 1);
+	} else {
+		/* Fixed setup for existing users */
+		info->var.bits_per_pixel = 4;
+		cfb->mode.xres = 640;
+		cfb->mode.yres = 240;
+		cfb->ac_prescale = 13;
+		pixclk = 10000000;
+	}
+
+	cfb->mode.refresh = pixclk / (cfb->mode.xres * cfb->mode.yres);
+	cfb->mode.pixclock = KHZ2PICOS(pixclk / 1000);
+
+	return 0;
+}
+
+static int clps711x_fb_get_mode_dt(struct platform_device *pdev)
+{
+	struct device_node *disp, *np = pdev->dev.of_node;
+	struct fb_info *info = platform_get_drvdata(pdev);
+	struct clps711x_fb_info *cfb = info->par;
+	int ret;
+
+	cfb->syscon +		syscon_regmap_lookup_by_compatible("cirrus,clps711x-syscon1");
+	if (IS_ERR(cfb->syscon))
+		return PTR_ERR(cfb->syscon);
+
+	disp = of_parse_phandle(np, "display", 0);
+	if (!disp) {
+		dev_err(&pdev->dev, "No display defined\n");
+		return -ENODATA;
+	}
+
+	ret = of_get_fb_videomode(disp, &cfb->mode, OF_USE_NATIVE_MODE);
+	if (ret)
+		return ret;
+
+	of_property_read_u32(disp, "ac-prescale", &cfb->ac_prescale);
+	cfb->cmap_invert = of_property_read_bool(disp, "cmap-invert");
+
+	return of_property_read_u32(disp, "bits-per-pixel",
+				    &info->var.bits_per_pixel);
+}
+
+static int clps711x_fb_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	struct clps711x_fb_info *cfb;
+	struct lcd_device *lcd;
+	struct fb_info *info;
+	struct resource *res;
+	int ret = -ENOENT;
+	u32 val;
+
+	if (fb_get_options(CLPS711X_FB_NAME, NULL))
+		return -ENODEV;
+
+	info = framebuffer_alloc(sizeof(*cfb), dev);
+	if (!info)
+		return -ENOMEM;
+
+	cfb = info->par;
+	platform_set_drvdata(pdev, info);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		goto out_fb_release;
+	cfb->base = devm_ioremap(dev, res->start, resource_size(res));
+	if (!cfb->base) {
+		ret = -ENOMEM;
+		goto out_fb_release;
+	}
+
+	info->fix.mmio_start = res->start;
+	info->fix.mmio_len = resource_size(res);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	info->screen_base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(info->screen_base)) {
+		ret = PTR_ERR(info->screen_base);
+		goto out_fb_release;
+	}
+
+	/* Physical address should be aligned to 256 MiB */
+	if (res->start & 0x0fffffff) {
+		ret = -EINVAL;
+		goto out_fb_release;
+	}
+
+	info->apertures = alloc_apertures(1);
+	if (!info->apertures) {
+		ret = -ENOMEM;
+		goto out_fb_release;
+	}
+
+	cfb->buffsize = resource_size(res);
+	info->fix.smem_start = res->start;
+	info->apertures->ranges[0].base = info->fix.smem_start;
+	info->apertures->ranges[0].size = cfb->buffsize;
+
+	cfb->clk = devm_clk_get(dev, NULL);
+	if (IS_ERR(cfb->clk)) {
+		ret = PTR_ERR(cfb->clk);
+		goto out_fb_release;
+	}
+
+	ret = np ? clps711x_fb_get_mode_dt(pdev) : clps711x_fb_get_mode(pdev);
+	if (ret)
+		goto out_fb_release;
+
+	/* Force disable LCD on any mismatch */
+	if (info->fix.smem_start != (readb(cfb->base + CLPS711X_FBADDR) << 28))
+		regmap_update_bits(cfb->syscon, SYSCON_OFFSET,
+				   SYSCON1_LCDEN, 0);
+
+	ret = regmap_read(cfb->syscon, SYSCON_OFFSET, &val);
+	if (ret)
+		goto out_fb_release;
+
+	if (!(val & SYSCON1_LCDEN)) {
+		/* Setup start FB address */
+		writeb(info->fix.smem_start >> 28, cfb->base + CLPS711X_FBADDR);
+		/* Clean FB memory */
+		memset(info->screen_base, 0, cfb->buffsize);
+	}
+
+	cfb->lcd_pwr = devm_regulator_get(dev, "lcd");
+	if (PTR_ERR(cfb->lcd_pwr) = -EPROBE_DEFER) {
+		ret = -EPROBE_DEFER;
+		goto out_fb_release;
+	}
+
+	info->fbops = &clps711x_fb_ops;
+	info->flags = FBINFO_DEFAULT;
+	info->var.activate = FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW;
+	info->var.height = -1;
+	info->var.width = -1;
+	info->var.vmode = FB_VMODE_NONINTERLACED;
+	info->fix.type = FB_TYPE_PACKED_PIXELS;
+	info->fix.accel = FB_ACCEL_NONE;
+	strlcpy(info->fix.id, CLPS711X_FB_NAME, sizeof(info->fix.id));
+	fb_videomode_to_var(&info->var, &cfb->mode);
+
+	ret = fb_alloc_cmap(&info->cmap, BIT(CLPS711X_FB_BPP_MAX), 0);
+	if (ret)
+		goto out_fb_release;
+
+	ret = fb_set_var(info, &info->var);
+	if (ret)
+		goto out_fb_dealloc_cmap;
+
+	ret = register_framebuffer(info);
+	if (ret)
+		goto out_fb_dealloc_cmap;
+
+	lcd = devm_lcd_device_register(dev, "clps711x-lcd", dev, cfb,
+				       &clps711x_lcd_ops);
+	if (!IS_ERR(lcd))
+		return 0;
+	
+	ret = PTR_ERR(lcd);
+	unregister_framebuffer(info);
+
+out_fb_dealloc_cmap:
+	regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
+	fb_dealloc_cmap(&info->cmap);
+
+out_fb_release:
+	framebuffer_release(info);
+
+	return ret;
+}
+
+static int clps711x_fb_remove(struct platform_device *pdev)
+{
+	struct fb_info *info = platform_get_drvdata(pdev);
+	struct clps711x_fb_info *cfb = info->par;
+
+	regmap_update_bits(cfb->syscon, SYSCON_OFFSET, SYSCON1_LCDEN, 0);
+
+	unregister_framebuffer(info);
+	fb_dealloc_cmap(&info->cmap);
+	framebuffer_release(info);
+
+	return 0;
+}
+
+static const struct of_device_id __maybe_unused clps711x_fb_dt_ids[] = {
+	{ .compatible = "cirrus,clps711x-fb", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, clps711x_fb_dt_ids);
+
+static struct platform_driver clps711x_fb_driver = {
+	.driver	= {
+		.name		= CLPS711X_FB_NAME,
+		.owner		= THIS_MODULE,
+		.of_match_table	= of_match_ptr(clps711x_fb_dt_ids),
+	},
+	.probe	= clps711x_fb_probe,
+	.remove	= clps711x_fb_remove,
+};
+module_platform_driver(clps711x_fb_driver);
+
+MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
+MODULE_DESCRIPTION("Cirrus Logic CLPS711X FB driver");
+MODULE_LICENSE("GPL");
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 2/3] video: clps711x: Switch CLPS711X boards to use new FB driver
From: Alexander Shiyan @ 2014-03-20 16:24 UTC (permalink / raw)
  To: linux-fbdev

This patch removes old implementation of Cirrus Logic CLPS711X FB
driver and switch current users to use new one.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-clps711x/board-autcpu12.c |   2 +-
 arch/arm/mach-clps711x/board-edb7211.c  |   2 +-
 arch/arm/mach-clps711x/board-p720t.c    |   2 +-
 arch/arm/mach-clps711x/devices.c        |  17 ++
 arch/arm/mach-clps711x/devices.h        |   1 +
 drivers/video/fbdev/Kconfig             |  18 +-
 drivers/video/fbdev/Makefile            |   2 +-
 drivers/video/fbdev/clps711xfb.c        | 315 --------------------------------
 8 files changed, 33 insertions(+), 326 deletions(-)
 delete mode 100644 drivers/video/fbdev/clps711xfb.c

diff --git a/arch/arm/mach-clps711x/board-autcpu12.c b/arch/arm/mach-clps711x/board-autcpu12.c
index d62ca16..c63f872 100644
--- a/arch/arm/mach-clps711x/board-autcpu12.c
+++ b/arch/arm/mach-clps711x/board-autcpu12.c
@@ -249,7 +249,7 @@ static void __init autcpu12_init(void)
 {
 	clps711x_devices_init();
 	platform_device_register(&autcpu12_flash_pdev);
-	platform_device_register_simple("video-clps711x", 0, NULL, 0);
+	clps711x_add_fb(CLPS711X_SRAM_BASE, CLPS711X_SRAM_SIZE);
 	platform_device_register_simple("cs89x0", 0, autcpu12_cs8900_resource,
 					ARRAY_SIZE(autcpu12_cs8900_resource));
 	platform_device_register(&autcpu12_mmgpio_pdev);
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index 0776098..d9293a0 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -166,7 +166,7 @@ static void __init edb7211_init_late(void)
 	platform_device_register_data(&platform_bus, "generic-bl", 0,
 				      &edb7211_lcd_backlight_pdata,
 				      sizeof(edb7211_lcd_backlight_pdata));
-	platform_device_register_simple("video-clps711x", 0, NULL, 0);
+	clps711x_add_fb(CLPS711X_SDRAM0_BASE, VIDEORAM_SIZE);
 	platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
 					ARRAY_SIZE(edb7211_cs8900_resource));
 	platform_device_register_data(&platform_bus, "i2c-gpio", 0,
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c
index 67b7337..5bc4fa4 100644
--- a/arch/arm/mach-clps711x/board-p720t.c
+++ b/arch/arm/mach-clps711x/board-p720t.c
@@ -354,7 +354,7 @@ static void __init p720t_init_late(void)
 	platform_device_register_data(&platform_bus, "generic-bl", 0,
 				      &p720t_lcd_backlight_pdata,
 				      sizeof(p720t_lcd_backlight_pdata));
-	platform_device_register_simple("video-clps711x", 0, NULL, 0);
+	clps711x_add_fb(CLPS711X_SRAM_BASE, CLPS711X_SRAM_SIZE);
 	platform_device_register_data(&platform_bus, "leds-gpio", 0,
 				      &p720t_gpio_led_pdata,
 				      sizeof(p720t_gpio_led_pdata));
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
index 2001488..f644d35 100644
--- a/arch/arm/mach-clps711x/devices.c
+++ b/arch/arm/mach-clps711x/devices.c
@@ -14,6 +14,23 @@
 
 #include <mach/hardware.h>
 
+void __init clps711x_add_fb(phys_addr_t base, resource_size_t size)
+{
+	struct resource res[2];
+
+	memset(res, 0, sizeof(res));
+
+	res[0].flags = IORESOURCE_MEM;
+	res[0].start = CLPS711X_PHYS_BASE + LCDCON;
+	res[0].end = CLPS711X_PHYS_BASE + FBADDR + 3;
+	res[1].flags = IORESOURCE_MEM;
+	res[1].start = base;
+	res[1].end = base + size - 1;
+
+	platform_device_register_simple("clps711x-fb", PLATFORM_DEVID_NONE,
+					res, ARRAY_SIZE(res));
+}
+
 static const phys_addr_t clps711x_gpios[][2] __initconst = {
 	{ PADR, PADDR },
 	{ PBDR, PBDDR },
diff --git a/arch/arm/mach-clps711x/devices.h b/arch/arm/mach-clps711x/devices.h
index a5efc17..01e7f45 100644
--- a/arch/arm/mach-clps711x/devices.h
+++ b/arch/arm/mach-clps711x/devices.h
@@ -9,4 +9,5 @@
  * (at your option) any later version.
  */
 
+void clps711x_add_fb(phys_addr_t, resource_size_t);
 void clps711x_devices_init(void);
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 45fd7f3..d1f6dca 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -302,14 +302,18 @@ config FB_ACORN
 	  unsure, say N.
 
 config FB_CLPS711X
-	bool "CLPS711X LCD support"
-	depends on (FB = y) && ARM && ARCH_CLPS711X
-	select FB_CFB_FILLRECT
-	select FB_CFB_COPYAREA
-	select FB_CFB_IMAGEBLIT
+	tristate "CLPS711X LCD support"
+	depends on FB && (ARCH_CLPS711X || COMPILE_TEST)
+	select BACKLIGHT_LCD_SUPPORT
+	select FB_MODE_HELPERS
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select LCD_CLASS_DEVICE
+	select VIDEOMODE_HELPERS
 	help
-	  Say Y to enable the Framebuffer driver for the CLPS7111 and
-	  EP7212 processors.
+	  Say Y to enable the Framebuffer driver for the Cirrus Logic
+	  CLPS711X CPUs.
 
 config FB_SA1100
 	bool "SA-1100 LCD support"
diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile
index 0284f2a..0164bb1 100644
--- a/drivers/video/fbdev/Makefile
+++ b/drivers/video/fbdev/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_FB_WMT_GE_ROPS)   += wmt_ge_rops.o
 # Hardware specific drivers go first
 obj-$(CONFIG_FB_AMIGA)            += amifb.o c2p_planar.o
 obj-$(CONFIG_FB_ARC)              += arcfb.o
-obj-$(CONFIG_FB_CLPS711X)         += clps711xfb.o
+obj-$(CONFIG_FB_CLPS711X)	  += clps711x-fb.o
 obj-$(CONFIG_FB_CYBER2000)        += cyber2000fb.o
 obj-$(CONFIG_FB_GRVGA)            += grvga.o
 obj-$(CONFIG_FB_PM2)              += pm2fb.o
diff --git a/drivers/video/fbdev/clps711xfb.c b/drivers/video/fbdev/clps711xfb.c
deleted file mode 100644
index f009806..0000000
--- a/drivers/video/fbdev/clps711xfb.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- *  linux/drivers/video/clps711xfb.c
- *
- *  Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- *  Framebuffer driver for the CLPS7111 and EP7212 processors.
- */
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/fb.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-
-#include <mach/hardware.h>
-#include <asm/mach-types.h>
-#include <linux/uaccess.h>
-
-struct fb_info	*cfb;
-
-#define CMAP_MAX_SIZE	16
-
-/*
- * LCD AC Prescale.  This comes from the LCD panel manufacturers specifications.
- * This determines how many clocks + 1 of CL1 before the M signal toggles.
- * The number of lines on the display must not be divisible by this number.
- */
-static unsigned int lcd_ac_prescale = 13;
-
-/*
- *    Set a single color register. Return != 0 for invalid regno.
- */
-static int
-clps7111fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
-		     u_int transp, struct fb_info *info)
-{
-	unsigned int level, mask, shift, pal;
-
-	if (regno >= (1 << info->var.bits_per_pixel))
-		return 1;
-
-	/* gray = 0.30*R + 0.58*G + 0.11*B */
-	level = (red * 77 + green * 151 + blue * 28) >> 20;
-
-	/*
-	 * On an LCD, a high value is dark, while a low value is light. 
-	 * So we invert the level.
-	 *
-	 * This isn't true on all machines, so we only do it on EDB7211.
-	 *  --rmk
-	 */
-	if (machine_is_edb7211()) {
-		level = 15 - level;
-	}
-
-	shift = 4 * (regno & 7);
-	level <<= shift;
-	mask  = 15 << shift;
-	level &= mask;
-
-	regno = regno < 8 ? PALLSW : PALMSW;
-
-	pal = clps_readl(regno);
-	pal = (pal & ~mask) | level;
-	clps_writel(pal, regno);
-
-	return 0;
-}
-
-/*
- * Validate the purposed mode.
- */	
-static int
-clps7111fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
-{
-	var->transp.msb_right	= 0;
-	var->transp.offset	= 0;
-	var->transp.length	= 0;
-	var->red.msb_right	= 0;
-	var->red.offset		= 0;
-	var->red.length		= var->bits_per_pixel;
-	var->green		= var->red;
-	var->blue		= var->red;
-
-	if (var->bits_per_pixel > 4) 
-		return -EINVAL;
-
-	return 0;
-}
-
-/*
- * Set the hardware state.
- */ 
-static int 
-clps7111fb_set_par(struct fb_info *info)
-{
-	unsigned int lcdcon, syscon, pixclock;
-
-	switch (info->var.bits_per_pixel) {
-	case 1:
-		info->fix.visual = FB_VISUAL_MONO01;
-		break;
-	case 2:
-		info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
-		break;
-	case 4:
-		info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
-		break;
-	}
-
-	info->fix.line_length = info->var.xres_virtual * info->var.bits_per_pixel / 8;
-
-	lcdcon = (info->var.xres_virtual * info->var.yres_virtual * info->var.bits_per_pixel) / 128 - 1;
-	lcdcon |= ((info->var.xres_virtual / 16) - 1) << 13;
-	lcdcon |= lcd_ac_prescale << 25;
-
-	/*
-	 * Calculate pixel prescale value from the pixclock.  This is:
-	 *  36.864MHz / pixclock_mhz - 1.
-	 * However, pixclock is in picoseconds, so this ends up being:
-	 *  36864000 * pixclock_ps / 10^12 - 1
-	 * and this will overflow the 32-bit math.  We perform this as
-	 * (9 * 4096000 = 36864000):
-	 *  pixclock_ps * 9 * (4096000 / 10^12) - 1
-	 */
-	pixclock = 9 * info->var.pixclock / 244140 - 1;
-	lcdcon |= pixclock << 19;
-
-	if (info->var.bits_per_pixel = 4)
-		lcdcon |= LCDCON_GSMD;
-	if (info->var.bits_per_pixel >= 2)
-		lcdcon |= LCDCON_GSEN;
-
-	/*
-	 * LCDCON must only be changed while the LCD is disabled
-	 */
-	syscon = clps_readl(SYSCON1);
-	clps_writel(syscon & ~SYSCON1_LCDEN, SYSCON1);
-	clps_writel(lcdcon, LCDCON);
-	clps_writel(syscon | SYSCON1_LCDEN, SYSCON1);
-	return 0;
-}
-
-static int clps7111fb_blank(int blank, struct fb_info *info)
-{
-	/* Enable/Disable LCD controller. */
-	if (blank)
-		clps_writel(clps_readl(SYSCON1) & ~SYSCON1_LCDEN, SYSCON1);
-	else
-		clps_writel(clps_readl(SYSCON1) | SYSCON1_LCDEN, SYSCON1);
-
-	return 0;
-}
-
-static struct fb_ops clps7111fb_ops = {
-	.owner		= THIS_MODULE,
-	.fb_check_var	= clps7111fb_check_var,
-	.fb_set_par	= clps7111fb_set_par,
-	.fb_setcolreg	= clps7111fb_setcolreg,
-	.fb_blank	= clps7111fb_blank,
-	.fb_fillrect	= cfb_fillrect,
-	.fb_copyarea	= cfb_copyarea,
-	.fb_imageblit	= cfb_imageblit,
-};
-
-static void clps711x_guess_lcd_params(struct fb_info *info)
-{
-	unsigned int lcdcon, syscon, size;
-	unsigned long phys_base = PAGE_OFFSET;
-	void *virt_base = (void *)PAGE_OFFSET;
-
-	info->var.xres_virtual	 = 640;
-	info->var.yres_virtual	 = 240;
-	info->var.bits_per_pixel = 4;
-	info->var.activate	 = FB_ACTIVATE_NOW;
-	info->var.height	 = -1;
-	info->var.width		 = -1;
-	info->var.pixclock	 = 93006; /* 10.752MHz pixel clock */
-
-	/*
-	 * If the LCD controller is already running, decode the values
-	 * in LCDCON to xres/yres/bpp/pixclock/acprescale
-	 */
-	syscon = clps_readl(SYSCON1);
-	if (syscon & SYSCON1_LCDEN) {
-		lcdcon = clps_readl(LCDCON);
-
-		/*
-		 * Decode GSMD and GSEN bits to bits per pixel
-		 */
-		switch (lcdcon & (LCDCON_GSMD | LCDCON_GSEN)) {
-		case LCDCON_GSMD | LCDCON_GSEN:
-			info->var.bits_per_pixel = 4;
-			break;
-
-		case LCDCON_GSEN:
-			info->var.bits_per_pixel = 2;
-			break;
-
-		default:
-			info->var.bits_per_pixel = 1;
-			break;
-		}
-
-		/*
-		 * Decode xres/yres
-		 */
-		info->var.xres_virtual = (((lcdcon >> 13) & 0x3f) + 1) * 16;
-		info->var.yres_virtual = (((lcdcon & 0x1fff) + 1) * 128) /
-					  (info->var.xres_virtual *
-					   info->var.bits_per_pixel);
-
-		/*
-		 * Calculate pixclock
-		 */
-		info->var.pixclock = (((lcdcon >> 19) & 0x3f) + 1) * 244140 / 9;
-
-		/*
-		 * Grab AC prescale
-		 */
-		lcd_ac_prescale = (lcdcon >> 25) & 0x1f;
-	}
-
-	info->var.xres = info->var.xres_virtual;
-	info->var.yres = info->var.yres_virtual;
-	info->var.grayscale = info->var.bits_per_pixel > 1;
-
-	size = info->var.xres * info->var.yres * info->var.bits_per_pixel / 8;
-
-	/*
-	 * Might be worth checking to see if we can use the on-board
-	 * RAM if size here...
-	 * CLPS7110 - no on-board SRAM
-	 * EP7212   - 38400 bytes
-	 */
-	if (size <= 38400) {
-		printk(KERN_INFO "CLPS711xFB: could use on-board SRAM?\n");
-	}
-
-	if ((syscon & SYSCON1_LCDEN) = 0) {
-		/*
-		 * The display isn't running.  Ensure that
-		 * the display memory is empty.
-		 */
-		memset(virt_base, 0, size);
-	}
-
-	info->screen_base    = virt_base;
-	info->fix.smem_start = phys_base;
-	info->fix.smem_len   = PAGE_ALIGN(size);
-	info->fix.type       = FB_TYPE_PACKED_PIXELS;
-}
-
-static int clps711x_fb_probe(struct platform_device *pdev)
-{
-	int err = -ENOMEM;
-
-	if (fb_get_options("clps711xfb", NULL))
-		return -ENODEV;
-
-	cfb = kzalloc(sizeof(*cfb), GFP_KERNEL);
-	if (!cfb)
-		goto out;
-
-	strcpy(cfb->fix.id, "clps711x");
-
-	cfb->fbops		= &clps7111fb_ops;
-	cfb->flags		= FBINFO_DEFAULT;
-
-	clps711x_guess_lcd_params(cfb);
-
-	fb_alloc_cmap(&cfb->cmap, CMAP_MAX_SIZE, 0);
-
-	err = register_framebuffer(cfb);
-
-out:	return err;
-}
-
-static int clps711x_fb_remove(struct platform_device *pdev)
-{
-	unregister_framebuffer(cfb);
-	kfree(cfb);
-
-	return 0;
-}
-
-static struct platform_driver clps711x_fb_driver = {
-	.driver	= {
-		.name	= "video-clps711x",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= clps711x_fb_probe,
-	.remove	= clps711x_fb_remove,
-};
-module_platform_driver(clps711x_fb_driver);
-
-MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
-MODULE_DESCRIPTION("CLPS711X framebuffer driver");
-MODULE_LICENSE("GPL");
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 3/3] video: clps711x: Add bindings documentation for CLPS711X framebuffer
From: Alexander Shiyan @ 2014-03-20 16:26 UTC (permalink / raw)
  To: linux-fbdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Russell King,
	Olof Johansson, Arnd Bergmann, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Alexander Shiyan

Add OF document for Cirrus Logic CLPS711X framebuffer driver.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 .../bindings/video/cirrus,clps711x-fb.txt          | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt

diff --git a/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt b/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
new file mode 100644
index 0000000..9d59ad3
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
@@ -0,0 +1,48 @@
+* Currus Logic CLPS711X Framebuffer
+
+Required properties:
+- compatible: Shall contain "cirrus,clps711x-fb".
+- reg: Physical base address and length of the controller's registers +
+   location and size of the framebuffer memory.
+- clocks: phandle + clock specifier pair of the FB reference clock.
+
+Required nodes:
+- display: Phandle to a display node as described in display-timing.txt.
+  Additionally, the display node has to define properties:
+  - bits-per-pixel: Bits per pixel.
+  - ac-prescale: LCD AC bias frequency. This frequency is the required
+     AC bias frequency for a given manufacturer's LCD plate.
+  - cmap-invert: Invert the color levels (Optional).
+
+Optional properties:
+- lcd-supply: Regulator for LCD supply voltage.
+
+Example:
+	fb: fb@800002c0 {
+		compatible = "cirrus,ep7312-fb", "cirrus,clps711x-fb";
+		reg = <0x800002c0 0xd44>, <0x60000000 0xc000>;
+		clocks = <&clks 2>;
+		lcd-supply = <&reg5v0>;
+		display = <&display>;
+	};
+
+	display: display {
+		model = "320x240x4";
+		native-mode = <&timing0>;
+		bits-per-pixel = <4>;
+		ac-prescale = <17>;
+
+		display-timings {
+			timing0: 320x240 {
+				hactive = <320>;
+				hback-porch = <0>;
+				hfront-porch = <0>;
+				hsync-len = <0>;
+				vactive = <240>;
+				vback-porch = <0>;
+				vfront-porch = <0>;
+				vsync-len = <0>;
+				clock-frequency = <6500000>;
+			};
+		};
+	};
-- 
1.8.3.2


^ permalink raw reply related

* Re: [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
From: Jingoo Han @ 2014-03-21  0:51 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140319142231.GF20872@samfundet.no>

On Wednesday, March 19, 2014 11:23 PM, Hans-Christian Egtvedt wrote:
> Around Wed 19 Mar 2014 14:03:27 +0100 or thereabout, Alexandre Belloni wrote:
> > The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
> > and is replaced by the generic pwm_bl with the pawm-atmel driver using the
> > generic PWM framework.
> >
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> 
> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> 
> > ---
> >  drivers/video/backlight/Kconfig        |  11 --
> >  drivers/video/backlight/Makefile       |   1 -
> >  drivers/video/backlight/atmel-pwm-bl.c | 223 ---------------------------------
> >  include/linux/atmel-pwm-bl.h           |  43 -------
> >  4 files changed, 278 deletions(-)
> >  delete mode 100644 drivers/video/backlight/atmel-pwm-bl.c
> >  delete mode 100644 include/linux/atmel-pwm-bl.h


^ permalink raw reply

* Re: [PATCH 3/3] video: clps711x: Add bindings documentation for CLPS711X framebuffer
From: Mark Rutland @ 2014-03-21  9:47 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, Russell King,
	Olof Johansson, Arnd Bergmann,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Rob Herring,
	Pawel Moll, Ian Campbell, Kumar Gala,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
In-Reply-To: <1395332818-23193-1-git-send-email-shc_work-JGs/UdohzUI@public.gmane.org>

On Thu, Mar 20, 2014 at 04:26:58PM +0000, Alexander Shiyan wrote:
> Add OF document for Cirrus Logic CLPS711X framebuffer driver.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  .../bindings/video/cirrus,clps711x-fb.txt          | 48 ++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
> 
> diff --git a/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt b/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
> new file mode 100644
> index 0000000..9d59ad3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/cirrus,clps711x-fb.txt
> @@ -0,0 +1,48 @@
> +* Currus Logic CLPS711X Framebuffer
> +
> +Required properties:
> +- compatible: Shall contain "cirrus,clps711x-fb".
> +- reg: Physical base address and length of the controller's registers +
> +   location and size of the framebuffer memory.
> +- clocks: phandle + clock specifier pair of the FB reference clock.
> +
> +Required nodes:
> +- display: Phandle to a display node as described in display-timing.txt.

Is this a node or a property?

It looks like you need a node and a phandle to it, please describe these
separately.

Cheers,
Mark.

> +  Additionally, the display node has to define properties:
> +  - bits-per-pixel: Bits per pixel.
> +  - ac-prescale: LCD AC bias frequency. This frequency is the required
> +     AC bias frequency for a given manufacturer's LCD plate.
> +  - cmap-invert: Invert the color levels (Optional).
> +
> +Optional properties:
> +- lcd-supply: Regulator for LCD supply voltage.
> +
> +Example:
> +	fb: fb@800002c0 {
> +		compatible = "cirrus,ep7312-fb", "cirrus,clps711x-fb";
> +		reg = <0x800002c0 0xd44>, <0x60000000 0xc000>;
> +		clocks = <&clks 2>;
> +		lcd-supply = <&reg5v0>;
> +		display = <&display>;
> +	};
> +
> +	display: display {
> +		model = "320x240x4";
> +		native-mode = <&timing0>;
> +		bits-per-pixel = <4>;
> +		ac-prescale = <17>;
> +
> +		display-timings {
> +			timing0: 320x240 {
> +				hactive = <320>;
> +				hback-porch = <0>;
> +				hfront-porch = <0>;
> +				hsync-len = <0>;
> +				vactive = <240>;
> +				vback-porch = <0>;
> +				vfront-porch = <0>;
> +				vsync-len = <0>;
> +				clock-frequency = <6500000>;
> +			};
> +		};
> +	};
> -- 
> 1.8.3.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [PATCH] drivers/video: fix mb862xx_i2c depends issue build failure
From: Tomi Valkeinen @ 2014-03-21 13:32 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel,
	Jim Davis, Fengguang Wu
In-Reply-To: <1395328560-48497-1-git-send-email-paul.gortmaker@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 1592 bytes --]

Hi,

On 20/03/14 17:16, Paul Gortmaker wrote:
> Any randconfig that sets I2C=m and FB_MB862XX_I2C=y will
> encounter a final link failure that looks like this:

It compiles fine with I2C=m, FB_MB862XX=m and FB_MB862XX_I2C=y.

> drivers/built-in.o: In function `mb862xx_i2c_init':
> drivers/video/mb862xx/mb862xx-i2c.c:165: undefined reference to `i2c_add_adapter'
> drivers/built-in.o: In function `mb862xx_i2c_exit':
> drivers/video/mb862xx/mb862xx-i2c.c:176: undefined reference to `i2c_del_adapter'
> 
> Since FB_MB862XX_I2C is a bool and not tristate, simply
> don't offer it at all if core I2C support is not built in.

FB_MB862XX_I2C is not a driver, it just adds the i2c support to
FB_MB862XX. The relevant thing is whether FB_MB862XX is m or y, so
compiling with:

I2C=m, FB_MB862XX=y and FB_MB862XX_I2C=y

will fail.

> Reported-by: Jim Davis <jim.epost@gmail.com>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> 
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index dade5b7699bc..aefd1b9a3cbd 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -2338,7 +2338,7 @@ endchoice
>  
>  config FB_MB862XX_I2C
>  	bool "Support I2C bus on MB862XX GDC"
> -	depends on FB_MB862XX && I2C
> +	depends on FB_MB862XX && I2C=y
>  	default y
>  	help
>  	  Selecting this option adds Coral-P(A)/Lime GDC I2C bus adapter

This fix is not correct, as it prevents the following, valid, config:

I2C=m, FB_MB862XX=m and FB_MB862XX_I2C=y

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply

* Re: [PATCH] fbdev: Make the switch from generic to native driver less alarming
From: Tomi Valkeinen @ 2014-03-21 13:42 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1345223444-15852-1-git-send-email-ajax@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On 12/02/14 23:02, Adam Jackson wrote:
> Calling this "conflicting" just makes people think there's a problem
> when there's not.
> 
> Signed-off-by: Adam Jackson <ajax@redhat.com>
> ---
>  drivers/video/fbmem.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index 7309ac7..b6d5008 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -1596,8 +1596,7 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
>  			(primary && gen_aper && gen_aper->count &&
>  			 gen_aper->ranges[0].base == VGA_FB_PHYS)) {
>  
> -			printk(KERN_INFO "fb: conflicting fb hw usage "
> -			       "%s vs %s - removing generic driver\n",
> +			printk(KERN_INFO "fb: switching to %s from %s\n",
>  			       name, registered_fb[i]->fix.id);
>  			ret = do_unregister_framebuffer(registered_fb[i]);
>  			if (ret)
> 

Thanks, queued for 3.15.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply

* Re: [PATCH] drivers/video: fix mb862xx_i2c depends issue build failure
From: Paul Gortmaker @ 2014-03-21 13:53 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel,
	Jim Davis, Fengguang Wu
In-Reply-To: <532C3F64.2020601@ti.com>

On 14-03-21 09:32 AM, Tomi Valkeinen wrote:
> Hi,
> 
> On 20/03/14 17:16, Paul Gortmaker wrote:
>> Any randconfig that sets I2C=m and FB_MB862XX_I2C=y will
>> encounter a final link failure that looks like this:
> 
> It compiles fine with I2C=m, FB_MB862XX=m and FB_MB862XX_I2C=y.
> 
>> drivers/built-in.o: In function `mb862xx_i2c_init':
>> drivers/video/mb862xx/mb862xx-i2c.c:165: undefined reference to `i2c_add_adapter'
>> drivers/built-in.o: In function `mb862xx_i2c_exit':
>> drivers/video/mb862xx/mb862xx-i2c.c:176: undefined reference to `i2c_del_adapter'
>>
>> Since FB_MB862XX_I2C is a bool and not tristate, simply
>> don't offer it at all if core I2C support is not built in.
> 
> FB_MB862XX_I2C is not a driver, it just adds the i2c support to
> FB_MB862XX. The relevant thing is whether FB_MB862XX is m or y, so
> compiling with:
> 
> I2C=m, FB_MB862XX=y and FB_MB862XX_I2C=y
> 
> will fail.

How would you suggest we fix it then?  Perhaps we could simplify the
Kconfig space and just get rid of FB_MB862XX_I2C entirely?  Is there
ever a reason why someone would want it turned off when I2C is present?

Paul.
--

> 
>> Reported-by: Jim Davis <jim.epost@gmail.com>
>> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>>
>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
>> index dade5b7699bc..aefd1b9a3cbd 100644
>> --- a/drivers/video/Kconfig
>> +++ b/drivers/video/Kconfig
>> @@ -2338,7 +2338,7 @@ endchoice
>>  
>>  config FB_MB862XX_I2C
>>  	bool "Support I2C bus on MB862XX GDC"
>> -	depends on FB_MB862XX && I2C
>> +	depends on FB_MB862XX && I2C=y
>>  	default y
>>  	help
>>  	  Selecting this option adds Coral-P(A)/Lime GDC I2C bus adapter
> 
> This fix is not correct, as it prevents the following, valid, config:
> 
> I2C=m, FB_MB862XX=m and FB_MB862XX_I2C=y
> 
>  Tomi
> 
> 

^ permalink raw reply

* Re: [PATCH] drivers/video: fix mb862xx_i2c depends issue build failure
From: Tomi Valkeinen @ 2014-03-21 14:07 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel,
	Jim Davis, Fengguang Wu
In-Reply-To: <532C4476.2030706@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 2241 bytes --]

On 21/03/14 15:53, Paul Gortmaker wrote:
> On 14-03-21 09:32 AM, Tomi Valkeinen wrote:
>> Hi,
>>
>> On 20/03/14 17:16, Paul Gortmaker wrote:
>>> Any randconfig that sets I2C=m and FB_MB862XX_I2C=y will
>>> encounter a final link failure that looks like this:
>>
>> It compiles fine with I2C=m, FB_MB862XX=m and FB_MB862XX_I2C=y.
>>
>>> drivers/built-in.o: In function `mb862xx_i2c_init':
>>> drivers/video/mb862xx/mb862xx-i2c.c:165: undefined reference to `i2c_add_adapter'
>>> drivers/built-in.o: In function `mb862xx_i2c_exit':
>>> drivers/video/mb862xx/mb862xx-i2c.c:176: undefined reference to `i2c_del_adapter'
>>>
>>> Since FB_MB862XX_I2C is a bool and not tristate, simply
>>> don't offer it at all if core I2C support is not built in.
>>
>> FB_MB862XX_I2C is not a driver, it just adds the i2c support to
>> FB_MB862XX. The relevant thing is whether FB_MB862XX is m or y, so
>> compiling with:
>>
>> I2C=m, FB_MB862XX=y and FB_MB862XX_I2C=y
>>
>> will fail.
> 
> How would you suggest we fix it then?  Perhaps we could simplify the
> Kconfig space and just get rid of FB_MB862XX_I2C entirely?  Is there
> ever a reason why someone would want it turned off when I2C is present?

I'm not familiar with the driver and devices that use it, so I can't
really say. But you could probably have a board with the FB_MB862XX,
without i2c displays, while still you'd have I2C for other uses. So
there you could minimally reduce the kernel size by leaving out the
FB_MB862XX_I2C.

I'm fine with that solution, though. But how would it work in practice?
Did you mean that FB_MB862XX would depend on I2C? That's not a good
option, but how would you otherwise make the i2c dependency correct?

Actually, I'm fine with the original patch also, as I believe the case
where I2C=m is somewhat theoretical (correct me if I'm wrong). But the
patch description was totally wrong, and if that solution is preferred,
it should also clearly state that the patch prevents the I2C support
when I2C is built as a module. But I think your proposal in this mail is
better.

Maybe there are even better ways to handle it in the Kconfig, as such
"add feature X to the driver" sounds quite common to me.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply

* How to make framebuffer look like a real monitor?
From: Ivan Drobyshevskyi @ 2014-03-21 14:30 UTC (permalink / raw)
  To: linux-fbdev

Is there a way to make X treat Linux framebuffer device (e.g. /dev/fb0
backed by virtual framebuffer) as a real display? Ideally it should
appear in system display settings as a configurable monitor. Does it
require writing some kernel code or it's possible to somehow get away
with for example X configuration?

Thanks,
Ivan.

^ permalink raw reply

* Re: [PATCH 0/9] Doc/DT: DT bindings for various display components
From: Grant Likely @ 2014-03-21 15:37 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Philipp Zabel,
	Laurent Pinchart, Russell King - ARM Linux, Sascha Hauer,
	Sebastian Hesselbarth, Rob Clark, Inki Dae, Andrzej Hajda,
	Tomasz Figa, Thierry Reding
In-Reply-To: <5326FECF.9070104-l0cyMroinI0@public.gmane.org>

On Mon, 17 Mar 2014 15:55:27 +0200, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> Hi Grant,
> 
> Ping.
> 
> Are you fine with me proceeding with the current V4L2 port/endpoint
> bindings?

Sorry, this thread didn't make it past my email filters. Yes, go ahead.

g.


^ permalink raw reply

* Re: How to make framebuffer look like a real monitor?
From: Tormod Volden @ 2014-03-21 20:27 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CADAXeK1HznKm6AuWa1431i0u+GSKkXq0u3FWMFvbHU95FJQbzg@mail.gmail.com>

On Fri, Mar 21, 2014 at 3:30 PM, Ivan Drobyshevskyi wrote:
> Is there a way to make X treat Linux framebuffer device (e.g. /dev/fb0
> backed by virtual framebuffer) as a real display? Ideally it should
> appear in system display settings as a configurable monitor. Does it
> require writing some kernel code or it's possible to somehow get away
> with for example X configuration?

If I understand your question correctly, you are asking for the xorg
fbdev driver:
http://www.x.org/releases/current/doc/man/man4/fbdev.4.xhtml

HTH,
Tormod

^ permalink raw reply

* Re: [PATCH] drivers/video: fix mb862xx_i2c depends issue build failure
From: Randy Dunlap @ 2014-03-21 23:11 UTC (permalink / raw)
  To: Paul Gortmaker, Tomi Valkeinen
  Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel,
	Jim Davis, Fengguang Wu
In-Reply-To: <532C4476.2030706@windriver.com>

On 03/21/2014 06:53 AM, Paul Gortmaker wrote:
> On 14-03-21 09:32 AM, Tomi Valkeinen wrote:
>> Hi,
>>
>> On 20/03/14 17:16, Paul Gortmaker wrote:
>>> Any randconfig that sets I2C=m and FB_MB862XX_I2C=y will
>>> encounter a final link failure that looks like this:
>>
>> It compiles fine with I2C=m, FB_MB862XX=m and FB_MB862XX_I2C=y.
>>
>>> drivers/built-in.o: In function `mb862xx_i2c_init':
>>> drivers/video/mb862xx/mb862xx-i2c.c:165: undefined reference to `i2c_add_adapter'
>>> drivers/built-in.o: In function `mb862xx_i2c_exit':
>>> drivers/video/mb862xx/mb862xx-i2c.c:176: undefined reference to `i2c_del_adapter'
>>>
>>> Since FB_MB862XX_I2C is a bool and not tristate, simply
>>> don't offer it at all if core I2C support is not built in.
>>
>> FB_MB862XX_I2C is not a driver, it just adds the i2c support to
>> FB_MB862XX. The relevant thing is whether FB_MB862XX is m or y, so
>> compiling with:
>>
>> I2C=m, FB_MB862XX=y and FB_MB862XX_I2C=y
>>
>> will fail.
> 
> How would you suggest we fix it then?  Perhaps we could simplify the
> Kconfig space and just get rid of FB_MB862XX_I2C entirely?  Is there
> ever a reason why someone would want it turned off when I2C is present?
> 
> Paul.
> --
> 
>>
>>> Reported-by: Jim Davis <jim.epost@gmail.com>
>>> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
>>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>>>
>>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
>>> index dade5b7699bc..aefd1b9a3cbd 100644
>>> --- a/drivers/video/Kconfig
>>> +++ b/drivers/video/Kconfig
>>> @@ -2338,7 +2338,7 @@ endchoice
>>>  
>>>  config FB_MB862XX_I2C
>>>  	bool "Support I2C bus on MB862XX GDC"
>>> -	depends on FB_MB862XX && I2C
>>> +	depends on FB_MB862XX && I2C=y
>>>  	default y
>>>  	help
>>>  	  Selecting this option adds Coral-P(A)/Lime GDC I2C bus adapter
>>
>> This fix is not correct, as it prevents the following, valid, config:
>>
>> I2C=m, FB_MB862XX=m and FB_MB862XX_I2C=y

If I am following this correctly, this kconfig situation is often handled
by something like

	depends on I2C=y || I2Cû_MB862XX



-- 
~Randy

^ permalink raw reply

* Re: How to make framebuffer look like a real monitor?
From: Ivan Drobyshevskyi @ 2014-03-22  8:50 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CADAXeK1HznKm6AuWa1431i0u+GSKkXq0u3FWMFvbHU95FJQbzg@mail.gmail.com>

Thank you, that could work. As I understand, using fbdev doesn't
support hotplug and the only way to setup it is via xorg.conf editing?

(in short, I need to create a virtual GPU that is treated as a real
one by desktop environment but instead of actual rendering only
writing to framebuffer in RAM is required).

On Fri, Mar 21, 2014 at 10:27 PM, Tormod Volden <lists.tormod@gmail.com> wrote:
> On Fri, Mar 21, 2014 at 3:30 PM, Ivan Drobyshevskyi wrote:
>> Is there a way to make X treat Linux framebuffer device (e.g. /dev/fb0
>> backed by virtual framebuffer) as a real display? Ideally it should
>> appear in system display settings as a configurable monitor. Does it
>> require writing some kernel code or it's possible to somehow get away
>> with for example X configuration?
>
> If I understand your question correctly, you are asking for the xorg
> fbdev driver:
> http://www.x.org/releases/current/doc/man/man4/fbdev.4.xhtml
>
> HTH,
> Tormod

^ permalink raw reply

* Re: How to make framebuffer look like a real monitor?
From: Tormod Volden @ 2014-03-22 10:39 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CADAXeK1HznKm6AuWa1431i0u+GSKkXq0u3FWMFvbHU95FJQbzg@mail.gmail.com>

>> On Fri, Mar 21, 2014 at 3:30 PM, Ivan Drobyshevskyi wrote:
>>> Is there a way to make X treat Linux framebuffer device (e.g. /dev/fb0
>>> backed by virtual framebuffer) as a real display? Ideally it should
>>> appear in system display settings as a configurable monitor. Does it
>>> require writing some kernel code or it's possible to somehow get away
>>> with for example X configuration?
>>
>> If I understand your question correctly, you are asking for the xorg
>> fbdev driver:
>> http://www.x.org/releases/current/doc/man/man4/fbdev.4.xhtml
>
> Thank you, that could work. As I understand, using fbdev doesn't
> support hotplug and the only way to setup it is via xorg.conf editing?
>
> (in short, I need to create a virtual GPU that is treated as a real
> one by desktop environment but instead of actual rendering only
> writing to framebuffer in RAM is required).

Does it have to be a linux-fbdev driver? There are virtual xorg
drivers (xf86-video-dummy?) or servers (Xfvb) that you can use like
this, all in user-space. Or you create a DRM driver (à la the
experimental SimpleDRM driver from dri-devel@lists.freedesktop.org)
and use the xorg xf86-modesetting driver on top of it. However I don't
know if these examples support the kind of hotplug you want in their
current status.

Tormod

^ permalink raw reply

* Re: [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
From: Alexandre Belloni @ 2014-03-24 15:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <000101cf449f$aa609960$ff21cc20$%han@samsung.com>

Hi,

On 21/03/2014 at 09:51:16 +0900, Jingoo Han wrote :
> On Wednesday, March 19, 2014 11:23 PM, Hans-Christian Egtvedt wrote:
> > Around Wed 19 Mar 2014 14:03:27 +0100 or thereabout, Alexandre Belloni wrote:
> > > The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
> > > and is replaced by the generic pwm_bl with the pawm-atmel driver using the
> > > generic PWM framework.
> > >
> > > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > 
> > Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> 
> Acked-by: Jingoo Han <jg1.han@samsung.com>
> 

You didn't comment on patch 08/16, are you fine with it ? I guess this
is the only one holding back the full series.

Regards,

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply

* Re: [PATCH 14/16] backlight: atmel-pwm-bl: remove obsolete driver
From: Jingoo Han @ 2014-03-25  0:15 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140324155412.GA9083@piout.net>

On Tuesday, March 25, 2014 12:54 AM, Alexandre Belloni wrote:
> On 21/03/2014 at 09:51:16 +0900, Jingoo Han wrote :
> > On Wednesday, March 19, 2014 11:23 PM, Hans-Christian Egtvedt wrote:
> > > Around Wed 19 Mar 2014 14:03:27 +0100 or thereabout, Alexandre Belloni wrote:
> > > > The atmel-pwm-bl driver is now obsolete. It is not used by any mainlined boards
> > > > and is replaced by the generic pwm_bl with the pawm-atmel driver using the
> > > > generic PWM framework.
> > > >
> > > > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > >
> > > Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> >
> > Acked-by: Jingoo Han <jg1.han@samsung.com>
> >
> 
> You didn't comment on patch 08/16, are you fine with it ? I guess this
> is the only one holding back the full series.

'drivers/video/backlight/pwm_bl.c' is Thierry Reding's domain,
as follows.

  PWM SUBSYSTEM
  M:      Thierry Reding <thierry.reding@gmail.com>
  L:      linux-pwm@vger.kernel.org
  S:      Maintained
  .....
  F:      drivers/video/backlight/pwm_bl.c

So, it is required to get Ack from Thierry Reding.

Best regards,
Jingoo Han

> 
> Regards,
> 
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com


^ permalink raw reply

* [PATCH] video/fsl: Fix the sleep function for FSL DIU module
From: Dongsheng Wang @ 2014-03-25  7:56 UTC (permalink / raw)
  To: scottwood, timur; +Cc: linux-fbdev, linuxppc-dev, Wang Dongsheng, Jason Jin

From: Jason Jin <Jason.Jin@freescale.com>

For deep sleep, the diu module will power off, when wake up
from the deep sleep, the registers need to be reinitialized.

Signed-off-by: Jason Jin <Jason.Jin@freescale.com>
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>

diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index e8758b9..7ec780c 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -1628,9 +1628,18 @@ static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state)
 static int fsl_diu_resume(struct platform_device *ofdev)
 {
 	struct fsl_diu_data *data;
+	struct mfb_info *mfbi;
+	int i;
 
 	data = dev_get_drvdata(&ofdev->dev);
-	enable_lcdc(data->fsl_diu_info);
+	fsl_diu_enable_interrupts(data);
+	update_lcdc(data->fsl_diu_info);
+
+	for (i = 0; i < NUM_AOIS; i++) {
+		mfbi = &data->mfb[i];
+		if (mfbi->count)
+			fsl_diu_enable_panel(&data->fsl_diu_info[i]);
+	}
 
 	return 0;
 }
-- 
1.8.5



^ permalink raw reply related

* Re: [PATCH] video/fsl: Fix the sleep function for FSL DIU module
From: Timur Tabi @ 2014-03-25 15:54 UTC (permalink / raw)
  To: Dongsheng Wang; +Cc: scottwood, linux-fbdev, linuxppc-dev, jason.jin
In-Reply-To: <1395734180-45012-1-git-send-email-dongsheng.wang@freescale.com>

On 03/25/2014 02:56 AM, Dongsheng Wang wrote:
> From: Jason Jin <Jason.Jin@freescale.com>
>
> For deep sleep, the diu module will power off, when wake up
> from the deep sleep, the registers need to be reinitialized.
>
> Signed-off-by: Jason Jin <Jason.Jin@freescale.com>
> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
> index e8758b9..7ec780c 100644
> --- a/drivers/video/fsl-diu-fb.c
> +++ b/drivers/video/fsl-diu-fb.c
> @@ -1628,9 +1628,18 @@ static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state)
>   static int fsl_diu_resume(struct platform_device *ofdev)
>   {
>   	struct fsl_diu_data *data;
> +	struct mfb_info *mfbi;

You don't need this, if ...

> +	int i;
>
>   	data = dev_get_drvdata(&ofdev->dev);
> -	enable_lcdc(data->fsl_diu_info);
> +	fsl_diu_enable_interrupts(data);
> +	update_lcdc(data->fsl_diu_info);
> +
> +	for (i = 0; i < NUM_AOIS; i++) {
> +		mfbi = &data->mfb[i];
> +		if (mfbi->count)

... you do this:

		if (data->mfb[i].count)

Also, 'i' should be an 'unsigned int'.

> +			fsl_diu_enable_panel(&data->fsl_diu_info[i]);
> +	}
>
>   	return 0;
>   }
>

Other than that, this seems okay.

^ permalink raw reply

* Re: [PATCH] video: da8xx-fb: Fix casting of info->pseudo_palette
From: Jon Ringle @ 2014-03-26 16:56 UTC (permalink / raw)
  To: linux-fbdev, linux-kernel@vger.kernel.org; +Cc: Jon Ringle
In-Reply-To: <1394007599-31429-1-git-send-email-jon@ringle.org>

I've not heard anything regarding this patch. I just want to make sure
it's not lost :)

Jon


On Wed, Mar 5, 2014 at 3:19 AM,  <jon@ringle.org> wrote:
> From: Jon Ringle <jringle@gridpoint.com>
>
> (Resending without corporate disclaimer in email footer)
>
> The casting to (u16 *) on info->pseudo_palette is wrong and causes the
> display to show a blue (garbage) vertical line on every other pixel column
>
> Signed-off-by: Jon Ringle <jringle@gridpoint.com>
> ---
>  drivers/video/da8xx-fb.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
> index d042624..83c43b2 100644
> --- a/drivers/video/da8xx-fb.c
> +++ b/drivers/video/da8xx-fb.c
> @@ -678,15 +678,7 @@ static int fb_setcolreg(unsigned regno, unsigned red, unsigned green,
>                         (green << info->var.green.offset) |
>                         (blue << info->var.blue.offset);
>
> -               switch (info->var.bits_per_pixel) {
> -               case 16:
> -                       ((u16 *) (info->pseudo_palette))[regno] = v;
> -                       break;
> -               case 24:
> -               case 32:
> -                       ((u32 *) (info->pseudo_palette))[regno] = v;
> -                       break;
> -               }
> +               ((u32 *) (info->pseudo_palette))[regno] = v;
>                 if (palette[0] != 0x4000) {
>                         update_hw = 1;
>                         palette[0] = 0x4000;
> --
> 1.8.5.4
>

^ permalink raw reply

* Re: [PATCH] video: da8xx-fb: Add support for Densitron 84-0023-001T
From: Jon Ringle @ 2014-03-26 16:56 UTC (permalink / raw)
  To: plagnioj, tomi.valkeinen
  Cc: linux-fbdev, linux-kernel@vger.kernel.org, Jon Ringle
In-Reply-To: <1394042711-7907-1-git-send-email-jon@ringle.org>

I've not heard anything regarding this patch. I just want to make sure
it's not lost :)

Jon


On Wed, Mar 5, 2014 at 1:05 PM,  <jon@ringle.org> wrote:
> From: Jon Ringle <jringle@gridpoint.com>
>
> Signed-off-by: Jon Ringle <jringle@gridpoint.com>
> ---
>  drivers/video/da8xx-fb.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
> index e7f5937..83c43b2 100644
> --- a/drivers/video/da8xx-fb.c
> +++ b/drivers/video/da8xx-fb.c
> @@ -243,6 +243,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_LCD",
> +               .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)
> --
> 1.8.5.4
>

^ permalink raw reply

* [PATCH 1/2] video/fsl: make the diu driver work without platform hooks
From: Jason Jin @ 2014-03-26 17:41 UTC (permalink / raw)
  To: b07421, timur; +Cc: linux-fbdev, linuxppc-dev, r58472

make the diu driver work without platform hooks.

So far the DIU driver does not have a mechanism to do the
board specific initialization. So on some platforms,
such as P1022, 8610 and 5121, The board specific initialization
is implmented in the platform file such p10222_ds.

This board sepecific initialization mechanism is not feasible i
for corenet platform as the corenet platform file is a
abstraction of serveral platforms.

However, the DIU is already initialized in u-boot and we can
rely on the settings in u-boot for corenet platform, the only
issue is that when DIU wake up from the deepsleep, some of the
board specific initialization will lost, such as the pixel clock
setting.

This patch try to make the diu work on the platform without board
specific initialization such as corenet(T1040 so far), and rely on
the board initialization in u-boot. The following patch will try to
fix the pixel clock saving issue for deepsleep.

Signed-off-by: Jason Jin <Jason.Jin@freescale.com>
---
 drivers/video/fsl-diu-fb.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index e8758b9..4640846 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -479,7 +479,10 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)
 			port = FSL_DIU_PORT_DLVDS;
 	}
 
-	return diu_ops.valid_monitor_port(port);
+	if (diu_ops.valid_monitor_port)
+		return diu_ops.valid_monitor_port(port);
+	else
+		return port;
 }
 
 /*
@@ -846,7 +849,11 @@ static void update_lcdc(struct fb_info *info)
 
 	out_be32(&hw->vsyn_para, temp);
 
-	diu_ops.set_pixel_clock(var->pixclock);
+	/*if there is platform function for pixel clock setting, use it.
+	 * otherwise we rely on the settings in u-boot.
+	 */
+	if (diu_ops.set_pixel_clock)
+		diu_ops.set_pixel_clock(var->pixclock);
 
 #ifndef CONFIG_PPC_MPC512x
 	/*
-- 
1.8.0



^ permalink raw reply related

* [PATCH 2/2] video/fsl: Fix the sleep function for FSL DIU module
From: Jason Jin @ 2014-03-26 17:41 UTC (permalink / raw)
  To: b07421, timur; +Cc: linux-fbdev, linuxppc-dev, r58472, Wang Dongsheng
In-Reply-To: <1395855704-19908-1-git-send-email-Jason.Jin@freescale.com>

For sleep, The diu module will power off and when
wake up for initialization will need.

Some platform such as the corenet plafrom does not provide
the DIU board sepecific initialization, but rely on the
DIU initializtion in u-boot. then the pixel clock resume will
be an issuel on this platform, This patch save the pixel clock
for diu before enter the deepsleep and then restore it after
resume, the extra pixelclock register information will be needed
in this situation.

Signed-off-by: Jason Jin <Jason.Jin@freescale.com>
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
---
v2: clean up the resume function based on Timur's comments.
Add the pixel clock saving for the platforms without board sepecific
initializaton.

 drivers/video/fsl-diu-fb.c | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 4640846..fbdd166 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -372,6 +372,7 @@ struct fsl_diu_data {
 	unsigned int irq;
 	enum fsl_diu_monitor_port monitor_port;
 	struct diu __iomem *diu_reg;
+	void __iomem *pixelclk_ptr;
 	spinlock_t reg_lock;
 	u8 dummy_aoi[4 * 4 * 4];
 	struct diu_ad dummy_ad __aligned(8);
@@ -383,6 +384,7 @@ struct fsl_diu_data {
 	__le16 blank_cursor[MAX_CURS * MAX_CURS] __aligned(32);
 	uint8_t edid_data[EDID_LENGTH];
 	bool has_edid;
+	u32 saved_pixel_clock;
 } __aligned(32);
 
 /* Determine the DMA address of a member of the fsl_diu_data structure */
@@ -1625,19 +1627,47 @@ static irqreturn_t fsl_diu_isr(int irq, void *dev_id)
 static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state)
 {
 	struct fsl_diu_data *data;
+	struct resource res;
+	int ret;
 
+	ret = 0;
 	data = dev_get_drvdata(&ofdev->dev);
 	disable_lcdc(data->fsl_diu_info);
 
-	return 0;
+	if (!diu_ops.set_pixel_clock) {
+		data->saved_pixel_clock = 0;
+		if (of_address_to_resource(ofdev->dev.of_node, 1, &res))
+			pr_err(KERN_ERR "No pixel clock set func and no pixel node!\n");
+		else {
+			data->pixelclk_ptr +				devm_ioremap(&ofdev->dev, res.start, resource_size(&res));
+			if (!data->pixelclk_ptr) {
+				pr_err(KERN_ERR "fslfb: could not map pixelclk register!\n");
+				ret = -ENOMEM;
+			} else
+				data->saved_pixel_clock = in_be32(data->pixelclk_ptr);
+		}
+	}
+
+	return ret;
 }
 
 static int fsl_diu_resume(struct platform_device *ofdev)
 {
 	struct fsl_diu_data *data;
+	unsigned int i;
 
 	data = dev_get_drvdata(&ofdev->dev);
-	enable_lcdc(data->fsl_diu_info);
+	if (!diu_ops.set_pixel_clock && data->pixelclk_ptr)
+		out_be32(data->pixelclk_ptr, data->saved_pixel_clock);
+
+	fsl_diu_enable_interrupts(data);
+	update_lcdc(data->fsl_diu_info);
+
+	for (i = 0; i < NUM_AOIS; i++) {
+		if (data->mfb[i].count)
+			fsl_diu_enable_panel(&data->fsl_diu_info[i]);
+	}
 
 	return 0;
 }
-- 
1.8.0



^ permalink raw reply related

* Re: [PATCH 1/2] video/fsl: make the diu driver work without platform hooks
From: Timur Tabi @ 2014-03-26 18:46 UTC (permalink / raw)
  To: Jason Jin; +Cc: b07421, linux-fbdev, linuxppc-dev, r58472
In-Reply-To: <1395855704-19908-1-git-send-email-Jason.Jin@freescale.com>

On 03/26/2014 12:41 PM, Jason Jin wrote:
> This board sepecific initialization mechanism is not feasible i
> for corenet platform as the corenet platform file is a
> abstraction of serveral platforms.

You can't make it 100% abstract.  The DIU driver requires some sort of 
board support.  I think you can make a generic platform file for the DIU.

> However, the DIU is already initialized in u-boot and we can
> rely on the settings in u-boot for corenet platform,

I don't like that at all.

> the only
> issue is that when DIU wake up from the deepsleep, some of the
> board specific initialization will lost, such as the pixel clock
> setting.

That is a BIG issue.  This is why we have a platform file -- to handle 
the platform issues.




^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox