* [PATCH 2/8] video: atmel_lcdfb: introduce atmel_lcdfb_power_control
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11 15:00 ` Jean-Christophe PLAGNIOL-VILLARD
[not found] ` <1365692422-9565-2-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2013-04-11 15:00 ` [PATCH 3/8] video: atmel_lcdfb: pass the pdata as params Jean-Christophe PLAGNIOL-VILLARD
` (8 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, devicetree-discuss,
Jean-Christophe PLAGNIOL-VILLARD, linux-fbdev, Andrew Morton
to simplify the check on the presence of the callback
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
drivers/video/atmel_lcdfb.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 98733cd4..9574c47 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -283,6 +283,13 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo)
init_backlight(sinfo);
}
+static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int on)
+{
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+
+ if (pdata->atmel_lcdfb_power_control)
+ pdata->atmel_lcdfb_power_control(on);
+}
static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
.type = FB_TYPE_PACKED_PIXELS,
@@ -1114,8 +1121,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
fb_add_videomode(&fbmode, &info->modelist);
/* Power up the LCDC screen */
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(1);
+ atmel_lcdfb_power_control(sinfo, 1);
dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
@@ -1169,8 +1175,7 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
cancel_work_sync(&sinfo->task);
exit_backlight(sinfo);
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(0);
+ atmel_lcdfb_power_control(sinfo, 0);
unregister_framebuffer(info);
atmel_lcdfb_stop_clock(sinfo);
clk_put(sinfo->lcdc_clk);
@@ -1198,7 +1203,6 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
{
struct fb_info *info = platform_get_drvdata(pdev);
struct atmel_lcdfb_info *sinfo = info->par;
- struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
/*
* We don't want to handle interrupts while the clock is
@@ -1208,9 +1212,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(0);
-
+ atmel_lcdfb_power_control(sinfo, 0);
atmel_lcdfb_stop(sinfo);
atmel_lcdfb_stop_clock(sinfo);
@@ -1221,12 +1223,10 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
{
struct fb_info *info = platform_get_drvdata(pdev);
struct atmel_lcdfb_info *sinfo = info->par;
- struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
atmel_lcdfb_start_clock(sinfo);
atmel_lcdfb_start(sinfo);
- if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(1);
+ atmel_lcdfb_power_control(sinfo, 1);
lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
/* Enable FIFO & DMA errors */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 3/8] video: atmel_lcdfb: pass the pdata as params
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
2013-04-11 15:00 ` [PATCH 2/8] video: atmel_lcdfb: introduce atmel_lcdfb_power_control Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11 15:00 ` Jean-Christophe PLAGNIOL-VILLARD
[not found] ` <1365692422-9565-3-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2013-04-11 15:00 ` [PATCH 4/8] video: atmel_lcdfb: add device tree suport Jean-Christophe PLAGNIOL-VILLARD
` (7 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, devicetree-discuss,
Jean-Christophe PLAGNIOL-VILLARD, linux-fbdev, Andrew Morton
so we can use have list gpio as example (probe via DT)
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
arch/arm/mach-at91/board-sam9261ek.c | 4 ++--
arch/arm/mach-at91/board-sam9263ek.c | 2 +-
arch/arm/mach-at91/board-sam9rlek.c | 2 +-
arch/avr32/boards/atngw100/evklcd10x.c | 2 +-
drivers/video/atmel_lcdfb.c | 2 +-
include/video/atmel_lcdc.h | 4 +++-
6 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index c819e29..9a6618a 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -393,7 +393,7 @@ static struct fb_monspecs at91fb_default_stn_monspecs = {
| ATMEL_LCDC_IFWIDTH_4 \
| ATMEL_LCDC_SCANMOD_SINGLE)
-static void at91_lcdc_stn_power_control(int on)
+static void at91_lcdc_stn_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
/* backlight */
if (on) { /* power up */
@@ -452,7 +452,7 @@ static struct fb_monspecs at91fb_default_tft_monspecs = {
| ATMEL_LCDC_DISTYPE_TFT \
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
-static void at91_lcdc_tft_power_control(int on)
+static void at91_lcdc_tft_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
if (on)
at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 0fdae3f..8b4942c 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -275,7 +275,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
| ATMEL_LCDC_DISTYPE_TFT \
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
-static void at91_lcdc_power_control(int on)
+static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
at91_set_gpio_value(AT91_PIN_PA30, on);
}
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index b77d7a9..604eecf 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -170,7 +170,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
| ATMEL_LCDC_DISTYPE_TFT \
| ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
-static void at91_lcdc_power_control(int on)
+static void at91_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
if (on)
at91_set_gpio_value(AT91_PIN_PC1, 0); /* power up */
diff --git a/arch/avr32/boards/atngw100/evklcd10x.c b/arch/avr32/boards/atngw100/evklcd10x.c
index dc42804..64919b0 100644
--- a/arch/avr32/boards/atngw100/evklcd10x.c
+++ b/arch/avr32/boards/atngw100/evklcd10x.c
@@ -145,7 +145,7 @@ static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
};
#endif
-static void atevklcd10x_lcdc_power_control(int on)
+static void atevklcd10x_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
{
gpio_set_value(GPIO_PIN_PB(15), on);
}
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 9574c47..f67e226 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -288,7 +288,7 @@ static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int
struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
if (pdata->atmel_lcdfb_power_control)
- pdata->atmel_lcdfb_power_control(on);
+ pdata->atmel_lcdfb_power_control(pdata, on);
}
static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 2eb601c..f624c51 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -40,8 +40,10 @@ struct atmel_lcdfb_pdata {
u8 lcd_wiring_mode;
unsigned int default_lcdcon2;
unsigned int default_dmacon;
- void (*atmel_lcdfb_power_control)(int on);
+ void (*atmel_lcdfb_power_control)(struct atmel_lcdfb_pdata *pdata, int on);
struct fb_monspecs *default_monspecs;
+
+ struct list_head pwr_gpios;
};
#define ATMEL_LCDC_DMABADDR1 0x00
--
1.7.10.4
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH 4/8] video: atmel_lcdfb: add device tree suport
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
2013-04-11 15:00 ` [PATCH 2/8] video: atmel_lcdfb: introduce atmel_lcdfb_power_control Jean-Christophe PLAGNIOL-VILLARD
2013-04-11 15:00 ` [PATCH 3/8] video: atmel_lcdfb: pass the pdata as params Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11 15:00 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 13:42 ` Nicolas Ferre
[not found] ` <1365692422-9565-4-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2013-04-11 15:00 ` [PATCH 5/8] ARM: at91: sam9g45: add lcd support Jean-Christophe PLAGNIOL-VILLARD
` (6 subsequent siblings)
9 siblings, 2 replies; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, devicetree-discuss,
Jean-Christophe PLAGNIOL-VILLARD, linux-fbdev, Andrew Morton
get display timings from device tree
Use videomode helpers to get display timings and configurations from
device tree
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
.../devicetree/bindings/video/atmel,lcdc.txt | 75 ++++++
drivers/video/Kconfig | 2 +
drivers/video/atmel_lcdfb.c | 244 +++++++++++++++++---
3 files changed, 289 insertions(+), 32 deletions(-)
create mode 100644 Documentation/devicetree/bindings/video/atmel,lcdc.txt
diff --git a/Documentation/devicetree/bindings/video/atmel,lcdc.txt b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
new file mode 100644
index 0000000..1ec175e
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
@@ -0,0 +1,75 @@
+Atmel LCDC Framebuffer
+-----------------------------------------------------
+
+Required properties:
+- compatible :
+ "atmel,at91sam9261-lcdc" ,
+ "atmel,at91sam9263-lcdc" ,
+ "atmel,at91sam9g10-lcdc" ,
+ "atmel,at91sam9g45-lcdc" ,
+ "atmel,at91sam9g45es-lcdc" ,
+ "atmel,at91sam9rl-lcdc" ,
+ "atmel,at32ap-lcdc"
+- reg : Should contain 1 register ranges(address and length)
+- interrupts : framebuffer controller interrupt
+- display: a phandle pointing to the display node
+
+Required nodes:
+- display: a display node is required to initialize the lcd panel
+ This should be in the board dts.
+- default-mode: a videomode within the display with timing parameters
+ as specified below.
+
+Example:
+
+ fb0: fb@0x00500000 {
+ compatible = "atmel,at91sam9g45-lcdc";
+ reg = <0x00500000 0x1000>;
+ interrupts = <23 3 0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_fb>;
+ display = <&display0>;
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ };
+
+Atmel LCDC Display
+-----------------------------------------------------
+Required properties (as per of_videomode_helper):
+
+ - atmel,dmacon: dma controler configuration
+ - atmel,lcdcon2: lcd controler configuration
+ - atmel,guard-time: lcd guard time (Delay in frame periods)
+ - bits-per-pixel: lcd panel bit-depth.
+
+Optional properties (as per of_videomode_helper):
+ - atmel,lcdcon-backlight: enable backlight
+ - atmel,lcd-wiring-mode: lcd wiring mode "RGB" or "BRG"
+ - atmel,power-control-gpio: gpio to power on or off the LCD (as many as needed)
+
+Example:
+ display0: display {
+ bits-per-pixel = <32>;
+ atmel,lcdcon-backlight;
+ atmel,dmacon = <0x1>;
+ atmel,lcdcon2 = <0x80008002>;
+ atmel,guard-time = <9>;
+ atmel,lcd-wiring-mode = <1>;
+
+ display-timings {
+ native-mode = <&timing0>;
+ timing0: timing0 {
+ clock-frequency = <9000000>;
+ hactive = <480>;
+ vactive = <272>;
+ hback-porch = <1>;
+ hfront-porch = <1>;
+ vback-porch = <40>;
+ vfront-porch = <1>;
+ hsync-len = <45>;
+ vsync-len = <1>;
+ };
+ };
+ };
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4c1546f..0687482 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1018,6 +1018,8 @@ config FB_ATMEL
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
+ select FB_MODE_HELPERS
+ select OF_VIDEOMODE
help
This enables support for the AT91/AT32 LCD Controller.
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index f67e226..4a31570 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -20,7 +20,11 @@
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/platform_data/atmel.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
#include <video/of_display_timing.h>
+#include <video/videomode.h>
#include <mach/cpu.h>
#include <asm/gpio.h>
@@ -59,6 +63,13 @@ struct atmel_lcdfb_info {
struct atmel_lcdfb_config *config;
};
+struct atmel_lcdfb_power_ctrl_gpio {
+ int gpio;
+ int active_low;
+
+ struct list_head list;
+};
+
#define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
#define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
@@ -945,16 +956,187 @@ static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
clk_disable(sinfo->lcdc_clk);
}
+#ifdef CONFIG_OF
+static const struct of_device_id atmel_lcdfb_dt_ids[] = {
+ { .compatible = "atmel,at91sam9261-lcdc" , .data = &at91sam9261_config, },
+ { .compatible = "atmel,at91sam9263-lcdc" , .data = &at91sam9263_config, },
+ { .compatible = "atmel,at91sam9g10-lcdc" , .data = &at91sam9g10_config, },
+ { .compatible = "atmel,at91sam9g45-lcdc" , .data = &at91sam9g45_config, },
+ { .compatible = "atmel,at91sam9g45es-lcdc" , .data = &at91sam9g45es_config, },
+ { .compatible = "atmel,at91sam9rl-lcdc" , .data = &at91sam9rl_config, },
+ { .compatible = "atmel,at32ap-lcdc" , .data = &at32ap_config, },
+ { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_lcdfb_dt_ids);
+
+static const char *atmel_lcdfb_wiring_modes[] = {
+ [ATMEL_LCDC_WIRING_BGR] = "BRG",
+ [ATMEL_LCDC_WIRING_RGB] = "RGB",
+};
+
+const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
+{
+ const char *mode;
+ int err, i;
+
+ err = of_property_read_string(np, "atmel,lcd-wiring-mode", &mode);
+ if (err < 0)
+ return ATMEL_LCDC_WIRING_BGR;
+
+ for (i = 0; i < ARRAY_SIZE(atmel_lcdfb_wiring_modes); i++)
+ if (!strcasecmp(mode, atmel_lcdfb_wiring_modes[i]))
+ return i;
+
+ return -ENODEV;
+}
+
+static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int on)
+{
+ struct atmel_lcdfb_power_ctrl_gpio *og;
+
+ list_for_each_entry(og, &pdata->pwr_gpios, list)
+ gpio_set_value(og->gpio, on);
+}
+
+static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
+{
+ struct fb_info *info = sinfo->info;
+ struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
+ struct fb_var_screeninfo *var = &info->var;
+ struct device *dev = &sinfo->pdev->dev;
+ struct device_node *np =dev->of_node;
+ struct device_node *display_np;
+ struct device_node *timings_np;
+ struct display_timings *timings;
+ enum of_gpio_flags flags;
+ struct atmel_lcdfb_power_ctrl_gpio *og;
+ bool is_gpio_power = false;
+ int ret = -ENOENT;
+ int i, gpio;
+
+ sinfo->config = (struct atmel_lcdfb_config*)
+ of_match_device(atmel_lcdfb_dt_ids, dev)->data;
+
+ display_np = of_parse_phandle(np, "display", 0);
+ if (!display_np) {
+ dev_err(dev, "failed to find display phandle\n");
+ return -ENOENT;
+ }
+
+ ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property bits-per-pixel\n");
+ goto put_display_node;
+ }
+
+ ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property atmel,guard-time\n");
+ goto put_display_node;
+ }
+
+ ret = of_property_read_u32(display_np, "atmel,lcdcon2", &pdata->default_lcdcon2);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property atmel,lcdcon2\n");
+ goto put_display_node;
+ }
+
+ ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon);
+ if (ret < 0) {
+ dev_err(dev, "failed to get property bits-per-pixel\n");
+ goto put_display_node;
+ }
+
+ ret = -ENOMEM;
+ for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) {
+ gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio",
+ i, &flags);
+ if (gpio < 0)
+ continue;
+
+ og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
+ if (!og)
+ goto put_display_node;
+
+ og->gpio = gpio;
+ og->active_low = flags & OF_GPIO_ACTIVE_LOW;
+ is_gpio_power = true;
+ ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
+ if (ret) {
+ dev_err(dev, "request gpio %d failed\n", gpio);
+ goto put_display_node;
+ }
+
+ ret = gpio_direction_output(gpio, og->active_low);
+ if (ret) {
+ dev_err(dev, "set direction output gpio %d failed\n", gpio);
+ goto put_display_node;
+ }
+ }
+
+ if (is_gpio_power)
+ pdata->atmel_lcdfb_power_control = atmel_lcdfb_power_control_gpio;
+
+ ret = atmel_lcdfb_get_of_wiring_modes(display_np);
+ if (ret < 0) {
+ dev_err(dev, "invalid atmel,lcd-wiring-mode\n");
+ goto put_display_node;
+ }
+ pdata->lcd_wiring_mode = ret;
+
+ pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
+
+ timings = of_get_display_timings(display_np);
+ if (!timings) {
+ dev_err(dev, "failed to get display timings\n");
+ goto put_display_node;
+ }
+
+ timings_np = of_find_node_by_name(display_np, "display-timings");
+ if (!timings_np) {
+ dev_err(dev, "failed to find display-timings node\n");
+ goto put_display_node;
+ }
+
+ for (i = 0; i < of_get_child_count(timings_np); i++) {
+ struct videomode vm;
+ struct fb_videomode fb_vm;
+
+ ret = videomode_from_timing(timings, &vm, i);
+ if (ret < 0)
+ goto put_timings_node;
+ ret = fb_videomode_from_videomode(&vm, &fb_vm);
+ if (ret < 0)
+ goto put_timings_node;
+
+ fb_add_videomode(&fb_vm, &info->modelist);
+ }
+
+ return 0;
+
+put_timings_node:
+ of_node_put(timings_np);
+put_display_node:
+ of_node_put(display_np);
+ return ret;
+}
+#else
+static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
+{
+ return 0;
+}
+#endif
static int __init atmel_lcdfb_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct fb_info *info;
struct atmel_lcdfb_info *sinfo;
- struct atmel_lcdfb_pdata *pdata;
- struct fb_videomode fbmode;
+ struct atmel_lcdfb_pdata *pdata = NULL;
struct resource *regs = NULL;
struct resource *map = NULL;
+ struct fb_modelist *modelist;
int ret;
dev_dbg(dev, "%s BEGIN\n", __func__);
@@ -967,17 +1149,35 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
}
sinfo = info->par;
+ sinfo->pdev = pdev;
+ sinfo->info = info;
+
+ INIT_LIST_HEAD(&info->modelist);
- if (dev->platform_data) {
- pdata = (struct atmel_lcdfb_pdata *)dev->platform_data;
+ if (pdev->dev.of_node) {
+ ret = atmel_lcdfb_of_init(sinfo);
+ if (ret)
+ goto free_info;
+ } else if (dev->platform_data) {
+ struct fb_monspecs *monspecs;
+ int i;
+
+ pdata = dev->platform_data;
+ monspecs = pdata->default_monspecs;
sinfo->pdata = *pdata;
+
+ for (i = 0; i < monspecs->modedb_len; i++)
+ fb_add_videomode(&monspecs->modedb[i], &info->modelist);
+
+ sinfo->config = atmel_lcdfb_get_config(pdev);
+
+ info->var.bits_per_pixel = pdata->default_bpp ? pdata->default_bpp : 16;
+ memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
} else {
dev_err(dev, "cannot get default configuration\n");
goto free_info;
}
- sinfo->info = info;
- sinfo->pdev = pdev;
- sinfo->config = atmel_lcdfb_get_config(pdev);
+
if (!sinfo->config)
goto free_info;
@@ -986,7 +1186,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
info->pseudo_palette = sinfo->pseudo_palette;
info->fbops = &atmel_lcdfb_ops;
- memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
info->fix = atmel_lcdfb_fix;
/* Enable LCDC Clocks */
@@ -1002,14 +1201,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
}
atmel_lcdfb_start_clock(sinfo);
- ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
- info->monspecs.modedb_len, info->monspecs.modedb,
- pdata->default_bpp);
- if (!ret) {
- dev_err(dev, "no suitable video mode found\n");
- goto stop_clk;
- }
+ modelist = list_first_entry(&info->modelist,
+ struct fb_modelist, list);
+ fb_videomode_to_var(&info->var, &modelist->mode);
+ atmel_lcdfb_check_var(&info->var, info);
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs) {
@@ -1093,18 +1289,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
goto unregister_irqs;
}
- /*
- * This makes sure that our colour bitfield
- * descriptors are correctly initialised.
- */
- atmel_lcdfb_check_var(&info->var, info);
-
- ret = fb_set_var(info, &info->var);
- if (ret) {
- dev_warn(dev, "unable to set display parameters\n");
- goto free_cmap;
- }
-
dev_set_drvdata(dev, info);
/*
@@ -1116,10 +1300,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
goto reset_drvdata;
}
- /* add selected videomode to modelist */
- fb_var_to_videomode(&fbmode, &info->var);
- fb_add_videomode(&fbmode, &info->modelist);
-
/* Power up the LCDC screen */
atmel_lcdfb_power_control(sinfo, 1);
@@ -1130,7 +1310,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
reset_drvdata:
dev_set_drvdata(dev, NULL);
-free_cmap:
fb_dealloc_cmap(&info->cmap);
unregister_irqs:
cancel_work_sync(&sinfo->task);
@@ -1249,6 +1428,7 @@ static struct platform_driver atmel_lcdfb_driver = {
.driver = {
.name = "atmel_lcdfb",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(atmel_lcdfb_dt_ids),
},
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 4/8] video: atmel_lcdfb: add device tree suport
2013-04-11 15:00 ` [PATCH 4/8] video: atmel_lcdfb: add device tree suport Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-16 13:42 ` Nicolas Ferre
2013-04-16 13:44 ` Jean-Christophe PLAGNIOL-VILLARD
[not found] ` <1365692422-9565-4-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
1 sibling, 1 reply; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 13:42 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Andrew Morton, devicetree-discuss, linux-fbdev, linux-arm-kernel
On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> get display timings from device tree
> Use videomode helpers to get display timings and configurations from
> device tree
2 sentences? Simply elaborate the 2nd one and it will be good.
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
> .../devicetree/bindings/video/atmel,lcdc.txt | 75 ++++++
> drivers/video/Kconfig | 2 +
> drivers/video/atmel_lcdfb.c | 244 +++++++++++++++++---
> 3 files changed, 289 insertions(+), 32 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/video/atmel,lcdc.txt
>
> diff --git a/Documentation/devicetree/bindings/video/atmel,lcdc.txt b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
> new file mode 100644
> index 0000000..1ec175e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
Why lcdc? I would have preferred atmel,lcdfb, like the driver's name: it
is even more self-explanatory...
> @@ -0,0 +1,75 @@
> +Atmel LCDC Framebuffer
> +-----------------------------------------------------
> +
> +Required properties:
> +- compatible :
> + "atmel,at91sam9261-lcdc" ,
> + "atmel,at91sam9263-lcdc" ,
> + "atmel,at91sam9g10-lcdc" ,
> + "atmel,at91sam9g45-lcdc" ,
> + "atmel,at91sam9g45es-lcdc" ,
> + "atmel,at91sam9rl-lcdc" ,
> + "atmel,at32ap-lcdc"
> +- reg : Should contain 1 register ranges(address and length)
> +- interrupts : framebuffer controller interrupt
> +- display: a phandle pointing to the display node
> +
> +Required nodes:
> +- display: a display node is required to initialize the lcd panel
> + This should be in the board dts.
> +- default-mode: a videomode within the display with timing parameters
> + as specified below.
> +
> +Example:
> +
> + fb0: fb@0x00500000 {
> + compatible = "atmel,at91sam9g45-lcdc";
> + reg = <0x00500000 0x1000>;
> + interrupts = <23 3 0>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_fb>;
> + display = <&display0>;
> + status = "okay";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + };
> +
> +Atmel LCDC Display
> +-----------------------------------------------------
> +Required properties (as per of_videomode_helper):
Can you please point somewhere to the documentation:
Documentation/devicetree/bindings/video/display-timing.txt
> + - atmel,dmacon: dma controler configuration
Typo: controller.
> + - atmel,lcdcon2: lcd controler configuration
Ditto
> + - atmel,guard-time: lcd guard time (Delay in frame periods)
periods -> period, no?
> + - bits-per-pixel: lcd panel bit-depth.
> +
> +Optional properties (as per of_videomode_helper):
> + - atmel,lcdcon-backlight: enable backlight
> + - atmel,lcd-wiring-mode: lcd wiring mode "RGB" or "BRG"
Is it a sting, or a number (as seen below)? If it is a number, please
tell how to choose the index.
> + - atmel,power-control-gpio: gpio to power on or off the LCD (as many as needed)
> +
> +Example:
> + display0: display {
> + bits-per-pixel = <32>;
> + atmel,lcdcon-backlight;
> + atmel,dmacon = <0x1>;
> + atmel,lcdcon2 = <0x80008002>;
> + atmel,guard-time = <9>;
> + atmel,lcd-wiring-mode = <1>;
> +
> + display-timings {
> + native-mode = <&timing0>;
> + timing0: timing0 {
> + clock-frequency = <9000000>;
> + hactive = <480>;
> + vactive = <272>;
> + hback-porch = <1>;
> + hfront-porch = <1>;
> + vback-porch = <40>;
> + vfront-porch = <1>;
> + hsync-len = <45>;
> + vsync-len = <1>;
> + };
> + };
> + };
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 4c1546f..0687482 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -1018,6 +1018,8 @@ config FB_ATMEL
> select FB_CFB_FILLRECT
> select FB_CFB_COPYAREA
> select FB_CFB_IMAGEBLIT
> + select FB_MODE_HELPERS
> + select OF_VIDEOMODE
> help
> This enables support for the AT91/AT32 LCD Controller.
>
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index f67e226..4a31570 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -20,7 +20,11 @@
> #include <linux/gfp.h>
> #include <linux/module.h>
> #include <linux/platform_data/atmel.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_gpio.h>
> #include <video/of_display_timing.h>
As said in patch 1/8, this one belongs to this 4/8 patch.
> +#include <video/videomode.h>
>
> #include <mach/cpu.h>
> #include <asm/gpio.h>
> @@ -59,6 +63,13 @@ struct atmel_lcdfb_info {
> struct atmel_lcdfb_config *config;
> };
>
> +struct atmel_lcdfb_power_ctrl_gpio {
> + int gpio;
> + int active_low;
> +
> + struct list_head list;
> +};
> +
> #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
> #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
>
> @@ -945,16 +956,187 @@ static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
> clk_disable(sinfo->lcdc_clk);
> }
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id atmel_lcdfb_dt_ids[] = {
> + { .compatible = "atmel,at91sam9261-lcdc" , .data = &at91sam9261_config, },
> + { .compatible = "atmel,at91sam9263-lcdc" , .data = &at91sam9263_config, },
> + { .compatible = "atmel,at91sam9g10-lcdc" , .data = &at91sam9g10_config, },
> + { .compatible = "atmel,at91sam9g45-lcdc" , .data = &at91sam9g45_config, },
> + { .compatible = "atmel,at91sam9g45es-lcdc" , .data = &at91sam9g45es_config, },
> + { .compatible = "atmel,at91sam9rl-lcdc" , .data = &at91sam9rl_config, },
> + { .compatible = "atmel,at32ap-lcdc" , .data = &at32ap_config, },
> + { /* sentinel */ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, atmel_lcdfb_dt_ids);
> +
> +static const char *atmel_lcdfb_wiring_modes[] = {
> + [ATMEL_LCDC_WIRING_BGR] = "BRG",
> + [ATMEL_LCDC_WIRING_RGB] = "RGB",
> +};
> +
> +const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
> +{
> + const char *mode;
> + int err, i;
> +
> + err = of_property_read_string(np, "atmel,lcd-wiring-mode", &mode);
> + if (err < 0)
> + return ATMEL_LCDC_WIRING_BGR;
> +
> + for (i = 0; i < ARRAY_SIZE(atmel_lcdfb_wiring_modes); i++)
> + if (!strcasecmp(mode, atmel_lcdfb_wiring_modes[i]))
> + return i;
> +
> + return -ENODEV;
> +}
> +
> +static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int on)
> +{
> + struct atmel_lcdfb_power_ctrl_gpio *og;
> +
> + list_for_each_entry(og, &pdata->pwr_gpios, list)
> + gpio_set_value(og->gpio, on);
> +}
> +
> +static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> +{
> + struct fb_info *info = sinfo->info;
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> + struct fb_var_screeninfo *var = &info->var;
> + struct device *dev = &sinfo->pdev->dev;
> + struct device_node *np =dev->of_node;
> + struct device_node *display_np;
> + struct device_node *timings_np;
> + struct display_timings *timings;
> + enum of_gpio_flags flags;
> + struct atmel_lcdfb_power_ctrl_gpio *og;
> + bool is_gpio_power = false;
> + int ret = -ENOENT;
> + int i, gpio;
> +
> + sinfo->config = (struct atmel_lcdfb_config*)
> + of_match_device(atmel_lcdfb_dt_ids, dev)->data;
Please split it in 2 steps, otherwise the day that the drivers doesn't
find the device in dt_ids table, it hangs here with an Oops.
> +
> + display_np = of_parse_phandle(np, "display", 0);
> + if (!display_np) {
> + dev_err(dev, "failed to find display phandle\n");
> + return -ENOENT;
> + }
> +
> + ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property bits-per-pixel\n");
> + goto put_display_node;
> + }
> +
> + ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property atmel,guard-time\n");
> + goto put_display_node;
> + }
> +
> + ret = of_property_read_u32(display_np, "atmel,lcdcon2", &pdata->default_lcdcon2);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property atmel,lcdcon2\n");
> + goto put_display_node;
> + }
> +
> + ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property bits-per-pixel\n");
No, wrong error message.
> + goto put_display_node;
> + }
> +
> + ret = -ENOMEM;
> + for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) {
> + gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio",
> + i, &flags);
> + if (gpio < 0)
> + continue;
> +
> + og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
> + if (!og)
> + goto put_display_node;
> +
> + og->gpio = gpio;
> + og->active_low = flags & OF_GPIO_ACTIVE_LOW;
> + is_gpio_power = true;
> + ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
> + if (ret) {
> + dev_err(dev, "request gpio %d failed\n", gpio);
> + goto put_display_node;
> + }
> +
> + ret = gpio_direction_output(gpio, og->active_low);
> + if (ret) {
> + dev_err(dev, "set direction output gpio %d failed\n", gpio);
> + goto put_display_node;
> + }
> + }
> +
> + if (is_gpio_power)
> + pdata->atmel_lcdfb_power_control = atmel_lcdfb_power_control_gpio;
> +
> + ret = atmel_lcdfb_get_of_wiring_modes(display_np);
> + if (ret < 0) {
> + dev_err(dev, "invalid atmel,lcd-wiring-mode\n");
> + goto put_display_node;
> + }
> + pdata->lcd_wiring_mode = ret;
> +
> + pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
> +
> + timings = of_get_display_timings(display_np);
> + if (!timings) {
> + dev_err(dev, "failed to get display timings\n");
> + goto put_display_node;
> + }
> +
> + timings_np = of_find_node_by_name(display_np, "display-timings");
> + if (!timings_np) {
> + dev_err(dev, "failed to find display-timings node\n");
> + goto put_display_node;
> + }
> +
> + for (i = 0; i < of_get_child_count(timings_np); i++) {
> + struct videomode vm;
> + struct fb_videomode fb_vm;
> +
> + ret = videomode_from_timing(timings, &vm, i);
> + if (ret < 0)
> + goto put_timings_node;
> + ret = fb_videomode_from_videomode(&vm, &fb_vm);
> + if (ret < 0)
> + goto put_timings_node;
> +
> + fb_add_videomode(&fb_vm, &info->modelist);
> + }
> +
> + return 0;
> +
> +put_timings_node:
> + of_node_put(timings_np);
> +put_display_node:
> + of_node_put(display_np);
> + return ret;
> +}
> +#else
> +static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> +{
> + return 0;
> +}
> +#endif
>
> static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct fb_info *info;
> struct atmel_lcdfb_info *sinfo;
> - struct atmel_lcdfb_pdata *pdata;
> - struct fb_videomode fbmode;
> + struct atmel_lcdfb_pdata *pdata = NULL;
> struct resource *regs = NULL;
> struct resource *map = NULL;
> + struct fb_modelist *modelist;
> int ret;
>
> dev_dbg(dev, "%s BEGIN\n", __func__);
> @@ -967,17 +1149,35 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> }
>
> sinfo = info->par;
> + sinfo->pdev = pdev;
> + sinfo->info = info;
> +
> + INIT_LIST_HEAD(&info->modelist);
>
> - if (dev->platform_data) {
> - pdata = (struct atmel_lcdfb_pdata *)dev->platform_data;
> + if (pdev->dev.of_node) {
> + ret = atmel_lcdfb_of_init(sinfo);
> + if (ret)
> + goto free_info;
> + } else if (dev->platform_data) {
> + struct fb_monspecs *monspecs;
> + int i;
> +
> + pdata = dev->platform_data;
> + monspecs = pdata->default_monspecs;
> sinfo->pdata = *pdata;
> +
> + for (i = 0; i < monspecs->modedb_len; i++)
> + fb_add_videomode(&monspecs->modedb[i], &info->modelist);
> +
> + sinfo->config = atmel_lcdfb_get_config(pdev);
> +
> + info->var.bits_per_pixel = pdata->default_bpp ? pdata->default_bpp : 16;
> + memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
> } else {
> dev_err(dev, "cannot get default configuration\n");
> goto free_info;
> }
> - sinfo->info = info;
> - sinfo->pdev = pdev;
> - sinfo->config = atmel_lcdfb_get_config(pdev);
> +
> if (!sinfo->config)
> goto free_info;
>
> @@ -986,7 +1186,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> info->pseudo_palette = sinfo->pseudo_palette;
> info->fbops = &atmel_lcdfb_ops;
>
> - memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
> info->fix = atmel_lcdfb_fix;
>
> /* Enable LCDC Clocks */
> @@ -1002,14 +1201,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> }
> atmel_lcdfb_start_clock(sinfo);
>
> - ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
> - info->monspecs.modedb_len, info->monspecs.modedb,
> - pdata->default_bpp);
> - if (!ret) {
> - dev_err(dev, "no suitable video mode found\n");
> - goto stop_clk;
> - }
> + modelist = list_first_entry(&info->modelist,
> + struct fb_modelist, list);
> + fb_videomode_to_var(&info->var, &modelist->mode);
>
> + atmel_lcdfb_check_var(&info->var, info);
>
> regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!regs) {
> @@ -1093,18 +1289,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> goto unregister_irqs;
> }
>
> - /*
> - * This makes sure that our colour bitfield
> - * descriptors are correctly initialised.
> - */
> - atmel_lcdfb_check_var(&info->var, info);
> -
> - ret = fb_set_var(info, &info->var);
> - if (ret) {
> - dev_warn(dev, "unable to set display parameters\n");
> - goto free_cmap;
> - }
> -
> dev_set_drvdata(dev, info);
>
> /*
> @@ -1116,10 +1300,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> goto reset_drvdata;
> }
>
> - /* add selected videomode to modelist */
> - fb_var_to_videomode(&fbmode, &info->var);
> - fb_add_videomode(&fbmode, &info->modelist);
> -
> /* Power up the LCDC screen */
> atmel_lcdfb_power_control(sinfo, 1);
>
> @@ -1130,7 +1310,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>
> reset_drvdata:
> dev_set_drvdata(dev, NULL);
> -free_cmap:
> fb_dealloc_cmap(&info->cmap);
> unregister_irqs:
> cancel_work_sync(&sinfo->task);
> @@ -1249,6 +1428,7 @@ static struct platform_driver atmel_lcdfb_driver = {
> .driver = {
> .name = "atmel_lcdfb",
> .owner = THIS_MODULE,
> + .of_match_table = of_match_ptr(atmel_lcdfb_dt_ids),
> },
> };
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 4/8] video: atmel_lcdfb: add device tree suport
2013-04-16 13:42 ` Nicolas Ferre
@ 2013-04-16 13:44 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 15:43 ` Nicolas Ferre
0 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-16 13:44 UTC (permalink / raw)
To: Nicolas Ferre
Cc: Andrew Morton, devicetree-discuss, linux-fbdev, linux-arm-kernel
On 15:42 Tue 16 Apr , Nicolas Ferre wrote:
> On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> > get display timings from device tree
> > Use videomode helpers to get display timings and configurations from
> > device tree
>
> 2 sentences? Simply elaborate the 2nd one and it will be good.
>
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > Cc: linux-fbdev@vger.kernel.org
> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > ---
> > .../devicetree/bindings/video/atmel,lcdc.txt | 75 ++++++
> > drivers/video/Kconfig | 2 +
> > drivers/video/atmel_lcdfb.c | 244 +++++++++++++++++---
> > 3 files changed, 289 insertions(+), 32 deletions(-)
> > create mode 100644 Documentation/devicetree/bindings/video/atmel,lcdc.txt
> >
> > diff --git a/Documentation/devicetree/bindings/video/atmel,lcdc.txt b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
> > new file mode 100644
> > index 0000000..1ec175e
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
>
> Why lcdc? I would have preferred atmel,lcdfb, like the driver's name: it
> is even more self-explanatory...
we do not describe drivers but IP
>
> > @@ -0,0 +1,75 @@
> > +Atmel LCDC Framebuffer
> > +-----------------------------------------------------
> > +
> > +Required properties:
> > +- compatible :
> > + "atmel,at91sam9261-lcdc" ,
> > + "atmel,at91sam9263-lcdc" ,
> > + "atmel,at91sam9g10-lcdc" ,
> > + "atmel,at91sam9g45-lcdc" ,
> > + "atmel,at91sam9g45es-lcdc" ,
> > + "atmel,at91sam9rl-lcdc" ,
> > + "atmel,at32ap-lcdc"
> > +- reg : Should contain 1 register ranges(address and length)
> > +- interrupts : framebuffer controller interrupt
> > +- display: a phandle pointing to the display node
> > +
> > +Required nodes:
> > +- display: a display node is required to initialize the lcd panel
> > + This should be in the board dts.
> > +- default-mode: a videomode within the display with timing parameters
> > + as specified below.
> > +
> > +Example:
> > +
> > + fb0: fb@0x00500000 {
> > + compatible = "atmel,at91sam9g45-lcdc";
> > + reg = <0x00500000 0x1000>;
> > + interrupts = <23 3 0>;
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&pinctrl_fb>;
> > + display = <&display0>;
> > + status = "okay";
> > + #address-cells = <1>;
> > + #size-cells = <1>;
> > +
> > + };
> > +
> > +Atmel LCDC Display
> > +-----------------------------------------------------
> > +Required properties (as per of_videomode_helper):
>
> Can you please point somewhere to the documentation:
> Documentation/devicetree/bindings/video/display-timing.txt
>
> > + - atmel,dmacon: dma controler configuration
>
> Typo: controller.
>
> > + - atmel,lcdcon2: lcd controler configuration
>
> Ditto
>
> > + - atmel,guard-time: lcd guard time (Delay in frame periods)
>
> periods -> period, no?
no it's periods even in the datasheet
>
> > + - bits-per-pixel: lcd panel bit-depth.
> > +
> > +Optional properties (as per of_videomode_helper):
> > + - atmel,lcdcon-backlight: enable backlight
> > + - atmel,lcd-wiring-mode: lcd wiring mode "RGB" or "BRG"
>
> Is it a sting, or a number (as seen below)? If it is a number, please
> tell how to choose the index.
String
>
>
> > + - atmel,power-control-gpio: gpio to power on or off the LCD (as many as needed)
> > +
> > +Example:
> > + display0: display {
> > + bits-per-pixel = <32>;
> > + atmel,lcdcon-backlight;
> > + atmel,dmacon = <0x1>;
> > + atmel,lcdcon2 = <0x80008002>;
> > + atmel,guard-time = <9>;
> > + atmel,lcd-wiring-mode = <1>;
> > +
> > + display-timings {
> > + native-mode = <&timing0>;
> > + timing0: timing0 {
> > + clock-frequency = <9000000>;
> > + hactive = <480>;
> > + vactive = <272>;
> > + hback-porch = <1>;
> > + hfront-porch = <1>;
> > + vback-porch = <40>;
> > + vfront-porch = <1>;
> > + hsync-len = <45>;
> > + vsync-len = <1>;
> > + };
> > + };
> > + };
> > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> > index 4c1546f..0687482 100644
> > --- a/drivers/video/Kconfig
> > +++ b/drivers/video/Kconfig
> > @@ -1018,6 +1018,8 @@ config FB_ATMEL
> > select FB_CFB_FILLRECT
> > select FB_CFB_COPYAREA
> > select FB_CFB_IMAGEBLIT
> > + select FB_MODE_HELPERS
> > + select OF_VIDEOMODE
> > help
> > This enables support for the AT91/AT32 LCD Controller.
> >
> > diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> > index f67e226..4a31570 100644
> > --- a/drivers/video/atmel_lcdfb.c
> > +++ b/drivers/video/atmel_lcdfb.c
> > @@ -20,7 +20,11 @@
> > #include <linux/gfp.h>
> > #include <linux/module.h>
> > #include <linux/platform_data/atmel.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> > +#include <linux/of_gpio.h>
> > #include <video/of_display_timing.h>
>
> As said in patch 1/8, this one belongs to this 4/8 patch.
>
> > +#include <video/videomode.h>
> >
> > #include <mach/cpu.h>
> > #include <asm/gpio.h>
> > @@ -59,6 +63,13 @@ struct atmel_lcdfb_info {
> > struct atmel_lcdfb_config *config;
> > };
> >
> > +struct atmel_lcdfb_power_ctrl_gpio {
> > + int gpio;
> > + int active_low;
> > +
> > + struct list_head list;
> > +};
> > +
> > #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
> > #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
> >
> > @@ -945,16 +956,187 @@ static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
> > clk_disable(sinfo->lcdc_clk);
> > }
> >
> > +#ifdef CONFIG_OF
> > +static const struct of_device_id atmel_lcdfb_dt_ids[] = {
> > + { .compatible = "atmel,at91sam9261-lcdc" , .data = &at91sam9261_config, },
> > + { .compatible = "atmel,at91sam9263-lcdc" , .data = &at91sam9263_config, },
> > + { .compatible = "atmel,at91sam9g10-lcdc" , .data = &at91sam9g10_config, },
> > + { .compatible = "atmel,at91sam9g45-lcdc" , .data = &at91sam9g45_config, },
> > + { .compatible = "atmel,at91sam9g45es-lcdc" , .data = &at91sam9g45es_config, },
> > + { .compatible = "atmel,at91sam9rl-lcdc" , .data = &at91sam9rl_config, },
> > + { .compatible = "atmel,at32ap-lcdc" , .data = &at32ap_config, },
> > + { /* sentinel */ }
> > +};
> > +
> > +MODULE_DEVICE_TABLE(of, atmel_lcdfb_dt_ids);
> > +
> > +static const char *atmel_lcdfb_wiring_modes[] = {
> > + [ATMEL_LCDC_WIRING_BGR] = "BRG",
> > + [ATMEL_LCDC_WIRING_RGB] = "RGB",
> > +};
> > +
> > +const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
> > +{
> > + const char *mode;
> > + int err, i;
> > +
> > + err = of_property_read_string(np, "atmel,lcd-wiring-mode", &mode);
> > + if (err < 0)
> > + return ATMEL_LCDC_WIRING_BGR;
> > +
> > + for (i = 0; i < ARRAY_SIZE(atmel_lcdfb_wiring_modes); i++)
> > + if (!strcasecmp(mode, atmel_lcdfb_wiring_modes[i]))
> > + return i;
> > +
> > + return -ENODEV;
> > +}
> > +
> > +static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int on)
> > +{
> > + struct atmel_lcdfb_power_ctrl_gpio *og;
> > +
> > + list_for_each_entry(og, &pdata->pwr_gpios, list)
> > + gpio_set_value(og->gpio, on);
> > +}
> > +
> > +static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> > +{
> > + struct fb_info *info = sinfo->info;
> > + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> > + struct fb_var_screeninfo *var = &info->var;
> > + struct device *dev = &sinfo->pdev->dev;
> > + struct device_node *np =dev->of_node;
> > + struct device_node *display_np;
> > + struct device_node *timings_np;
> > + struct display_timings *timings;
> > + enum of_gpio_flags flags;
> > + struct atmel_lcdfb_power_ctrl_gpio *og;
> > + bool is_gpio_power = false;
> > + int ret = -ENOENT;
> > + int i, gpio;
> > +
> > + sinfo->config = (struct atmel_lcdfb_config*)
> > + of_match_device(atmel_lcdfb_dt_ids, dev)->data;
>
> Please split it in 2 steps, otherwise the day that the drivers doesn't
> find the device in dt_ids table, it hangs here with an Oops.
no as you will never end here in this case
>
> > +
> > + display_np = of_parse_phandle(np, "display", 0);
> > + if (!display_np) {
> > + dev_err(dev, "failed to find display phandle\n");
> > + return -ENOENT;
> > + }
> > +
> > + ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
> > + if (ret < 0) {
> > + dev_err(dev, "failed to get property bits-per-pixel\n");
> > + goto put_display_node;
> > + }
> > +
> > + ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time);
> > + if (ret < 0) {
> > + dev_err(dev, "failed to get property atmel,guard-time\n");
> > + goto put_display_node;
> > + }
> > +
> > + ret = of_property_read_u32(display_np, "atmel,lcdcon2", &pdata->default_lcdcon2);
> > + if (ret < 0) {
> > + dev_err(dev, "failed to get property atmel,lcdcon2\n");
> > + goto put_display_node;
> > + }
> > +
> > + ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon);
> > + if (ret < 0) {
> > + dev_err(dev, "failed to get property bits-per-pixel\n");
>
> No, wrong error message.
>
> > + goto put_display_node;
> > + }
> > +
> > + ret = -ENOMEM;
> > + for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) {
> > + gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio",
> > + i, &flags);
> > + if (gpio < 0)
> > + continue;
> > +
> > + og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
> > + if (!og)
> > + goto put_display_node;
> > +
> > + og->gpio = gpio;
> > + og->active_low = flags & OF_GPIO_ACTIVE_LOW;
> > + is_gpio_power = true;
> > + ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
> > + if (ret) {
> > + dev_err(dev, "request gpio %d failed\n", gpio);
> > + goto put_display_node;
> > + }
> > +
> > + ret = gpio_direction_output(gpio, og->active_low);
> > + if (ret) {
> > + dev_err(dev, "set direction output gpio %d failed\n", gpio);
> > + goto put_display_node;
> > + }
> > + }
> > +
> > + if (is_gpio_power)
> > + pdata->atmel_lcdfb_power_control = atmel_lcdfb_power_control_gpio;
> > +
> > + ret = atmel_lcdfb_get_of_wiring_modes(display_np);
> > + if (ret < 0) {
> > + dev_err(dev, "invalid atmel,lcd-wiring-mode\n");
> > + goto put_display_node;
> > + }
> > + pdata->lcd_wiring_mode = ret;
> > +
> > + pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
> > +
> > + timings = of_get_display_timings(display_np);
> > + if (!timings) {
> > + dev_err(dev, "failed to get display timings\n");
> > + goto put_display_node;
> > + }
> > +
> > + timings_np = of_find_node_by_name(display_np, "display-timings");
> > + if (!timings_np) {
> > + dev_err(dev, "failed to find display-timings node\n");
> > + goto put_display_node;
> > + }
> > +
> > + for (i = 0; i < of_get_child_count(timings_np); i++) {
> > + struct videomode vm;
> > + struct fb_videomode fb_vm;
> > +
> > + ret = videomode_from_timing(timings, &vm, i);
> > + if (ret < 0)
> > + goto put_timings_node;
> > + ret = fb_videomode_from_videomode(&vm, &fb_vm);
> > + if (ret < 0)
> > + goto put_timings_node;
> > +
> > + fb_add_videomode(&fb_vm, &info->modelist);
> > + }
> > +
> > + return 0;
> > +
> > +put_timings_node:
> > + of_node_put(timings_np);
> > +put_display_node:
> > + of_node_put(display_np);
> > + return ret;
> > +}
> > +#else
> > +static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> > +{
> > + return 0;
> > +}
> > +#endif
> >
> > static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > struct fb_info *info;
> > struct atmel_lcdfb_info *sinfo;
> > - struct atmel_lcdfb_pdata *pdata;
> > - struct fb_videomode fbmode;
> > + struct atmel_lcdfb_pdata *pdata = NULL;
> > struct resource *regs = NULL;
> > struct resource *map = NULL;
> > + struct fb_modelist *modelist;
> > int ret;
> >
> > dev_dbg(dev, "%s BEGIN\n", __func__);
> > @@ -967,17 +1149,35 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> > }
> >
> > sinfo = info->par;
> > + sinfo->pdev = pdev;
> > + sinfo->info = info;
> > +
> > + INIT_LIST_HEAD(&info->modelist);
> >
> > - if (dev->platform_data) {
> > - pdata = (struct atmel_lcdfb_pdata *)dev->platform_data;
> > + if (pdev->dev.of_node) {
> > + ret = atmel_lcdfb_of_init(sinfo);
> > + if (ret)
> > + goto free_info;
> > + } else if (dev->platform_data) {
> > + struct fb_monspecs *monspecs;
> > + int i;
> > +
> > + pdata = dev->platform_data;
> > + monspecs = pdata->default_monspecs;
> > sinfo->pdata = *pdata;
> > +
> > + for (i = 0; i < monspecs->modedb_len; i++)
> > + fb_add_videomode(&monspecs->modedb[i], &info->modelist);
> > +
> > + sinfo->config = atmel_lcdfb_get_config(pdev);
> > +
> > + info->var.bits_per_pixel = pdata->default_bpp ? pdata->default_bpp : 16;
> > + memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
> > } else {
> > dev_err(dev, "cannot get default configuration\n");
> > goto free_info;
> > }
> > - sinfo->info = info;
> > - sinfo->pdev = pdev;
> > - sinfo->config = atmel_lcdfb_get_config(pdev);
> > +
> > if (!sinfo->config)
> > goto free_info;
> >
> > @@ -986,7 +1186,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> > info->pseudo_palette = sinfo->pseudo_palette;
> > info->fbops = &atmel_lcdfb_ops;
> >
> > - memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
> > info->fix = atmel_lcdfb_fix;
> >
> > /* Enable LCDC Clocks */
> > @@ -1002,14 +1201,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> > }
> > atmel_lcdfb_start_clock(sinfo);
> >
> > - ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
> > - info->monspecs.modedb_len, info->monspecs.modedb,
> > - pdata->default_bpp);
> > - if (!ret) {
> > - dev_err(dev, "no suitable video mode found\n");
> > - goto stop_clk;
> > - }
> > + modelist = list_first_entry(&info->modelist,
> > + struct fb_modelist, list);
> > + fb_videomode_to_var(&info->var, &modelist->mode);
> >
> > + atmel_lcdfb_check_var(&info->var, info);
> >
> > regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > if (!regs) {
> > @@ -1093,18 +1289,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> > goto unregister_irqs;
> > }
> >
> > - /*
> > - * This makes sure that our colour bitfield
> > - * descriptors are correctly initialised.
> > - */
> > - atmel_lcdfb_check_var(&info->var, info);
> > -
> > - ret = fb_set_var(info, &info->var);
> > - if (ret) {
> > - dev_warn(dev, "unable to set display parameters\n");
> > - goto free_cmap;
> > - }
> > -
> > dev_set_drvdata(dev, info);
> >
> > /*
> > @@ -1116,10 +1300,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> > goto reset_drvdata;
> > }
> >
> > - /* add selected videomode to modelist */
> > - fb_var_to_videomode(&fbmode, &info->var);
> > - fb_add_videomode(&fbmode, &info->modelist);
> > -
> > /* Power up the LCDC screen */
> > atmel_lcdfb_power_control(sinfo, 1);
> >
> > @@ -1130,7 +1310,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> >
> > reset_drvdata:
> > dev_set_drvdata(dev, NULL);
> > -free_cmap:
> > fb_dealloc_cmap(&info->cmap);
> > unregister_irqs:
> > cancel_work_sync(&sinfo->task);
> > @@ -1249,6 +1428,7 @@ static struct platform_driver atmel_lcdfb_driver = {
> > .driver = {
> > .name = "atmel_lcdfb",
> > .owner = THIS_MODULE,
> > + .of_match_table = of_match_ptr(atmel_lcdfb_dt_ids),
> > },
> > };
> >
> >
>
>
> --
> Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 4/8] video: atmel_lcdfb: add device tree suport
2013-04-16 13:44 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-16 15:43 ` Nicolas Ferre
0 siblings, 0 replies; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 15:43 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Andrew Morton, devicetree-discuss, linux-fbdev, linux-arm-kernel
On 04/16/2013 03:44 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 15:42 Tue 16 Apr , Nicolas Ferre wrote:
>> On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
>>> get display timings from device tree
>>> Use videomode helpers to get display timings and configurations from
>>> device tree
>>
>> 2 sentences? Simply elaborate the 2nd one and it will be good.
>>
>>> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>> Cc: linux-fbdev@vger.kernel.org
>>> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>> ---
>>> .../devicetree/bindings/video/atmel,lcdc.txt | 75 ++++++
>>> drivers/video/Kconfig | 2 +
>>> drivers/video/atmel_lcdfb.c | 244 +++++++++++++++++---
>>> 3 files changed, 289 insertions(+), 32 deletions(-)
>>> create mode 100644 Documentation/devicetree/bindings/video/atmel,lcdc.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/video/atmel,lcdc.txt b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
>>> new file mode 100644
>>> index 0000000..1ec175e
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
>>
>> Why lcdc? I would have preferred atmel,lcdfb, like the driver's name: it
>> is even more self-explanatory...
> we do not describe drivers but IP
fine, but in
static const struct platform_device_id atmel_lcdfb_devtypes, we use
"xxx-lcdfb" type...
>>
>>> @@ -0,0 +1,75 @@
>>> +Atmel LCDC Framebuffer
>>> +-----------------------------------------------------
>>> +
>>> +Required properties:
>>> +- compatible :
>>> + "atmel,at91sam9261-lcdc" ,
>>> + "atmel,at91sam9263-lcdc" ,
>>> + "atmel,at91sam9g10-lcdc" ,
>>> + "atmel,at91sam9g45-lcdc" ,
>>> + "atmel,at91sam9g45es-lcdc" ,
>>> + "atmel,at91sam9rl-lcdc" ,
>>> + "atmel,at32ap-lcdc"
>>> +- reg : Should contain 1 register ranges(address and length)
>>> +- interrupts : framebuffer controller interrupt
>>> +- display: a phandle pointing to the display node
>>> +
>>> +Required nodes:
>>> +- display: a display node is required to initialize the lcd panel
>>> + This should be in the board dts.
>>> +- default-mode: a videomode within the display with timing parameters
>>> + as specified below.
>>> +
>>> +Example:
>>> +
>>> + fb0: fb@0x00500000 {
>>> + compatible = "atmel,at91sam9g45-lcdc";
>>> + reg = <0x00500000 0x1000>;
>>> + interrupts = <23 3 0>;
>>> + pinctrl-names = "default";
>>> + pinctrl-0 = <&pinctrl_fb>;
>>> + display = <&display0>;
>>> + status = "okay";
>>> + #address-cells = <1>;
>>> + #size-cells = <1>;
>>> +
>>> + };
>>> +
>>> +Atmel LCDC Display
>>> +-----------------------------------------------------
>>> +Required properties (as per of_videomode_helper):
>>
>> Can you please point somewhere to the documentation:
>> Documentation/devicetree/bindings/video/display-timing.txt
>>
>>> + - atmel,dmacon: dma controler configuration
>>
>> Typo: controller.
>>
>>> + - atmel,lcdcon2: lcd controler configuration
>>
>> Ditto
>>
>>> + - atmel,guard-time: lcd guard time (Delay in frame periods)
>>
>> periods -> period, no?
> no it's periods even in the datasheet
>>
>>> + - bits-per-pixel: lcd panel bit-depth.
>>> +
>>> +Optional properties (as per of_videomode_helper):
>>> + - atmel,lcdcon-backlight: enable backlight
>>> + - atmel,lcd-wiring-mode: lcd wiring mode "RGB" or "BRG"
>>
>> Is it a sting, or a number (as seen below)? If it is a number, please
>> tell how to choose the index.
> String
Okay: so tell it in the description and correct the example below.
>>> + - atmel,power-control-gpio: gpio to power on or off the LCD (as many as needed)
>>> +
>>> +Example:
>>> + display0: display {
>>> + bits-per-pixel = <32>;
>>> + atmel,lcdcon-backlight;
>>> + atmel,dmacon = <0x1>;
>>> + atmel,lcdcon2 = <0x80008002>;
>>> + atmel,guard-time = <9>;
>>> + atmel,lcd-wiring-mode = <1>;
Here ----------------------------------^^^^
>>> +
>>> + display-timings {
>>> + native-mode = <&timing0>;
>>> + timing0: timing0 {
>>> + clock-frequency = <9000000>;
>>> + hactive = <480>;
>>> + vactive = <272>;
>>> + hback-porch = <1>;
>>> + hfront-porch = <1>;
>>> + vback-porch = <40>;
>>> + vfront-porch = <1>;
>>> + hsync-len = <45>;
>>> + vsync-len = <1>;
>>> + };
>>> + };
>>> + };
>>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
>>> index 4c1546f..0687482 100644
>>> --- a/drivers/video/Kconfig
>>> +++ b/drivers/video/Kconfig
>>> @@ -1018,6 +1018,8 @@ config FB_ATMEL
>>> select FB_CFB_FILLRECT
>>> select FB_CFB_COPYAREA
>>> select FB_CFB_IMAGEBLIT
>>> + select FB_MODE_HELPERS
>>> + select OF_VIDEOMODE
>>> help
>>> This enables support for the AT91/AT32 LCD Controller.
>>>
>>> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
>>> index f67e226..4a31570 100644
>>> --- a/drivers/video/atmel_lcdfb.c
>>> +++ b/drivers/video/atmel_lcdfb.c
>>> @@ -20,7 +20,11 @@
>>> #include <linux/gfp.h>
>>> #include <linux/module.h>
>>> #include <linux/platform_data/atmel.h>
>>> +#include <linux/of.h>
>>> +#include <linux/of_device.h>
>>> +#include <linux/of_gpio.h>
>>> #include <video/of_display_timing.h>
>>
>> As said in patch 1/8, this one belongs to this 4/8 patch.
>>
>>> +#include <video/videomode.h>
>>>
>>> #include <mach/cpu.h>
>>> #include <asm/gpio.h>
>>> @@ -59,6 +63,13 @@ struct atmel_lcdfb_info {
>>> struct atmel_lcdfb_config *config;
>>> };
>>>
>>> +struct atmel_lcdfb_power_ctrl_gpio {
>>> + int gpio;
>>> + int active_low;
>>> +
>>> + struct list_head list;
>>> +};
>>> +
>>> #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
>>> #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
>>>
>>> @@ -945,16 +956,187 @@ static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
>>> clk_disable(sinfo->lcdc_clk);
>>> }
>>>
>>> +#ifdef CONFIG_OF
>>> +static const struct of_device_id atmel_lcdfb_dt_ids[] = {
>>> + { .compatible = "atmel,at91sam9261-lcdc" , .data = &at91sam9261_config, },
>>> + { .compatible = "atmel,at91sam9263-lcdc" , .data = &at91sam9263_config, },
>>> + { .compatible = "atmel,at91sam9g10-lcdc" , .data = &at91sam9g10_config, },
>>> + { .compatible = "atmel,at91sam9g45-lcdc" , .data = &at91sam9g45_config, },
>>> + { .compatible = "atmel,at91sam9g45es-lcdc" , .data = &at91sam9g45es_config, },
>>> + { .compatible = "atmel,at91sam9rl-lcdc" , .data = &at91sam9rl_config, },
>>> + { .compatible = "atmel,at32ap-lcdc" , .data = &at32ap_config, },
>>> + { /* sentinel */ }
>>> +};
>>> +
>>> +MODULE_DEVICE_TABLE(of, atmel_lcdfb_dt_ids);
>>> +
>>> +static const char *atmel_lcdfb_wiring_modes[] = {
>>> + [ATMEL_LCDC_WIRING_BGR] = "BRG",
>>> + [ATMEL_LCDC_WIRING_RGB] = "RGB",
>>> +};
>>> +
>>> +const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
>>> +{
>>> + const char *mode;
>>> + int err, i;
>>> +
>>> + err = of_property_read_string(np, "atmel,lcd-wiring-mode", &mode);
>>> + if (err < 0)
>>> + return ATMEL_LCDC_WIRING_BGR;
>>> +
>>> + for (i = 0; i < ARRAY_SIZE(atmel_lcdfb_wiring_modes); i++)
>>> + if (!strcasecmp(mode, atmel_lcdfb_wiring_modes[i]))
>>> + return i;
>>> +
>>> + return -ENODEV;
>>> +}
>>> +
>>> +static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int on)
>>> +{
>>> + struct atmel_lcdfb_power_ctrl_gpio *og;
>>> +
>>> + list_for_each_entry(og, &pdata->pwr_gpios, list)
>>> + gpio_set_value(og->gpio, on);
>>> +}
>>> +
>>> +static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
>>> +{
>>> + struct fb_info *info = sinfo->info;
>>> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
>>> + struct fb_var_screeninfo *var = &info->var;
>>> + struct device *dev = &sinfo->pdev->dev;
>>> + struct device_node *np =dev->of_node;
>>> + struct device_node *display_np;
>>> + struct device_node *timings_np;
>>> + struct display_timings *timings;
>>> + enum of_gpio_flags flags;
>>> + struct atmel_lcdfb_power_ctrl_gpio *og;
>>> + bool is_gpio_power = false;
>>> + int ret = -ENOENT;
>>> + int i, gpio;
>>> +
>>> + sinfo->config = (struct atmel_lcdfb_config*)
>>> + of_match_device(atmel_lcdfb_dt_ids, dev)->data;
>>
>> Please split it in 2 steps, otherwise the day that the drivers doesn't
>> find the device in dt_ids table, it hangs here with an Oops.
> no as you will never end here in this case
Ok, I see.
>>
>>> +
>>> + display_np = of_parse_phandle(np, "display", 0);
>>> + if (!display_np) {
>>> + dev_err(dev, "failed to find display phandle\n");
>>> + return -ENOENT;
>>> + }
>>> +
>>> + ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
>>> + if (ret < 0) {
>>> + dev_err(dev, "failed to get property bits-per-pixel\n");
>>> + goto put_display_node;
>>> + }
>>> +
>>> + ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time);
>>> + if (ret < 0) {
>>> + dev_err(dev, "failed to get property atmel,guard-time\n");
>>> + goto put_display_node;
>>> + }
>>> +
>>> + ret = of_property_read_u32(display_np, "atmel,lcdcon2", &pdata->default_lcdcon2);
>>> + if (ret < 0) {
>>> + dev_err(dev, "failed to get property atmel,lcdcon2\n");
>>> + goto put_display_node;
>>> + }
>>> +
>>> + ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon);
>>> + if (ret < 0) {
>>> + dev_err(dev, "failed to get property bits-per-pixel\n");
>>
>> No, wrong error message.
>>
>>> + goto put_display_node;
>>> + }
>>> +
>>> + ret = -ENOMEM;
>>> + for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) {
>>> + gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio",
>>> + i, &flags);
>>> + if (gpio < 0)
>>> + continue;
>>> +
>>> + og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
>>> + if (!og)
>>> + goto put_display_node;
>>> +
>>> + og->gpio = gpio;
>>> + og->active_low = flags & OF_GPIO_ACTIVE_LOW;
>>> + is_gpio_power = true;
>>> + ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
>>> + if (ret) {
>>> + dev_err(dev, "request gpio %d failed\n", gpio);
>>> + goto put_display_node;
>>> + }
>>> +
>>> + ret = gpio_direction_output(gpio, og->active_low);
>>> + if (ret) {
>>> + dev_err(dev, "set direction output gpio %d failed\n", gpio);
>>> + goto put_display_node;
>>> + }
>>> + }
>>> +
>>> + if (is_gpio_power)
>>> + pdata->atmel_lcdfb_power_control = atmel_lcdfb_power_control_gpio;
>>> +
>>> + ret = atmel_lcdfb_get_of_wiring_modes(display_np);
>>> + if (ret < 0) {
>>> + dev_err(dev, "invalid atmel,lcd-wiring-mode\n");
>>> + goto put_display_node;
>>> + }
>>> + pdata->lcd_wiring_mode = ret;
>>> +
>>> + pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
>>> +
>>> + timings = of_get_display_timings(display_np);
>>> + if (!timings) {
>>> + dev_err(dev, "failed to get display timings\n");
>>> + goto put_display_node;
>>> + }
>>> +
>>> + timings_np = of_find_node_by_name(display_np, "display-timings");
>>> + if (!timings_np) {
>>> + dev_err(dev, "failed to find display-timings node\n");
>>> + goto put_display_node;
>>> + }
>>> +
>>> + for (i = 0; i < of_get_child_count(timings_np); i++) {
>>> + struct videomode vm;
>>> + struct fb_videomode fb_vm;
>>> +
>>> + ret = videomode_from_timing(timings, &vm, i);
>>> + if (ret < 0)
>>> + goto put_timings_node;
>>> + ret = fb_videomode_from_videomode(&vm, &fb_vm);
>>> + if (ret < 0)
>>> + goto put_timings_node;
>>> +
>>> + fb_add_videomode(&fb_vm, &info->modelist);
>>> + }
>>> +
>>> + return 0;
>>> +
>>> +put_timings_node:
>>> + of_node_put(timings_np);
>>> +put_display_node:
>>> + of_node_put(display_np);
>>> + return ret;
>>> +}
>>> +#else
>>> +static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
>>> +{
>>> + return 0;
>>> +}
>>> +#endif
>>>
>>> static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>>> {
>>> struct device *dev = &pdev->dev;
>>> struct fb_info *info;
>>> struct atmel_lcdfb_info *sinfo;
>>> - struct atmel_lcdfb_pdata *pdata;
>>> - struct fb_videomode fbmode;
>>> + struct atmel_lcdfb_pdata *pdata = NULL;
>>> struct resource *regs = NULL;
>>> struct resource *map = NULL;
>>> + struct fb_modelist *modelist;
>>> int ret;
>>>
>>> dev_dbg(dev, "%s BEGIN\n", __func__);
>>> @@ -967,17 +1149,35 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>>> }
>>>
>>> sinfo = info->par;
>>> + sinfo->pdev = pdev;
>>> + sinfo->info = info;
>>> +
>>> + INIT_LIST_HEAD(&info->modelist);
>>>
>>> - if (dev->platform_data) {
>>> - pdata = (struct atmel_lcdfb_pdata *)dev->platform_data;
>>> + if (pdev->dev.of_node) {
>>> + ret = atmel_lcdfb_of_init(sinfo);
>>> + if (ret)
>>> + goto free_info;
>>> + } else if (dev->platform_data) {
>>> + struct fb_monspecs *monspecs;
>>> + int i;
>>> +
>>> + pdata = dev->platform_data;
>>> + monspecs = pdata->default_monspecs;
>>> sinfo->pdata = *pdata;
>>> +
>>> + for (i = 0; i < monspecs->modedb_len; i++)
>>> + fb_add_videomode(&monspecs->modedb[i], &info->modelist);
>>> +
>>> + sinfo->config = atmel_lcdfb_get_config(pdev);
>>> +
>>> + info->var.bits_per_pixel = pdata->default_bpp ? pdata->default_bpp : 16;
>>> + memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
>>> } else {
>>> dev_err(dev, "cannot get default configuration\n");
>>> goto free_info;
>>> }
>>> - sinfo->info = info;
>>> - sinfo->pdev = pdev;
>>> - sinfo->config = atmel_lcdfb_get_config(pdev);
>>> +
>>> if (!sinfo->config)
>>> goto free_info;
>>>
>>> @@ -986,7 +1186,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>>> info->pseudo_palette = sinfo->pseudo_palette;
>>> info->fbops = &atmel_lcdfb_ops;
>>>
>>> - memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
>>> info->fix = atmel_lcdfb_fix;
>>>
>>> /* Enable LCDC Clocks */
>>> @@ -1002,14 +1201,11 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>>> }
>>> atmel_lcdfb_start_clock(sinfo);
>>>
>>> - ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
>>> - info->monspecs.modedb_len, info->monspecs.modedb,
>>> - pdata->default_bpp);
>>> - if (!ret) {
>>> - dev_err(dev, "no suitable video mode found\n");
>>> - goto stop_clk;
>>> - }
>>> + modelist = list_first_entry(&info->modelist,
>>> + struct fb_modelist, list);
>>> + fb_videomode_to_var(&info->var, &modelist->mode);
>>>
>>> + atmel_lcdfb_check_var(&info->var, info);
>>>
>>> regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> if (!regs) {
>>> @@ -1093,18 +1289,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>>> goto unregister_irqs;
>>> }
>>>
>>> - /*
>>> - * This makes sure that our colour bitfield
>>> - * descriptors are correctly initialised.
>>> - */
>>> - atmel_lcdfb_check_var(&info->var, info);
>>> -
>>> - ret = fb_set_var(info, &info->var);
>>> - if (ret) {
>>> - dev_warn(dev, "unable to set display parameters\n");
>>> - goto free_cmap;
>>> - }
>>> -
>>> dev_set_drvdata(dev, info);
>>>
>>> /*
>>> @@ -1116,10 +1300,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>>> goto reset_drvdata;
>>> }
>>>
>>> - /* add selected videomode to modelist */
>>> - fb_var_to_videomode(&fbmode, &info->var);
>>> - fb_add_videomode(&fbmode, &info->modelist);
>>> -
>>> /* Power up the LCDC screen */
>>> atmel_lcdfb_power_control(sinfo, 1);
>>>
>>> @@ -1130,7 +1310,6 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>>>
>>> reset_drvdata:
>>> dev_set_drvdata(dev, NULL);
>>> -free_cmap:
>>> fb_dealloc_cmap(&info->cmap);
>>> unregister_irqs:
>>> cancel_work_sync(&sinfo->task);
>>> @@ -1249,6 +1428,7 @@ static struct platform_driver atmel_lcdfb_driver = {
>>> .driver = {
>>> .name = "atmel_lcdfb",
>>> .owner = THIS_MODULE,
>>> + .of_match_table = of_match_ptr(atmel_lcdfb_dt_ids),
>>> },
>>> };
>>>
>>>
>>
>>
>> --
>> Nicolas Ferre
>
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
[parent not found: <1365692422-9565-4-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH 4/8] video: atmel_lcdfb: add device tree suport
[not found] ` <1365692422-9565-4-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
@ 2013-05-29 15:01 ` Richard Genoud
0 siblings, 0 replies; 35+ messages in thread
From: Richard Genoud @ 2013-05-29 15:01 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Andreas Bießmann,
Andrew Morton, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
2013/4/11 Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>:
> get display timings from device tree
> Use videomode helpers to get display timings and configurations from
> device tree
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
> Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> ---
> .../devicetree/bindings/video/atmel,lcdc.txt | 75 ++++++
> drivers/video/Kconfig | 2 +
> drivers/video/atmel_lcdfb.c | 244 +++++++++++++++++---
> 3 files changed, 289 insertions(+), 32 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/video/atmel,lcdc.txt
>
> diff --git a/Documentation/devicetree/bindings/video/atmel,lcdc.txt b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
> new file mode 100644
> index 0000000..1ec175e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/atmel,lcdc.txt
> @@ -0,0 +1,75 @@
> +Atmel LCDC Framebuffer
> +-----------------------------------------------------
> +
> +Required properties:
> +- compatible :
> + "atmel,at91sam9261-lcdc" ,
> + "atmel,at91sam9263-lcdc" ,
> + "atmel,at91sam9g10-lcdc" ,
> + "atmel,at91sam9g45-lcdc" ,
> + "atmel,at91sam9g45es-lcdc" ,
> + "atmel,at91sam9rl-lcdc" ,
> + "atmel,at32ap-lcdc"
> +- reg : Should contain 1 register ranges(address and length)
> +- interrupts : framebuffer controller interrupt
> +- display: a phandle pointing to the display node
> +
> +Required nodes:
> +- display: a display node is required to initialize the lcd panel
> + This should be in the board dts.
> +- default-mode: a videomode within the display with timing parameters
> + as specified below.
> +
> +Example:
> +
> + fb0: fb@0x00500000 {
> + compatible = "atmel,at91sam9g45-lcdc";
> + reg = <0x00500000 0x1000>;
> + interrupts = <23 3 0>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_fb>;
> + display = <&display0>;
> + status = "okay";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + };
> +
> +Atmel LCDC Display
> +-----------------------------------------------------
> +Required properties (as per of_videomode_helper):
> +
> + - atmel,dmacon: dma controler configuration
> + - atmel,lcdcon2: lcd controler configuration
> + - atmel,guard-time: lcd guard time (Delay in frame periods)
> + - bits-per-pixel: lcd panel bit-depth.
> +
> +Optional properties (as per of_videomode_helper):
> + - atmel,lcdcon-backlight: enable backlight
> + - atmel,lcd-wiring-mode: lcd wiring mode "RGB" or "BRG"
> + - atmel,power-control-gpio: gpio to power on or off the LCD (as many as needed)
still on lcdcon_pol_negative, we can add something like that:
- atmel,lcdcon-pwm-pulse-low: Output PWM pulses are low level (high
level if not set)
> +
> +Example:
> + display0: display {
> + bits-per-pixel = <32>;
> + atmel,lcdcon-backlight;
> + atmel,dmacon = <0x1>;
> + atmel,lcdcon2 = <0x80008002>;
> + atmel,guard-time = <9>;
> + atmel,lcd-wiring-mode = <1>;
> +
> + display-timings {
> + native-mode = <&timing0>;
> + timing0: timing0 {
> + clock-frequency = <9000000>;
> + hactive = <480>;
> + vactive = <272>;
> + hback-porch = <1>;
> + hfront-porch = <1>;
> + vback-porch = <40>;
> + vfront-porch = <1>;
> + hsync-len = <45>;
> + vsync-len = <1>;
> + };
> + };
> + };
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 4c1546f..0687482 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -1018,6 +1018,8 @@ config FB_ATMEL
> select FB_CFB_FILLRECT
> select FB_CFB_COPYAREA
> select FB_CFB_IMAGEBLIT
> + select FB_MODE_HELPERS
> + select OF_VIDEOMODE
> help
> This enables support for the AT91/AT32 LCD Controller.
>
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index f67e226..4a31570 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -20,7 +20,11 @@
> #include <linux/gfp.h>
> #include <linux/module.h>
> #include <linux/platform_data/atmel.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_gpio.h>
> #include <video/of_display_timing.h>
> +#include <video/videomode.h>
>
> #include <mach/cpu.h>
> #include <asm/gpio.h>
> @@ -59,6 +63,13 @@ struct atmel_lcdfb_info {
> struct atmel_lcdfb_config *config;
> };
>
> +struct atmel_lcdfb_power_ctrl_gpio {
> + int gpio;
> + int active_low;
> +
> + struct list_head list;
> +};
> +
> #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
> #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
>
> @@ -945,16 +956,187 @@ static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
> clk_disable(sinfo->lcdc_clk);
> }
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id atmel_lcdfb_dt_ids[] = {
> + { .compatible = "atmel,at91sam9261-lcdc" , .data = &at91sam9261_config, },
> + { .compatible = "atmel,at91sam9263-lcdc" , .data = &at91sam9263_config, },
> + { .compatible = "atmel,at91sam9g10-lcdc" , .data = &at91sam9g10_config, },
> + { .compatible = "atmel,at91sam9g45-lcdc" , .data = &at91sam9g45_config, },
> + { .compatible = "atmel,at91sam9g45es-lcdc" , .data = &at91sam9g45es_config, },
> + { .compatible = "atmel,at91sam9rl-lcdc" , .data = &at91sam9rl_config, },
> + { .compatible = "atmel,at32ap-lcdc" , .data = &at32ap_config, },
> + { /* sentinel */ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, atmel_lcdfb_dt_ids);
> +
> +static const char *atmel_lcdfb_wiring_modes[] = {
> + [ATMEL_LCDC_WIRING_BGR] = "BRG",
> + [ATMEL_LCDC_WIRING_RGB] = "RGB",
> +};
> +
> +const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
> +{
> + const char *mode;
> + int err, i;
> +
> + err = of_property_read_string(np, "atmel,lcd-wiring-mode", &mode);
> + if (err < 0)
> + return ATMEL_LCDC_WIRING_BGR;
> +
> + for (i = 0; i < ARRAY_SIZE(atmel_lcdfb_wiring_modes); i++)
> + if (!strcasecmp(mode, atmel_lcdfb_wiring_modes[i]))
> + return i;
> +
> + return -ENODEV;
> +}
> +
> +static void atmel_lcdfb_power_control_gpio(struct atmel_lcdfb_pdata *pdata, int on)
> +{
> + struct atmel_lcdfb_power_ctrl_gpio *og;
> +
> + list_for_each_entry(og, &pdata->pwr_gpios, list)
> + gpio_set_value(og->gpio, on);
> +}
> +
> +static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
> +{
> + struct fb_info *info = sinfo->info;
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> + struct fb_var_screeninfo *var = &info->var;
> + struct device *dev = &sinfo->pdev->dev;
> + struct device_node *np =dev->of_node;
> + struct device_node *display_np;
> + struct device_node *timings_np;
> + struct display_timings *timings;
> + enum of_gpio_flags flags;
> + struct atmel_lcdfb_power_ctrl_gpio *og;
> + bool is_gpio_power = false;
> + int ret = -ENOENT;
> + int i, gpio;
> +
> + sinfo->config = (struct atmel_lcdfb_config*)
> + of_match_device(atmel_lcdfb_dt_ids, dev)->data;
> +
> + display_np = of_parse_phandle(np, "display", 0);
> + if (!display_np) {
> + dev_err(dev, "failed to find display phandle\n");
> + return -ENOENT;
> + }
> +
> + ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property bits-per-pixel\n");
> + goto put_display_node;
> + }
> +
> + ret = of_property_read_u32(display_np, "atmel,guard-time", &pdata->guard_time);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property atmel,guard-time\n");
> + goto put_display_node;
> + }
> +
> + ret = of_property_read_u32(display_np, "atmel,lcdcon2", &pdata->default_lcdcon2);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property atmel,lcdcon2\n");
> + goto put_display_node;
> + }
> +
> + ret = of_property_read_u32(display_np, "atmel,dmacon", &pdata->default_dmacon);
> + if (ret < 0) {
> + dev_err(dev, "failed to get property bits-per-pixel\n");
> + goto put_display_node;
> + }
> +
> + ret = -ENOMEM;
> + for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) {
> + gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio",
> + i, &flags);
> + if (gpio < 0)
> + continue;
> +
> + og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
> + if (!og)
> + goto put_display_node;
> +
> + og->gpio = gpio;
> + og->active_low = flags & OF_GPIO_ACTIVE_LOW;
> + is_gpio_power = true;
> + ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
> + if (ret) {
> + dev_err(dev, "request gpio %d failed\n", gpio);
> + goto put_display_node;
> + }
> +
> + ret = gpio_direction_output(gpio, og->active_low);
> + if (ret) {
> + dev_err(dev, "set direction output gpio %d failed\n", gpio);
> + goto put_display_node;
> + }
> + }
> +
> + if (is_gpio_power)
> + pdata->atmel_lcdfb_power_control = atmel_lcdfb_power_control_gpio;
> +
> + ret = atmel_lcdfb_get_of_wiring_modes(display_np);
> + if (ret < 0) {
> + dev_err(dev, "invalid atmel,lcd-wiring-mode\n");
> + goto put_display_node;
> + }
> + pdata->lcd_wiring_mode = ret;
> +
> + pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
and here, something like:
pdata->lcdcon_pol_negative = of_property_read_bool(display_np,
"atmel,lcdcon-pwm-pulse-low");
would be nice
Regards,
Richard.
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 5/8] ARM: at91: sam9g45: add lcd support
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
` (2 preceding siblings ...)
2013-04-11 15:00 ` [PATCH 4/8] video: atmel_lcdfb: add device tree suport Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11 15:00 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 13:57 ` Nicolas Ferre
2013-04-16 14:00 ` Nicolas Ferre
2013-04-11 15:00 ` [PATCH 6/8] ARM: at91: sam9263: add fb dt support Jean-Christophe PLAGNIOL-VILLARD
` (5 subsequent siblings)
9 siblings, 2 replies; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, devicetree-discuss,
Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
arch/arm/boot/dts/at91sam9g45.dtsi | 47 ++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 6b1d4ca..ab8a8fc 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -322,6 +322,42 @@
};
};
+ fb {
+ pinctrl_fb: fb-0 {
+ atmel,pins =
+ <4 0 0x1 0x0 /* PE0 periph A */
+ 4 2 0x1 0x0 /* PE2 periph A */
+ 4 3 0x1 0x0 /* PE3 periph A */
+ 4 4 0x1 0x0 /* PE4 periph A */
+ 4 5 0x1 0x0 /* PE5 periph A */
+ 4 6 0x1 0x0 /* PE6 periph A */
+ 4 7 0x1 0x0 /* PE7 periph A */
+ 4 8 0x1 0x0 /* PE8 periph A */
+ 4 9 0x1 0x0 /* PE9 periph A */
+ 4 10 0x1 0x0 /* PE10 periph A */
+ 4 11 0x1 0x0 /* PE11 periph A */
+ 4 12 0x1 0x0 /* PE12 periph A */
+ 4 13 0x1 0x0 /* PE13 periph A */
+ 4 14 0x1 0x0 /* PE14 periph A */
+ 4 15 0x1 0x0 /* PE15 periph A */
+ 4 16 0x1 0x0 /* PE16 periph A */
+ 4 17 0x1 0x0 /* PE17 periph A */
+ 4 18 0x1 0x0 /* PE18 periph A */
+ 4 19 0x1 0x0 /* PE19 periph A */
+ 4 20 0x1 0x0 /* PE20 periph A */
+ 4 21 0x1 0x0 /* PE21 periph A */
+ 4 22 0x1 0x0 /* PE22 periph A */
+ 4 23 0x1 0x0 /* PE23 periph A */
+ 4 24 0x1 0x0 /* PE24 periph A */
+ 4 25 0x1 0x0 /* PE25 periph A */
+ 4 26 0x1 0x0 /* PE26 periph A */
+ 4 27 0x1 0x0 /* PE27 periph A */
+ 4 28 0x1 0x0 /* PE28 periph A */
+ 4 29 0x1 0x0 /* PE29 periph A */
+ 4 30 0x1 0x0>; /* PE30 periph A */
+ };
+ };
+
pioA: gpio@fffff200 {
compatible = "atmel,at91rm9200-gpio";
reg = <0xfffff200 0x200>;
@@ -533,6 +569,17 @@
};
};
+ fb0: fb@0x00500000 {
+ compatible = "atmel,at91sam9g45-lcdc";
+ reg = <0x00500000 0x1000>;
+ interrupts = <23 3 0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_fb>;
+ status = "disabled";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
+
nand0: nand@40000000 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 5/8] ARM: at91: sam9g45: add lcd support
2013-04-11 15:00 ` [PATCH 5/8] ARM: at91: sam9g45: add lcd support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-16 13:57 ` Nicolas Ferre
2013-04-16 14:00 ` Nicolas Ferre
1 sibling, 0 replies; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 13:57 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: devicetree-discuss, linux-arm-kernel
On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> arch/arm/boot/dts/at91sam9g45.dtsi | 47 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
> index 6b1d4ca..ab8a8fc 100644
> --- a/arch/arm/boot/dts/at91sam9g45.dtsi
> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi
> @@ -322,6 +322,42 @@
> };
> };
>
> + fb {
> + pinctrl_fb: fb-0 {
> + atmel,pins =
> + <4 0 0x1 0x0 /* PE0 periph A */
> + 4 2 0x1 0x0 /* PE2 periph A */
> + 4 3 0x1 0x0 /* PE3 periph A */
> + 4 4 0x1 0x0 /* PE4 periph A */
> + 4 5 0x1 0x0 /* PE5 periph A */
> + 4 6 0x1 0x0 /* PE6 periph A */
> + 4 7 0x1 0x0 /* PE7 periph A */
> + 4 8 0x1 0x0 /* PE8 periph A */
> + 4 9 0x1 0x0 /* PE9 periph A */
> + 4 10 0x1 0x0 /* PE10 periph A */
> + 4 11 0x1 0x0 /* PE11 periph A */
> + 4 12 0x1 0x0 /* PE12 periph A */
> + 4 13 0x1 0x0 /* PE13 periph A */
> + 4 14 0x1 0x0 /* PE14 periph A */
> + 4 15 0x1 0x0 /* PE15 periph A */
> + 4 16 0x1 0x0 /* PE16 periph A */
> + 4 17 0x1 0x0 /* PE17 periph A */
> + 4 18 0x1 0x0 /* PE18 periph A */
> + 4 19 0x1 0x0 /* PE19 periph A */
> + 4 20 0x1 0x0 /* PE20 periph A */
> + 4 21 0x1 0x0 /* PE21 periph A */
> + 4 22 0x1 0x0 /* PE22 periph A */
> + 4 23 0x1 0x0 /* PE23 periph A */
> + 4 24 0x1 0x0 /* PE24 periph A */
> + 4 25 0x1 0x0 /* PE25 periph A */
> + 4 26 0x1 0x0 /* PE26 periph A */
> + 4 27 0x1 0x0 /* PE27 periph A */
> + 4 28 0x1 0x0 /* PE28 periph A */
> + 4 29 0x1 0x0 /* PE29 periph A */
> + 4 30 0x1 0x0>; /* PE30 periph A */
Verified, correct.
> + };
> + };
> +
> pioA: gpio@fffff200 {
> compatible = "atmel,at91rm9200-gpio";
> reg = <0xfffff200 0x200>;
> @@ -533,6 +569,17 @@
> };
> };
>
> + fb0: fb@0x00500000 {
> + compatible = "atmel,at91sam9g45-lcdc";
If we change to "atmel,at91sam9g45-lcdfb", we will have to change this
as-well.
> + reg = <0x00500000 0x1000>;
> + interrupts = <23 3 0>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_fb>;
> + status = "disabled";
> + #address-cells = <1>;
> + #size-cells = <1>;
I do not think we need these 2 properties: is a "reg" property existing
in child nodes?
> + };
> +
> nand0: nand@40000000 {
> compatible = "atmel,at91rm9200-nand";
> #address-cells = <1>;
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 5/8] ARM: at91: sam9g45: add lcd support
2013-04-11 15:00 ` [PATCH 5/8] ARM: at91: sam9g45: add lcd support Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 13:57 ` Nicolas Ferre
@ 2013-04-16 14:00 ` Nicolas Ferre
[not found] ` <516D5991.8020603-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 14:00 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: devicetree-discuss, linux-arm-kernel
On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> arch/arm/boot/dts/at91sam9g45.dtsi | 47 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
> index 6b1d4ca..ab8a8fc 100644
> --- a/arch/arm/boot/dts/at91sam9g45.dtsi
> +++ b/arch/arm/boot/dts/at91sam9g45.dtsi
> @@ -322,6 +322,42 @@
> };
> };
>
> + fb {
> + pinctrl_fb: fb-0 {
> + atmel,pins =
> + <4 0 0x1 0x0 /* PE0 periph A */
> + 4 2 0x1 0x0 /* PE2 periph A */
> + 4 3 0x1 0x0 /* PE3 periph A */
> + 4 4 0x1 0x0 /* PE4 periph A */
> + 4 5 0x1 0x0 /* PE5 periph A */
> + 4 6 0x1 0x0 /* PE6 periph A */
> + 4 7 0x1 0x0 /* PE7 periph A */
> + 4 8 0x1 0x0 /* PE8 periph A */
> + 4 9 0x1 0x0 /* PE9 periph A */
> + 4 10 0x1 0x0 /* PE10 periph A */
> + 4 11 0x1 0x0 /* PE11 periph A */
> + 4 12 0x1 0x0 /* PE12 periph A */
> + 4 13 0x1 0x0 /* PE13 periph A */
> + 4 14 0x1 0x0 /* PE14 periph A */
> + 4 15 0x1 0x0 /* PE15 periph A */
> + 4 16 0x1 0x0 /* PE16 periph A */
> + 4 17 0x1 0x0 /* PE17 periph A */
> + 4 18 0x1 0x0 /* PE18 periph A */
> + 4 19 0x1 0x0 /* PE19 periph A */
> + 4 20 0x1 0x0 /* PE20 periph A */
> + 4 21 0x1 0x0 /* PE21 periph A */
> + 4 22 0x1 0x0 /* PE22 periph A */
> + 4 23 0x1 0x0 /* PE23 periph A */
> + 4 24 0x1 0x0 /* PE24 periph A */
> + 4 25 0x1 0x0 /* PE25 periph A */
> + 4 26 0x1 0x0 /* PE26 periph A */
> + 4 27 0x1 0x0 /* PE27 periph A */
> + 4 28 0x1 0x0 /* PE28 periph A */
> + 4 29 0x1 0x0 /* PE29 periph A */
> + 4 30 0x1 0x0>; /* PE30 periph A */
> + };
> + };
> +
> pioA: gpio@fffff200 {
> compatible = "atmel,at91rm9200-gpio";
> reg = <0xfffff200 0x200>;
> @@ -533,6 +569,17 @@
> };
> };
>
> + fb0: fb@0x00500000 {
> + compatible = "atmel,at91sam9g45-lcdc";
> + reg = <0x00500000 0x1000>;
> + interrupts = <23 3 0>;
Error: here, it is <23 4 0>
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_fb>;
> + status = "disabled";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
> +
> nand0: nand@40000000 {
> compatible = "atmel,at91rm9200-nand";
> #address-cells = <1>;
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 6/8] ARM: at91: sam9263: add fb dt support
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
` (3 preceding siblings ...)
2013-04-11 15:00 ` [PATCH 5/8] ARM: at91: sam9g45: add lcd support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11 15:00 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 14:11 ` Nicolas Ferre
2013-04-11 15:00 ` [PATCH 7/8] ARM: at91: at9sam9m10g45ek: add dt lcd support Jean-Christophe PLAGNIOL-VILLARD
` (4 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, devicetree-discuss,
Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
arch/arm/boot/dts/at91sam9263.dtsi | 39 ++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 271d4de..3d0effa 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -303,6 +303,34 @@
};
};
+ fb {
+ pinctrl_fb: fb-0 {
+ atmel,pins =
+ <2 1 0x1 0x0 /* PC1 periph A */
+ 2 2 0x1 0x0 /* PC2 periph A */
+ 2 3 0x1 0x0 /* PC3 periph A */
+ 1 9 0x2 0x0 /* PB9 periph B */
+ 2 6 0x1 0x0 /* PC6 periph A */
+ 2 7 0x1 0x0 /* PC7 periph A */
+ 2 8 0x1 0x0 /* PC8 periph A */
+ 2 9 0x1 0x0 /* PC9 periph A */
+ 2 10 0x1 0x0 /* PC10 periph A */
+ 2 11 0x1 0x0 /* PC11 periph A */
+ 2 14 0x1 0x0 /* PC14 periph A */
+ 2 15 0x1 0x0 /* PC15 periph A */
+ 2 16 0x1 0x0 /* PC16 periph A */
+ 2 12 0x2 0x0 /* PC12 periph B */
+ 2 18 0x1 0x0 /* PC18 periph A */
+ 2 19 0x1 0x0 /* PC19 periph A */
+ 2 22 0x1 0x0 /* PC22 periph A */
+ 2 23 0x1 0x0 /* PC23 periph A */
+ 2 24 0x1 0x0 /* PC24 periph A */
+ 2 17 0x2 0x0 /* PC17 periph B */
+ 2 26 0x1 0x0 /* PC26 periph A */
+ 2 27 0x1 0x0>; /* PC27 periph A */
+ };
+ };
+
pioA: gpio@fffff200 {
compatible = "atmel,at91rm9200-gpio";
reg = <0xfffff200 0x200>;
@@ -464,6 +492,17 @@
};
};
+ fb0: fb@0x00500000 {
+ compatible = "atmel,at91sam9263-lcdc";
+ reg = <0x00700000 0x1000>;
+ interrupts = <26 3 0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_fb>;
+ status = "disabled";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
+
nand0: nand@40000000 {
compatible = "atmel,at91rm9200-nand";
#address-cells = <1>;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 6/8] ARM: at91: sam9263: add fb dt support
2013-04-11 15:00 ` [PATCH 6/8] ARM: at91: sam9263: add fb dt support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-16 14:11 ` Nicolas Ferre
2013-04-16 14:13 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 14:11 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: devicetree-discuss, linux-arm-kernel
On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> arch/arm/boot/dts/at91sam9263.dtsi | 39 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
> index 271d4de..3d0effa 100644
> --- a/arch/arm/boot/dts/at91sam9263.dtsi
> +++ b/arch/arm/boot/dts/at91sam9263.dtsi
> @@ -303,6 +303,34 @@
> };
> };
>
> + fb {
> + pinctrl_fb: fb-0 {
> + atmel,pins =
> + <2 1 0x1 0x0 /* PC1 periph A */
> + 2 2 0x1 0x0 /* PC2 periph A */
> + 2 3 0x1 0x0 /* PC3 periph A */
> + 1 9 0x2 0x0 /* PB9 periph B */
> + 2 6 0x1 0x0 /* PC6 periph A */
> + 2 7 0x1 0x0 /* PC7 periph A */
> + 2 8 0x1 0x0 /* PC8 periph A */
> + 2 9 0x1 0x0 /* PC9 periph A */
> + 2 10 0x1 0x0 /* PC10 periph A */
> + 2 11 0x1 0x0 /* PC11 periph A */
> + 2 14 0x1 0x0 /* PC14 periph A */
> + 2 15 0x1 0x0 /* PC15 periph A */
> + 2 16 0x1 0x0 /* PC16 periph A */
> + 2 12 0x2 0x0 /* PC12 periph B */
> + 2 18 0x1 0x0 /* PC18 periph A */
> + 2 19 0x1 0x0 /* PC19 periph A */
> + 2 22 0x1 0x0 /* PC22 periph A */
> + 2 23 0x1 0x0 /* PC23 periph A */
> + 2 24 0x1 0x0 /* PC24 periph A */
> + 2 17 0x2 0x0 /* PC17 periph B */
> + 2 26 0x1 0x0 /* PC26 periph A */
> + 2 27 0x1 0x0>; /* PC27 periph A */
Verified, okay.
> + };
> + };
> +
> pioA: gpio@fffff200 {
> compatible = "atmel,at91rm9200-gpio";
> reg = <0xfffff200 0x200>;
> @@ -464,6 +492,17 @@
> };
> };
>
> + fb0: fb@0x00500000 {
No, it is 0x700000
> + compatible = "atmel,at91sam9263-lcdc";
> + reg = <0x00700000 0x1000>;
Ditto.
> + interrupts = <26 3 0>;
<26 4 0> here.
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_fb>;
> + status = "disabled";
> + #address-cells = <1>;
> + #size-cells = <1>;
Ditto in 9g45 case.
> + };
> +
> nand0: nand@40000000 {
> compatible = "atmel,at91rm9200-nand";
> #address-cells = <1>;
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 6/8] ARM: at91: sam9263: add fb dt support
2013-04-16 14:11 ` Nicolas Ferre
@ 2013-04-16 14:13 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 15:11 ` Nicolas Ferre
0 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-16 14:13 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: devicetree-discuss, linux-arm-kernel
On 16:11 Tue 16 Apr , Nicolas Ferre wrote:
> On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> > ---
> > arch/arm/boot/dts/at91sam9263.dtsi | 39 ++++++++++++++++++++++++++++++++++++
> > 1 file changed, 39 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
> > index 271d4de..3d0effa 100644
> > --- a/arch/arm/boot/dts/at91sam9263.dtsi
> > +++ b/arch/arm/boot/dts/at91sam9263.dtsi
> > @@ -303,6 +303,34 @@
> > };
> > };
> >
> > + fb {
> > + pinctrl_fb: fb-0 {
> > + atmel,pins =
> > + <2 1 0x1 0x0 /* PC1 periph A */
> > + 2 2 0x1 0x0 /* PC2 periph A */
> > + 2 3 0x1 0x0 /* PC3 periph A */
> > + 1 9 0x2 0x0 /* PB9 periph B */
> > + 2 6 0x1 0x0 /* PC6 periph A */
> > + 2 7 0x1 0x0 /* PC7 periph A */
> > + 2 8 0x1 0x0 /* PC8 periph A */
> > + 2 9 0x1 0x0 /* PC9 periph A */
> > + 2 10 0x1 0x0 /* PC10 periph A */
> > + 2 11 0x1 0x0 /* PC11 periph A */
> > + 2 14 0x1 0x0 /* PC14 periph A */
> > + 2 15 0x1 0x0 /* PC15 periph A */
> > + 2 16 0x1 0x0 /* PC16 periph A */
> > + 2 12 0x2 0x0 /* PC12 periph B */
> > + 2 18 0x1 0x0 /* PC18 periph A */
> > + 2 19 0x1 0x0 /* PC19 periph A */
> > + 2 22 0x1 0x0 /* PC22 periph A */
> > + 2 23 0x1 0x0 /* PC23 periph A */
> > + 2 24 0x1 0x0 /* PC24 periph A */
> > + 2 17 0x2 0x0 /* PC17 periph B */
> > + 2 26 0x1 0x0 /* PC26 periph A */
> > + 2 27 0x1 0x0>; /* PC27 periph A */
>
> Verified, okay.
>
> > + };
> > + };
> > +
> > pioA: gpio@fffff200 {
> > compatible = "atmel,at91rm9200-gpio";
> > reg = <0xfffff200 0x200>;
> > @@ -464,6 +492,17 @@
> > };
> > };
> >
> > + fb0: fb@0x00500000 {
>
> No, it is 0x700000
>
> > + compatible = "atmel,at91sam9263-lcdc";
> > + reg = <0x00700000 0x1000>;
>
> Ditto.
>
> > + interrupts = <26 3 0>;
>
> <26 4 0> here.
no lcd is 3 even in c
and even 3 could be slow in some big lcd case
>
>
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&pinctrl_fb>;
> > + status = "disabled";
> > + #address-cells = <1>;
> > + #size-cells = <1>;
>
> Ditto in 9g45 case.
>
> > + };
> > +
> > nand0: nand@40000000 {
> > compatible = "atmel,at91rm9200-nand";
> > #address-cells = <1>;
> >
>
>
> --
> Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 6/8] ARM: at91: sam9263: add fb dt support
2013-04-16 14:13 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-16 15:11 ` Nicolas Ferre
2013-04-16 15:48 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 15:11 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: devicetree-discuss, linux-arm-kernel
On 04/16/2013 04:13 PM, Jean-Christophe PLAGNIOL-VILLARD :
> On 16:11 Tue 16 Apr , Nicolas Ferre wrote:
>> On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
>>> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
>>> ---
>>> arch/arm/boot/dts/at91sam9263.dtsi | 39 ++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 39 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
>>> index 271d4de..3d0effa 100644
>>> --- a/arch/arm/boot/dts/at91sam9263.dtsi
>>> +++ b/arch/arm/boot/dts/at91sam9263.dtsi
>>> @@ -303,6 +303,34 @@
>>> };
>>> };
>>>
>>> + fb {
>>> + pinctrl_fb: fb-0 {
>>> + atmel,pins =
>>> + <2 1 0x1 0x0 /* PC1 periph A */
>>> + 2 2 0x1 0x0 /* PC2 periph A */
>>> + 2 3 0x1 0x0 /* PC3 periph A */
>>> + 1 9 0x2 0x0 /* PB9 periph B */
>>> + 2 6 0x1 0x0 /* PC6 periph A */
>>> + 2 7 0x1 0x0 /* PC7 periph A */
>>> + 2 8 0x1 0x0 /* PC8 periph A */
>>> + 2 9 0x1 0x0 /* PC9 periph A */
>>> + 2 10 0x1 0x0 /* PC10 periph A */
>>> + 2 11 0x1 0x0 /* PC11 periph A */
>>> + 2 14 0x1 0x0 /* PC14 periph A */
>>> + 2 15 0x1 0x0 /* PC15 periph A */
>>> + 2 16 0x1 0x0 /* PC16 periph A */
>>> + 2 12 0x2 0x0 /* PC12 periph B */
>>> + 2 18 0x1 0x0 /* PC18 periph A */
>>> + 2 19 0x1 0x0 /* PC19 periph A */
>>> + 2 22 0x1 0x0 /* PC22 periph A */
>>> + 2 23 0x1 0x0 /* PC23 periph A */
>>> + 2 24 0x1 0x0 /* PC24 periph A */
>>> + 2 17 0x2 0x0 /* PC17 periph B */
>>> + 2 26 0x1 0x0 /* PC26 periph A */
>>> + 2 27 0x1 0x0>; /* PC27 periph A */
>>
>> Verified, okay.
>>
>>> + };
>>> + };
>>> +
>>> pioA: gpio@fffff200 {
>>> compatible = "atmel,at91rm9200-gpio";
>>> reg = <0xfffff200 0x200>;
>>> @@ -464,6 +492,17 @@
>>> };
>>> };
>>>
>>> + fb0: fb@0x00500000 {
>>
>> No, it is 0x700000
>>
>>> + compatible = "atmel,at91sam9263-lcdc";
>>> + reg = <0x00700000 0x1000>;
>>
>> Ditto.
>>
>>> + interrupts = <26 3 0>;
>>
>> <26 4 0> here.
> no lcd is 3 even in c
>
> and even 3 could be slow in some big lcd case
No, you mean the priority, but priority is encoded as the 3rd cell. So,
we end up with:
<26 4 3>
(I agree with the 3)
>>
>>
>>> + pinctrl-names = "default";
>>> + pinctrl-0 = <&pinctrl_fb>;
>>> + status = "disabled";
>>> + #address-cells = <1>;
>>> + #size-cells = <1>;
>>
>> Ditto in 9g45 case.
>>
>>> + };
>>> +
>>> nand0: nand@40000000 {
>>> compatible = "atmel,at91rm9200-nand";
>>> #address-cells = <1>;
>>>
>>
>>
>> --
>> Nicolas Ferre
>
Bye,
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 6/8] ARM: at91: sam9263: add fb dt support
2013-04-16 15:11 ` Nicolas Ferre
@ 2013-04-16 15:48 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-16 15:48 UTC (permalink / raw)
To: Nicolas Ferre; +Cc: devicetree-discuss, linux-arm-kernel
On 17:11 Tue 16 Apr , Nicolas Ferre wrote:
> On 04/16/2013 04:13 PM, Jean-Christophe PLAGNIOL-VILLARD :
> > On 16:11 Tue 16 Apr , Nicolas Ferre wrote:
> >> On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> >>> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> >>> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> >>> ---
> >>> arch/arm/boot/dts/at91sam9263.dtsi | 39 ++++++++++++++++++++++++++++++++++++
> >>> 1 file changed, 39 insertions(+)
> >>>
> >>> diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
> >>> index 271d4de..3d0effa 100644
> >>> --- a/arch/arm/boot/dts/at91sam9263.dtsi
> >>> +++ b/arch/arm/boot/dts/at91sam9263.dtsi
> >>> @@ -303,6 +303,34 @@
> >>> };
> >>> };
> >>>
> >>> + fb {
> >>> + pinctrl_fb: fb-0 {
> >>> + atmel,pins =
> >>> + <2 1 0x1 0x0 /* PC1 periph A */
> >>> + 2 2 0x1 0x0 /* PC2 periph A */
> >>> + 2 3 0x1 0x0 /* PC3 periph A */
> >>> + 1 9 0x2 0x0 /* PB9 periph B */
> >>> + 2 6 0x1 0x0 /* PC6 periph A */
> >>> + 2 7 0x1 0x0 /* PC7 periph A */
> >>> + 2 8 0x1 0x0 /* PC8 periph A */
> >>> + 2 9 0x1 0x0 /* PC9 periph A */
> >>> + 2 10 0x1 0x0 /* PC10 periph A */
> >>> + 2 11 0x1 0x0 /* PC11 periph A */
> >>> + 2 14 0x1 0x0 /* PC14 periph A */
> >>> + 2 15 0x1 0x0 /* PC15 periph A */
> >>> + 2 16 0x1 0x0 /* PC16 periph A */
> >>> + 2 12 0x2 0x0 /* PC12 periph B */
> >>> + 2 18 0x1 0x0 /* PC18 periph A */
> >>> + 2 19 0x1 0x0 /* PC19 periph A */
> >>> + 2 22 0x1 0x0 /* PC22 periph A */
> >>> + 2 23 0x1 0x0 /* PC23 periph A */
> >>> + 2 24 0x1 0x0 /* PC24 periph A */
> >>> + 2 17 0x2 0x0 /* PC17 periph B */
> >>> + 2 26 0x1 0x0 /* PC26 periph A */
> >>> + 2 27 0x1 0x0>; /* PC27 periph A */
> >>
> >> Verified, okay.
> >>
> >>> + };
> >>> + };
> >>> +
> >>> pioA: gpio@fffff200 {
> >>> compatible = "atmel,at91rm9200-gpio";
> >>> reg = <0xfffff200 0x200>;
> >>> @@ -464,6 +492,17 @@
> >>> };
> >>> };
> >>>
> >>> + fb0: fb@0x00500000 {
> >>
> >> No, it is 0x700000
> >>
> >>> + compatible = "atmel,at91sam9263-lcdc";
> >>> + reg = <0x00700000 0x1000>;
> >>
> >> Ditto.
> >>
> >>> + interrupts = <26 3 0>;
> >>
> >> <26 4 0> here.
> > no lcd is 3 even in c
> >
> > and even 3 could be slow in some big lcd case
>
> No, you mean the priority, but priority is encoded as the 3rd cell. So,
> we end up with:
>
> <26 4 3>
>
> (I agree with the 3)
I hate those magic number
so this is the las patch to go in with as soon as the macro for dts are in I
free the at91 dts and switch to it
>
>
> >>
> >>
> >>> + pinctrl-names = "default";
> >>> + pinctrl-0 = <&pinctrl_fb>;
> >>> + status = "disabled";
> >>> + #address-cells = <1>;
> >>> + #size-cells = <1>;
> >>
> >> Ditto in 9g45 case.
> >>
> >>> + };
> >>> +
> >>> nand0: nand@40000000 {
> >>> compatible = "atmel,at91rm9200-nand";
> >>> #address-cells = <1>;
> >>>
> >>
> >>
> >> --
> >> Nicolas Ferre
> >
>
> Bye,
> --
> Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 7/8] ARM: at91: at9sam9m10g45ek: add dt lcd support
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
` (4 preceding siblings ...)
2013-04-11 15:00 ` [PATCH 6/8] ARM: at91: sam9263: add fb dt support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11 15:00 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 14:56 ` Nicolas Ferre
2013-04-11 15:00 ` [PATCH 8/8] ARM: at91: sam9263ek: " Jean-Christophe PLAGNIOL-VILLARD
` (3 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, devicetree-discuss,
Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
arch/arm/boot/dts/at91sam9m10g45ek.dts | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 20c3191..79dc034 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -104,6 +104,35 @@
};
};
+ fb0: fb@0x00500000 {
+ display = <&display0>;
+ status = "okay";
+
+ display0: display {
+ bits-per-pixel = <32>;
+ atmel,lcdcon-backlight;
+ atmel,dmacon = <0x1>;
+ atmel,lcdcon2 = <0x80008002>;
+ atmel,guard-time = <9>;
+ atmel,lcd-wiring-mode = "RGB";
+
+ display-timings {
+ native-mode = <&timing0>;
+ timing0: timing0 {
+ clock-frequency = <9000000>;
+ hactive = <480>;
+ vactive = <272>;
+ hback-porch = <1>;
+ hfront-porch = <1>;
+ vback-porch = <40>;
+ vfront-porch = <1>;
+ hsync-len = <45>;
+ vsync-len = <1>;
+ };
+ };
+ };
+ };
+
nand0: nand@40000000 {
nand-bus-width = <8>;
nand-ecc-mode = "soft";
--
1.7.10.4
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 7/8] ARM: at91: at9sam9m10g45ek: add dt lcd support
2013-04-11 15:00 ` [PATCH 7/8] ARM: at91: at9sam9m10g45ek: add dt lcd support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-16 14:56 ` Nicolas Ferre
0 siblings, 0 replies; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 14:56 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: devicetree-discuss, linux-arm-kernel
On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> arch/arm/boot/dts/at91sam9m10g45ek.dts | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
> index 20c3191..79dc034 100644
> --- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
> +++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
> @@ -104,6 +104,35 @@
> };
> };
>
> + fb0: fb@0x00500000 {
> + display = <&display0>;
> + status = "okay";
> +
> + display0: display {
> + bits-per-pixel = <32>;
> + atmel,lcdcon-backlight;
> + atmel,dmacon = <0x1>;
> + atmel,lcdcon2 = <0x80008002>;
> + atmel,guard-time = <9>;
> + atmel,lcd-wiring-mode = "RGB";
> +
> + display-timings {
> + native-mode = <&timing0>;
> + timing0: timing0 {
> + clock-frequency = <9000000>;
> + hactive = <480>;
> + vactive = <272>;
> + hback-porch = <1>;
> + hfront-porch = <1>;
> + vback-porch = <40>;
> + vfront-porch = <1>;
> + hsync-len = <45>;
> + vsync-len = <1>;
> + };
> + };
> + };
> + };
> +
Seems good.
> nand0: nand@40000000 {
> nand-bus-width = <8>;
> nand-ecc-mode = "soft";
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH 8/8] ARM: at91: sam9263ek: add dt lcd support
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
` (5 preceding siblings ...)
2013-04-11 15:00 ` [PATCH 7/8] ARM: at91: at9sam9m10g45ek: add dt lcd support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-11 15:00 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-16 14:54 ` Nicolas Ferre
2013-04-12 9:52 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Hans-Christian Egtvedt
` (2 subsequent siblings)
9 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-11 15:00 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nicolas Ferre, devicetree-discuss,
Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
arch/arm/boot/dts/at91sam9263ek.dts | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index 1eb0872..d471b49 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -81,6 +81,36 @@
};
};
+ fb0: fb@0x00500000 {
+ display = <&display0>;
+ status = "okay";
+
+ display0: display {
+ bits-per-pixel = <16>;
+ atmel,lcdcon-backlight;
+ atmel,dmacon = <0x1>;
+ atmel,lcdcon2 = <0x80008002>;
+ atmel,guard-time = <1>;
+
+ display-timings {
+ native-mode = <&timing0>;
+ timing0: timing0 {
+ clock-frequency = <4965000>;
+ hactive = <240>;
+ vactive = <320>;
+ hback-porch = <1>;
+ hfront-porch = <33>;
+ vback-porch = <1>;
+ vfront-porch = <0>;
+ hsync-len = <5>;
+ vsync-len = <1>;
+ hsync-active = <1>;
+ vsync-active = <1>;
+ };
+ };
+ };
+ };
+
nand0: nand@40000000 {
nand-bus-width = <8>;
nand-ecc-mode = "soft";
--
1.7.10.4
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH 8/8] ARM: at91: sam9263ek: add dt lcd support
2013-04-11 15:00 ` [PATCH 8/8] ARM: at91: sam9263ek: " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-16 14:54 ` Nicolas Ferre
0 siblings, 0 replies; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 14:54 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: devicetree-discuss, linux-arm-kernel
On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> arch/arm/boot/dts/at91sam9263ek.dts | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
> index 1eb0872..d471b49 100644
> --- a/arch/arm/boot/dts/at91sam9263ek.dts
> +++ b/arch/arm/boot/dts/at91sam9263ek.dts
> @@ -81,6 +81,36 @@
> };
> };
>
> + fb0: fb@0x00500000 {
Ditto: Not good address: 0x700000
> + display = <&display0>;
> + status = "okay";
> +
> + display0: display {
> + bits-per-pixel = <16>;
> + atmel,lcdcon-backlight;
> + atmel,dmacon = <0x1>;
> + atmel,lcdcon2 = <0x80008002>;
> + atmel,guard-time = <1>;
> +
> + display-timings {
> + native-mode = <&timing0>;
> + timing0: timing0 {
> + clock-frequency = <4965000>;
> + hactive = <240>;
> + vactive = <320>;
> + hback-porch = <1>;
> + hfront-porch = <33>;
> + vback-porch = <1>;
> + vfront-porch = <0>;
> + hsync-len = <5>;
> + vsync-len = <1>;
> + hsync-active = <1>;
> + vsync-active = <1>;
> + };
> + };
> + };
> + };
Otherwise, seems good.
> +
> nand0: nand@40000000 {
> nand-bus-width = <8>;
> nand-ecc-mode = "soft";
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 1/8] video: atmel_lcdfb: fix platform data struct
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
` (6 preceding siblings ...)
2013-04-11 15:00 ` [PATCH 8/8] ARM: at91: sam9263ek: " Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-12 9:52 ` Hans-Christian Egtvedt
2013-04-16 12:33 ` Nicolas Ferre
[not found] ` <1365692422-9565-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
9 siblings, 0 replies; 35+ messages in thread
From: Hans-Christian Egtvedt @ 2013-04-12 9:52 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Andrew Morton, devicetree-discuss, Nicolas Ferre, linux-fbdev,
linux-arm-kernel
Around Thu 11 Apr 2013 17:00:15 +0200 or thereabout, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Today we mix pdata and drivers data in the struct atmel_lcdfb_info
> Fix it and introduce a new struct atmel_lcdfb_pdata for platform data only
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
For the AVR32 bits
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> ---
> arch/arm/mach-at91/at91sam9261_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9263_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9g45_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9rl_devices.c | 6 +-
> arch/arm/mach-at91/board-sam9261ek.c | 6 +-
> arch/arm/mach-at91/board-sam9263ek.c | 4 +-
> arch/arm/mach-at91/board-sam9m10g45ek.c | 4 +-
> arch/arm/mach-at91/board-sam9rlek.c | 4 +-
> arch/arm/mach-at91/board.h | 4 +-
> arch/avr32/boards/atngw100/evklcd10x.c | 6 +-
> arch/avr32/boards/atngw100/mrmt.c | 4 +-
> arch/avr32/boards/atstk1000/atstk1000.h | 2 +-
> arch/avr32/boards/atstk1000/setup.c | 2 +-
> arch/avr32/boards/favr-32/setup.c | 2 +-
> arch/avr32/boards/hammerhead/setup.c | 2 +-
> arch/avr32/boards/merisc/display.c | 2 +-
> arch/avr32/boards/mimc200/setup.c | 4 +-
> arch/avr32/mach-at32ap/at32ap700x.c | 8 +--
> arch/avr32/mach-at32ap/include/mach/board.h | 4 +-
> drivers/video/atmel_lcdfb.c | 104 +++++++++++++++++----------
> include/video/atmel_lcdc.h | 24 +------
> 21 files changed, 109 insertions(+), 101 deletions(-)
<snipp diff>
--
HcE
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 1/8] video: atmel_lcdfb: fix platform data struct
2013-04-11 15:00 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Jean-Christophe PLAGNIOL-VILLARD
` (7 preceding siblings ...)
2013-04-12 9:52 ` [PATCH 1/8] video: atmel_lcdfb: fix platform data struct Hans-Christian Egtvedt
@ 2013-04-16 12:33 ` Nicolas Ferre
[not found] ` <1365692422-9565-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
9 siblings, 0 replies; 35+ messages in thread
From: Nicolas Ferre @ 2013-04-16 12:33 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: Andrew Morton, devicetree-discuss, linux-fbdev, linux-arm-kernel,
Hans-Christian Egtvedt
On 04/11/2013 05:00 PM, Jean-Christophe PLAGNIOL-VILLARD :
> Today we mix pdata and drivers data in the struct atmel_lcdfb_info
> Fix it and introduce a new struct atmel_lcdfb_pdata for platform data only
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> ---
> arch/arm/mach-at91/at91sam9261_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9263_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9g45_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9rl_devices.c | 6 +-
> arch/arm/mach-at91/board-sam9261ek.c | 6 +-
> arch/arm/mach-at91/board-sam9263ek.c | 4 +-
> arch/arm/mach-at91/board-sam9m10g45ek.c | 4 +-
> arch/arm/mach-at91/board-sam9rlek.c | 4 +-
> arch/arm/mach-at91/board.h | 4 +-
> arch/avr32/boards/atngw100/evklcd10x.c | 6 +-
> arch/avr32/boards/atngw100/mrmt.c | 4 +-
> arch/avr32/boards/atstk1000/atstk1000.h | 2 +-
> arch/avr32/boards/atstk1000/setup.c | 2 +-
> arch/avr32/boards/favr-32/setup.c | 2 +-
> arch/avr32/boards/hammerhead/setup.c | 2 +-
> arch/avr32/boards/merisc/display.c | 2 +-
> arch/avr32/boards/mimc200/setup.c | 4 +-
> arch/avr32/mach-at32ap/at32ap700x.c | 8 +--
> arch/avr32/mach-at32ap/include/mach/board.h | 4 +-
> drivers/video/atmel_lcdfb.c | 104 +++++++++++++++++----------
> include/video/atmel_lcdc.h | 24 +------
> 21 files changed, 109 insertions(+), 101 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
> index 629ea5f..b2a3474 100644
> --- a/arch/arm/mach-at91/at91sam9261_devices.c
> +++ b/arch/arm/mach-at91/at91sam9261_devices.c
> @@ -465,7 +465,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
>
> #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
> static u64 lcdc_dmamask = DMA_BIT_MASK(32);
> -static struct atmel_lcdfb_info lcdc_data;
> +static struct atmel_lcdfb_pdata lcdc_data;
>
> static struct resource lcdc_resources[] = {
> [0] = {
> @@ -498,7 +498,7 @@ static struct platform_device at91_lcdc_device = {
> .num_resources = ARRAY_SIZE(lcdc_resources),
> };
>
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
> {
> if (!data) {
> return;
> @@ -559,7 +559,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> platform_device_register(&at91_lcdc_device);
> }
> #else
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
> #endif
>
>
> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
> index 858c8aa..4aeaddd 100644
> --- a/arch/arm/mach-at91/at91sam9263_devices.c
> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
> @@ -832,7 +832,7 @@ void __init at91_add_device_can(struct at91_can_data *data) {}
>
> #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
> static u64 lcdc_dmamask = DMA_BIT_MASK(32);
> -static struct atmel_lcdfb_info lcdc_data;
> +static struct atmel_lcdfb_pdata lcdc_data;
>
> static struct resource lcdc_resources[] = {
> [0] = {
> @@ -859,7 +859,7 @@ static struct platform_device at91_lcdc_device = {
> .num_resources = ARRAY_SIZE(lcdc_resources),
> };
>
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
> {
> if (!data)
> return;
> @@ -891,7 +891,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> platform_device_register(&at91_lcdc_device);
> }
> #else
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
> #endif
>
>
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index fe626d4..82636c7 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -965,7 +965,7 @@ void __init at91_add_device_isi(struct isi_platform_data *data,
>
> #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
> static u64 lcdc_dmamask = DMA_BIT_MASK(32);
> -static struct atmel_lcdfb_info lcdc_data;
> +static struct atmel_lcdfb_pdata lcdc_data;
>
> static struct resource lcdc_resources[] = {
> [0] = {
> @@ -991,7 +991,7 @@ static struct platform_device at91_lcdc_device = {
> .num_resources = ARRAY_SIZE(lcdc_resources),
> };
>
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
> {
> if (!data)
> return;
> @@ -1037,7 +1037,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> platform_device_register(&at91_lcdc_device);
> }
> #else
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
> #endif
>
>
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
> index 352468f..a698bda 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -498,7 +498,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}
>
> #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
> static u64 lcdc_dmamask = DMA_BIT_MASK(32);
> -static struct atmel_lcdfb_info lcdc_data;
> +static struct atmel_lcdfb_pdata lcdc_data;
>
> static struct resource lcdc_resources[] = {
> [0] = {
> @@ -525,7 +525,7 @@ static struct platform_device at91_lcdc_device = {
> .num_resources = ARRAY_SIZE(lcdc_resources),
> };
>
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)
> {
> if (!data) {
> return;
> @@ -557,7 +557,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
> platform_device_register(&at91_lcdc_device);
> }
> #else
> -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
> +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}
> #endif
>
>
> diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
> index b446645..c819e29 100644
> --- a/arch/arm/mach-at91/board-sam9261ek.c
> +++ b/arch/arm/mach-at91/board-sam9261ek.c
> @@ -405,7 +405,7 @@ static void at91_lcdc_stn_power_control(int on)
> }
> }
>
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
> .default_bpp = 1,
> .default_dmacon = ATMEL_LCDC_DMAEN,
> .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2,
> @@ -460,7 +460,7 @@ static void at91_lcdc_tft_power_control(int on)
> at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */
> }
>
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
> .lcdcon_is_backlight = true,
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN,
> @@ -475,7 +475,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> #endif
>
> #else
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data;
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
> #endif
>
>
> diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
> index 3284df0..0fdae3f 100644
> --- a/arch/arm/mach-at91/board-sam9263ek.c
> +++ b/arch/arm/mach-at91/board-sam9263ek.c
> @@ -281,7 +281,7 @@ static void at91_lcdc_power_control(int on)
> }
>
> /* Driver datas */
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
> .lcdcon_is_backlight = true,
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN,
> @@ -292,7 +292,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> };
>
> #else
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data;
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
> #endif
>
>
> diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
> index 2a94896..ef39078 100644
> --- a/arch/arm/mach-at91/board-sam9m10g45ek.c
> +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
> @@ -284,7 +284,7 @@ static struct fb_monspecs at91fb_default_monspecs = {
> | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
>
> /* Driver datas */
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
> .lcdcon_is_backlight = true,
> .default_bpp = 32,
> .default_dmacon = ATMEL_LCDC_DMAEN,
> @@ -295,7 +295,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> };
>
> #else
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data;
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
> #endif
>
>
> diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
> index aa265dc..b77d7a9 100644
> --- a/arch/arm/mach-at91/board-sam9rlek.c
> +++ b/arch/arm/mach-at91/board-sam9rlek.c
> @@ -179,7 +179,7 @@ static void at91_lcdc_power_control(int on)
> }
>
> /* Driver datas */
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data = {
> .lcdcon_is_backlight = true,
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN,
> @@ -191,7 +191,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
> };
>
> #else
> -static struct atmel_lcdfb_info __initdata ek_lcdc_data;
> +static struct atmel_lcdfb_pdata __initdata ek_lcdc_data;
> #endif
>
>
> diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
> index 4a234fb..6c08b34 100644
> --- a/arch/arm/mach-at91/board.h
> +++ b/arch/arm/mach-at91/board.h
> @@ -107,8 +107,8 @@ extern void __init at91_add_device_pwm(u32 mask);
> extern void __init at91_add_device_ssc(unsigned id, unsigned pins);
>
> /* LCD Controller */
> -struct atmel_lcdfb_info;
> -extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data);
> +struct atmel_lcdfb_pdata;
> +extern void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data);
>
> /* AC97 */
> extern void __init at91_add_device_ac97(struct ac97c_platform_data *data);
> diff --git a/arch/avr32/boards/atngw100/evklcd10x.c b/arch/avr32/boards/atngw100/evklcd10x.c
> index 2038875..dc42804 100644
> --- a/arch/avr32/boards/atngw100/evklcd10x.c
> +++ b/arch/avr32/boards/atngw100/evklcd10x.c
> @@ -58,7 +58,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
> .dclkmax = 28330000,
> };
>
> -static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> @@ -96,7 +96,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
> .dclkmax = 7000000,
> };
>
> -static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> @@ -134,7 +134,7 @@ static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
> .dclkmax = 6400000,
> };
>
> -static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> diff --git a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
> index f914319..ccc9599 100644
> --- a/arch/avr32/boards/atngw100/mrmt.c
> +++ b/arch/avr32/boards/atngw100/mrmt.c
> @@ -83,7 +83,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
> .dclkmax = 9260000,
> };
>
> -static struct atmel_lcdfb_info __initdata rmt_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
> .default_bpp = 24,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> @@ -126,7 +126,7 @@ static struct fb_monspecs __initdata lcd_fb_default_monspecs = {
> .dclkmax = 9260000,
> };
>
> -static struct atmel_lcdfb_info __initdata rmt_lcdc_data = {
> +static struct atmel_lcdfb_pdata __initdata rmt_lcdc_data = {
> .default_bpp = 24,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> diff --git a/arch/avr32/boards/atstk1000/atstk1000.h b/arch/avr32/boards/atstk1000/atstk1000.h
> index 9392d32..653cc09 100644
> --- a/arch/avr32/boards/atstk1000/atstk1000.h
> +++ b/arch/avr32/boards/atstk1000/atstk1000.h
> @@ -10,7 +10,7 @@
> #ifndef __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
> #define __ARCH_AVR32_BOARDS_ATSTK1000_ATSTK1000_H
>
> -extern struct atmel_lcdfb_info atstk1000_lcdc_data;
> +extern struct atmel_lcdfb_pdata atstk1000_lcdc_data;
>
> void atstk1000_setup_j2_leds(void);
>
> diff --git a/arch/avr32/boards/atstk1000/setup.c b/arch/avr32/boards/atstk1000/setup.c
> index 2d6b560..b6b88f5 100644
> --- a/arch/avr32/boards/atstk1000/setup.c
> +++ b/arch/avr32/boards/atstk1000/setup.c
> @@ -55,7 +55,7 @@ static struct fb_monspecs __initdata atstk1000_default_monspecs = {
> .dclkmax = 30000000,
> };
>
> -struct atmel_lcdfb_info __initdata atstk1000_lcdc_data = {
> +struct atmel_lcdfb_pdata __initdata atstk1000_lcdc_data = {
> .default_bpp = 24,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
> index 27bd6fb..7b1f2cd 100644
> --- a/arch/avr32/boards/favr-32/setup.c
> +++ b/arch/avr32/boards/favr-32/setup.c
> @@ -125,7 +125,7 @@ static struct fb_monspecs __initdata favr32_default_monspecs = {
> .dclkmax = 28000000,
> };
>
> -struct atmel_lcdfb_info __initdata favr32_lcdc_data = {
> +struct atmel_lcdfb_pdata __initdata favr32_lcdc_data = {
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c
> index 9d1efd1..dc0e317 100644
> --- a/arch/avr32/boards/hammerhead/setup.c
> +++ b/arch/avr32/boards/hammerhead/setup.c
> @@ -77,7 +77,7 @@ static struct fb_monspecs __initdata hammerhead_hda350t_monspecs = {
> .dclkmax = 10000000,
> };
>
> -struct atmel_lcdfb_info __initdata hammerhead_lcdc_data = {
> +struct atmel_lcdfb_pdata __initdata hammerhead_lcdc_data = {
> .default_bpp = 24,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> diff --git a/arch/avr32/boards/merisc/display.c b/arch/avr32/boards/merisc/display.c
> index 85a543c..e7683ee 100644
> --- a/arch/avr32/boards/merisc/display.c
> +++ b/arch/avr32/boards/merisc/display.c
> @@ -45,7 +45,7 @@ static struct fb_monspecs merisc_fb_monspecs = {
> .dclkmax = 30000000,
> };
>
> -struct atmel_lcdfb_info merisc_lcdc_data = {
> +struct atmel_lcdfb_pdata merisc_lcdc_data = {
> .default_bpp = 24,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c
> index 05358aa..1cb8e9c 100644
> --- a/arch/avr32/boards/mimc200/setup.c
> +++ b/arch/avr32/boards/mimc200/setup.c
> @@ -8,7 +8,7 @@
> * published by the Free Software Foundation.
> */
>
> -extern struct atmel_lcdfb_info mimc200_lcdc_data;
> +extern struct atmel_lcdfb_pdata mimc200_lcdc_data;
>
> #include <linux/clk.h>
> #include <linux/etherdevice.h>
> @@ -71,7 +71,7 @@ static struct fb_monspecs __initdata mimc200_default_monspecs = {
> .dclkmax = 25200000,
> };
>
> -struct atmel_lcdfb_info __initdata mimc200_lcdc_data = {
> +struct atmel_lcdfb_pdata __initdata mimc200_lcdc_data = {
> .default_bpp = 16,
> .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
> .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
> diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
> index 7c2f668..0badb05 100644
> --- a/arch/avr32/mach-at32ap/at32ap700x.c
> +++ b/arch/avr32/mach-at32ap/at32ap700x.c
> @@ -1437,7 +1437,7 @@ fail:
> * LCDC
> * -------------------------------------------------------------------- */
> #if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002)
> -static struct atmel_lcdfb_info atmel_lcdfb0_data;
> +static struct atmel_lcdfb_pdata atmel_lcdfb0_data;
> static struct resource atmel_lcdfb0_resource[] = {
> {
> .start = 0xff000000,
> @@ -1465,12 +1465,12 @@ static struct clk atmel_lcdfb0_pixclk = {
> };
>
> struct platform_device *__init
> -at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
> +at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
> unsigned long fbmem_start, unsigned long fbmem_len,
> u64 pin_mask)
> {
> struct platform_device *pdev;
> - struct atmel_lcdfb_info *info;
> + struct atmel_lcdfb_pdata *info;
> struct fb_monspecs *monspecs;
> struct fb_videomode *modedb;
> unsigned int modedb_size;
> @@ -1527,7 +1527,7 @@ at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
> }
>
> info = pdev->dev.platform_data;
> - memcpy(info, data, sizeof(struct atmel_lcdfb_info));
> + memcpy(info, data, sizeof(struct atmel_lcdfb_pdata));
> info->default_monspecs = monspecs;
>
> pdev->name = "at32ap-lcdfb";
> diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
> index d485b03..f1a316d 100644
> --- a/arch/avr32/mach-at32ap/include/mach/board.h
> +++ b/arch/avr32/mach-at32ap/include/mach/board.h
> @@ -44,9 +44,9 @@ struct platform_device *
> at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
> void at32_spi_setup_slaves(unsigned int bus_num, struct spi_board_info *b, unsigned int n);
>
> -struct atmel_lcdfb_info;
> +struct atmel_lcdfb_pdata;
> struct platform_device *
> -at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_info *data,
> +at32_add_device_lcdc(unsigned int id, struct atmel_lcdfb_pdata *data,
> unsigned long fbmem_start, unsigned long fbmem_len,
> u64 pin_mask);
>
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index c1a2914..98733cd4 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -20,12 +20,45 @@
> #include <linux/gfp.h>
> #include <linux/module.h>
> #include <linux/platform_data/atmel.h>
> +#include <video/of_display_timing.h>
I am not sure this one is useful for this patch, maybe place it in the
4/8 one.
> #include <mach/cpu.h>
> #include <asm/gpio.h>
>
> #include <video/atmel_lcdc.h>
>
> +struct atmel_lcdfb_config {
> + bool have_alt_pixclock;
> + bool have_hozval;
> + bool have_intensity_bit;
> +};
> +
> + /* LCD Controller info data structure, stored in device platform_data */
Is comment still relevant?
> +struct atmel_lcdfb_info {
> + spinlock_t lock;
> + struct fb_info *info;
> + void __iomem *mmio;
> + int irq_base;
> + struct work_struct task;
> +
> + unsigned int smem_len;
> + struct platform_device *pdev;
> + struct clk *bus_clk;
> + struct clk *lcdc_clk;
> +
> + struct backlight_device *backlight;
> + u8 bl_power;
> + bool lcdcon_pol_negative;
> + u8 saved_lcdcon;
> +
> + u32 pseudo_palette[16];
> + bool have_intensity_bit;
> +
> + struct atmel_lcdfb_pdata pdata;
> +
> + struct atmel_lcdfb_config *config;
> +};
> +
> #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
> #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
>
> @@ -34,12 +67,6 @@
> #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */
> #define ATMEL_LCDC_FIFO_SIZE 512 /* words */
>
> -struct atmel_lcdfb_config {
> - bool have_alt_pixclock;
> - bool have_hozval;
> - bool have_intensity_bit;
> -};
> -
> static struct atmel_lcdfb_config at91sam9261_config = {
> .have_hozval = true,
> .have_intensity_bit = true,
> @@ -242,6 +269,8 @@ static void exit_backlight(struct atmel_lcdfb_info *sinfo)
>
> static void init_contrast(struct atmel_lcdfb_info *sinfo)
> {
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> +
> /* contrast pwm can be 'inverted' */
> if (sinfo->lcdcon_pol_negative)
> contrast_ctr &= ~(ATMEL_LCDC_POL_POSITIVE);
> @@ -250,7 +279,7 @@ static void init_contrast(struct atmel_lcdfb_info *sinfo)
> lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
> lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
>
> - if (sinfo->lcdcon_is_backlight)
> + if (pdata->lcdcon_is_backlight)
> init_backlight(sinfo);
> }
>
> @@ -293,9 +322,11 @@ static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo,
>
> static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
> {
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> +
> /* Turn off the LCD controller and the DMA controller */
> lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
> - sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
> + pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
>
> /* Wait for the LCDC core to become idle */
> while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
> @@ -315,9 +346,11 @@ static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
>
> static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
> {
> - lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> +
> + lcdc_writel(sinfo, ATMEL_LCDC_DMACON, pdata->default_dmacon);
> lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
> - (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
> + (pdata->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
> | ATMEL_LCDC_PWR);
> }
>
> @@ -418,6 +451,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
> {
> struct device *dev = info->device;
> struct atmel_lcdfb_info *sinfo = info->par;
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> unsigned long clk_value_khz;
>
> clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
> @@ -501,7 +535,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
> else
> var->green.length = 6;
>
> - if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
> + if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
> /* RGB:5X5 mode */
> var->red.offset = var->green.length + 5;
> var->blue.offset = 0;
> @@ -518,7 +552,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
> var->transp.length = 8;
> /* fall through */
> case 24:
> - if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
> + if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
> /* RGB:888 mode */
> var->red.offset = 16;
> var->blue.offset = 0;
> @@ -567,6 +601,7 @@ static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
> static int atmel_lcdfb_set_par(struct fb_info *info)
> {
> struct atmel_lcdfb_info *sinfo = info->par;
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> unsigned long hozval_linesz;
> unsigned long value;
> unsigned long clk_value_khz;
> @@ -628,7 +663,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
>
>
> /* Initialize control register 2 */
> - value = sinfo->default_lcdcon2;
> + value = pdata->default_lcdcon2;
>
> if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT))
> value |= ATMEL_LCDC_INVLINE_INVERTED;
> @@ -732,6 +767,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
> unsigned int transp, struct fb_info *info)
> {
> struct atmel_lcdfb_info *sinfo = info->par;
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
> unsigned int val;
> u32 *pal;
> int ret = 1;
> @@ -768,8 +804,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
> */
> } else {
> /* new style BGR:565 / RGB:565 */
> - if (sinfo->lcd_wiring_mode ==
> - ATMEL_LCDC_WIRING_RGB) {
> + if (pdata->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
> val = ((blue >> 11) & 0x001f);
> val |= ((red >> 0) & 0xf800);
> } else {
> @@ -909,7 +944,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct fb_info *info;
> struct atmel_lcdfb_info *sinfo;
> - struct atmel_lcdfb_info *pdata_sinfo;
> + struct atmel_lcdfb_pdata *pdata;
> struct fb_videomode fbmode;
> struct resource *regs = NULL;
> struct resource *map = NULL;
> @@ -927,17 +962,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> sinfo = info->par;
>
> if (dev->platform_data) {
> - pdata_sinfo = (struct atmel_lcdfb_info *)dev->platform_data;
> - sinfo->default_bpp = pdata_sinfo->default_bpp;
> - sinfo->default_dmacon = pdata_sinfo->default_dmacon;
> - sinfo->default_lcdcon2 = pdata_sinfo->default_lcdcon2;
> - sinfo->default_monspecs = pdata_sinfo->default_monspecs;
> - sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control;
> - sinfo->guard_time = pdata_sinfo->guard_time;
> - sinfo->smem_len = pdata_sinfo->smem_len;
> - sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight;
> - sinfo->lcdcon_pol_negative = pdata_sinfo->lcdcon_pol_negative;
> - sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode;
> + pdata = (struct atmel_lcdfb_pdata *)dev->platform_data;
> + sinfo->pdata = *pdata;
> } else {
> dev_err(dev, "cannot get default configuration\n");
> goto free_info;
> @@ -953,7 +979,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> info->pseudo_palette = sinfo->pseudo_palette;
> info->fbops = &atmel_lcdfb_ops;
>
> - memcpy(&info->monspecs, sinfo->default_monspecs, sizeof(info->monspecs));
> + memcpy(&info->monspecs, pdata->default_monspecs, sizeof(info->monspecs));
> info->fix = atmel_lcdfb_fix;
>
> /* Enable LCDC Clocks */
> @@ -971,7 +997,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
>
> ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
> info->monspecs.modedb_len, info->monspecs.modedb,
> - sinfo->default_bpp);
> + pdata->default_bpp);
> if (!ret) {
> dev_err(dev, "no suitable video mode found\n");
> goto stop_clk;
> @@ -1088,8 +1114,8 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
> fb_add_videomode(&fbmode, &info->modelist);
>
> /* Power up the LCDC screen */
> - if (sinfo->atmel_lcdfb_power_control)
> - sinfo->atmel_lcdfb_power_control(1);
> + if (pdata->atmel_lcdfb_power_control)
> + pdata->atmel_lcdfb_power_control(1);
>
> dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
> info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
> @@ -1134,15 +1160,17 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct fb_info *info = dev_get_drvdata(dev);
> struct atmel_lcdfb_info *sinfo;
> + struct atmel_lcdfb_pdata *pdata;
>
> if (!info || !info->par)
> return 0;
> sinfo = info->par;
> + pdata = &sinfo->pdata;
>
> cancel_work_sync(&sinfo->task);
> exit_backlight(sinfo);
> - if (sinfo->atmel_lcdfb_power_control)
> - sinfo->atmel_lcdfb_power_control(0);
> + if (pdata->atmel_lcdfb_power_control)
> + pdata->atmel_lcdfb_power_control(0);
> unregister_framebuffer(info);
> atmel_lcdfb_stop_clock(sinfo);
> clk_put(sinfo->lcdc_clk);
> @@ -1170,6 +1198,7 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
> {
> struct fb_info *info = platform_get_drvdata(pdev);
> struct atmel_lcdfb_info *sinfo = info->par;
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
>
> /*
> * We don't want to handle interrupts while the clock is
> @@ -1179,8 +1208,8 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
>
> sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_CTR);
> lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
> - if (sinfo->atmel_lcdfb_power_control)
> - sinfo->atmel_lcdfb_power_control(0);
> + if (pdata->atmel_lcdfb_power_control)
> + pdata->atmel_lcdfb_power_control(0);
>
> atmel_lcdfb_stop(sinfo);
> atmel_lcdfb_stop_clock(sinfo);
> @@ -1192,11 +1221,12 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
> {
> struct fb_info *info = platform_get_drvdata(pdev);
> struct atmel_lcdfb_info *sinfo = info->par;
> + struct atmel_lcdfb_pdata *pdata = &sinfo->pdata;
>
> atmel_lcdfb_start_clock(sinfo);
> atmel_lcdfb_start(sinfo);
> - if (sinfo->atmel_lcdfb_power_control)
> - sinfo->atmel_lcdfb_power_control(1);
> + if (pdata->atmel_lcdfb_power_control)
> + pdata->atmel_lcdfb_power_control(1);
> lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
>
> /* Enable FIFO & DMA errors */
> diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
> index 0f5a2fc..2eb601c 100644
> --- a/include/video/atmel_lcdc.h
> +++ b/include/video/atmel_lcdc.h
> @@ -31,39 +31,17 @@
> #define ATMEL_LCDC_WIRING_BGR 0
> #define ATMEL_LCDC_WIRING_RGB 1
>
> -struct atmel_lcdfb_config;
>
> /* LCD Controller info data structure, stored in device platform_data */
Wrong comment: it is not the "info" data structure, this time.
> -struct atmel_lcdfb_info {
> - spinlock_t lock;
> - struct fb_info *info;
> - void __iomem *mmio;
> - int irq_base;
> - struct work_struct task;
> -
> +struct atmel_lcdfb_pdata {
> unsigned int guard_time;
> - unsigned int smem_len;
> - struct platform_device *pdev;
> - struct clk *bus_clk;
> - struct clk *lcdc_clk;
> -
> -#ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
> - struct backlight_device *backlight;
> - u8 bl_power;
> -#endif
> bool lcdcon_is_backlight;
> - bool lcdcon_pol_negative;
> - u8 saved_lcdcon;
> -
> u8 default_bpp;
> u8 lcd_wiring_mode;
> unsigned int default_lcdcon2;
> unsigned int default_dmacon;
> void (*atmel_lcdfb_power_control)(int on);
> struct fb_monspecs *default_monspecs;
> - u32 pseudo_palette[16];
> -
> - struct atmel_lcdfb_config *config;
> };
>
> #define ATMEL_LCDC_DMABADDR1 0x00
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 35+ messages in thread
[parent not found: <1365692422-9565-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH 1/8] video: atmel_lcdfb: fix platform data struct
[not found] ` <1365692422-9565-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
@ 2013-05-29 14:36 ` Richard Genoud
2013-05-29 17:35 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 35+ messages in thread
From: Richard Genoud @ 2013-05-29 14:36 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD
Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Andreas Bießmann,
Andrew Morton, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
Hans-Christian Egtvedt
2013/4/11 Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>:
> Today we mix pdata and drivers data in the struct atmel_lcdfb_info
> Fix it and introduce a new struct atmel_lcdfb_pdata for platform data only
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
> Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Cc: Hans-Christian Egtvedt <egtvedt-BrfabpQBY5qlHtIdYg32fQ@public.gmane.org>
> ---
> arch/arm/mach-at91/at91sam9261_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9263_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9g45_devices.c | 6 +-
> arch/arm/mach-at91/at91sam9rl_devices.c | 6 +-
> arch/arm/mach-at91/board-sam9261ek.c | 6 +-
> arch/arm/mach-at91/board-sam9263ek.c | 4 +-
> arch/arm/mach-at91/board-sam9m10g45ek.c | 4 +-
> arch/arm/mach-at91/board-sam9rlek.c | 4 +-
> arch/arm/mach-at91/board.h | 4 +-
> arch/avr32/boards/atngw100/evklcd10x.c | 6 +-
> arch/avr32/boards/atngw100/mrmt.c | 4 +-
> arch/avr32/boards/atstk1000/atstk1000.h | 2 +-
> arch/avr32/boards/atstk1000/setup.c | 2 +-
> arch/avr32/boards/favr-32/setup.c | 2 +-
> arch/avr32/boards/hammerhead/setup.c | 2 +-
> arch/avr32/boards/merisc/display.c | 2 +-
> arch/avr32/boards/mimc200/setup.c | 4 +-
> arch/avr32/mach-at32ap/at32ap700x.c | 8 +--
> arch/avr32/mach-at32ap/include/mach/board.h | 4 +-
> drivers/video/atmel_lcdfb.c | 104 +++++++++++++++++----------
> include/video/atmel_lcdc.h | 24 +------
> 21 files changed, 109 insertions(+), 101 deletions(-)
>
[snip]
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index c1a2914..98733cd4 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -20,12 +20,45 @@
> #include <linux/gfp.h>
> #include <linux/module.h>
> #include <linux/platform_data/atmel.h>
> +#include <video/of_display_timing.h>
>
> #include <mach/cpu.h>
> #include <asm/gpio.h>
>
> #include <video/atmel_lcdc.h>
>
> +struct atmel_lcdfb_config {
> + bool have_alt_pixclock;
> + bool have_hozval;
> + bool have_intensity_bit;
> +};
> +
> + /* LCD Controller info data structure, stored in device platform_data */
> +struct atmel_lcdfb_info {
> + spinlock_t lock;
> + struct fb_info *info;
> + void __iomem *mmio;
> + int irq_base;
> + struct work_struct task;
> +
> + unsigned int smem_len;
> + struct platform_device *pdev;
> + struct clk *bus_clk;
> + struct clk *lcdc_clk;
> +
> + struct backlight_device *backlight;
> + u8 bl_power;
> + bool lcdcon_pol_negative;
I think lcdcon_pol_negative should be part of pdata, because it really
depends on how the PWM is wired on the board.
Regards,
Richard.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH 1/8] video: atmel_lcdfb: fix platform data struct
2013-05-29 14:36 ` Richard Genoud
@ 2013-05-29 17:35 ` Jean-Christophe PLAGNIOL-VILLARD
[not found] ` <20130529173538.GC23899-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
0 siblings, 1 reply; 35+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-29 17:35 UTC (permalink / raw)
To: Richard Genoud
Cc: linux-fbdev, devicetree-discuss, Nicolas Ferre,
Andreas Bießmann, Andrew Morton, linux-arm-kernel,
Hans-Christian Egtvedt
On 16:36 Wed 29 May , Richard Genoud wrote:
> 2013/4/11 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> > Today we mix pdata and drivers data in the struct atmel_lcdfb_info
> > Fix it and introduce a new struct atmel_lcdfb_pdata for platform data only
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > Cc: linux-fbdev@vger.kernel.org
> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> > ---
> > arch/arm/mach-at91/at91sam9261_devices.c | 6 +-
> > arch/arm/mach-at91/at91sam9263_devices.c | 6 +-
> > arch/arm/mach-at91/at91sam9g45_devices.c | 6 +-
> > arch/arm/mach-at91/at91sam9rl_devices.c | 6 +-
> > arch/arm/mach-at91/board-sam9261ek.c | 6 +-
> > arch/arm/mach-at91/board-sam9263ek.c | 4 +-
> > arch/arm/mach-at91/board-sam9m10g45ek.c | 4 +-
> > arch/arm/mach-at91/board-sam9rlek.c | 4 +-
> > arch/arm/mach-at91/board.h | 4 +-
> > arch/avr32/boards/atngw100/evklcd10x.c | 6 +-
> > arch/avr32/boards/atngw100/mrmt.c | 4 +-
> > arch/avr32/boards/atstk1000/atstk1000.h | 2 +-
> > arch/avr32/boards/atstk1000/setup.c | 2 +-
> > arch/avr32/boards/favr-32/setup.c | 2 +-
> > arch/avr32/boards/hammerhead/setup.c | 2 +-
> > arch/avr32/boards/merisc/display.c | 2 +-
> > arch/avr32/boards/mimc200/setup.c | 4 +-
> > arch/avr32/mach-at32ap/at32ap700x.c | 8 +--
> > arch/avr32/mach-at32ap/include/mach/board.h | 4 +-
> > drivers/video/atmel_lcdfb.c | 104 +++++++++++++++++----------
> > include/video/atmel_lcdc.h | 24 +------
> > 21 files changed, 109 insertions(+), 101 deletions(-)
> >
> [snip]
> > diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> > index c1a2914..98733cd4 100644
> > --- a/drivers/video/atmel_lcdfb.c
> > +++ b/drivers/video/atmel_lcdfb.c
> > @@ -20,12 +20,45 @@
> > #include <linux/gfp.h>
> > #include <linux/module.h>
> > #include <linux/platform_data/atmel.h>
> > +#include <video/of_display_timing.h>
> >
> > #include <mach/cpu.h>
> > #include <asm/gpio.h>
> >
> > #include <video/atmel_lcdc.h>
> >
> > +struct atmel_lcdfb_config {
> > + bool have_alt_pixclock;
> > + bool have_hozval;
> > + bool have_intensity_bit;
> > +};
> > +
> > + /* LCD Controller info data structure, stored in device platform_data */
> > +struct atmel_lcdfb_info {
> > + spinlock_t lock;
> > + struct fb_info *info;
> > + void __iomem *mmio;
> > + int irq_base;
> > + struct work_struct task;
> > +
> > + unsigned int smem_len;
> > + struct platform_device *pdev;
> > + struct clk *bus_clk;
> > + struct clk *lcdc_clk;
> > +
> > + struct backlight_device *backlight;
> > + u8 bl_power;
> > + bool lcdcon_pol_negative;
> I think lcdcon_pol_negative should be part of pdata, because it really
> depends on how the PWM is wired on the board.
>
maybe but no one mainline use it on any pdata for non-dt boars
so I did not want to expose it
Best Regatgards,
J.
>
> Regards,
> Richard.
^ permalink raw reply [flat|nested] 35+ messages in thread