Skip to content

Commit 8e33e34

Browse files
singhomeleeasus-leslieyu
authored andcommitted
lvds: bridge: sn65dsi84 driver porting.
Change-Id: Icc75dcf860fe2539863f31df33c75cbb6b409e41
1 parent 2cbda6f commit 8e33e34

13 files changed

Lines changed: 1710 additions & 19 deletions

File tree

arch/arm/boot/dts/rk3288-tinker-board.dts

Lines changed: 154 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@
8585
240 241 242 243 244 245 246 247
8686
248 249 250 251 252 253 254 255>;
8787
default-brightness-level = <128>;
88-
enable-gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>;
89-
pinctrl-names = "default";
90-
pinctrl-0 = <&bl_en>;
9188
pwms = <&pwm0 0 1000000 0>;
9289
};
9390

@@ -249,6 +246,57 @@
249246
};
250247
};
251248

249+
&pwm3 {
250+
status = "disabled";
251+
};
252+
253+
&backlight {
254+
status = "disabled";
255+
compatible = "pwm-backlight";
256+
pwms = <&pwm3 0 400000 0>;//f=2500 t=400,000ns
257+
brightness-levels = <
258+
0 1 2 3 4 5 6 7
259+
8 9 10 11 12 13 14 15
260+
16 17 18 19 20 21 22 23
261+
24 25 26 27 28 29 30 31
262+
32 33 34 35 36 37 38 39
263+
40 41 42 43 44 45 46 47
264+
48 49 50 51 52 53 54 55
265+
56 57 58 59 60 61 62 63
266+
64 65 66 67 68 69 70 71
267+
72 73 74 75 76 77 78 79
268+
80 81 82 83 84 85 86 87
269+
88 89 90 91 92 93 94 95
270+
96 97 98 99 100 101 102 103
271+
104 105 106 107 108 109 110 111
272+
112 113 114 115 116 117 118 119
273+
120 121 122 123 124 125 126 127
274+
128 129 130 131 132 133 134 135
275+
136 137 138 139 140 141 142 143
276+
144 145 146 147 148 149 150 151
277+
152 153 154 155 156 157 158 159
278+
160 161 162 163 164 165 166 167
279+
168 169 170 171 172 173 174 175
280+
176 177 178 179 180 181 182 183
281+
184 185 186 187 188 189 190 191
282+
192 193 194 195 196 197 198 199
283+
200 201 202 203 204 205 206 207
284+
208 209 210 211 212 213 214 215
285+
216 217 218 219 220 221 222 223
286+
224 225 226 227 228 229 230 231
287+
232 233 234 235 236 237 238 239
288+
240 241 242 243 244 245 246 247
289+
248 249 250 251 252 253 254 255>;
290+
default-brightness-level = <200>;
291+
minimal-brightness-level = <26>;
292+
soc_enablekl-gpios = <&gpio8 RK_PB1 GPIO_ACTIVE_HIGH>;
293+
enable_delay = <15>;
294+
disable_delay = <5>;
295+
pinctrl-names = "default";
296+
pinctrl-0 = <&pinctrl_lvds_bl_en>;
297+
};
298+
299+
252300
&cif {
253301
status = "disabled";
254302
port {
@@ -314,7 +362,7 @@
314362
enable-delay-ms = <120>;
315363
pinctrl-0 = <&lcd_cs>;
316364
power-supply = <&vcc33_lan>;
317-
status = "okay";
365+
status = "disabled";
318366

319367
display-timings {
320368
native-mode = <&timing0>;
@@ -338,7 +386,7 @@
338386
};
339387

340388
&edp_phy {
341-
status = "okay";
389+
status = "disabled";
342390
};
343391

344392
&gpu {
@@ -362,6 +410,11 @@
362410
reg = <0>;
363411
status = "okay";
364412
};
413+
port@2 {
414+
mipi_dsi_out: endpoint3 {
415+
remote-endpoint = <&sn65dsi84_in>;
416+
};
417+
};
365418
};
366419

367420
&dsi0_in_vopb {
@@ -701,6 +754,70 @@
701754
&i2c3 {
702755
status = "okay";
703756

757+
dsi_lvds_bridge: sn65dsi84@2c {
758+
compatible = "asus,sn65dsi84";
759+
status = "disabled";
760+
reg = <0x2c>;
761+
762+
backlight = <&backlight>;
763+
764+
lvds-clk-rate = <72000000>;
765+
lvds-format = <2>;
766+
lvds-bpp = <24>;
767+
lvds-width-mm = <476>;
768+
lvds-height-mm = <267>;
769+
sync_delay = <33>;
770+
//dual-link;
771+
//test-pattern;
772+
773+
t1=<0>;
774+
t2=<1>;
775+
t3=<500>;
776+
t4=<200>;
777+
t5=<1>;
778+
t6=<0>;
779+
t7=<1000>;
780+
781+
bpc=<8>;
782+
bus-format = <0x100a>;//<MEDIA_BUS_FMT_RGB888_1X24>;
783+
dsi,flags = <0x3>;
784+
dsi,format = <0>;//MIPI_DSI_FMT_RGB888:
785+
dsi-lanes = <2>;
786+
787+
pinctrl-names = "default";
788+
pinctrl-0 = <&pinctrl_sn65dsi84_en>, <&pinctrl_lvds_vdd_en>, <&pinctrl_sn65dsi84_irq>, <&pinctrl_pwr_source>;//<&pinctrl_lvds_hdmi_sel>
789+
790+
/*lvds_hdmi_sel-gpios = <&5 23 GPIO_ACTIVE_HIGH>;*/
791+
EN-gpios = <&gpio8 RK_PB0 GPIO_ACTIVE_HIGH>;
792+
lvds_vdd_en-gpios = <&gpio8 RK_PA6 GPIO_ACTIVE_HIGH>;
793+
dsi84_irq-gpios = <&gpio8 RK_PA7 GPIO_ACTIVE_HIGH>;
794+
pwr_source-gpios = <&gpio8 RK_PA3 GPIO_ACTIVE_HIGH>;
795+
796+
display-timings {
797+
lvds {
798+
clock-frequency = <144000000>;
799+
hactive = <1920>;
800+
vactive = <1080>;
801+
hfront-porch = <96>;
802+
hback-porch = <96>;
803+
hsync-len = <64>;
804+
vfront-porch = <8>;
805+
vsync-len = <4>;
806+
vback-porch = <8>;
807+
hsync-active = <0>;
808+
vsync-active = <0>;
809+
de-active = <1>;
810+
pixelclk-active = <0>;
811+
};
812+
};
813+
814+
port {
815+
sn65dsi84_in: endpoint2 {
816+
remote-endpoint = <&mipi_dsi_out>;
817+
};
818+
};
819+
};
820+
704821
tinker_mcu: tinker_mcu@45 {
705822
compatible = "tinker_mcu";
706823
reg = <0x45>;
@@ -846,12 +963,16 @@
846963
pinctrl-names = "default";
847964
pinctrl-0 = <&gpio_init>;
848965

966+
pcfg_output_low: pcfg-output-low {
967+
output-low;
968+
};
969+
849970
gpio_init_config {
850971
gpio_init: gpio-init {
851-
rockchip,pins =
972+
rockchip,pins =
852973
<7 22 RK_FUNC_GPIO &pcfg_pull_none>,
853974
<7 23 RK_FUNC_GPIO &pcfg_pull_none>;
854-
};
975+
};
855976
};
856977

857978
backlight {
@@ -860,6 +981,32 @@
860981
};
861982
};
862983

984+
mipi_to_lvds {
985+
/*pinctrl_lvds_hdmi_sel: lvds_hdmi_sel {
986+
rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_none>;
987+
};*/
988+
989+
pinctrl_lvds_bl_en: lvds_bl_en {
990+
rockchip,pins = <8 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
991+
};
992+
993+
pinctrl_sn65dsi84_en: sn65dsi84_en {
994+
rockchip,pins = <8 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
995+
};
996+
997+
pinctrl_lvds_vdd_en: lvds_vdd_en {
998+
rockchip,pins = <8 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
999+
};
1000+
1001+
pinctrl_sn65dsi84_irq: sn65dsi84_irq{
1002+
rockchip,pins = <8 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
1003+
};
1004+
1005+
pinctrl_pwr_source: pwr_source {
1006+
rockchip,pins = <8 RK_PA3 RK_FUNC_GPIO &pcfg_output_low>;
1007+
};
1008+
};
1009+
8631010
buttons {
8641011
pwrbtn: pwrbtn {
8651012
rockchip,pins = <0 5 RK_FUNC_GPIO &pcfg_pull_up>;

arch/arm/configs/rockchip_linux_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ CONFIG_ROCKCHIP_DW_HDMI=y
563563
CONFIG_ROCKCHIP_DW_MIPI_DSI=y
564564
CONFIG_DRM_PANEL_TOSHIBA_TC358762=y
565565
CONFIG_DRM_PANEL_ASUS_ILI9881C=y
566+
CONFIG_DRM_I2C_SN65DSI84=y
566567
CONFIG_ROCKCHIP_ANALOGIX_DP=y
567568
CONFIG_ROCKCHIP_INNO_HDMI=y
568569
CONFIG_ROCKCHIP_LVDS=y

drivers/gpu/drm/bridge/Kconfig

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,6 @@ source "drivers/gpu/drm/bridge/analogix/Kconfig"
6262

6363
source "drivers/gpu/drm/bridge/synopsys/Kconfig"
6464

65+
source "drivers/gpu/drm/bridge/sn65dsi8x/Kconfig"
66+
6567
endmenu

drivers/gpu/drm/bridge/Makefile

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
77
obj-$(CONFIG_DRM_LONTIUM_LT8912) += lt8912.o
88
obj-$(CONFIG_DRM_CHIPONE_ICN6211) += icn6211.o
99

10+
obj-$(CONFIG_DRM_I2C_SN65DSI84) += sn65dsi8x/
1011
obj-y += analogix/
1112
obj-y += synopsys/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
config DRM_I2C_SN65DSI84
2+
tristate "SN65DSI84"
3+
depends on OF
4+
select DRM_KMS_HELPER
5+
select REGMAP_I2C
6+
help
7+
Support for the TI SN65DSI84.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
obj-$(CONFIG_DRM_I2C_SN65DSI84) += sn65dsi84_drv.o
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Analog Devices ADV7511 HDMI transmitter driver
3+
*
4+
* Copyright 2012 Analog Devices Inc.
5+
*
6+
* Licensed under the GPL-2.
7+
*/
8+
9+
#ifndef __DRM_I2C_ADV7511_H__
10+
#define __DRM_I2C_ADV7511_H__
11+
12+
#include <linux/hdmi.h>
13+
#include <linux/i2c.h>
14+
#include <linux/regmap.h>
15+
#include <linux/regulator/consumer.h>
16+
17+
#include <drm/drm_crtc_helper.h>
18+
#include <drm/drm_mipi_dsi.h>
19+
20+
#include <video/of_videomode.h>
21+
#include <video/videomode.h>
22+
23+
struct sn65dsi84_data {
24+
struct backlight_device *backlight;
25+
struct i2c_client *client;
26+
struct device *dev;
27+
28+
unsigned int lvds_clk_rate;
29+
unsigned int dsi_lanes;
30+
unsigned int lvds_format;;
31+
unsigned int lvds_bpp;
32+
unsigned int width_mm;
33+
unsigned int height_mm;
34+
unsigned int sync_delay;
35+
unsigned int refclk_multiplier;
36+
unsigned int lvds_voltage;
37+
bool test_pattern_en;
38+
bool dual_link;
39+
bool clk_from_refclk;
40+
bool enabled;
41+
bool debug;
42+
43+
bool powered;
44+
45+
struct gpio_desc *lvds_vdd_en_gpio;
46+
struct gpio_desc *sn65dsi84_en_gpio;
47+
struct gpio_desc *lvds_hdmi_sel_gpio;
48+
struct gpio_desc *pwr_source_gpio;
49+
50+
struct workqueue_struct *wq;
51+
struct work_struct work;
52+
//unsigned int dsi84_irq_gpio;
53+
struct gpio_desc *dsi84_irq_gpio;
54+
unsigned int dsi84_irq;
55+
56+
enum drm_connector_status status;
57+
struct drm_connector connector;
58+
struct device_node *host_node;
59+
struct drm_bridge bridge;
60+
61+
struct mipi_dsi_device *dsi;
62+
struct videomode vm;
63+
64+
struct drm_display_mode curr_mode;
65+
unsigned int bus_format;
66+
unsigned int bpc;
67+
unsigned int format;
68+
unsigned int mode_flags;
69+
unsigned int t1;
70+
unsigned int t2;
71+
unsigned int t3;
72+
unsigned int t4;
73+
unsigned int t5;
74+
unsigned int t6;
75+
unsigned int t7;
76+
};
77+
#endif /* __DRM_I2C_ADV7511_H__ */

0 commit comments

Comments
 (0)