fbdev: Add the lacking FB_SYNC_* for matching the DISPLAY_FLAGS_*
PATCH v4 1/6 fbdev: Add the lacking FB_SYNC_* for matching the DISPLAY_FLAGS_*
Without that fix, drivers using the fb_videomode_from_videomode
function will not be able to get certain information because some DISPLAY_FLAGS_* have no corresponding FB_SYNC_*.
---
ChangeLog v3->v4:
- Fixed the issue with FB_SYNC_PIXDAT_HIGH_ACT value.
ChangeLog v2->v3:
- Added Jean-Christophe PLAGNIOL-VILLARD's ACK.
--- drivers/video/fbmon.c | 4 ++++ include/uapi/linux/fb.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/video/fbmon.c +4 -0
@@ -1402,6 +1402,10 @@ int fb_videomode_from_videomode(const struct videomode *vm, fbmode->sync |=FB_SYNC_HOR_HIGH_ACT ;if (vm->flags &DISPLAY_FLAGS_VSYNC_HIGH ) fbmode->sync |=FB_SYNC_VERT_HIGH_ACT ; +if (vm->flags &DISPLAY_FLAGS_DE_HIGH ) + fbmode->sync |=FB_SYNC_DE_HIGH_ACT ; +if (vm->flags &DISPLAY_FLAGS_PIXDATA_POSEDGE ) + fbmode->sync |=FB_SYNC_PIXDAT_HIGH_ACT ;if (vm->flags &DISPLAY_FLAGS_INTERLACED ) fbmode->vmode |=FB_VMODE_INTERLACED ;if (vm->flags &DISPLAY_FLAGS_DOUBLESCAN )
include/uapi/linux/fb.h +2 -0
@@ -215,6 +215,8 @@ struct fb_bitfield {/* vtotal = 144d/288n/576i => PAL */ /* vtotal = 121d/242n/484i => NTSC */ #define FB_SYNC_ON_GREEN 32/* sync on green */ +#define FB_SYNC_DE_HIGH_ACT 64/* data enable high active */ +#define FB_SYNC_PIXDAT_HIGH_ACT 128/* data enable high active */ #define FB_VMODE_NONINTERLACED 0/* non interlaced */ #define FB_VMODE_INTERLACED 1/* interlaced */
Signature · 1 line
1.7.9.5
PATCH v4 2/6 dma: ipu: Add devicetree support.
---
ChangeLog v3->v4:
- Synced the documentation with the code.
ChangeLog v2->v3:
- The DMA channels are not exposed anymore in order to look more like the IPUv3 bindings.
--- .../devicetree/bindings/dma/fsl-imx-ipu.txt | 20 ++++++++++++++++++++ drivers/dma/ipu/ipu_idmac.c | 8 ++++++++ 2 files changed, 28 insertions(+) create mode 100644 Documentation/devicetree/bindings/dma/fsl-imx-ipu.txt
Documentation/devicetree/bindings/dma/fsl-imx-ipu.txt new file +20 -0
@@ -0,0 +1,20 @@ +* Freescale Image Processing Unit (IPU) support for i.MX3x. + +This driver supports the imx31 and imx35 devices. + +Required properties: +- compatible : Should be "fsl,imx31-ipu". +- reg : Should contain IPU registers location and length. +- interrupts : First item should be IPU interrupt, second one is optional and + should contain IPU Error interrupt. + +Example: + + ipu: ipu at 53fc0000 { + compatible = "fsl,imx31-ipu"; + reg = < 0x53fc0000 0x5f + 0x53fc0088 0x2b >; + interrupts = <42 41>; + clocks = <&clks 55>; + clock-names = ""; + };
drivers/dma/ipu/ipu_idmac.c +8 -0
@@ -22,6 +22,7 @@#include <linux/interrupt.h> #include <linux/io.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/dma/ipu-dma.h> #include "../dmaengine.h"
@@ -1768,6 +1769,12 @@ static int ipu_remove(struct platform_device *pdev)return 0 ; } +static const struct of_device_id ipu_dma_of_dev_id[] = { + { .compatible ="fsl,imx31-ipu" , }, + {/* Sentinel */ } +}; +MODULE_DEVICE_TABLE (of, ipu_dma_of_dev_id); +/* * We need two MEM resources - with IPU-common and Image Converter registers, * including PF_CONF and IDMAC_* registers, and two IRQs - function and error
@@ -1775,6 +1782,7 @@ static int ipu_remove(struct platform_device *pdev)static struct platform_driver ipu_platform_driver = { .driver = { .name ="ipu-core" , + .of_match_table =of_match_ptr (ipu_dma_of_dev_id), .owner =THIS_MODULE , }, .remove = ipu_remove,
Signature · 1 line
1.7.9.5
Sascha Hauer
maintainerPATCH v4 2/6 dma: ipu: Add devicetree support.
Quoted 16 lines · Denis Carikli
Documentation/devicetree/bindings/dma/fsl-imx-ipu.txt new file +10
-0@@ -0,0 +1,20 @@ +* Freescale Image Processing Unit (IPU) support for i.MX3x. + +This driver supports the imx31 and imx35 devices. + +Required properties: +- compatible : Should be "fsl,imx31-ipu". +- reg : Should contain IPU registers location and length. +- interrupts : First item should be IPU interrupt, second one is optional and + should contain IPU Error interrupt. +
Documentation/devicetree/bindings/dma/fsl-imx-ipu.txt line 20
Quoted 10 lines
Documentation/devicetree/bindings/dma/fsl-imx-ipu.txt new file +10
-0+Example: + + ipu: ipu at 53fc0000 { + compatible = "fsl,imx31-ipu"; + reg = < 0x53fc0000 0x5f + 0x53fc0088 0x2b >; + interrupts = <42 41>; + clocks = <&clks 55>; + clock-names = ""; + };
As said before: I don't think that splitting the IPU in several nodes like above just to satisfy the current Linux driver setup is appropriate.
The IPU should rather look like:
ipu: ipu at 53fc0000 {
compatible = "fsl,imx31-ipu";
reg = <0x53fc0000 0x4000>;
interrupts = <42 31>;
clocks = <&clks 55 ...>;
clock-names = "...";
};Note that the above covers the whole address space of the IPU. This is more close to the IPUv3 binding. With separating the IDMAC and DI nodes you force us to keep the current driver separation between dma and fb driver. The IPU should never have used the Linux DMA driver framework though.
When you cover the whole address space you could then in the corresponding driver register platform devices which match to the current dma/fb driver combination.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v4 3/6 video: mx3fb: Add device tree suport.
In reply to Denis Carikli---
ChangeLog v3->v4:
- Updated bindings.
- Updated documentation accordinly.
- Updated code accordinly.
- Fixed the lack of "ret =" in of_property_read_string(display_np, "model", &name);
- Supressed some compilation warnings.
ChangeLog v2->v3:
- The device tree bindings were reworked in order to make it look more like the IPUv3 bindings.
- The interface_pix_fmt property now looks like the IPUv3 one.
--- .../devicetree/bindings/video/fsl,mx3-fb.txt | 42 +++++++ drivers/video/Kconfig | 2 + drivers/video/mx3fb.c | 119 +++++++++++++++++--- 3 files changed, 148 insertions(+), 15 deletions(-) create mode 100644 Documentation/devicetree/bindings/video/fsl,mx3-fb.txt
Documentation/devicetree/bindings/video/fsl,mx3-fb.txt new file +42 -0
@@ -0,0 +1,42 @@ +Freescale MX3 framebuffer. +========================== + +Required properties: +- compatible: Should be "fsl,mx3fb". compatible chips include the imx31 and the + imx35. +- reg: should be register base and length as documented in the datasheet. +- clocks: Handle to the ipu_gate clock. +- display: Phandle to a "fsl,mx3-parallel-display" compatible display node. + +Example: + +lcdc: mx3fb at 53fc00b4 { + compatible = "fsl,mx3-fb"; + reg = <0x53fc00b4 0x0b>; + clocks = <&clks 55>; +}; + +Display support +=============== +Required properties: +- compatible: Should be "fsl,mx3-parallel-display". +- model : The user-visible name of the display. + +Optional properties: +- interface_pix_fmt: How this display is connected to the + crtc. Currently supported types: "rgb24", "rgb565", "rgb666". + +It can also have an optional timing subnode as described in + Documentation/devicetree/bindings/video/display-timing.txt. + +Example: + +display0: display at di0 { + compatible = "fsl,mx3-parallel-display"; + interface-pix-fmt = "rgb666"; + model = "CMO-QVGA"; +}; + +&lcdc { + display = <&display0>; +}
drivers/video/Kconfig +2 -0
@@ -2357,6 +2357,8 @@ config FB_MX3 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select VIDEOMODE_HELPERS + select FB_MODE_HELPERS default y help This is a framebuffer device for the i.MX31 LCD Controller. So
drivers/video/mx3fb.c +104 -15
191 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 4/6 video: mx3fb: Introduce regulator support.
In reply to Denis CarikliThis commit is based on the following commit by Fabio Estevam:
4344429 video: mxsfb: Introduce regulator support
---
ChangeLog v3->v4:
- Some code style fixes.
- Improved error handling in eremap.
ChangeLog v2->v3:
- The prints are now replaced with non line wrapped prints.
- The regulator retrival has been adapted to the new DT bindings which looks more like the IPUv3 ones.
- The regulator_is_enabled checks were kept, because regulator_disable do not do such check.
--- drivers/video/mx3fb.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-)
drivers/video/mx3fb.c +70 -1
@@ -27,6 +27,7 @@#include <linux/clk.h> #include <linux/mutex.h> #include <linux/dma/ipu-dma.h> +#include <linux/regulator/consumer.h> #include <linux/platform_data/dma-imx.h> #include <linux/platform_data/video-mx3fb.h>
@@ -269,6 +270,7 @@ struct mx3fb_info {struct dma_async_tx_descriptor *txd;dma_cookie_t cookie;struct scatterlist sg[2 ]; +struct regulator *reg_lcd;struct fb_var_screeninfo cur_var;/* current var info */ };
@@ -1005,6 +1007,7 @@ static void __blank(int blank, struct fb_info *fbi)struct mx3fb_info *mx3_fbi = fbi->par;struct mx3fb_data *mx3fb = mx3_fbi->mx3fb;int was_blank = mx3_fbi->blank; +int ret; mx3_fbi->blank = blank;
@@ -1023,6 +1026,15 @@ static void __blank(int blank, struct fb_info *fbi)case FB_BLANK_HSYNC_SUSPEND :case FB_BLANK_NORMAL :sdc_set_brightness (mx3fb,0 ); +if (mx3_fbi->reg_lcd) { +if (regulator_is_enabled (mx3_fbi->reg_lcd)) { + ret =regulator_disable (mx3_fbi->reg_lcd); +if (ret) +dev_warn (fbi->device, +"lcd regulator disable failed with error: %d\n" , + ret); + } + }memset ((char *)fbi->screen_base,0 , fbi->fix.smem_len);/* Give LCD time to update - enough for 50 and 60 Hz */ msleep (25 );
@@ -1030,6 +1042,15 @@ static void __blank(int blank, struct fb_info *fbi)break ;case FB_BLANK_UNBLANK :sdc_enable_channel (mx3_fbi); +if (mx3_fbi->reg_lcd) { +if (!regulator_is_enabled (mx3_fbi->reg_lcd)) { + ret =regulator_enable (mx3_fbi->reg_lcd); +if (ret) +dev_warn (fbi->device, +"lcd regulator enable failed with error: %d\n" , + ret); + } + }sdc_set_brightness (mx3fb, mx3fb->backlight_level);break ; }
@@ -1206,6 +1227,7 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state) {struct mx3fb_data *mx3fb =platform_get_drvdata (pdev);struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; +int ret;console_lock ();fb_set_suspend (mx3fb->fbi,1 );
@@ -1214,7 +1236,15 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state)if (mx3_fbi->blank ==FB_BLANK_UNBLANK ) {sdc_disable_channel (mx3_fbi);sdc_set_brightness (mx3fb,0 ); - +if (mx3_fbi->reg_lcd) { +if (regulator_is_enabled (mx3_fbi->reg_lcd)) { + ret =regulator_disable (mx3_fbi->reg_lcd); +if (ret) +dev_warn (&pdev->dev, +"lcd regulator disable failed with error: %d\n" , + ret); + } + } }return 0 ; }
@@ -1226,10 +1256,20 @@ static int mx3fb_resume(struct platform_device *pdev) {struct mx3fb_data *mx3fb =platform_get_drvdata (pdev);struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; +int ret;if (mx3_fbi->blank ==FB_BLANK_UNBLANK ) {sdc_enable_channel (mx3_fbi);sdc_set_brightness (mx3fb, mx3fb->backlight_level); +if (mx3_fbi->reg_lcd) { +if (!regulator_is_enabled (mx3_fbi->reg_lcd)) { + ret =regulator_enable (mx3_fbi->reg_lcd); +if (ret) +dev_warn (&pdev->dev, +"lcd regulator enable failed with error: %d\n" , + ret); + } + } }console_lock ();
@@ -1373,6 +1413,7 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)struct mx3fb_platform_data *mx3fb_pdata = dev->platform_data;struct device_node *np = dev->of_node;const char *name; +const char *regulator_name;const char *ipu_disp_format;unsigned int irq;struct fb_info *fbi;
@@ -1389,6 +1430,9 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)return -EINVAL ; } +of_property_read_string (display_np,"regulator-name" , + ®ulator_name); +of_property_read_string (display_np,"interface-pix-fmt" , &ipu_disp_format);if (!ipu_disp_format) {
@@ -1503,6 +1547,25 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan)if (ret <0 ) goto erfb; +/* In dt mode, +* using devm_regulator_get would require that the proprety referencing +* the regulator phandle has to be inside the mx3fb node. +*/ +if (np) { +if (regulator_name) + mx3fbi->reg_lcd =regulator_get (NULL , regulator_name); + }else { + mx3fbi->reg_lcd =devm_regulator_get (dev,"lcd" ); + } + +if (IS_ERR (mx3fbi->reg_lcd)) { +dev_warn (mx3fb->dev,"Operating without regulator \"lcd\"\n" ); + mx3fbi->reg_lcd =NULL ; + }else { +dev_info (mx3fb->dev,"Using \"%s\" Regulator\n" , + regulator_name); + } +return 0 ; erfb:
@@ -1569,6 +1632,7 @@ static int mx3fb_probe(struct platform_device *pdev)dma_cap_mask_t mask;struct dma_chan *chan;struct dma_chan_request rq; +struct mx3fb_info *mx3_fbi;/* * Display Interface (DI) and Synchronous Display Controller (SDC)
@@ -1624,6 +1688,11 @@ ersdc0:dmaengine_put ();iounmap (mx3fb->reg_base); eremap: +if (mx3fb->fbi) { + mx3_fbi = mx3fb->fbi->par; +if (mx3_fbi->reg_lcd) +regulator_put (mx3_fbi->reg_lcd); + }kfree (mx3fb);dev_err (dev,"mx3fb: failed to register fb\n" );return ret;
Signature · 1 line
1.7.9.5
PATCH v4 5/6 ARM: dts: i.MX35: Add display support.
In reply to Denis Carikli---
ChangeLog v3->v4:
- Splitted the imx35.dtsi display support (new patch).
--- arch/arm/boot/dts/imx35.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/boot/dts/imx35.dtsi +16 -0
@@ -349,6 +349,22 @@ status = "disabled"; }; + ipu: ipu at 53fc0000 { + compatible = "fsl,imx31-ipu"; + reg = < 0x53fc0000 0x5f + 0x53fc0088 0x2b >; + interrupts = <42 41>; + clocks = <&clks 55>; + status = "disabled"; + }; + + lcdc: mx3fb at 53fc00b4 { + compatible = "fsl,mx3-fb"; + reg = <0x53fc00b4 0x0b>; + clocks = <&clks 55>; + status = "disabled"; + }; + audmux: audmux at 53fc4000 { compatible = "fsl,imx35-audmux", "fsl,imx31-audmux"; reg = <0x53fc4000 0x4000>;
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH v4 5/6 ARM: dts: i.MX35: Add display support.
Hi Denis,
Quoted 5 lines · Denis Carikli
arch/arm/boot/dts/imx35.dtsi +5
-0+ ipu: ipu at 53fc0000 { + compatible = "fsl,imx31-ipu"; + reg = < 0x53fc0000 0x5f + 0x53fc0088 0x2b >; + interrupts = <42 41>;
arch/arm/boot/dts/imx35.dtsi line 366
Quoted 10 lines
arch/arm/boot/dts/imx35.dtsi +10
-0+ clocks = <&clks 55>; + status = "disabled"; + }; + + lcdc: mx3fb at 53fc00b4 { + compatible = "fsl,mx3-fb"; + reg = <0x53fc00b4 0x0b>; + clocks = <&clks 55>; + status = "disabled"; + };
MX35 Reference Manual states that the IPU address range is 0x53fc0000
- 0x53fc3fff
There is no 'lcdc' peripheral listed there, so I don't think 'lcdc' should be included here.
Regards,
Fabio Estevam
PATCH v4 6/6 ARM: dts: mbimxsd35 Add video and displays support.
In reply to Denis Carikli---
ChangeLog v3->v4:
- Shortened the licenses.
- adapted the dts(i) to the new bindings.
ChangeLog v2->v3:
- The dts were adapted to the new DT bindings which looks more like the IPUv3 ones.
--- .../imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts | 62 ++++++++++++++++++++ .../imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts | 51 ++++++++++++++++ .../imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts | 52 ++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts create mode 100644 arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts
arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-cmo-qvga.dts new file +62 -0
@@ -0,0 +1,62 @@ +/* + * Copyright 2013 Eukr?a Electromatique <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "imx35-eukrea-mbimxsd35-baseboard.dts" + +/ { + model = "Eukrea MBIMXSD35 with the CMO-QVGA Display"; + compatible = "eukrea,mbimxsd35-baseboard-cmo-qvga", "eukrea,mbimxsd35-baseboard", "eukrea,cpuimx35", "fsl,imx35"; + + cmo_qvga: display at di0 { + compatible = "fsl,mx3-parallel-display"; + regulator-name = "lcd"; + interface-pix-fmt = "rgb666"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcdc_1>; + lcd-supply = <®_lcd_3v3>; + model = "CMO-QVGA"; + display-timings { + qvga_timings: 320x240 { + clock-frequency = <6500000>; + hactive = <320>; + vactive = <240>; + hback-porch = <68>; + hfront-porch = <20>; + vback-porch = <15>; + vfront-porch = <4>; + hsync-len = <30>; + vsync-len = <3>; + }; + }; + }; + + reg_lcd_3v3: lcd-en { + compatible = "regulator-fixed"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_reg_lcd_3v3>; + regulator-name = "lcd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio1 4 0>; + enable-active-high; + }; +}; + +&ipu { + status = "okay"; +}; + +&lcdc { + display = <&cmo_qvga>; + status = "okay"; +};
arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-svga.dts new file +51 -0
51 lines not on this page · raw message
arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard-dvi-vga.dts new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 1/6 fbdev: Add the lacking FB_SYNC_* for matching the DISPLAY_FLAGS_*
In reply to Denis Carikliinclude/uapi/linux/fb.h struct fb_bitfield { · line 219
Quoted 5 lines · Denis Carikli
include/uapi/linux/fb.h +2
-0+#define FB_SYNC_DE_HIGH_ACT 64/* data enable high active */ +#define FB_SYNC_PIXDAT_HIGH_ACT 128/* data enable high active */
copy and paste of the comment above?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH v4 1/6 fbdev: Add the lacking FB_SYNC_* for matching the DISPLAY_FLAGS_*
In reply to Denis CarikliQuoted 3 lines · Denis Carikli
Without that fix, drivers using the
fb_videomode_from_videomode
function will not be able to get certain information because some DISPLAY_FLAGS_* have no corresponding FB_SYNC_*.
Please describe how userspace knows how to set these flags.
Flags such as the polarity of the hsync and vsync signals are fairly well defined based upon the display mode, but aren't things like data enable and the pixel clock edge a property of the attached LCD panel, which is something that is configured according to the panel which is attached.
In other words, this information should not be passed from userspace, but should be part of the DT description about the connected panel. So should be the polarity of the line and frame pulses (iow, hsync and vsync pulses) in the case of a connected panel.
Moreover, in the case of a connected LCD panel, chances are it can only support a very limited number of settings, so support for userspace changing the timings is arguably incorrect from a system point of view.