LVDS screen M215HGE-L21 adaptation process on the rk3288

2019-08-09

Keywords: LVDS point screen, rk3288 LVDS dot screen, dot screen CMO screen LVDS


 

Chi Mei M215HGE-L21 is a 21.5-inch resolution of 1920 * 1080 must not touch the LVDS type display.

 

The author is a side of this screen embedded in a touchpad inside. There are two wires connects to the RK3288, LVDS is a line for transmitting video data, the other is a USB cable, for transmitting a touch signal. This is not the default screen with touch function, so the touchpad is on our side the additional.

 

Prior to point screen must first confirm that the hardware circuit, point-screen is a very hardware-dependent thing, no one can ensure that their hardware engineers in the design of the circuit will not go wrong. Of course, we, as software is certainly difficult to judge circuit in the end there is no problem, but we must have this awareness. If you encounter any very incredible thing 㤐 screen process, not without reason not to call on people to come together to analyze hardware.

 

The author here rk3288 are running Android5.1, rk original SDK already has a very sound lvds screen support. So the screen points to our software, the basic specification is shining screen to fill out parameters only. Screen specification is generally given to us by the hardware or the project manager, of course, can be found online.

 

You then need to confirm dts files when you compile the kernel used is which one. 3288 will generally have a script compiled a large bag, where you can see in this script compiler command, as shown below

Dts consistent with the general name of the compiled image name. Therefore, according to the map, I use here to dts should be:

./kernel/arch/arm/boot/dts/rk3288_lvds.dts

 

Open dts, we need to focus on backlight node:

    backlight {
        compatible = "pwm-backlight";
        pwms = <&pwm0 0 25000>;        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 101 102 103
            104 105 106 107 108 109 110 111
            112 113 114 115 116 117 118 119
            120 121 122 123 124 125 126 127
            128 129 130 131 132 133 134 135
            136 137 138 139 140 141 142 143
            144 145 146 147 148 149 150 151
            152 153 154 155 156 157 158 159
            160 161 162 163 164 165 166 167
            168 169 170 171 172 173 174 175
            176 177 178 179 180 181 182 183
            184 185 186 187 188 189 190 191
            192 193 194 195 196 197 198 199
            200 201 202 203 204 205 206 207
            208 209 210 211 212 213 214 215
            216 217 218 219 220 221 222 223
            224 225 226 227 228 229 230 231
            232 233 234 235 236 237 238 239
            240 241 242 243 244 245 246 247
            248 249 250 251 252 253 254 255>;
        default-brightness-level = <200>;
        enable-gpios = <&gpio7 GPIO_A2 GPIO_ACTIVE_HIGH>;    };

This node in the more important is pwms property and enable-gpios property. Both properties are generally directly control the backlight brightness of the screen, with reference to their values to your circuit diagram to fill. Note that had the same time, since the brightness of the backlight is controlled by PWM, so that the specific pwm not forget to open it, as follows:

&pwm0 {
    status = "okay";
};

 

 

Another concern is the node to node lcdc0

&lcdc0 {
    status = "okay";
    rockchip,mirror = <NO_MIRROR>;
    rockchip,cabc_mode = <0>;
    power_ctr: power_ctr {
        rockchip,debug = <1>;

        lcd_en:lcd_en {
            rockchip,power_type = <GPIO>;
            gpios = <&gpio7 GPIO_B1 GPIO_ACTIVE_HIGH>;
            rockchip,delay = <200>;
        };
    };
};

The node control is to lcdc0 interrelated states, such as enable pin, the reset pin and the like. The above backlight brightness control of the backlight, the backlight is controlled lights do not light. Its value is to be referred to a specific circuit diagram to fill.

 

Some students may be in doubt, the 3288 has a lot of groups lcdc, why is it that lcdc0? A picture is worth a thousand words:

 

The third node concern is rk_screen

&rk_screen {
     display-timings = <&disp_timings>;
};

This is dependent on the screen indicate the parameters nodes.

 

The fourth is to pay attention to the lvds node is set to okay the state, to compile the relevant drive lvds so when compiled.

&lvds{
   status = "okay";
};

 

The last node to be concerned about is the screen parameter we mentioned node at a third point:

    disp_timings: display-timings {
        native-mode = <&timing0>;
        timing0: timing0 {
            screen-type = <SCREEN_DUAL_LVDS>;
            lvds-format = <LVDS_8BIT_1>;
            color-mode = <COLOR_RGB>;
            out-face    = <OUT_P888>;
            clock-frequency = <148000000>;
            
            hactive = <1920>;
            vactive = <1080>;
            
            hback-porch = <35> ; // the line field screen shoulder 
            hfront -porch = < 100 > ; // field scanning front shoulder panel 
            
            Vback -porch = < 15 > ; // screen frame sync back porch 
            vfront -porch = < 20 is > ; // screen frame synchronization front shoulder 
            
            HSYNC -len = < . 5 > ; // the line width of the screen synchronization signal 
            VSYNC -len = < 10 > ; // screen frame width synchronizing signal 
            
            HSYNC -active = < 0 > ; / horizontal and vertical sync signal polarity / screen 
            VSYNC -active = < 0 > ; // screen frame synchronizing signal polarity
            
            de -active = < 0 > ; // screen DE signal polarity 
            pixelclk -active = < . 1 > ; // screen polar dclk 
            
            the swap -RB = < 0 > ; // red and blue color switching 
            the swap -rg = < 0 > ; // red, green and exchange 
            the swap -gb = < 0 > ; // cyan exchange 
        }; 
    };

If the screen you need to model and author of the point is the same, then shining fill it.

 

Values ​​of the parameters described above disp_timings nodes are from the screen to get the specifications, following a brief interpretation of the screen specifications.

 

When a screen to get the specifications, first of all look at its screen characteristics, the first piece of content is the text of the general specifications it. As shown below

This section generally we just need to focus on the screen size: 1920 * 1080. Hactive value is 1920, the value of vactive is 1080. We also know that this is a "landscape screen."

 

Then we have to turn down, to see what the screen shows clock characteristics, as shown below:

这里我们一般只关注它的典型值。首先第一行,这个是它的时钟频率,为 74.25MHz。它就是上面 disp_timings 节点的 clock-frequency 应该填的值。但是,由于我们这款屏幕的类型是 SCREEN_DUAL_LVDS ,因此实际的时钟值应该再乘个 2。所以,最终填写的值为

clock-frequency = <148000000>;

可能有的同学会说 74.25MHz 乘个 2 以后的值应该是 14.85MHz,对,没错,但其实这条属性的值的要并没有那么严格。它可以填入一个范围内的值。

 

接下来,我们要记住这几个值:

Tv : 1125

Tvd : 1080

Th : 1100

Thd : 960

我们要根据这几个值算出 disp_timings 中的 hback-porch, hfront-porch, vback-porch, vfront-porch, hsync-len, vsync-len 的值。它们之间的关系如下:

Tv = vback-porch + vfront-porch + vsync-len + Tvd
Th = hback-porch + hfront-porch + hsync-len + Thd

所以:

vback-porch + vfront-porch + vsync-len = 1125 - 1080 = 45
hback-porch + hfront-porch + hsync-len = 1100 - 960 = 140

这里只需要保证这 3 个参数之和等于那个数就可以了,对具体的值没有特别的要求。

 

最后剩下那几个参数,照着填就好了。

hsync-active = <0>;
vsync-active = <0>;

de-active = <0>;
pixelclk-active = <1>;

swap-rb = <0>;
swap-rg = <0>;
swap-gb = <0>;

 

 

最后,再贴一下几个比较重要的属性的可选值,如果怀疑是自己填的参数不对导致屏幕点不亮的话,可以逐个尝试一下。

 

screen-type 的可选值:

SCREEN_NULL
SCREEN_RGB
SCREEN_LVDS
SCREEN_DUAL_LVDS
SCREEN_MCU
SCREEN_TVOUT
SCREEN_HDMI
SCREEN_MIPI
SCREEN_DUAL_MIPI
SCREEN_EDP
SCREEN_TVOUT_TEST

 

lvds-format 的可选值:

LVDS_8BIT_1
LVDS_8BIT_2
LVDS_8BIT_3
LVDS_6BIG
LVDS_10BIT_1
LVDS_10BIT_2

 

out-face 的可选值:

OUT_P888
OUT_P666
OUT_P565
OUT_CCIR656
OUT_S888
OUT_S888DUMY
OUT_YUV_420
OUT_P101010
OUT_YUV_420_10BIT
OUT_P16BPP4
OUT_D888_P666
OUT_D888_P565

 

关于调试过程

这款屏幕电源正常供电但没有视频信号过去时将会显示纯白色背景。如果发现 LVDS 信号线不管接不接都显示纯白色,那么极有可能是 LVDS 信号线线序不对,要叫硬件检查一下。

 

如果发现不插信号线显示纯白色,接了信号线后就黑屏了,则说明有信号过去了,但 dts 的配置可能不正确。在 disp_timings 节点的 screen-type, lvds-format, out-face 几个属性检查一下。还有就是里面的宽高尺寸,尺寸不对也会黑屏。

 

 

关于触摸屏

笔者手里的屏幕是显示触摸一体式的。显示通过 LVDS 信号线传输,触摸通过 USB 线传输。rk3288 只要配好 USB 模式,触摸板就是即插即用的。触摸板的 USB 口插入后会有如下打印提示

EHCI: rk_ehci_hcd_enable, enable host controller
usb 3-1: new full-speed USB device number 3 using ohci-rockchip
usb 3-1: New USB device found, idVendor=222a, idProduct=0001
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 3-1: Product: ILITEK-TP
usb 3-1: Manufacturer: ILITEK
input: ILITEK ILITEK-TP as /devices/ff520000.usb/usb3/3-1/3-1:1.0/input/input3
gpufreq_input_connect
hid-multitouch 0003:222A:0001.0002: input,hiddev0,hidraw0: USB HID v1.10 Mouse [ILITEK ILITEK-TP] on usb-ff520000.usb-1/input0
rockchip-rt5631 rockchip-rt5631.30: ASoC: CODEC (null) not registered
rockchip_rt5631_audio_probe() register card failed:-517
platform rockchip-rt5631.30: Driver rockchip-rt5631 requests probe deferral
rockchip-rt3261 rockchip-rt3224.31: ASoC: CODEC (null) not registered
rockchip_rt3261_audio_probe() register card failed:-517
platform rockchip-rt3224.31: Driver rockchip-rt3261 requests probe deferral

触摸驱动代码主要在

./kernel/drivers/hid/hid-multitouch.c

 

笔者在适配触摸板时发现触摸坐标点发生了翻转,即屏幕的右下角变成了“坐标原点”。很有可能是驱动程序不匹配导致的。但是偏偏笔者又弄不到合适的驱动程序,所以只能改现有驱动。改动的地方倒也很小,只需将接收并传递触摸坐标的地方将坐标转换一下就好了。

 

整个操作都在上面提到的 hid-multitouch.c 中实现。首先记录下触摸板的尺寸,然后在转发坐标时做一下翻转。具体如下

 


 

Guess you like

Origin www.cnblogs.com/chorm590/p/11325516.html