Adding custom LCD to the SAMA5D2 XULT
I`m using the Atmel KMS/DRM LCD driver to make it work a custom LCD (ST5651CB + ST5021CB) that I have at home from another project that I wanted to use. So, in order to speed up the development strategy I have divided the problem into several parts which are detailed below.
I have started by integrating the TSC2007 touchscreen driver with successful results, as voltage fluctuations are detected on the screen when it is touched, according to the normal operation after the inclusion of the relevant node in the corresponding i2c bus.
Subsequently, the node for the backlight has been included, making use of the pwm-backlight kernel driver. Also in this case it is fully functional, being able to activate or deactivate it on demand, as well as change the brightness levels (which have been previously defined with the values that oscillate in the interval [0,255]).
Once this has been done, the timing analysis of the panel in SYNC mode has been undertaken using the ST5651CB specification in which this is detailed, to populate the node that makes use of the simple-panel driver of the kernel (to which the backlight previously discussed has been assigned).
(root node)
....
/* Screen brightness */
backlight: backlight {
compatible = "pwm-backlight";
pwms = <&hlcdc_pwm 0 50000 0>;
brightness-levels = <0 4 8 16 32 64 128 255>;
default-brightness-level = <7>;
status = "okay";
};
/* ST5651CB + ST5021CB TFT LCD */
panel: panel {
compatible = "simple-panel";
backlight = <&backlight>;
width-mm = <155>; /* Active area (W) 154.21 */
height-mm = <86>; /* Active area (H) 85.92 */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
/* SYNC mode */
panel-timing {
clock-frequency = <65000000>; /* Panel clock (Hz) */
hactive = <1024>; /* Active frame width (px) */
vactive = <768>; /* Active frame height (px) */
hfront-porch = <160>; /* Horizontal front porch timing (px) */
hsync-len = <160>; /* HSD blanking (px) */
hback-porch = <160>; /* Horizontal back porch timing (px) */
vfront-porch = <15>; /* Vertical front porch timing (lines) */
vsync-len = <23>; /* VSD blanking (lines) */
vback-porch = <15>; /* Vertical back porch timing (lines) */
pixelclk-active = <0>; /* Data driving on falling edge */
hsync-active = <0>; /* Horizontal sync pulse (low) */
vsync-active = <0>; /* Vertical sync pulse (low) */
de-active = <0>; /* Data enable (low) */
};
port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
panel_input: endpoint@0 {
reg = <0>;
remote-endpoint = <&hlcdc_panel_output>;
};
};
};
...
Also in the kernel argument line (using U-Boot bootargs) I`m specifying the mode by supplying video=Unknown-1:1024x768-16
Finally, and I have conglomerated each of these parts to achieve the final goal, populating the hlcdc node in the device tree and having the LCD functional.
(apb node)
...
hlcdc: hlcdc@f0000000 {
u-boot,dm-pre-reloc;
status = "okay";
hlcdc-display-controller {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_rgb666 &pinctrl_lcd_reset>;
port@0 {
#address-cells = <1>;
#size-cells = <0>;
hlcdc_panel_output: endpoint@0 {
reg = <0>;
remote-endpoint = <&panel_input>;
};
};
};
hlcdc_pwm: hlcdc-pwm {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcd_pwm>;
#pwm-cells = <3>;
};
};
...
The problem is that this strategy does not seem to work because, as mentioned above, because I only have the backlight and the touchscreen functional, but nothing is displayed on the screen.
The question is basically if this guide to integrate a custom LCD in linux is correct or if it has been wrong somewhere.
Thank you very much in advance @ehristev @noglitch ! Best regards. Alejandro