video: imxfb: Introduce regulator support.
Subsystems (4)
PATCH v14 1/4 video: imxfb: Introduce regulator support.
This commit is based on the following commit by Fabio Estevam:
4344429 video: mxsfb: Introduce regulator support
---
ChangeLog v13->v14:
- Remove people not concerned by this patch from the Cc list.
- Simplified the regulator handling: The regulator-core now supplies a dummy regulator if one hasn't been hooked up explicitely. So we don't need to handle that case in the driver.
The code has been updated to do that, and the error messages were updated accordingly.
ChangeLog v9->v10:
- Added a return 0; at the end of imxfb_disable_controller.
ChangeLog v8->v9:
- return an error if regulator_{enable,disable} fails in imxfb_{enable,disable}_controller, and use it.
--- drivers/video/imxfb.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-)
drivers/video/imxfb.c +25 -13
@@ -28,6 +28,7 @@#include <linux/cpufreq.h> #include <linux/clk.h> #include <linux/platform_device.h> +#include <linux/regulator/consumer.h> #include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/math64.h>
@@ -145,6 +146,7 @@ struct imxfb_info {struct clk *clk_ipg;struct clk *clk_ahb;struct clk *clk_per; +struct regulator *reg_lcd;enum imxfb_type devtype;bool enabled;
@@ -561,14 +563,16 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi) }#endif -static void imxfb_enable_controller (struct imxfb_info *fbi) +static int imxfb_enable_controller (struct imxfb_info *fbi) { -if (fbi->enabled) -return ; +return 0 ;pr_debug ("Enabling LCD controller\n" ); +if (regulator_enable (fbi->reg_lcd)) +dev_err (&fbi->pdev->dev,"Failed to enable regulator.\n" ); +writel (fbi->screen_dma, fbi->regs +LCDC_SSA );/* panning offset 0 (0 pixel offset) */
@@ -593,12 +597,14 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) fbi->backlight_power (1 );if (fbi->lcd_power) fbi->lcd_power (1 ); + +return 0 ; } -static void imxfb_disable_controller (struct imxfb_info *fbi) +static int imxfb_disable_controller (struct imxfb_info *fbi) {if (!fbi->enabled) -return ; +return 0 ;pr_debug ("Disabling LCD controller\n" );
@@ -613,6 +619,11 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) fbi->enabled = false;writel (0 , fbi->regs +LCDC_RMCR ); + +if (regulator_disable (fbi->reg_lcd)) +dev_err (&fbi->pdev->dev,"Failed to disable regulator.\n" ); + +return 0 ; }static int imxfb_blank (int blank,struct fb_info *info)
@@ -626,13 +637,12 @@ static int imxfb_blank(int blank, struct fb_info *info)case FB_BLANK_VSYNC_SUSPEND :case FB_BLANK_HSYNC_SUSPEND :case FB_BLANK_NORMAL : -imxfb_disable_controller (fbi); -break ; +return imxfb_disable_controller (fbi);case FB_BLANK_UNBLANK : -imxfb_enable_controller (fbi); -break ; +return imxfb_enable_controller (fbi); } +return 0 ; }
@@ -734,8 +744,7 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state)pr_debug ("%s\n" , __func__); -imxfb_disable_controller (fbi); -return 0 ; +return imxfb_disable_controller (fbi); }static int imxfb_resume (struct platform_device *dev)
@@ -745,8 +754,7 @@ static int imxfb_resume(struct platform_device *dev)pr_debug ("%s\n" , __func__); -imxfb_enable_controller (fbi); - return 0; + return imxfb_enable_controller(fbi); }#else #define imxfb_suspend NULL
@@ -1020,6 +1028,10 @@ static int imxfb_probe(struct platform_device *pdev) goto failed_register; } + fbi->reg_lcd =devm_regulator_get (&pdev->dev,"lcd" ); +if (IS_ERR (fbi->reg_lcd)) +return PTR_ERR (fbi->reg_lcd); +imxfb_enable_controller (fbi); fbi->pdev = pdev;#ifdef PWMR_BACKLIGHT_AVAILABLE
Signature · 1 line
1.7.9.5
PATCH v14 3/4 video: Kconfig: Allow more broad selection of the imxfb framebuffer driver.
Without that patch, a user can't select the imxfb driver when the i.MX25 and/or
the i.MX27 device tree board are selected and that no boards that selects IMX_HAVE_PLATFORM_IMX_FB are compiled in.
---
ChangeLog v11->v14:
- Remove people not concerned by this patch from the Cc list.
ChangeLog v10->v11:
- moved my signed-off-by.
ChangeLog v8->v9:
- Added Jean-Christophe PLAGNIOL-VILLARD's ACK.
--- drivers/video/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/Kconfig +1 -1
@@ -364,7 +364,7 @@ config FB_SA1100 config FB_IMX tristate "Freescale i.MX1/21/25/27 LCD support" - depends on FB && IMX_HAVE_PLATFORM_IMX_FB + depends on FB && ARCH_MXC select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT
Signature · 1 line
1.7.9.5
PATCH v14 3/4 video: Kconfig: Allow more broad selection of the imxfb framebuffer driver.
Hi,
Quoted 4 lines · Denis Carikli
Without that patch, a user can't select the imxfb driver when the i.MX25 and/or
the i.MX27 device tree board are selected and that no boards that selectsIMX_HAVE_PLATFORM_IMX_FBare compiled in.
Quoted 10 lines
Cc Eric B?nard <[email protected]>Cc Jean-Christophe Plagniol-Villard <[email protected]>Cc Sascha Hauer <[email protected]>Cc Tomi Valkeinen <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc linux-fbdev at vger.kernel.orgSigned-off-by Denis Carikli <[email protected]>Acked-by Shawn Guo <[email protected]>Acked-by Sascha Hauer <[email protected]>
Applied for 3.14 fbdev fixes.
As a generic comment, I'd appreciate if you'd use normal formatting in the patch descriptions (no double spaces in the beginning of the lines).
Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140214/b4a85b49/attachment.sig>
PATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
In reply to Denis CarikliThe CMO-QVGA(With backlight), DVI-VGA and DVI-SVGA displays were added.
---
ChangeLog v13->v14:
- Remove people not concerned by this patch from the Cc list.
- changed the fsl,pwmr lcdc property to fsl,lpccr, to match the previous patches in that serie.
ChangeLog v10->v13:
- This patch is the display part splitted out from the patch adding support for the cpuimx25(and its baseboard).
- Shawn Guo was added to the Cc list.
- The regulator part was updated to match the current style.
- The new GPIO defines are now used in the dts(i).
--- .../imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts | 72 ++++++++++++++++++++ .../imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts | 45 ++++++++++++ .../imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts | 45 ++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts create mode 100644 arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts create mode 100644 arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts
arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-cmo-qvga.dts new file +72 -0
@@ -0,0 +1,72 @@ +/* + * 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 "imx25-eukrea-mbimxsd25-baseboard.dts" + +/ { + model = "Eukrea MBIMXSD25 with the CMO-QVGA Display"; + compatible = "eukrea,mbimxsd25-baseboard-cmo-qvga", "eukrea,mbimxsd25-baseboard", "eukrea,cpuimx25", "fsl,imx25"; + + cmo_qvga: display { + model = "CMO-QVGA"; + bits-per-pixel = <16>; + fsl,pcr = <0xcad08b80>; + bus-width = <18>; + native-mode = <&qvga_timings>; + display-timings { + qvga_timings: 320x240 { + clock-frequency = <6500000>; + hactive = <320>; + vactive = <240>; + hback-porch = <30>; + hfront-porch = <38>; + vback-porch = <20>; + vfront-porch = <3>; + hsync-len = <15>; + vsync-len = <4>; + }; + }; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + reg_lcd_3v3: regulator at 0 { + compatible = "regulator-fixed"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_reg_lcd_3v3>; + regulator-name = "lcd-3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + }; +}; + +&iomuxc { + imx25-eukrea-mbimxsd25-baseboard-cmo-qvga { + pinctrl_reg_lcd_3v3: reg_lcd_3v3 { + fsl,pins = <MX25_PAD_PWM__GPIO_1_26 0x80000000>; + }; + }; +}; + +&lcdc { + display = <&cmo_qvga>; + fsl,lpccr = <0x00a903ff>; + lcd-supply = <®_lcd_3v3>; + status = "okay"; +};
arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-svga.dts new file +45 -0
45 lines not on this page · raw message
arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dts new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
Hi Denis,
Quoted 2 lines · Denis Carikli
The CMO-QVGA(With backlight), DVI-VGA and DVI-SVGA displays were added.
I am trying the same on a mx25pdk and these are my changes:
arch/arm/boot/dts/imx25-pdk.dts | 60 +++++++++++++++++++++++++++++++++++++++++
drivers/video/fbdev/imxfb.c | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx25-pdk.dts +60 -0
@@ -21,6 +21,26 @@ reg = <0x80000000 0x4000000>; }; + display: display { + model = "CLAA057VC01CW"; + native-mode = <&timing0>; + bits-per-pixel = <16>; + fsl,pcr = <0xfa208b80>; + display-timings { + timing0: 640x480 { + hactive = <640>; + vactive = <480>; + hback-porch = <114>; + hfront-porch = <45>; + hsync-len = <1>; + vback-porch = <11>; + vfront-porch = <33>; + vsync-len = <1>; + clock-frequency = <25000000>; + }; + }; + }; + regulators { compatible = "simple-bus"; #address-cells = <1>;
@@ -98,6 +118,16 @@ status = "okay"; }; +&lcdc { + display = <&display>; + fsl,lpccr = <0x00a903ff>; + fsl,lscr1 = <0x00120300>; + fsl,dmacr = <0x00020010>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcd>; + status = "okay"; +}; + &fec { phy-mode = "rmii"; pinctrl-names = "default";
@@ -170,6 +200,36 @@ >; }; + pinctrl_lcd: lcdgrp { + fsl,pins = < + MX25_PAD_LD0__LD0 0x80000000 + MX25_PAD_LD1__LD1 0x80000000 + MX25_PAD_LD2__LD2 0x80000000 + MX25_PAD_LD3__LD3 0x80000000 + MX25_PAD_LD4__LD4 0x80000000 + MX25_PAD_LD5__LD5 0x80000000 + MX25_PAD_LD6__LD6 0x80000000 + MX25_PAD_LD7__LD7 0x80000000 + MX25_PAD_LD8__LD8 0x80000000 + MX25_PAD_LD9__LD9 0x80000000 + MX25_PAD_LD10__LD10 0x80000000 + MX25_PAD_LD11__LD11 0x80000000 + MX25_PAD_LD12__LD12 0x80000000 + MX25_PAD_LD13__LD13 0x80000000 + MX25_PAD_LD14__LD14 0x80000000 + MX25_PAD_LD15__LD15 0x80000000 + MX25_PAD_GPIO_E__LD16 0x80000000 + MX25_PAD_GPIO_F__LD17 0x80000000 + MX25_PAD_HSYNC__HSYNC 0x80000000 + MX25_PAD_VSYNC__VSYNC 0x80000000 + MX25_PAD_LSCLK__LSCLK 0x80000000 + MX25_PAD_OE_ACD__OE_ACD 0x80000000 + MX25_PAD_CONTRAST__CONTRAST 0x80000000 + >; + }; + + + pinctrl_i2c1: i2c1grp { fsl,pins = < MX25_PAD_I2C1_CLK__I2C1_CLK 0x80000000
drivers/video/fbdev/imxfb.c +1 -1
@@ -671,8 +671,8 @@ static int imxfb_init_fbinfo(struct platform_device *pdev) fbi->lscr1 =IMXFB_LSCR1_DEFAULT ;of_property_read_u32 (np,"fsl,lscr1" , &fbi->lscr1); -of_property_read_u32 (np,"fsl,dmacr" , &fbi->dmacr); +of_property_read_u32 (np,"fsl,lpccr" , &fbi->pwmr); }return 0 ;
This last hunk if from an earlier patch from you. (I suggest you to resend it since the location of imxfb.c has changed in linux-next).
Is there any other imxfb patch I am missing?
I turned on the backlight supply via bootloader (kernel still does not support MC34704 PMIC yet), but the LCD screen is white and I cannot see the Linux logo. The /dev/fb0 does exist though.
Any ideas?
Regards,
Fabio Estevam
PATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
Hi Fabio,
Le Wed, 12 Mar 2014 14:27:25 -0300,
Fabio Estevam <[email protected]> a ?crit :
Quoted 2 lines
Any ideas?
do you drive the signal LCD_EN GPIO3_17 ?
Eric
Fabio Estevam
reviewerPATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
Hi Eric,
Quoted 7 lines · Eric B?nard
Hi Fabio,
Le Wed, 12 Mar 2014 14:27:25 -0300,
Fabio Estevam <[email protected]> a ?crit :Quoted 2 lines
Any ideas?
do you drive the signal
LCD_ENGPIO3_17?
Good point. Even though I am not touching LCD_EN it is at the correct level of 0.
I get 3.3V at LCD_VCC and VDD_LCDIO. 5V is present at LCD_5V that drives the backlight.
So the LCD supplies seem to be good.
The problem should be in some other area.
Thanks,
Fabio Estevam
Fabio Estevam
reviewerPATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
Denis/Eric,
Quoted 14 lines · Fabio Estevam
Hi Eric,
Quoted 7 lines · Eric B?nard
Hi Fabio,
Le Wed, 12 Mar 2014 14:27:25 -0300,
Fabio Estevam <[email protected]> a ?crit :Quoted 2 lines
Any ideas?
do you drive the signal
LCD_ENGPIO3_17?Good point. Even though I am not touching
LCD_ENit is at the correct level of 0.
Quoted 6 lines
I get 3.3V at
LCD_VCCandVDD_LCDIO. 5V is present atLCD_5Vthat drives the backlight.So the LCD supplies seem to be good.
The problem should be in some other area.
Do you know of a kernel version where imxfb is functional?
I have tried latest linus tree and booted a non-dt kernel on mx25pdk and I get the same white display.
Regards,
Fabio Estevam
PATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
In reply to Fabio EstevamHi Fabio,
Le Wed, 12 Mar 2014 15:24:57 -0300,
Fabio Estevam <[email protected]> a ?crit :
Quoted 2 lines
The problem should be in some other area.
if you have an oscilloscope, can you probe PIXCLK, HSYNC, VSYNC and DE to check the signals are properly configured vs the datasheet of your display.
Eric
Fabio Estevam
reviewerPATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
Hi Eric,
Quoted 3 lines · Eric B?nard
if you have an oscilloscope, can you probe PIXCLK, HSYNC, VSYNC and DE to check the signals are properly configured vs the datasheet of your display.
Yes, I have measured VSYNC and there is no activity on this line.
Also tried 3.13 with a non-dt kernel and the same issue is seen.
Running FSL 2.6.31 I can see VSYNC at 57Hz and Tux on the display, so the hardware is good.
At least for me imxfb seems to be broken even for the non-dt case.
Regards,
Fabio Estevam
Re: [PATCHv14][ 4/4] ARM: dts: imx25: mbimxsd25: Add displays support.
?????, 12 ????? 2014, 18:16 -03:00 ?? Fabio Estevam <[email protected]>:
Quoted 8 lines
Hi Eric,
Quoted 3 lines · Eric B?nard
if you have an oscilloscope, can you probe PIXCLK, HSYNC, VSYNC and DE to check the signals are properly configured vs the datasheet of your display.
Quoted 8 lines
Yes, I have measured VSYNC and there is no activity on this line.
Also tried 3.13 with a non-dt kernel and the same issue is seen.
Running FSL 2.6.31 I can see VSYNC at 57Hz and Tux on the display, so the hardware is good.
At least for me imxfb seems to be broken even for the non-dt case.
I will check the latest changes on the weekends for i.MX27.
---
Re: [PATCHv14][ 4/4] ARM: dts: imx25: mbimxsd25: Add displays support.
+CC: Tomi Valkeinen
???????, 13 ????? 2014, 8:25 +04:00 ?? Alexander Shiyan <[email protected]>:
Quoted 11 lines
?????, 12 ????? 2014, 18:16 -03:00 ?? Fabio Estevam <[email protected]>:
Quoted 10 lines
Hi Eric,
Quoted 3 lines · Eric B?nard
if you have an oscilloscope, can you probe PIXCLK, HSYNC, VSYNC and DE to check the signals are properly configured vs the datasheet of your display.
Yes, I have measured VSYNC and there is no activity on this line.
Quoted 8 lines
Quoted 6 lines
Also tried 3.13 with a non-dt kernel and the same issue is seen.
Running FSL 2.6.31 I can see VSYNC at 57Hz and Tux on the display, so the hardware is good.
At least for me imxfb seems to be broken even for the non-dt case.
I will check the latest changes on the weekends for i.MX27.
I acknowledge that the (linux-next-20140314) framebuffer driver works fine. Today I checked it on Phytec-PCM970 board with i.MX27 (DT).
Nevertheless, I ask Tomi to apply at least two patches for this driver:
http://www.spinics.net/lists/arm-kernel/msg315522.html
http://www.spinics.net/lists/arm-kernel/msg315523.html
---
Fabio Estevam
reviewerPATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
Quoted 2 lines · Alexander Shiyan
I acknowledge that the (linux-next-20140314) framebuffer driver works fine. Today I checked it on Phytec-PCM970 board with i.MX27 (DT).
Thanks for confirming imxfb is functional, Alexander.
Just tried linux-next-20140314 and still do not get LCD functional, so it looks like a mx25pdk specific issue then.
Regards,
Fabio Estevam
Re: [PATCHv14][ 4/4] ARM: dts: imx25: mbimxsd25: Add displays support.
???????, 15 ????? 2014, 11:17 -03:00 ?? Fabio Estevam <[email protected]>:
Quoted 9 lines · Alexander Shiyan
Quoted 3 lines
I acknowledge that the (linux-next-20140314) framebuffer driver works fine. Today I checked it on Phytec-PCM970 board with i.MX27 (DT).
Thanks for confirming imxfb is functional, Alexander.
Just tried linux-next-20140314 and still do not get LCD functional, so it looks like a mx25pdk specific issue then.
Fabio, I use settings, which sent in the patch. Look, maybe it will help ...
http://www.spinics.net/lists/arm-kernel/msg315707.html
---
PATCH v14 4/4 ARM: dts: imx25: mbimxsd25: Add displays support.
In reply to Fabio EstevamQuoted 1 line · Fabio Estevam
Hi Denis,
Hi,
Quoted 2 lines
I turned on the backlight supply via bootloader (kernel still does not support MC34704 PMIC yet),
Maybe this patchset[1] could help, but it still requires some work, and I don't have the hardware to test anymore right now.
So feel free to improve it and resubmit it.
References:
-----------
[1]http://lists.infradead.org/pipermail/linux-arm-kernel/2013-November/thread.html#214619
Denis.