Jump to content

Enabling LCD in u-boot Kernel 4.7.2


MartinKeppler

Recommended Posts

 Hi,

 

since Igor told me to enable LCD in u-boot I was searching for a solution. In the menuconfig of Kernel 3.4 ... 3.14 I saw Device Drivers > Graphics Support > Enable driver model support for LCD/video ...

Now in menuconfig of armbian with Kernel 4.7.2 I can't see this option. I see attach screenshot. Has anyone an idea how to enable LCD? 

I'm using LeMaker 5" LCD with CP - Touch. My board is Banana Pi with Allwinner a20.

 

post-1861-0-77910900-1472137447_thumb.png

Link to comment
Share on other sites

Ok, I downloaded the armbian source with all build tools from 

 

https://github.com/igorpecovnik/lib

 

as described at

 

http://docs.armbian.com/Developer-Guide_Build-Preparation/

 

I changed the file /sources/u-boot/v2016.07/configs/Bananapi_defconfig. Here I added:

CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:48,vs:3,sync:3,vmode:0"
CONFIG_VIDEO_LCD_POWER="PH12"
CONFIG_VIDEO_LCD_BL_EN="PH8"
CONFIG_VIDEO_LCD_BL_PWM="PB2"
Left the rest of file as it was. 
 
 
I also changed /sources/u-boot-v2016.07/arch/arm/dts/sun7i-a20-bananapi.dts
At the end of &pio node, I added:
    edt_ft5x06_pins: edt_ft5x06_pins@0 {
            allwinner,pins = "PH7", "PH9";
            allwinner,function = "gpio_out";
            allwinner,drive = <SUN4I_PINCTRL_40_MA>;
            allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
    }; 

And for touchdriver:

&i2c3 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&i2c3_pins_a>;
        edt: edt-ft5x06@38 {
                        compatible = "edt,edt-ft5x06";
                        reg = <0x38>;
                        interrupt-parent = <&pio>;
                        interrupts = <7 9 IRQ_TYPE_EDGE_FALLING>;
                        wake-gpios = <7 7 GPIO_ACTIVE_LOW>;
                        pinctrl-names = "default";
                        pinctrl-0 = <&edt_ft5x06_pins>;
                        touchscreen-size-x = <1024>;
                        touchscreen-size-y = <600>;
                        touchscreen-inverted-x;
                        touchscreen-swapped-x-y;
        };
};

After &i2c2.

 

PWM.

&pwm {
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pins_a>, <&pwm1_pins_a>;
status = "okay";
};

for backlight PWM after the &pio node.

In /sources/u-boot-v2016.07/arch/arm/dts/sun7i-a20.dtsi I activated simpleframebuffer "framebuffer@1":

framebuffer@1 {
compatible = "allwinner,simple-framebuffer",
    "simple-framebuffer";
allwinner,pipeline = "de_be0-lcd0";
clocks = <&ahb_gates 36>, <&ahb_gates 44>,
<&de_be0_clk>, <&tcon0_ch0_clk>,
<&dram_gates 26>;
status = "enabled";
};

Built the armbian, made an image, wrote it to SD and let it run. Still HDMI is on, LCD stays dark.

 

Any Ideas?

Link to comment
Share on other sites

At http://docs.armbian.com/Developer-Guide_Build-Options/I saw, that there are two variables EXTERNAL and EXTERNAL_NEW.

EXTERNAL compiles some extra applications like sunxi display control. EXTERNAL_NEW does compiles extra applications in to chroot.

 

I now set both to "yes" in compile.sh.

But still got no picture on my lcd.

Those things has nothing to do with your problem.

 

http://forum.armbian.com/index.php/topic/1905-enabling-lcd-in-u-boot-kernel-472/#entry14676

You are on the right track here but obviously something is missing.

Link to comment
Share on other sites

The same thought as me. Must be missing something.

Isn't it necessary to map the pins for the Display like in FEX as shown below? 

Is there a syntax for DT to do this?

[lcd0_para]
.
.
.
.
lcd_bl_en = port:PH08<1><0><default><1>
lcd_power_used = 1
lcd_power = port:PH12<1><0><default><1>
lcd_pwm_used = 1
lcd_pwm = port:PB02<2><0><default><default>
lcdd0 = port:PD00<2><0><3><default>
lcdd1 = port:PD01<2><0><3><default>
lcdd2 = port:PD02<2><0><3><default>
lcdd3 = port:PD03<2><0><3><default>
lcdd4 = port:PD04<2><0><3><default>
lcdd5 = port:PD05<2><0><3><default>
lcdd6 = port:PD06<2><0><3><default>
lcdd7 = port:PD07<2><0><3><default>
lcdd8 = port:PD08<2><0><3><default>
lcdd9 = port:PD09<2><0><3><default>
lcdd10 = port:PD10<2><0><3><default>
lcdd11 = port:PD11<2><0><3><default>
lcdd12 = port:PD12<2><0><3><default>
lcdd13 = port:PD13<2><0><3><default>
lcdd14 = port:PD14<2><0><3><default>
lcdd15 = port:PD15<2><0><3><default>
lcdd16 = port:PD16<2><0><3><default>
lcdd17 = port:PD17<2><0><3><default>
lcdd18 = port:PD18<2><0><3><default>
lcdd19 = port:PD19<2><0><3><default>
lcdd20 = port:PD20<2><0><3><default>
lcdd21 = port:PD21<2><0><3><default>
lcdd22 = port:PD22<2><0><3><default>
lcdd23 = port:PD23<2><0><3><default>
lcdclk = port:PD24<2><0><3><default>
lcdde = port:PD25<2><0><3><default>
lcdhsync = port:PD26<2><0><3><default>
lcdvsync = port:PD27<2><0><3><default>

I saw a file at /sources/u-boot/v2016.07/drivers/video called sunxi_display.c. There are some specific defines like SSD2828. 

ifdef CONFIG_VIDEO_LCD_SSD2828
static int sunxi_ssd2828_init(const struct ctfb_res_modes *mode)
{
	struct ssd2828_config cfg = {
		.csx_pin = name_to_gpio(CONFIG_VIDEO_LCD_SPI_CS),
		.sck_pin = name_to_gpio(CONFIG_VIDEO_LCD_SPI_SCLK),
		.sdi_pin = name_to_gpio(CONFIG_VIDEO_LCD_SPI_MOSI),
		.sdo_pin = name_to_gpio(CONFIG_VIDEO_LCD_SPI_MISO),
		.reset_pin = name_to_gpio(CONFIG_VIDEO_LCD_SSD2828_RESET),
		.ssd2828_tx_clk_khz  = CONFIG_VIDEO_LCD_SSD2828_TX_CLK * 1000,
		.ssd2828_color_depth = 24,
#ifdef CONFIG_VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828
		.mipi_dsi_number_of_data_lanes           = 4,
		.mipi_dsi_bitrate_per_data_lane_mbps     = 513,
		.mipi_dsi_delay_after_exit_sleep_mode_ms = 100,
		.mipi_dsi_delay_after_set_display_on_ms  = 200
#else
#error MIPI LCD panel needs configuration parameters
#endif
	};

I'm hoping not have to change a driver to make my display work.

Link to comment
Share on other sites

I'm getting deeper and deeper into the topic. But it still doesn't work.

At http://wiki.lemaker.org/LeMaker_Guitar:LCD I saw an exampel of activiating LCD on the LeMakers Guitar:

I changed a few things and added this to my dtsi files.

lcd0: lcd0@01c0c000 {  /* org: lcd0: lcd0@b02a0000 {
                          0x01c0c000 from a20 allwinner manual*/
		pinctrl-names = "default";
		pinctrl-0 = <&lvds_state_default>;
		lcd_power_gpios = <&gpio 7 12 0> /*PH12"  /*<&gpio 36 0>;*/    /*GPIOB4*/
		//lcd_reset_gpios = <&gpio 49 0>; /*GPIOB17*/
		port_type = "lvds";
		data_width = <0>;		/* 0:24bit ,1:18bit */
		videomode-0 = <&lcd_mode0>;
		vsync_inversion = <0>;
		hsync_inversion = <0>;
 
		dclk_inversion = <0>;
		lde_inversion = <0>;
		lvds_ctl = <0x000a9523>;	/* last two bit: 3:8bit ,1:6bit */
		lvds_alg_ctl0 = <0xc141a030>;
		lightness = <128>;
		saturation = <7>;
		contrast = <5>;
 
		lcd_mode0:mode@800x600p60 {/*1280x800p60 {*/
				refresh = <60>;
				xres = <800>; /*1280*/
				yres = <480>; /*480*/   
				pixclock = <14090>;
				left_margin = <80>;
				right_margin = <60>;
				upper_margin = <8>;
				lower_margin = <7>;
				hsync_len = <20>;
				vsync_len = <8>;
				vmode = <0>;
		};
	};
 
        //Set LCD as a master device
        framebuffer {
                compatible = "actions,framebuffer";
                def_display = "lcd";          
        };
        //Set HDMI display as a master device
 /*     framebuffer {
                compatible = "actions,framebuffer";
                def_display = "hdmi";
                xres = <1280>;
                yres = <720>;
                bpp = <4>;               
        };
 */

First build throws an error because &lvds_state_default was unknown. So I seachrched arround and did find the original file https://github.com/LeMaker/linux-actions/blob/linux-3.10.y/arch/arm/boot/dts/lemaker_guitar_bbb.dts

I added lvds_state_default to my dtsi files. But build now throws a new error. I think it could be because of the "actions" and the names "mfp1_6_5" and so on. For a20 I saw at compatible and such things "allwinner,arm-cortex-a7" and so on.

 		lvds_state_default: lvds_default {
       			lvds_mux {
               			actions,groups = "mfp1_6_5", "mfp2_28_27";
                		actions,function = "lvds";
       			};
       			lcd_mux {
            			actions,groups = "mfp1_22_21";
            			actions,function = "lcd0";
     			};
  		};	
		rgb_state_default: rgb_default {
			rgb_mux {
				actions,groups = "mfp0_25_23","mfp1_16_14", "mfp1_22_21", "mfp1_13_12", "mfp1_11_10", "mfp1_6_5", "mfp2_30_29", "mfp2_28_27";
				actions,function = "lcd0";
			};
		};

Any hints how to name it correct?

Is there any documentation, where I can find the correct names?

Link to comment
Share on other sites

Ok got some news:

 

Added following to sun7i-a20.dtsi

		framebuffer0: framebuffer@1d385000 {
			compatible = "simple-framebuffer";
			reg = <0x1d385000 (800 * 480 * 2)>;
			width = <800>;
			height = <4800>;
			stride = <(800 * 2)>;
			format = "r5g6b5";
			clocks = <&ahb_gates 36>, <&ahb_gates 43>, <&ahb_gates 44>;
			lcd-supply = <&reg_dc1sw>;
			display = <&lcdc0>;
		};
		stdout-path = "display0";

Changed the last lines in sun7i-a20.dtsi because of compiling errors to:

	 //Set LCD as a master device
	framebuffer {
			compatible = "allwinner,framebuffer";
			def_display = "lcd";          
	};
	
	/*lvds_state_default: lvds_default {
		lvds_mux {
				allwinner,groups = "mfp1_6_5", "mfp2_28_27";
				allwinner,function = "lvds";
		};
		lcd_mux {
				allwinner,groups = "mfp1_22_21";
				allwinner,function = "lcd0";
		};*/
		
		rgb_state_default: rgb_default {
			rgb_mux {
				allwinner,pins = "PD0", "PD1", "PD2", "PD3", "PD4", 
								"PD5", "PD6", "PD7", "PD8", "PD9", 
								"PD10", "PD11", "PD12", "PD13", 
								"PD14", "PD15", "PD16", "PD17", 
								"PD18", "PD19", "PD20", "PD21", 
								"PD22", "PD23", "PD24", "PD25", 
								"PD26", "PD26", "PD27", "PD27"; 								
				allwinner,function = "lcd0";
			};
		};		

And also changed the pinctrl value in sun7i-a20.dtsi for lcd0 and added a compatible line:

lcd0: lcd0@01c0c000 {
			compatible = "allwinner,sun4i-a10-lcdc";
			pinctrl-names = "default";
			pinctrl-0 = <&rgb_state_default>;

I thought "actions" could not be the correct label, because all other functions in device tree of a20 are called allwinner,...

Also find out that the groups does not exist for a20. Didn't find groups witch match. Maybe anybody knows where I can find out or add this groups. Must be a header file. So I changed "groups" to "pins" and added all pins from a20's port D witch represents the lcd0.

 

But what should I say ... display is still dark. I got sneaking suspicion, that still isn't activate in u-boot. I'm not sure, if the additions to my Bananapi_defconfig from http://forum.armbian.com/index.php/topic/1905-enabling-lcd-in-u-boot-kernel-472/?p=14676 arereally compiled into the u-boot. I'm thinking that hdmi has to stay black, if my configs are correct. Am I right?

Is there a way to check the config, of u-boot at runtime?

Link to comment
Share on other sites

Okay Guys,

 

I've got a little success. My display is on now. I think the worst thing I could do, was to let HDMI plugged in and HDMI monitor switched on. Only by luck, I saw, that my display is working when HDMI monitor is switched of.

Now, I will search for the correct solution and post it here soon.

 

Yours Martin

Link to comment
Share on other sites

So, now I can tell you how to enable LCD in u-boot and DT.

 

First getting the source of armbian from https://github.com/igorpecovnik/lib

Open the file sources/u-boot/v2016.09/configs/Bananapi_defconfig and add:

CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:48,vs:3,sync:3,vmode:0"
CONFIG_VIDEO_LCD_POWER="PH12"
CONFIG_VIDEO_LCD_BL_EN="PH8"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

Now LCD is enabled in u-boot. But it will not switch on backlight, because backlight uses pwm and pwm is disabled per default in DT. So you also have to add:

&pwm {
      pinctrl-names = "default";
      pinctrl-0 = <&pwm0_pins_a>, <&pwm1_pins_a>;
      status = "okay";
};

Ready!

But be aware, LCD only turns on if there is no HDMI Monitor plugged in!!

 

Ok, hopping some one else of you can use this stuff.

Link to comment
Share on other sites

Hi,

 

I'm trying to do the same with Banana Pi + 7" LCD module. But my display stays dark.

 

  1. installed the toolchain
  2. changed the additional line for the 7" display to:

     

    CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:50,vs:10,sync:3,vmode:0"
    CONFIG_VIDEO_LCD_POWER="PH12"
    CONFIG_VIDEO_LCD_BL_EN="PH8"
    CONFIG_VIDEO_LCD_BL_PWM="PB2"

     

  3. added pwm group to .dts file like Martin did
  4. made no changes to compile.sh
  5. ./compile.sh with latest stable Jessie kernel + Desktop Environment

With a plugged in HDMI Monitor my BPi start correctly to Desktop. With unplugged HMDI unfortunately my 7" LCD stays dark

 

What have I done wrong? :-)

Link to comment
Share on other sites

Hi Smuggler,

 

I think your on the right way. Your Display needs PWM to drive backlight, as you see in this line: CONFIG_VIDEO_LCD_BL_PWM="PB2". For default pwm is not enabled in device tree. So you also have to turn on the pwm backlight. Look at this thread: https://forum.armbian.com/index.php/topic/1817-using-pwm-without-rebuilding-kernel/#entry14015

 

Hope it will help you.

Yours,

Martin

Link to comment
Share on other sites

I have done this. And added

&pwm {
    pinctrl-names = "default";
    pinctrl-0 = <&pwm0_pins_a>, <&pwm1_pins_a>;
    status = "okay";
};

 to my .../arch/arm/dts/sun7i-a20-bananpi.dts file

 

but it seems that the changed .dts file is not recompiled at all because after build image an recompile .dtb to .dts

i only can find

 

pwm@01c20e00 {
                        compatible = "allwinner,sun7i-a20-pwm";
                        reg = <0x1c20e00 0xc>;
                        clocks = <0xc>;
                        #pwm-cells = <0x3>;
                        status = "disabled";
                };

Link to comment
Share on other sites

Ok, I got the same problem. This happens because compile.sh by default forces the checkout of all sources and also by default cleans the builds you did bevor. So every time you compile, your changes will be overwritten.

I suggest to set CREATE_PATCHES=yes in compile.sh.

Now you will be asked in the build process to change some files. Build process is hold, till you press enter. While it's waiting, copy your changed *.dts to the two folders in source. I rember, there must be two folder: /sources/linux-vanilla/master/arch/arm/boot/dts/ and /sources/u-boot/v2016.11/arch/arm/dts/. After pressing enter, the build process automatically detects your changes and creates a patch. So you only have to do this once.

 

You can read about build options and process here: https://docs.armbian.com/Developer-Guide_Build-Options/

 

 

Yours,

Martin

Link to comment
Share on other sites

Thanks Martin, that was the missing hint i needed.

CREATE_PATCHES = yes and then copy the customized sun7i-a20-bananpi.dts to both folders.

 

P.s. added the touch driver like you explained in your other thread.

 

Works for me. Thanks

Link to comment
Share on other sites

Hi there. I'm trying the same with bananapi_pro right now.

 

So, toolchain isn't working for me since I'm running Gentoo. But anyway.

 

I downloaded the armbian Jessie desktop image and put it on my SD. It boots and shows content on HDMI.

 

Then I've downloaded u-boot and changed sun7i-a20-bananapro.dts .

# make Bananapro_defconfig && make clean all

 

I updated u-boot via:

# dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8

So that probably seemed to work since u-boots tells me the correct build date on startup.

 

For the kernel, I've downloaded  https://github.com/megous/linuxand copied the config from /boot .

I also added the pwm stuff in the coresponding dts.

 

So, copied modules to /lib , kernel and dts to /boot and also made the links in /boot .

 

The kernel starts fine but still a dark display while not having the HDMI connected. On reset the display seems to flash for a short time but I've no idea if this hasn't be the case before.

 

Do you have anything in /sysfs or dmesg which relates to PWM or backlight?

 

Regards,

Alex

Link to comment
Share on other sites

Hi erazor,

 

thats great to read! Just wanna give you an answer, that it propably would be about the pwm isn't working. My display also is flashing for a short moment, but stays black when pwm isn't in the dtb.

 

I think thats also good information for all others who try to use Banana Pi and Pro with LCD.

 

Yours,

Martin

Link to comment
Share on other sites

Guest HeinrichG

Hello guys,

 

I would like to activate LVDS on my BananaPRO. I'm using mainline kernel (4.9.10) and mainline U-Boot (2016.11).

 

It is enough to add those lines

 

 

CONFIG_VIDEO_LCD_MODE="x:1920,y:1080,depth:24,pclk_khz:72000,le:48,ri:48,up:8,lo:8,hs:50,vs:10,sync:3,vmode:0"
CONFIG_VIDEO_LCD_PANEL_LVDS=y
CONFIG_VIDEO_LCD_POWER="X"
CONFIG_VIDEO_LCD_BL_EN="Y"
CONFIG_VIDEO_LCD_BL_PWM="Z"

 

to my Bananapro_defconfig or have I do something else? Like config framebuffer, some changes in kernel device tree? (CONFIG_VIDEO_LCD_MODE line is "configured" from datasheet of my lcd panel).

 

Thanks you.

Link to comment
Share on other sites

Guest HeinrichG

Hi Martin,

 

at the moment I'm not able to test my setup, because I'm waiting for pcb for LCD driver (power supply, backlight driver and power supply for BPro on one board), but I can prepare all the stuff...

 

The panel is an LG LM230WF5-TLF1, datasheet is here: click me.

 

So, what I've done already:

 

I've created a mapping between BPro and panel: click me, there are two sheets, pinning and mapping.

 

On the pinning are just a pin and symbol lists of both devices.
Mapping sheet "connects" lcd to BPro.

 

Then, I added some lines to u-boot configuration (Bananapro_defconfig):

CONFIG_VIDEO_LCD_MODE="x:1920,y:1080,depth:24,pclk_khz:72000,le:48,ri:48,up:8,lo:8,hs:50,vs:10,sync:3,vmode:0"
CONFIG_VIDEO_LCD_PANEL_LVDS=y
CONFIG_VIDEO_LCD_POWER="PH7"
CONFIG_VIDEO_LCD_BL_EN="PH12"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

recompile them, wrote them to sd-card. U-Boot version is 2016.11.

In my dts file is pwm configured as:

&pwm {
    pinctrl-names = "default";
    pinctrl-0 = <&pwm0_pins_a>, <&pwm1_pins_a>;
    status = "okay";
};

Then I've created a pin definition for BL_EN and LCD_POWER (in &pio section):

    bl_en_pin_bananapro: bl_en@0 {
        allwinner,pins = "PH12";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
    };
    
    lcd_power_pin_bananapro: lcd_power@0 {
        allwinner,pins = "PH7";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
    };

and recompile dts file. I think, I'll have to add a definition on top of dts, next to (or like) "leds" to be able to access those pins throw labels. I'll see...

After reboot, I see this in dmesg:

[    0.319628] simple-framebuffer 7f817000.framebuffer: framebuffer at 0x7f817000, 0x7e9000 bytes, mapped to 0xf0900000
[    0.330308] simple-framebuffer 7f817000.framebuffer: format=x8r8g8b8, mode=1920x1080x32, linelength=7680
[    0.418036] simple-framebuffer 7f817000.framebuffer: fb0: simplefb registered!

It seems to be active. Kernel version is pure 4.9.11 from kernel.org

Link to comment
Share on other sites

Guest HeinrichG

I'm excited too :)

 

But, there is a thing, which I'm not unterstanding.

 

I defined the both pins for LCD control like that:

    bl_en_pin_bananapro: bl_en@0 {
        allwinner,pins = "PH12";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
    };
    
    lcd_power_pin_bananapro: lcd_power@0 {
        allwinner,pins = "PH7";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
    };

But, this both pins will not be published under /sys/class... like the both LEDs (blue and green, bananapro:blue:usr and bananapro:green:usr).

 

So, after that I've redifined the both pins as (in pio section):

lcd_control_pins_bananapro: lcd_control_pins@0 {
        allwinner,pins = "PH7", "PH12";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_PULL_DOWN>;
    };

and added the definition on the top of my dts file, next to leds:

    lcd_control {
        compatible = "gpio-leds";
        pinctrl-names = "default";
        pinctrl-0 = <&lcd_cpontrol_pins_bananapro>;
        
        backlight {
            label = "lcd_backlight";
            linux,default-trigger = "backlight";
            gpios = <&pio 7 12 GPIO_ACTIVE_HIGH>;
        };
        
        lcd_on_off {
            label = "lcd_power";
            gpios = <&pio 7 7 GPIO_ACTIVE_HIGH >;
        };
    };

If it is the same logic like in the case off leds, my both pins should be publshed under

/sys/class/lcd_control/backlight

and

/sys/class/lcd_control/lcd_on_off

Correct?

Link to comment
Share on other sites

I remeber I had a similar problem, but do not remeber excatly where... I try to catch my memories ...

Are you sure, that there is no error at boot up?

It's possible that system uses the pins for something. You can test this by trying to export the gpio manually. If you can export and set value of gpios, system doesn't use them. When you get an error, you have to search for the useage.

Link to comment
Share on other sites

Guest HeinrichG

So, I've added those lines to my dts file, compile them and start BPro.

 

Check this out:

root@bananapro:/sys/class# ls -la
total 0
drwxr-xr-x 42 root root 0 Feb 24 17:55 .
dr-xr-xr-x 12 root root 0 Feb 24 17:55 ..
drwxr-xr-x  2 root root 0 Feb 24 17:55 ata_device
drwxr-xr-x  2 root root 0 Feb 24 17:55 ata_link
drwxr-xr-x  2 root root 0 Feb 24 17:55 ata_port
drwxr-xr-x  2 root root 0 Feb 24 17:55 bdi
drwxr-xr-x  2 root root 0 Feb 24 17:55 block
drwxr-xr-x  2 root root 0 Feb 24 17:55 bsg
drwxr-xr-x  2 root root 0 Feb 24 17:55 dma
drwxr-xr-x  2 root root 0 Feb 24 17:55 drm
drwxr-xr-x  2 root root 0 Feb 24 17:55 extcon
drwxr-xr-x  2 root root 0 Feb 24 17:55 gpio
drwxr-xr-x  2 root root 0 Feb 24 17:55 graphics
drwxr-xr-x  2 root root 0 Feb 24 17:55 hwmon
drwxr-xr-x  2 root root 0 Feb 24 17:55 i2c-adapter
drwxr-xr-x  2 root root 0 Feb 24 17:55 i2c-dev
drwxr-xr-x  2 root root 0 Feb 24 17:55 input
drwxr-xr-x  2 root root 0 Feb 24 17:55 leds
drwxr-xr-x  2 root root 0 Feb 24 17:55 mdio_bus
drwxr-xr-x  2 root root 0 Feb 24 17:55 mem
drwxr-xr-x  2 root root 0 Feb 24 17:55 misc
drwxr-xr-x  2 root root 0 Feb 24 17:55 mmc_host
drwxr-xr-x  2 root root 0 Feb 24 17:55 net
drwxr-xr-x  2 root root 0 Feb 24 17:55 phy
drwxr-xr-x  2 root root 0 Feb 24 17:55 power_supply
drwxr-xr-x  2 root root 0 Feb 24 17:55 pps
drwxr-xr-x  2 root root 0 Feb 24 17:55 ptp
drwxr-xr-x  2 root root 0 Feb 24 17:55 pwm
drwxr-xr-x  2 root root 0 Feb 24 17:55 rc
drwxr-xr-x  2 root root 0 Feb 24 17:55 regulator
drwxr-xr-x  2 root root 0 Feb 24 17:55 rtc
drwxr-xr-x  2 root root 0 Feb 24 17:55 scsi_device
drwxr-xr-x  2 root root 0 Feb 24 17:55 scsi_disk
drwxr-xr-x  2 root root 0 Feb 24 17:55 scsi_host
drwxr-xr-x  2 root root 0 Feb 24 17:55 sound
drwxr-xr-x  2 root root 0 Feb 24 17:55 spi_master
drwxr-xr-x  2 root root 0 Feb 24 17:55 thermal
drwxr-xr-x  2 root root 0 Feb 24 17:55 tty
drwxr-xr-x  2 root root 0 Feb 24 17:55 udc
drwxr-xr-x  2 root root 0 Feb 24 17:55 vc
drwxr-xr-x  2 root root 0 Feb 24 17:55 vtconsole
drwxr-xr-x  2 root root 0 Feb 24 17:55 watchdog
root@bananapro:/sys/class#

So, lcd_control isn't there. But:

root@bananapro:/sys/class/leds# ll
total 0
drwxr-xr-x  2 root root 0 Feb 24 17:55 .
drwxr-xr-x 42 root root 0 Feb 24 17:55 ..
lrwxrwxrwx  1 root root 0 Feb 24 17:55 bananapro:blue:usr -> ../../devices/platform/leds/leds/bananapro:blue:usr
lrwxrwxrwx  1 root root 0 Feb 24 17:55 bananapro:green:usr -> ../../devices/platform/leds/leds/bananapro:green:usr
lrwxrwxrwx  1 root root 0 Feb 24 17:55 lcd_backlight -> ../../devices/platform/lcd_control/leds/lcd_backlight
lrwxrwxrwx  1 root root 0 Feb 24 17:55 lcd_power -> ../../devices/platform/lcd_control/leds/lcd_power
root@bananapro:/sys/class/leds#

The "targets" lcd_backlight and lcd_power are exported into leds, because of "gpio_leds". So, it's okay.

 

EDIT: And, I'm able to control the pins, I've checked this with multi.

 

And it is possible to declare a gpio-led as gpio-backlight: check this out

Link to comment
Share on other sites

Hello guys,

 

I have tried the following HowTo to get my 7 inch LCD working, but I can't find the file "sources/u-boot/v2016.09/configs/Bananapi_defconfig".

 

Can anybody help me please?

 

On 22.9.2016 at 9:00 AM, MartinKeppler said:

So, now I can tell you how to enable LCD in u-boot and DT.

 

First getting the source of armbian from https://github.com/igorpecovnik/lib

Open the file sources/u-boot/v2016.09/configs/Bananapi_defconfig and add:


CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:48,vs:3,sync:3,vmode:0"
CONFIG_VIDEO_LCD_POWER="PH12"
CONFIG_VIDEO_LCD_BL_EN="PH8"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

Now LCD is enabled in u-boot. But it will not switch on backlight, because backlight uses pwm and pwm is disabled per default in DT. So you also have to add:


&pwm {
      pinctrl-names = "default";
      pinctrl-0 = <&pwm0_pins_a>, <&pwm1_pins_a>;
      status = "okay";
};

Ready!

But be aware, LCD only turns on if there is no HDMI Monitor plugged in!!

 

Ok, hopping some one else of you can use this stuff.

 

Thanks.

 

Steffen

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines