Browse Source

[starfive][display] support hdmi of tda998x

david.li 3 years ago
parent
commit
b09ccdd82f

+ 115 - 6
arch/riscv/dts/starfive_vic7100_evb.dts

@@ -1,5 +1,6 @@
 /dts-v1/;
 #include "starfive_vic7100_clk.dtsi"
+#include <dt-bindings/starfive_fb.h>
 
 / {
 	#address-cells = <2>;
@@ -107,6 +108,16 @@
 		nvdla_reserved:framebuffer@d0000000{
 			reg = <0x0 0xd0000000 0x0 0x28000000>;
 		};
+		vin_reserved: framebuffer@f9000000 {
+			compatible = "shared-dma-pool";
+			no-map;
+			reg = <0x0 0xf9000000 0x0 0x1000000>;
+		};
+		sffb_reserved: framebuffer@fb000000 {
+			compatible = "shared-dma-pool";
+			no-map;
+			reg = <0x0 0xfb000000 0x0 0x2000000>;
+		};
 	};
 
 	soc {
@@ -285,10 +296,22 @@
 			interrupt-parent = <&plic>;
 			interrupts = <96>;
 			/*clocks = <&hfclk>; */
-			clock-frequency = <1000000>;
+			clock-frequency = <1000000>;  
 			i2c-sda-hold-time-ns = <300>;
-			i2c-sda-falling-time-ns = <500>;
+			i2c-sda-falling-time-ns = <500>; 
 			i2c-scl-falling-time-ns = <500>;
+		
+			scl-gpio = <&gpio 62 0>;
+			sda-gpio = <&gpio 61 0>;
+			tda998x@70 {
+				compatible = "nxp,tda998x";
+				reg = <0x70>;
+			};
+			imx219@10 {
+				compatible = "imx219";
+				reg = <0x10>;
+				reset-gpio = <&gpio 58 0>;
+			};
 		};
 
 		i2c1: i2c@118c0000 {
@@ -317,6 +340,9 @@
 			i2c-sda-hold-time-ns = <300>;
 			i2c-sda-falling-time-ns = <500>;
 			i2c-scl-falling-time-ns = <500>;
+			auto_calc_scl_lhcnt;
+			scl-gpio = <&gpio 18 0>;
+			sda-gpio = <&gpio 19 0>;
 
 			seeed_plane_i2c@45 {
 				compatible = "seeed_panel";
@@ -420,6 +446,13 @@
 
 		};
 
+		sfc_tmp:tmpsensor@124A0000 {
+		compatible = "sfc,tempsensor";
+		reg = <0x0 0x124A0000 0x0 0x1000>;
+		interrupt-parent = <&plic>;
+		interrupts = <122>;
+		status = "okay";
+		};
 		qspi:qspi@11860000 {
 			compatible = "cadence,qspi","cdns,qspi-nor";
 			#address-cells = <1>;
@@ -522,12 +555,88 @@
 			/*fixed-emmc-driver-type;*/
 			post-power-on-delay-ms = <200>;
 		};
-		sfc_tmp:tmpsensor@124A0000 {
-			compatible = "sfc,tempsensor";
-			reg = <0x0 0x124A0000 0x0 0x1000>;
+	
+		sfivefb:sfivefb@12000000 {
+			compatible = "starfive,vpp-lcdc";
 			interrupt-parent = <&plic>;
-			interrupts = <122>;
+			interrupts = <101>, <103>;
+			interrupt-names = "lcdc_irq", "vpp1_irq";
+			reg = <0x0 0x12000000 0x0 0x10000>,
+				<0x0 0x12100000 0x0 0x10000>,
+				<0x0 0x12040000 0x0 0x10000>,
+				<0x0 0x12080000 0x0 0x10000>,
+				<0x0 0x120c0000 0x0 0x10000>,
+				<0x0 0x12240000 0x0 0x10000>,
+				<0x0 0x12250000 0x0 0x10000>,
+				<0x0 0x12260000 0x0 0x10000>;
+			reg-names = "lcdc", "dsitx", "vpp0", "vpp1", "vpp2", "clk", "rst", "sys";
+			memory-region = <&sffb_reserved>;
+			clocks = <&uartclk>, <&apb2clk>;
+			clock-names = "baudclk", "apb_pclk";
 			status = "okay";
+			ddr-format = <WIN_FMT_RGB565>;
+
+			
+			pp1 {
+				pp-id = <1>;
+				fifo-out;
+				src-format = <COLOR_YUV420_NV21>;
+				src-width = <1920>;
+				src-height = <1080>;
+				dst-format = <COLOR_RGB888_ARGB>;
+				dst-width = <1920>;
+				dst-height = <1080>;
+			};
+		};
+		vin_sysctl:vin_sysctl@19800000 {
+			compatible = "starfive,stf-vin";
+			reg = <0x0 0x19800000 0x0 0x10000>,
+				  <0x0 0x19810000 0x0 0x10000>,
+				  <0x0 0x19820000 0x0 0x10000>,
+				  <0x0 0x19830000 0x0 0x10000>,
+				  <0x0 0x19840000 0x0 0x10000>,
+				  <0x0 0x19870000 0x0 0x30000>,
+				  <0x0 0x198a0000 0x0 0x30000>,
+				  <0x0 0x11800000 0x0 0x10000>,
+				  <0x0 0x11840000 0x0 0x10000>,
+				  <0x0 0x11858000 0x0 0x10000>;
+			reg-names = "mipi0", "vclk", "vrst", "mipi1", "sctrl", "isp0", "isp1", "tclk", "trst", "iopad";
+			interrupt-parent = <&plic>;
+			interrupts = <119 109>;
+			memory-region = <&vin_reserved>;
+			/*for imx219 vim&isp*/
+			format = <SRC_CSI2RX_VIN_ISP>;
+			frame-width = <1920>;
+			frame-height =<1080>;
+
+
+			/*defaule config sc2235
+			format = <SRC_DVP_SENSOR_VIN_ISP>;
+			frame-width = <1920>;
+			frame-height =<1080>;
+			isp0_enable;*/
+
+			/*defaule config ov5640	
+			format = <SRC_DVP_SENSOR_VIN_OV5640>;
+			frame-width = <1920>;
+			frame-height =<1080>;*/
+
+			/*defaule config for ov4689 vin&isp
+			format = <SRC_CSI2RX_VIN_ISP>;
+			frame-width = <800>;
+			frame-height =<480>;
+			*/
+			isp0_enable;
+			csi-lane = <2>;
+			csi-dlane-swaps = /bits/ 8 <1>,/bits/ 8 <2>,/bits/ 8 <3>,/bits/ 8 <4>;
+			csi-dlane-pn-swaps  = /bits/ 8 <0>,/bits/ 8 <0>,/bits/ 8 <0>,/bits/ 8 <0>;
+			csi-clane-swap = /bits/ 8 <0>;
+			csi-clane-pn-swap = /bits/ 8 <0>;
+			csi-mipiID = <0>;
+			csi-width = <1920>;
+			csi-height = <1080>;
+			csi-dt = <0x2b>;
 		};
 	};
 };
+#include "tda998x_1080p.dtsi"

+ 106 - 0
arch/riscv/dts/tda998x_1080p.dtsi

@@ -0,0 +1,106 @@
+#include <dt-bindings/starfive_fb.h>
+
+&sfivefb {
+	tda_998x_1080p {
+		compatible = "starfive,display-dev";
+		panel_name = "tda_998x_1080p";
+		panel_lcd_id = <22>;  /*1080p*/
+		interface_info = "rgb_interface";
+		refresh_en = <1>;
+		bits-per-pixel = <16>;
+		physical-width = <62>;
+		physical-height = <114>;
+		panel-width = <1920>;
+		panel-height = <1080>;
+		pixel-clock = <78000000>;
+		/*dyn_fps;*/		/*dynamic frame rate support*/
+
+		/*.flags = PREFER_CMD_SEND_MONOLITHIC | CE_CMD_SEND_MONOLITHIC | RESUME_WITH_PREFER | RESUME_WITH_CE*/
+		/*gamma-command-monolithic;*/
+		/*ce-command-monolithic;*/
+		/*resume-with-gamma;*/
+		/*resume-with-ce;*/
+
+		/*mipi info*/
+		mipi-byte-clock = <78000>;
+		mipi-escape-clock = <13000>;
+		lane-no = <4>;
+		display_mode = "video_mode";		/*video_mode, command_mode*/
+
+		/*
+		auto_stop_clklane_en;
+		im_pin_val;*/
+
+
+		color_bits = <COLOR_CODE_24BIT>;
+		/*is_18bit_loosely;*/
+
+		/*video mode info*/
+		h-pulse-width = <44>;
+		h-back-porch = <148>;
+		h-front-porch = <88>;
+		v-pulse-width = <5>;
+		v-back-porch = <36>;
+		v-front-porch = <4>;
+		status = "okay";
+		sync_pol = "vsync_high_act";		/*vsync_high_act, hsync_high_act*/
+		lp_cmd_en;
+		/*lp_hfp_en;*/
+		/*lp_hbp_en;*/
+		/*lp_vact_en;*/
+		lp_vfp_en;
+		lp_vbp_en;
+		lp_vsa_en;
+		traffic-mode = "burst_with_sync_pulses";	/*non_burst_with_sync_pulses, non_burst_with_sync_events*/
+
+		/*phy info*/
+		data_tprepare = /bits/ 8 <0>;
+		data_hs_zero = /bits/ 8 <0>;
+		data_hs_exit = /bits/ 8 <0>;
+		data_hs_trail = /bits/ 8 <0>;
+
+		/*te info*/
+		te_source = "external_pin";			/*external_pin, dsi_te_trigger*/
+		te_trigger_mode = "rising_edge";		/*rising_edge, high_1000us*/
+		te_enable = <0>;
+		cm_te_effect_sync_enable = <0>;			/*used in command mode*/
+		te_count_per_sec = <64>;				/*used in esd*/
+
+		/*ext info*/
+		/*
+		crc_rx_en;
+		ecc_rx_en;
+		eotp_rx_en;
+		*/
+		eotp_tx_en;
+
+		dev_read_time = <0x7FFF>;
+		/*type cmd return_count return_code*/
+		/*id_read_cmd_info = [];*/
+		/*pre_id_cmd = [];*/
+		/*esd_read_cmd_info = [DCS_CMD 0A 01 9C];*/
+		/*pre_esd_cmd = [];*/
+		/*panel-on-command = [];*/
+		/*panel-off-command = [];*/
+		/*reset-sequence = <1 5>, <0 10>, <1 30>;*/
+		/*
+		panel-gamma-warm-command = [
+
+		];
+		panel-gamma-nature-command = [
+
+		];
+		panel-gamma-cool-command = [
+
+		];
+
+		panel-ce-std-command = [
+
+		];
+		panel-ce-vivid-command = [
+
+		];
+		*/
+	};
+};
+

+ 47 - 0
arch/riscv/include/dt-bindings/starfive_fb.h

@@ -0,0 +1,47 @@
+#ifndef __STARFIVE_FB_H
+#define __STARFIVE_FB_H
+
+/*color code*/
+#define COLOR_CODE_16BIT_CONFIG1	0	//PACKET RGB565
+#define	COLOR_CODE_16BIT_CONFIG2	1	//UNPACKET RGB565
+#define	COLOR_CODE_16BIT_CONFIG3	2	//UNPACKET RGB565
+#define	COLOR_CODE_18BIT_CONFIG1	3	//PACKET RGB666
+#define	COLOR_CODE_18BIT_CONFIG2	4	//UNPACKET RGB666
+#define	COLOR_CODE_24BIT		5	//PACKET RGB888
+#define	COLOR_CODE_MAX			6
+
+/*command code*/
+#define	DCS_CMD				02
+#define	GEN_CMD				03
+#define	SW_PACK0			04
+#define	SW_PACK1			05
+#define	SW_PACK2			06
+#define	LW_PACK				07
+#define	SHUTDOWN_SW_PACK		08
+
+/*color format, need match to enum COLOR_FORMAT in starfive_vpp.h*/
+#define	COLOR_YUV422_UYVY	0
+#define	COLOR_YUV422_VYUY	1
+#define	COLOR_YUV422_YUYV	2
+#define	COLOR_YUV422_YVYU	3
+#define	COLOR_YUV420P	4
+#define	COLOR_YUV420_NV21	5
+#define	COLOR_YUV420_NV12	6
+#define	COLOR_RGB888_ARGB	7
+#define	COLOR_RGB888_ABGR	8
+#define	COLOR_RGB888_RGBA	9
+#define	COLOR_RGB888_BGRA	10
+#define	COLOR_RGB565	11
+
+#define SRC_COLORBAR_VIN_ISP  0
+#define SRC_DVP_SENSOR_VIN    1
+#define SRC_DVP_SENSOR_VIN_ISP 2
+#define SRC_CSI2RX_VIN_ISP    3
+#define SRC_DVP_SENSOR_VIN_OV5640 4
+
+#define    WIN_FMT_RGB565		4
+#define    WIN_FMT_xRGB1555		5
+#define    WIN_FMT_xRGB4444		6
+#define    WIN_FMT_xRGB8888		7
+
+#endif