mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-24 12:03:39 +00:00
96b109ba74
Update the driver to support the device tree and the driver model. Timings and panel parameters are now loaded from the device tree. The DM code replaces the am335x_lcdpanel structure with tilcdc_panel_info taken from the linux kernel, as well the management of additional parameters not covered in the legacy code. In addition, the am335x_lcdpanel structure contains parameters and operations that were probably a requirement of the board for which this driver was developed and which, however, were not developed in the linux kernel. All this led to rewrite th DM controller initialization code, except for the pixel clock setting that is executed in a function created in a previous patch with code taken from the legacy am335xfb_init. The patch has been tested on a custom board with u-boot 2018.11-rc2 and the following device-tree configuration: panel { compatible = "ti,tilcdc,panel"; pinctrl-names = "default"; pinctrl-0 = <&lcd_enable_pins>; enable-gpios = <&gpio0 31 0>; backlight = <&backlight>; status = "okay"; u-boot,dm-pre-reloc; panel-info { ac-bias = <255>; ac-bias-intrpt = <0>; dma-burst-sz = <16>; bpp = <16>; fdd = <0x80>; sync-edge = <0>; sync-ctrl = <1>; raster-order = <0>; fifo-th = <0>; }; display-timings { native-mode = <&timing0>; timing0: 800x480 { hactive = <800>; vactive = <480>; hback-porch = <46>; hfront-porch = <210>; hsync-len = <20>; vback-porch = <23>; vfront-porch = <22>; vsync-len = <10>; clock-frequency = <33000000>; hsync-active = <0>; vsync-active = <0>; }; }; }; Signed-off-by: Dario Binacchi <dariobin@libero.it> Tested-by: Dario Binacchi <dariobin@libero.it>
75 lines
2.2 KiB
C
75 lines
2.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* Copyright (C) 2013-2018 Hannes Schmelzer <oe5hpm@oevsv.at> -
|
|
* B&R Industrial Automation GmbH - http://www.br-automation.com
|
|
*/
|
|
|
|
#ifndef AM335X_FB_H
|
|
#define AM335X_FB_H
|
|
|
|
#if !CONFIG_IS_ENABLED(DM_VIDEO)
|
|
|
|
#define HSVS_CONTROL BIT(25) /*
|
|
* 0 = lcd_lp and lcd_fp are driven on
|
|
* opposite edges of pixel clock than
|
|
* the lcd_pixel_o
|
|
* 1 = lcd_lp and lcd_fp are driven
|
|
* according to bit 24 Note that this
|
|
* bit MUST be set to '0' for Passive
|
|
* Matrix displays the edge timing is
|
|
* fixed
|
|
*/
|
|
#define HSVS_RISEFALL BIT(24) /*
|
|
* 0 = lcd_lp and lcd_fp are driven on
|
|
* the rising edge of pixel clock (bit
|
|
* 25 must be set to 1)
|
|
* 1 = lcd_lp and lcd_fp are driven on
|
|
* the falling edge of pixel clock (bit
|
|
* 25 must be set to 1)
|
|
*/
|
|
#define DE_INVERT BIT(23) /*
|
|
* 0 = DE is low-active
|
|
* 1 = DE is high-active
|
|
*/
|
|
#define PXCLK_INVERT BIT(22) /*
|
|
* 0 = pix-clk is high-active
|
|
* 1 = pic-clk is low-active
|
|
*/
|
|
#define HSYNC_INVERT BIT(21) /*
|
|
* 0 = HSYNC is active high
|
|
* 1 = HSYNC is avtive low
|
|
*/
|
|
#define VSYNC_INVERT BIT(20) /*
|
|
* 0 = VSYNC is active high
|
|
* 1 = VSYNC is active low
|
|
*/
|
|
|
|
struct am335x_lcdpanel {
|
|
unsigned int hactive; /* Horizontal active area */
|
|
unsigned int vactive; /* Vertical active area */
|
|
unsigned int bpp; /* bits per pixel */
|
|
unsigned int hfp; /* Horizontal front porch */
|
|
unsigned int hbp; /* Horizontal back porch */
|
|
unsigned int hsw; /* Horizontal Sync Pulse Width */
|
|
unsigned int vfp; /* Vertical front porch */
|
|
unsigned int vbp; /* Vertical back porch */
|
|
unsigned int vsw; /* Vertical Sync Pulse Width */
|
|
unsigned int pxl_clk; /* Pixel clock */
|
|
unsigned int pol; /* polarity of sync, clock signals */
|
|
unsigned int pup_delay; /*
|
|
* time in ms after power on to
|
|
* initialization of lcd-controller
|
|
* (VCC ramp up time)
|
|
*/
|
|
unsigned int pon_delay; /*
|
|
* time in ms after initialization of
|
|
* lcd-controller (pic stabilization)
|
|
*/
|
|
void (*panel_power_ctrl)(int); /* fp for power on/off display */
|
|
};
|
|
|
|
int am335xfb_init(struct am335x_lcdpanel *panel);
|
|
|
|
#endif /* CONFIG_DM_VIDEO */
|
|
|
|
#endif /* AM335X_FB_H */
|