This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/BEAGLEBK: 24-bit LCD mode

Part Number: BEAGLEBK

Tool/software: Linux

Hello,

I'm trying to put my BeagleBone Black into 24-bit LCD mode, but it isn't working.  Instead, I get 16-bit mode.  I'm driving an all Red test pattern and get all Blue on screen due to the Sitara Errata notes in 3.1.1.  If the Sitara would go into 24-bit mode, I should have the correct color.   I have also probed the LCD lines and found that only LCD_Data0 - LCD_Data15 are active.

I am running Kernel 4.9.79 from the Processor SDK.

Here is my Device Tree, shouldn't this put it into 24-bit mode?

/dts-v1/;

#include "am33xx.dtsi"
#include "am335x-bone-common.dtsi"
#include <dt-bindings/display/tda998x.h>

/ {
    model = "TI AM335x BeagleBone Black";
    compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
};

&ldo3_reg {
    regulator-min-microvolt = <1800000>;
    regulator-max-microvolt = <1800000>;
    regulator-always-on;
};

&mmc1 {
    vmmc-supply = <&vmmcsd_fixed>;
};

&mmc2 {
    vmmc-supply = <&vmmcsd_fixed>;
    pinctrl-names = "default";
    pinctrl-0 = <&emmc_pins>;
    bus-width = <8>;
    status = "okay";
};

&cpu0_opp_table {
    /*
     * All PG 2.0 silicon may not support 1GHz but some of the early
     * BeagleBone Blacks have PG 2.0 silicon which is guaranteed
     * to support 1GHz OPP so enable it for PG 2.0 on this board.
     */
    oppnitro@1000000000 {
        opp-supported-hw = <0x06 0x0100>;
    };
};

&am33xx_pinmux {
    lcd_pins: lcd_pins {
        pinctrl-single,pins = <
            AM33XX_IOPAD(0x8a0, PIN_OUTPUT | MUX_MODE0)        /* lcd_data0.lcd_data0 */
            AM33XX_IOPAD(0x8a4, PIN_OUTPUT | MUX_MODE0)        /* lcd_data1.lcd_data1 */
            AM33XX_IOPAD(0x8a8, PIN_OUTPUT | MUX_MODE0)        /* lcd_data2.lcd_data2 */
            AM33XX_IOPAD(0x8ac, PIN_OUTPUT | MUX_MODE0)        /* lcd_data3.lcd_data3 */
            AM33XX_IOPAD(0x8b0, PIN_OUTPUT | MUX_MODE0)        /* lcd_data4.lcd_data4 */
            AM33XX_IOPAD(0x8b4, PIN_OUTPUT | MUX_MODE0)        /* lcd_data5.lcd_data5 */
            AM33XX_IOPAD(0x8b8, PIN_OUTPUT | MUX_MODE0)        /* lcd_data6.lcd_data6 */
            AM33XX_IOPAD(0x8bc, PIN_OUTPUT | MUX_MODE0)        /* lcd_data7.lcd_data7 */
            AM33XX_IOPAD(0x8c0, PIN_OUTPUT | MUX_MODE0)        /* lcd_data8.lcd_data8 */
            AM33XX_IOPAD(0x8c4, PIN_OUTPUT | MUX_MODE0)        /* lcd_data9.lcd_data9 */
            AM33XX_IOPAD(0x8c8, PIN_OUTPUT | MUX_MODE0)        /* lcd_data10.lcd_data10 */
            AM33XX_IOPAD(0x8cc, PIN_OUTPUT | MUX_MODE0)        /* lcd_data11.lcd_data11 */
            AM33XX_IOPAD(0x8d0, PIN_OUTPUT | MUX_MODE0)        /* lcd_data12.lcd_data12 */
            AM33XX_IOPAD(0x8d4, PIN_OUTPUT | MUX_MODE0)        /* lcd_data13.lcd_data13 */
            AM33XX_IOPAD(0x8d8, PIN_OUTPUT | MUX_MODE0)        /* lcd_data14.lcd_data14 */
            AM33XX_IOPAD(0x8dc, PIN_OUTPUT | MUX_MODE0)        /* lcd_data15.lcd_data15 */
                        

            /*  elinux.org/24bit_LCD_for_BBB  */
            0x3c 0x09 /* lcd_data16.lcd_data16, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
            0x38 0x09 /* lcd_data17.lcd_data17, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
            0x34 0x09 /* lcd_data18.lcd_data18, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
            0x30 0x09 /* lcd_data19.lcd_data19, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
            0x2c 0x09 /* lcd_data20.lcd_data20, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
            0x28 0x09 /* lcd_data21.lcd_data21, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
            0x24 0x09 /* lcd_data22.lcd_data22, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */
            0x20 0x09 /* lcd_data23.lcd_data23, OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA */


            AM33XX_IOPAD(0x8e0, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_vsync.lcd_vsync */
            AM33XX_IOPAD(0x8e4, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_hsync.lcd_hsync */
            AM33XX_IOPAD(0x8e8, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_pclk.lcd_pclk */
            AM33XX_IOPAD(0x8ec, PIN_OUTPUT_PULLDOWN | MUX_MODE0)    /* lcd_ac_bias_en.lcd_ac_bias_en */
            AM33XX_IOPAD(0x878, PIN_OUTPUT_PULLDOWN | MUX_MODE7)
        >;
    };

    backlight_pin: backlight_pin {
            pinctrl-single,pins = <
                AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLUP | MUX_MODE6)
        >;
    };

        bb_spi0_pins: pinmux_bb_spi0_pins {
                pinctrl-single,pins = <
                        0x150 0x30      /* spi0_sclk.spi0_sclk, INPUT_PULLUP | MODE0 */
                        0x154 0x30      /* spi0_d0.spi0_d0, INPUT_PULLUP | MODE0 */
                        0x158 0x10      /* spi0_d1.spi0_d1, OUTPUT_PULLUP | MODE0 */
                        0x15c 0x10      /* spi0_cs0.spi0_cs0, OUTPUT_PULLUP | MODE0 */
                >;
        };
                                                                        
};

&spi0 {
        #address-cells = <1>;
        #size-cells = <0>;

        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&bb_spi0_pins>;


        channel@0 {
                #address-cells = <1>;
                #size-cells = <0>;

                compatible = "spidev";

                reg = <0>;
                spi-max-frequency = <16000000>;
        };
};

&lcdc {
    status = "okay";
};

&epwmss1 {
    status = "okay";
};

&ehrpwm1 {
    pinctrl-names = "default";
    pinctrl-0 = <&backlight_pin>;
    status = "okay";
};

&rtc {
    system-power-controller;
};

&sgx {
    status = "okay";
};

/ {

    lcd0: display {
        status = "okay";
        compatible = "ti,tilcdc,panel";
        label = "lcd";
        pinctrl-names = "default";
        pinctrl-0 = <&lcd_pins>;

        panel-info {
            ac-bias           = <255>;
            ac-bias-intrpt    = <0>;
            dma-burst-sz      = <16>;
            bpp               = <24>;
            fdd               = <0x80>;
            sync-edge         = <0>;
            sync-ctrl         = <1>;
            raster-order      = <0>;
            fifo-th           = <0>;
        };

        display-timings {
            native-mode = <&timing0>;
            timing0: 240x320 {
                clock-frequency = <7200000>;
                hactive = <240>;
                vactive = <320>;
                hfront-porch = <38>;
                hback-porch = <10>;
                hsync-len = <10>;
                vback-porch = <4>;
                vfront-porch = <8>;  
                vsync-len = <4>;
                hsync-active = <0>;     // Low active
                vsync-active = <0>;     // Low active
                de-active = <1>;        // The data DB17-0 is written when ENABLE = “1”. Disable data write operation when ENABLE = “0”.
                pixelclk-active = <1>;  // The data is input on the positive edge of DOTCLK
            };
        };
    };

    fb {
        compatible = "ti,am33xx-tilcdc";
        reg = <0x4830e000 0x1000>;
        interrupt-parent = <&intc>;
        interrupts = <36>;
        ti,hwmods = "lcdc";
    };

    backlight {
        status = "okay";
        compatible = "pwm-backlight";
        pwms = <&ehrpwm1 0 500000 0>;
        brightness-levels = <
            0  1  2  3  4  5  6  7  8  9
            10 11 12 13 14 15 16 17 18 19
            20 21 22 23 24 25 26 27 28 29
            30 31 32 33 34 35 36 37 38 39
            40 41 42 43 44 45 46 47 48 49
            50 51 52 53 54 55 56 57 58 59
            60 61 62 63 64 65 66 67 68 69
            70 71 72 73 74 75 76 77 78 79
            80 81 82 83 84 85 86 87 88 89
            90 91 92 93 94 95 96 97 98 99
            100
        >;
        default-brightness-level = <100>;
    };
};

  • Hello,

    I can not allocate the kernel version that you are using. Even in the latest PSDK 4.03 the version is 4.9.69.
    However please check this wikis:
    processors.wiki.ti.com/.../Processor_Linux_SDK_Graphics_and_Display
    processors.wiki.ti.com/.../Linux_Core_LCD_Controller_User_Guide

    Hope this helps.

    BR
    Margarita
  • Sorry - that was a typo.  I am building:

    git://git.ti.com/processor-sdk/processor-sdk-linux.git

    Branch: processor-sdk-linux-04.02.00

    commit a75d8e93056181d512f6c818e8627bd4554aaf92

    Menuconfig reports 4.9.59. 

    Still, I don't understand why I'm getting RGB565 instead of RGB888.  Do you have a known working Kernel device tree for 24-bit RGB888?

    Thanks,

    Matt

  • Hello,

    You may check these threads:
    e2e.ti.com/.../635633
    e2e.ti.com/.../641400
    e2e.ti.com/.../626242
    e2e.ti.com/.../659517
    and compare/check your settings.

    Hope this helps.

    BR
    Margarita
  • Thanks, it turns out I really did mess up the kernel version. I didn't realize that the linux-ti-staging builds the same kernel as the Processor SDK and somehow I messed up my git import of the processor SDK. Now that I'm using Kernel commit a75d8e93056181d512f6c818e8627bd4554aaf92 the bpp of 24 is respected and I get the proper colors on the LCD. Thanks!!
  • Hello,

    I am glad that this issue is solved.
    Thank you for verifying the thread.

    BR
    Margarita
  • I need to update this.  I had a lot of confusion about the kernel version, but now I've reverted to using the pre-built kernel from SDK 04.03.00.05 (4.9.69-g9ce43c71ae).

    The key requirement for 24-bit mode is in the Kernel device tree.  

    YOU MUST SET:

    &lcdc {

        status = "okay";

        blue-and-red-wiring = "crossed";

    };

    IT WILL NOT WORK UNLESS SET TO "crossed"

    See drivers/gpu/drm/tilcdc/tilcdc_drv.c:

                    of_property_read_string(node, "blue-and-red-wiring", &str);
                    if (0 == strcmp(str, "crossed")) {
                            DBG("Configured for crossed blue and red wires");
                            priv->pixelformats = tilcdc_crossed_formats;
                            priv->num_pixelformats =
                                    ARRAY_SIZE(tilcdc_crossed_formats);
                            bpp = 32; /* Choose bpp with RGB support for fbdef */
                    } else if (0 == strcmp(str, "straight")) {
                            DBG("Configured for straight blue and red wires");
                            priv->pixelformats = tilcdc_straight_formats;
                            priv->num_pixelformats =
                                    ARRAY_SIZE(tilcdc_straight_formats);
                            bpp = 16; /* Choose bpp with RGB support for fbdef */
                    } else {
                            DBG("Blue and red wiring '%s' unknown, use legacy mode",
                                str);
                            priv->pixelformats = tilcdc_legacy_formats;
                            priv->num_pixelformats =
                                    ARRAY_SIZE(tilcdc_legacy_formats);
                            bpp = 16; /* This is just a guess */
                    }
    

    bpp is later set on the frame buffer:

            priv->fbdev = drm_fbdev_cma_init(ddev, bpp,
                            ddev->mode_config.num_crtc,
                            ddev->mode_config.num_connector);

    I'm not sure if the panel-info bpp value is respected or not.  I've tried values of 24 and 32 but they seem behave the same.  Theoretically, value of 32 should give UNPACKED 24-bit mode (RGB8888 with alpha channel) and 24 should give just RGB888.

    I've tried setting blue-and-red-wiring to "straight" or leave it undefined and I always get 16-bit mode.