1 Star 2 Fork 4

千古长夜丶/TSPiPhoneEXT

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
kernel_v3.patch 62.46 KB
一键复制 编辑 原始数据 按行查看 历史
千古长夜丶 提交于 2024-06-08 10:30 . V3版本优化屏幕背光
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241
From 123e73e89d4be2e4b20f8914c26d558d9315f3b2 Mon Sep 17 00:00:00 2001
From: You Meng <36076779@qq.com>
Date: Thu, 23 May 2024 09:31:32 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A03.1=E8=A7=A6=E6=91=B8?=
=?UTF-8?q?=E5=B1=8F=E5=92=8CEC20=E7=94=B5=E6=BA=90=E6=8E=A7=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Change-Id: Iea5d0fdd9f654cf6533ec449684403c79bc34c10
硬件上修改屏幕背光输出,软件上修改pwm输出端口为6
Change-Id: Ia3f411ad37b34643e7fb2b3d7f2ec30b043081d9
---
.../dts/rockchip/tspi-rk3566-dsi-v10.dtsi | 1504 +++--------------
.../dts/rockchip/tspi-rk3566-user-v10.dts | 10 +-
arch/arm64/configs/tspi_defconfig | 6 +-
drivers/input/touchscreen/Kconfig | 1 +
drivers/input/touchscreen/Makefile | 1 +
.../input/touchscreen/cst128a_cust/Kconfig | 7 +
.../input/touchscreen/cst128a_cust/Makefile | 1 +
.../touchscreen/cst128a_cust/cst128a_ts.c | 288 ++++
drivers/power/supply/Kconfig | 2 +
drivers/power/supply/Makefile | 1 +
drivers/power/supply/ec20_power/Kconfig | 7 +
drivers/power/supply/ec20_power/Makefile | 1 +
drivers/power/supply/ec20_power/ec20_power.c | 250 +++
13 files changed, 808 insertions(+), 1271 deletions(-)
create mode 100644 drivers/input/touchscreen/cst128a_cust/Kconfig
create mode 100644 drivers/input/touchscreen/cst128a_cust/Makefile
create mode 100644 drivers/input/touchscreen/cst128a_cust/cst128a_ts.c
create mode 100644 drivers/power/supply/ec20_power/Kconfig
create mode 100644 drivers/power/supply/ec20_power/Makefile
create mode 100644 drivers/power/supply/ec20_power/ec20_power.c
diff --git a/arch/arm64/boot/dts/rockchip/tspi-rk3566-dsi-v10.dtsi b/arch/arm64/boot/dts/rockchip/tspi-rk3566-dsi-v10.dtsi
index f358292624b2..6376a1db2582 100755
--- a/arch/arm64/boot/dts/rockchip/tspi-rk3566-dsi-v10.dtsi
+++ b/arch/arm64/boot/dts/rockchip/tspi-rk3566-dsi-v10.dtsi
@@ -1,1268 +1,236 @@
-// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
-/*
- * Copyright (c) 2020 Rockchip Electronics Co., Ltd.
- *
- */
-/*********************************************************************
- * 立创开发板不靠卖板赚钱,以培养中国工程师为己任
- * 泰山派软硬件资料与相关扩展板软硬件资料官网全部开源
- * 开发板官网:www.lckfb.com
- * 立创论坛:oshwhub.com/forum
- * 关注B站:【立创开发板】,掌握我们的最新动态!
- *********************************************************************
- * 文件名:tspi-rk3566-dsi-v10.dtsi
- * 描述:mipi 屏幕
- * 更新:
- * 时间 作者 联系 说明
- * 2023-07-21 吴才成 1378913492@qq.com v1.0.0
- *********************************************************************/
-/ {
- backlight: backlight {
- compatible = "pwm-backlight";
- pwms = <&pwm5 0 25000 0>;
- brightness-levels = <
- 0 20 20 21 21 22 22 23
- 23 24 24 25 25 26 26 27
- 27 28 28 29 29 30 30 31
- 31 32 32 33 33 34 34 35
- 35 36 36 37 37 38 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 = <255>;
- };
-};
-
-&pwm5 {
- status = "okay";
-};
-
-// &i2c1 {
-// status = "okay";
-// ts@5d {
-// compatible = "goodix,gt9xx";
-// reg = <0x5d>;
-// tp-size = <89>;
-// max-x = <1280>;
-// max-y = <800>;
-// touch-gpio = <&gpio1 RK_PA0 IRQ_TYPE_LEVEL_LOW>;
-// reset-gpio = <&gpio1 RK_PA1 IRQ_TYPE_LEVEL_LOW>;
-// };
-// };
-&i2c1 {
- status = "okay";
- ts@5d {
- pinctrl-0 = <&touch_gpio>;
- compatible = "goodix,gt9xx";
- reg = <0x5d>;
- tp-size = <970>;
- max-x = <1080>;
- max-y = <1920>;
- touch-gpio = <&gpio1 RK_PA0 IRQ_TYPE_LEVEL_LOW>;
- reset-gpio = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
- };
-};
-
-&pinctrl {
- dsi1 {
- dsi1_rst_gpio: dsi1-rst-gpio {
- rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
- };
- touch_gpio: touch-gpio {
- rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
- };
- };
-};
-
-/*
- * video_phy1 needs to be enabled
- * when dsi1 is enabled
- */
-&dsi1 {
- status = "okay";
-};
-
-&dsi1_in_vp0 {
- status = "disabled";
-};
-
-&dsi1_in_vp1 {
- status = "okay";
-};
-
-&video_phy1 {
- status = "okay";
-};
-
-&route_dsi1 {
- status = "okay";//wucaicheng mipi okay
- connect = <&vp1_out_dsi1>;
-};
-
-/************************************************************************************************************************************************
-10寸晶尚
-默认 8寸800x1280
-************************************************************************************************************************************************/
-// &dsi1 {
-// status = "okay";
-// rockchip,lane-rate = <480>;
-// dsi1_panel: panel@0 {
-// status = "okay";
-// compatible = "simple-panel-dsi";
-// reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
-// pinctrl-names = "default";
-// pinctrl-0 = <&dsi1_rst_gpio>;
-// reg = <0>;
-// backlight = <&backlight>;
-// reset-delay-ms = <10>;
-// enable-delay-ms = <120>;
-// prepare-delay-ms = <20>;
-// unprepare-delay-ms = <20>;
-// disable-delay-ms = <50>;
-// dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
-// MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
-// dsi,format = <MIPI_DSI_FMT_RGB888>;
-// dsi,lanes = <4>;
-// panel-init-sequence = [
-// 15 00 02 E0 00
-// 15 00 02 E1 93
-// 15 00 02 E2 65
-// 15 00 02 E3 F8
-// 15 00 02 80 03
-// 15 00 02 E0 01
-// 15 00 02 00 00
-// 15 00 02 01 3C
-// 15 00 02 03 10
-// 15 00 02 04 38
-// 15 00 02 0C 74
-// 15 00 02 17 00
-// 15 00 02 18 E7
-// 15 00 02 19 01
-// 15 00 02 1A 00
-// 15 00 02 1B E7
-// 15 00 02 1C 01
-// 15 00 02 24 FE
-// 15 00 02 35 23
-// 15 00 02 37 09
-// 15 00 02 38 04
-// 15 00 02 39 00
-// 15 00 02 3A 01
-// 15 00 02 3C 70
-// 15 00 02 3D FF
-// 15 00 02 3E FF
-// 15 00 02 3F 7F
-// 15 00 02 40 06
-// 15 00 02 41 A0
-// 15 00 02 43 1E
-// 15 00 02 44 0B
-// 15 00 02 45 28
-// 15 00 02 55 02
-// 15 00 02 57 A9
-// 15 00 02 59 0A
-// 15 00 02 5A 2D
-// 15 00 02 5B 19
-// 15 00 02 5C 15
-// 15 00 02 5D 7F
-// 15 00 02 5E 6E
-// 15 00 02 5F 5F
-// 15 00 02 60 53
-// 15 00 02 61 50
-// 15 00 02 62 41
-// 15 00 02 63 44
-// 15 00 02 64 2C
-// 15 00 02 65 44
-// 15 00 02 66 42
-// 15 00 02 67 40
-// 15 00 02 68 5B
-// 15 00 02 69 45
-// 15 00 02 6A 48
-// 15 00 02 6B 38
-// 15 00 02 6C 32
-// 15 00 02 6D 25
-// 15 00 02 6E 14
-// 15 00 02 6F 08
-// 15 00 02 70 7F
-// 15 00 02 71 6E
-// 15 00 02 72 5F
-// 15 00 02 73 53
-// 15 00 02 74 50
-// 15 00 02 75 41
-// 15 00 02 76 44
-// 15 00 02 77 2C
-// 15 00 02 78 44
-// 15 00 02 79 42
-// 15 00 02 7A 40
-// 15 00 02 7B 5B
-// 15 00 02 7C 45
-// 15 00 02 7D 48
-// 15 00 02 7E 38
-// 15 00 02 7F 32
-// 15 00 02 80 25
-// 15 00 02 81 14
-// 15 00 02 82 08
-// 15 00 02 E0 02
-// 15 00 02 00 50
-// 15 00 02 01 5F
-// 15 00 02 02 5F
-// 15 00 02 03 52
-// 15 00 02 04 77
-// 15 00 02 05 57
-// 15 00 02 06 5F
-// 15 00 02 07 4E
-// 15 00 02 08 4C
-// 15 00 02 09 5F
-// 15 00 02 0A 4A
-// 15 00 02 0B 48
-// 15 00 02 0C 5F
-// 15 00 02 0D 46
-// 15 00 02 0E 44
-// 15 00 02 0F 40
-// 15 00 02 10 5F
-// 15 00 02 11 5F
-// 15 00 02 12 5F
-// 15 00 02 13 5F
-// 15 00 02 14 5F
-// 15 00 02 15 5F
-// 15 00 02 16 51
-// 15 00 02 17 5F
-// 15 00 02 18 5F
-// 15 00 02 19 53
-// 15 00 02 1A 77
-// 15 00 02 1B 57
-// 15 00 02 1C 5F
-// 15 00 02 1D 4F
-// 15 00 02 1E 4D
-// 15 00 02 1F 5F
-// 15 00 02 20 4B
-// 15 00 02 21 49
-// 15 00 02 22 5F
-// 15 00 02 23 47
-// 15 00 02 24 45
-// 15 00 02 25 41
-// 15 00 02 26 5F
-// 15 00 02 27 5F
-// 15 00 02 28 5F
-// 15 00 02 29 5F
-// 15 00 02 2A 5F
-// 15 00 02 2B 5F
-// 15 00 02 2C 01
-// 15 00 02 2D 1F
-// 15 00 02 2E 1F
-// 15 00 02 2F 13
-// 15 00 02 30 17
-// 15 00 02 31 17
-// 15 00 02 32 1F
-// 15 00 02 33 0D
-// 15 00 02 34 0F
-// 15 00 02 35 1F
-// 15 00 02 36 05
-// 15 00 02 37 07
-// 15 00 02 38 1F
-// 15 00 02 39 09
-// 15 00 02 3A 0B
-// 15 00 02 3B 11
-// 15 00 02 3C 1F
-// 15 00 02 3D 1F
-// 15 00 02 3E 1F
-// 15 00 02 3F 1F
-// 15 00 02 40 1F
-// 15 00 02 41 1F
-// 15 00 02 42 00
-// 15 00 02 43 1F
-// 15 00 02 44 1F
-// 15 00 02 45 12
-// 15 00 02 46 17
-// 15 00 02 47 17
-// 15 00 02 48 1F
-// 15 00 02 49 0C
-// 15 00 02 4A 0E
-// 15 00 02 4B 1F
-// 15 00 02 4C 04
-// 15 00 02 4D 06
-// 15 00 02 4E 1F
-// 15 00 02 4F 08
-// 15 00 02 50 0A
-// 15 00 02 51 10
-// 15 00 02 52 1F
-// 15 00 02 53 1F
-// 15 00 02 54 1F
-// 15 00 02 55 1F
-// 15 00 02 56 1F
-// 15 00 02 57 1F
-// 15 00 02 58 40
-// 15 00 02 5B 10
-// 15 00 02 5C 06
-// 15 00 02 5D 40
-// 15 00 02 5E 00
-// 15 00 02 5F 00
-// 15 00 02 60 40
-// 15 00 02 61 03
-// 15 00 02 62 04
-// 15 00 02 63 6C
-// 15 00 02 64 6C
-// 15 00 02 65 75
-// 15 00 02 66 08
-// 15 00 02 67 B4
-// 15 00 02 68 08
-// 15 00 02 69 6C
-// 15 00 02 6A 6C
-// 15 00 02 6B 0C
-// 15 00 02 6D 00
-// 15 00 02 6E 00
-// 15 00 02 6F 88
-// 15 00 02 75 BB
-// 15 00 02 76 00
-// 15 00 02 77 05
-// 15 00 02 78 2A
-// 15 00 02 E0 04
-// 15 00 02 00 0E
-// 15 00 02 02 B3
-// 15 00 02 09 60
-// 15 00 02 0E 48
-// 15 00 02 E0 00
-// 05 fa 01 11
-// 05 32 01 29
-// ];
-
-// panel-exit-sequence = [
-// 05 00 01 28
-// 05 00 01 10
-// ];
-
-// disp_timings1: display-timings {
-// native-mode = <&dsi1_timing0>;
-// dsi1_timing0: timing0 {
-// clock-frequency = <66000000>;
-// hactive = <800>;
-// vactive = <1280>;
-// hfront-porch = <18>;
-// hsync-len = <12>;
-// hback-porch = <18>;
-// vfront-porch = <24>;
-// vsync-len = <4>;
-// vback-porch = <12>;
-// hsync-active = <0>;
-// vsync-active = <0>;
-// de-active = <0>;
-// pixelclk-active = <1>;
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@0 {
-// reg = <0>;
-// panel_in_dsi1: endpoint {
-// remote-endpoint = <&dsi1_out_panel>;
-// };
-// };
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@1 {
-// reg = <1>;
-// dsi1_out_panel: endpoint {
-// remote-endpoint = <&panel_in_dsi1>;
-// };
-// };
-// };
-
-// };
-
-/************************************************************************************************************************************************
-10寸晶尚
-默认 10.1寸1200x1920
-************************************************************************************************************************************************/
-// &dsi1 {
-// status = "okay";
-// rockchip,lane-rate = <1000>;
-// dsi1_panel: panel@0 {
-// status = "okay";
-// compatible = "simple-panel-dsi";
-// reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
-// pinctrl-names = "default";
-// pinctrl-0 = <&dsi1_rst_gpio>;
-// reg = <0>;
-// backlight = <&backlight>;
-// reset-delay-ms = <100>;
-// enable-delay-ms = <120>;
-// prepare-delay-ms = <20>;
-// unprepare-delay-ms = <20>;
-// disable-delay-ms = <100>;
-// dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
-// MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
-// dsi,format = <MIPI_DSI_FMT_RGB888>;
-// dsi,lanes = <4>;
-// panel-init-sequence = [
-// 15 00 02 B0 01
-// 15 00 02 C3 4F
-// 15 00 02 C4 40
-// 15 00 02 C5 40
-// 15 00 02 C6 40
-// 15 00 02 C7 40
-// 15 00 02 C8 4D
-// 15 00 02 C9 52
-// 15 00 02 CA 51
-// 15 00 02 CD 5D
-// 15 00 02 CE 5B
-// 15 00 02 CF 4B
-// 15 00 02 D0 49
-// 15 00 02 D1 47
-// 15 00 02 D2 45
-// 15 00 02 D3 41
-// 15 00 02 D7 50
-// 15 00 02 D8 40
-// 15 00 02 D9 40
-// 15 00 02 DA 40
-// 15 00 02 DB 40
-// 15 00 02 DC 4E
-// 15 00 02 DD 52
-// 15 00 02 DE 51
-// 15 00 02 E1 5E
-// 15 00 02 E2 5C
-// 15 00 02 E3 4C
-// 15 00 02 E4 4A
-// 15 00 02 E5 48
-// 15 00 02 E6 46
-// 15 00 02 E7 42
-// 15 00 02 B0 03
-// 15 00 02 BE 03
-// 15 00 02 CC 44
-// 15 00 02 C8 07
-// 15 00 02 C9 05
-// 15 00 02 CA 42
-// 15 00 02 CD 3E
-// 15 00 02 CF 60
-// 15 00 02 D2 04
-// 15 00 02 D3 04
-// 15 00 02 D4 01
-// 15 00 02 D5 00
-// 15 00 02 D6 03
-// 15 00 02 D7 04
-// 15 00 02 D9 01
-// 15 00 02 DB 01
-// 15 00 02 E4 F0
-// 15 00 02 E5 0A
-// 15 00 02 B0 00
-// 15 00 02 B1 08
-// 15 00 02 BD 54
-// 15 00 02 C2 06
-// 15 00 02 C4 0B
-// 15 00 02 B0 02
-// 15 00 02 C0 00
-// 15 00 02 C1 0A
-// 15 00 02 C2 20
-// 15 00 02 C3 24
-// 15 00 02 C4 23
-// 15 00 02 C5 29
-// 15 00 02 C6 23
-// 15 00 02 C7 1C
-// 15 00 02 C8 19
-// 15 00 02 C9 17
-// 15 00 02 CA 17
-// 15 00 02 CB 18
-// 15 00 02 CC 1A
-// 15 00 02 CD 1E
-// 15 00 02 CE 20
-// 15 00 02 CF 23
-// 15 00 02 D0 07
-// 15 00 02 D1 00
-// 15 00 02 D2 00
-// 15 00 02 D3 0A
-// 15 00 02 D4 13
-// 15 00 02 D5 1C
-// 15 00 02 D6 1A
-// 15 00 02 D7 13
-// 15 00 02 D8 17
-// 15 00 02 D9 1C
-// 15 00 02 DA 19
-// 15 00 02 DB 17
-// 15 00 02 DC 17
-// 15 00 02 DD 18
-// 15 00 02 DE 1A
-// 15 00 02 DF 1E
-// 15 00 02 E0 20
-// 15 00 02 E1 23
-// 15 00 02 E2 07
-// 05 78 01 11
-// 05 14 01 29
-// ];
-
-// panel-exit-sequence = [
-// 05 00 01 28
-// 05 00 01 10
-// ];
-
-// disp_timings1: display-timings {
-// native-mode = <&dsi1_timing0>;
-// dsi1_timing0: timing0 {
-// clock-frequency = <156000000>;
-// hactive = <1200 >;
-// vactive = <1920>;
-// hfront-porch = <42>;
-// hsync-len = <10>;
-// hback-porch = <32>;
-// vfront-porch = <35>;
-// vsync-len = <4>;
-// vback-porch = <30>;
-// hsync-active = <0>;
-// vsync-active = <0>;
-// de-active = <0>;
-// pixelclk-active = <0>;
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@0 {
-// reg = <0>;
-// panel_in_dsi1: endpoint {
-// remote-endpoint = <&dsi1_out_panel>;
-// };
-// };
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@1 {
-// reg = <1>;
-// dsi1_out_panel: endpoint {
-// remote-endpoint = <&panel_in_dsi1>;
-// };
-// };
-// };
-
-// };
-
-// /************************************************************************************************************************************************
-// 10寸晶尚
-// 默认 8寸800x1280
-// ************************************************************************************************************************************************/
-// &dsi1 {
-// status = "okay";
-// rockchip,lane-rate = <500>;
-// dsi1_panel: panel@0 {
-// status = "okay";
-// compatible = "simple-panel-dsi";
-// reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
-// pinctrl-names = "default";
-// pinctrl-0 = <&dsi1_rst_gpio>;
-// reg = <0>;
-// backlight = <&backlight>;
-// reset-delay-ms = <30>;
-// enable-delay-ms = <100>;
-// prepare-delay-ms = <20>;
-// unprepare-delay-ms = <20>;
-// disable-delay-ms = <20>;
-// init-delay-ms = <10>;
-// dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
-// MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
-// dsi,format = <MIPI_DSI_FMT_RGB888>;
-// dsi,lanes = <4>;
-// panel-init-sequence = [
-// 39 00 04 FF 98 81 03
-// 15 00 02 01 00
-// 15 00 02 02 00
-// 15 00 02 03 53
-// 15 00 02 04 53
-// 15 00 02 05 13
-// 15 00 02 06 04
-// 15 00 02 07 02
-// 15 00 02 08 02
-// 15 00 02 09 00
-// 15 00 02 0a 00
-// 15 00 02 0b 00
-// 15 00 02 0c 00
-// 15 00 02 0d 00
-// 15 00 02 0e 00
-// 15 00 02 0f 00
-// 15 00 02 10 00
-// 15 00 02 11 00
-// 15 00 02 12 00
-// 15 00 02 13 00
-// 15 00 02 14 00
-// 15 00 02 15 00
-// 15 00 02 16 00
-// 15 00 02 17 00
-// 15 00 02 18 00
-// 15 00 02 19 00
-// 15 00 02 1a 00
-// 15 00 02 1b 00
-// 15 00 02 1c 00
-// 15 00 02 1d 00
-// 15 00 02 1e c0
-// 15 00 02 1f 00
-// 15 00 02 20 02
-// 15 00 02 21 09
-// 15 00 02 22 00
-// 15 00 02 23 00
-// 15 00 02 24 00
-// 15 00 02 25 00
-// 15 00 02 26 00
-// 15 00 02 27 00
-// 15 00 02 28 55
-// 15 00 02 29 03
-// 15 00 02 2a 00
-// 15 00 02 2b 00
-// 15 00 02 2c 00
-// 15 00 02 2d 00
-// 15 00 02 2e 00
-// 15 00 02 2f 00
-// 15 00 02 30 00
-// 15 00 02 31 00
-// 15 00 02 32 00
-// 15 00 02 33 00
-// 15 00 02 34 00
-// 15 00 02 35 00
-// 15 00 02 36 00
-// 15 00 02 37 00
-// 15 00 02 38 3C
-// 15 00 02 39 00
-// 15 00 02 3a 00
-// 15 00 02 3b 00
-// 15 00 02 3c 00
-// 15 00 02 3d 00
-// 15 00 02 3e 00
-// 15 00 02 3f 00
-// 15 00 02 40 00
-// 15 00 02 41 00
-// 15 00 02 42 00
-// 15 00 02 43 00
-// 15 00 02 44 00
-
-// 15 00 02 50 01
-// 15 00 02 51 23
-// 15 00 02 52 45
-// 15 00 02 53 67
-// 15 00 02 54 89
-// 15 00 02 55 ab
-// 15 00 02 56 01
-// 15 00 02 57 23
-// 15 00 02 58 45
-// 15 00 02 59 67
-// 15 00 02 5a 89
-// 15 00 02 5b ab
-// 15 00 02 5c cd
-// 15 00 02 5d ef
-
-// 15 00 02 5e 01
-// 15 00 02 5f 0A
-// 15 00 02 60 02
-// 15 00 02 61 02
-// 15 00 02 62 08
-// 15 00 02 63 15
-// 15 00 02 64 14
-// 15 00 02 65 02
-// 15 00 02 66 11
-// 15 00 02 67 10
-// 15 00 02 68 02
-// 15 00 02 69 0F
-// 15 00 02 6a 0E
-// 15 00 02 6b 02
-// 15 00 02 6c 0D
-// 15 00 02 6d 0C
-// 15 00 02 6e 06
-// 15 00 02 6f 02
-// 15 00 02 70 02
-// 15 00 02 71 02
-// 15 00 02 72 02
-// 15 00 02 73 02
-// 15 00 02 74 02
-
-// 15 00 02 75 0A
-// 15 00 02 76 02
-// 15 00 02 77 02
-// 15 00 02 78 06
-// 15 00 02 79 15
-// 15 00 02 7a 14
-// 15 00 02 7b 02
-// 15 00 02 7c 10
-// 15 00 02 7d 11
-// 15 00 02 7e 02
-// 15 00 02 7f 0C
-// 15 00 02 80 0D
-// 15 00 02 81 02
-// 15 00 02 82 0E
-// 15 00 02 83 0F
-// 15 00 02 84 08
-// 15 00 02 85 02
-// 15 00 02 86 02
-// 15 00 02 87 02
-// 15 00 02 88 02
-// 15 00 02 89 02
-// 15 00 02 8A 02
-
-
-// 39 00 04 FF 98 81 04
-// //15 00 02 00 00 //
-// // 15 00 02 2F 01 //bist 用户调试,屏幕会闪演示测试
-// 15 00 02 3B C0
-// 15 00 02 6C 15
-// 15 00 02 6E 30
-// 15 00 02 6F 55
-// 15 00 02 3A 24
-// 15 00 02 8D 1F
-// 15 00 02 87 BA
-// 15 00 02 26 76
-// 15 00 02 B2 D1
-// 15 00 02 B5 07
-// 15 00 02 35 1F
-// 15 00 02 88 0B
-// 15 00 02 21 09
-
-
-// 39 00 04 FF 98 81 01
-// 15 00 02 22 0A
-// 15 00 02 31 09
-// 15 00 02 40 33
-// 15 00 02 53 37
-// 15 00 02 55 38
-// 15 00 02 50 95
-// 15 00 02 51 95
-// 15 00 02 60 30
-
-// 15 00 02 A0 0F
-// 15 00 02 A1 17
-// 15 00 02 A2 22
-// 15 00 02 A3 19
-// 15 00 02 A4 15
-// 15 00 02 A5 28
-// 15 00 02 A6 1C
-// 15 00 02 A7 1C
-// 15 00 02 A8 78
-// 15 00 02 A9 1C
-// 15 00 02 AA 28
-// 15 00 02 AB 69
-// 15 00 02 AC 1A
-// 15 00 02 AD 19
-// 15 00 02 AE 4B
-// 15 00 02 AF 22
-// 15 00 02 B0 2A
-// 15 00 02 B1 4B
-// 15 00 02 B2 6B
-// 15 00 02 B3 3F
-
-// 15 00 02 C0 01
-// 15 00 02 C1 17
-// 15 00 02 C2 22
-// 15 00 02 C3 19
-// 15 00 02 C4 15
-// 15 00 02 C5 28
-// 15 00 02 C6 1C
-// 15 00 02 C7 1D
-// 15 00 02 C8 78
-// 15 00 02 C9 1C
-// 15 00 02 CA 28
-// 15 00 02 CB 69
-// 15 00 02 CC 1A
-// 15 00 02 CD 19
-// 15 00 02 CE 4B
-// 15 00 02 CF 22
-// 15 00 02 D0 2A
-// 15 00 02 D1 4B
-// 15 00 02 D2 6B
-// 15 00 02 D3 3F
-// 39 00 04 FF 98 81 00
-// 05 78 01 11
-// 05 14 01 29
-// ];
-
-// panel-exit-sequence = [
-// 05 00 01 28
-// 05 00 01 10
-// ];
-
-// disp_timings1: display-timings {
-// native-mode = <&dsi1_timing0>;
-// dsi1_timing0: timing0 {
-// clock-frequency = <71000000>;
-// hactive = <800>;
-// vactive = <1280>;
-// hfront-porch = <52>;
-// hsync-len = <8>;
-// hback-porch = <48>;
-// vfront-porch = <15>;
-// vsync-len = <6>;
-// vback-porch = <16>;
-// hsync-active = <0>;
-// vsync-active = <0>;
-// de-active = <0>;
-// pixelclk-active = <0>;
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@0 {
-// reg = <0>;
-// panel_in_dsi1: endpoint {
-// remote-endpoint = <&dsi1_out_panel>;
-// };
-// };
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@1 {
-// reg = <1>;
-// dsi1_out_panel: endpoint {
-// remote-endpoint = <&panel_in_dsi1>;
-// };
-// };
-// };
-
-// };
-
-// /************************************************************************************************************************************************
-// 贝力佳屏幕
-// 默认 8寸800x1280
-// ************************************************************************************************************************************************/
-// &dsi1 {
-// status = "okay";
-// rockchip,lane-rate = <500>;
-// dsi1_panel: panel@0 {
-// status = "okay";
-// compatible = "simple-panel-dsi";
-// reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
-// pinctrl-names = "default";
-// pinctrl-0 = <&dsi1_rst_gpio>;
-// reg = <0>;
-// backlight = <&backlight>;
-// reset-delay-ms = <30>;
-// enable-delay-ms = <100>;
-// prepare-delay-ms = <20>;
-// unprepare-delay-ms = <20>;
-// disable-delay-ms = <20>;
-// init-delay-ms = <10>;
-// dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
-// MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
-// dsi,format = <MIPI_DSI_FMT_RGB888>;
-// dsi,lanes = <4>;
-// panel-init-sequence = [
-// 39 00 04 FF 98 81 03
-// 15 00 02 01 00
-// 15 00 02 02 00
-// 15 00 02 03 53
-// 15 00 02 04 13
-// 15 00 02 05 00
-// 15 00 02 06 04
-// 15 00 02 07 00
-// 15 00 02 08 00
-// 15 00 02 09 22
-// 15 00 02 0a 22
-// 15 00 02 0b 00
-// 15 00 02 0c 01
-// 15 00 02 0d 00
-// 15 00 02 0e 00
-// 15 00 02 0f 25
-// 15 00 02 10 25
-// 15 00 02 11 00
-// 15 00 02 12 00
-// 15 00 02 13 00
-// 15 00 02 14 00
-// 15 00 02 15 00
-// 15 00 02 16 00
-// 15 00 02 17 00
-// 15 00 02 18 00
-// 15 00 02 19 00
-// 15 00 02 1a 00
-// 15 00 02 1b 00
-// 15 00 02 1c 00
-// 15 00 02 1d 00
-// 15 00 02 1e 44
-// 15 00 02 1f 80
-// 15 00 02 20 02
-// 15 00 02 21 03
-// 15 00 02 22 00
-// 15 00 02 23 00
-// 15 00 02 24 00
-// 15 00 02 25 00
-// 15 00 02 26 00
-// 15 00 02 27 00
-// 15 00 02 28 33
-// 15 00 02 29 03
-// 15 00 02 2a 00
-// 15 00 02 2b 00
-// 15 00 02 2c 00
-// 15 00 02 2d 00
-// 15 00 02 2e 00
-// 15 00 02 2f 00
-// 15 00 02 30 00
-// 15 00 02 31 00
-// 15 00 02 32 00
-// 15 00 02 33 00
-// 15 00 02 34 04
-// 15 00 02 35 00
-// 15 00 02 36 00
-// 15 00 02 37 00
-// 15 00 02 38 3C
-// 15 00 02 39 00
-// 15 00 02 3a 40
-// 15 00 02 3b 40
-// 15 00 02 3c 00
-// 15 00 02 3d 00
-// 15 00 02 3e 00
-// 15 00 02 3f 00
-// 15 00 02 40 00
-// 15 00 02 41 00
-// 15 00 02 42 00
-// 15 00 02 43 00
-// 15 00 02 44 00
-
-// 15 00 02 50 01
-// 15 00 02 51 23
-// 15 00 02 52 45
-// 15 00 02 53 67
-// 15 00 02 54 89
-// 15 00 02 55 ab
-// 15 00 02 56 01
-// 15 00 02 57 23
-// 15 00 02 58 45
-// 15 00 02 59 67
-// 15 00 02 5a 89
-// 15 00 02 5b ab
-// 15 00 02 5c cd
-// 15 00 02 5d ef
-
-// 15 00 02 5e 11
-
-// 15 00 02 5f 01
-// 15 00 02 60 00
-// 15 00 02 61 15
-// 15 00 02 62 14
-// 15 00 02 63 0C
-// 15 00 02 64 0D
-// 15 00 02 65 0E
-// 15 00 02 66 0F
-// 15 00 02 67 06
-// 15 00 02 68 02
-// 15 00 02 69 02
-// 15 00 02 6a 02
-// 15 00 02 6b 02
-// 15 00 02 6c 02
-// 15 00 02 6d 02
-// 15 00 02 6e 08
-// 15 00 02 6f 02
-// 15 00 02 70 02
-// 15 00 02 71 02
-// 15 00 02 72 02
-// 15 00 02 73 02
-// 15 00 02 74 02
-
-// 15 00 02 75 01
-// 15 00 02 76 00
-// 15 00 02 77 15
-// 15 00 02 78 14
-// 15 00 02 79 0C
-// 15 00 02 7a 0D
-// 15 00 02 7b 0E
-// 15 00 02 7c 0F
-// 15 00 02 7D 08
-// 15 00 02 7E 02
-// 15 00 02 7F 02
-// 15 00 02 80 02
-// 15 00 02 81 02
-// 15 00 02 82 02
-// 15 00 02 83 02
-// 15 00 02 84 06
-// 15 00 02 85 02
-// 15 00 02 86 02
-// 15 00 02 87 02
-// 15 00 02 88 02
-// 15 00 02 89 02
-// 15 00 02 8A 02
-
-// 39 00 04 FF 98 81 04
-// 15 00 02 6C 15
-// 15 00 02 6E 3B
-// 15 00 02 6F 55
-// // 15 00 02 3A 14
-// 15 00 02 8D 14
-// 15 00 02 87 BA
-// 15 00 02 26 76
-// 15 00 02 B2 D1
-// 15 00 02 3B 98
-// 15 00 02 35 1f
-// 15 00 02 3A 24
-// 15 00 02 B5 27
-// 15 00 02 31 75
-// 15 00 02 30 03
-// 15 00 02 33 14
-// 15 00 02 38 02
-// 15 00 02 39 00
-// 15 00 02 7A 10
-
-// // 15 00 02 2F 01 //开bist模式 检测gIP和ic有没有问题
-
-// 39 00 04 FF 98 81 01
-// 15 00 02 22 0A
-// 15 00 02 31 0A
-// 15 00 02 50 AE
-// 15 00 02 51 A9
-// 15 00 02 60 1F
-// 15 00 02 62 07
-// 15 00 02 63 00
-
-// 15 00 02 52 00
-// 15 00 02 53 56
-// 15 00 02 54 00
-// 15 00 02 55 59
-
-// 15 00 02 A0 08
-// 15 00 02 A1 20
-// 15 00 02 A2 2D
-// 15 00 02 A3 13
-// 15 00 02 A4 16
-// 15 00 02 A5 29
-// 15 00 02 A6 1D
-// 15 00 02 A7 1E
-// 15 00 02 A8 77
-// 15 00 02 A9 17
-// 15 00 02 AA 24
-// 15 00 02 AB 6A
-// 15 00 02 AC 22
-// 15 00 02 AD 24
-// 15 00 02 AE 5A
-// 15 00 02 AF 2B
-// 15 00 02 B0 2C
-// 15 00 02 B1 4D
-// 15 00 02 B2 6F
-// 15 00 02 B3 3F
-
-// 15 00 02 C0 08
-// 15 00 02 C1 1E
-// 15 00 02 C2 2B
-// 15 00 02 C3 13
-// 15 00 02 C4 16
-// 15 00 02 C5 28
-// 15 00 02 C6 1A
-// 15 00 02 C7 1D
-// 15 00 02 C8 75
-// 15 00 02 C9 18
-// 15 00 02 CA 25
-// 15 00 02 CB 71
-// 15 00 02 CC 23
-// 15 00 02 CD 28
-// 15 00 02 CE 59
-// 15 00 02 CF 2C
-// 15 00 02 D0 30
-// 15 00 02 D1 55
-// 15 00 02 D2 6B
-// 15 00 02 D3 3F
-
-// //CMD_Page 0
-// 39 00 04 FF 98 81 00
-// 15 00 02 35 00
-// 05 78 01 11
-// 05 14 01 29
-// ];
-
-// panel-exit-sequence = [
-// 05 00 01 28
-// 05 00 01 10
-// ];
-
-// disp_timings1: display-timings {
-// native-mode = <&dsi1_timing0>;
-// dsi1_timing0: timing0 {
-// clock-frequency = <71000000>;
-// hactive = <800>;
-// vactive = <1280>;
-// hfront-porch = <52>;
-// hsync-len = <8>;
-// hback-porch = <48>;
-// vfront-porch = <15>;
-// vsync-len = <6>;
-// vback-porch = <16>;
-// hsync-active = <0>;
-// vsync-active = <0>;
-// de-active = <0>;
-// pixelclk-active = <0>;
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@0 {
-// reg = <0>;
-// panel_in_dsi1: endpoint {
-// remote-endpoint = <&dsi1_out_panel>;
-// };
-// };
-// };
-// };
-
-// ports {
-// #address-cells = <1>;
-// #size-cells = <0>;
-
-// port@1 {
-// reg = <1>;
-// dsi1_out_panel: endpoint {
-// remote-endpoint = <&panel_in_dsi1>;
-// };
-// };
-// };
-
-// };
-
-
-/************************************************************************************************************************************************
-贝力佳屏幕
-默认 5寸
-************************************************************************************************************************************************/
-&dsi1 {
- status = "okay";
- rockchip,lane-rate = <1000>;
- dsi1_panel: panel@0 {
- status = "okay";
- compatible = "simple-panel-dsi";
- reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
- pinctrl-names = "default";
- pinctrl-0 = <&dsi1_rst_gpio>;
- reg = <0>;
- backlight = <&backlight>;
- reset-delay-ms = <30>;
- enable-delay-ms = <100>;
- prepare-delay-ms = <20>;
- unprepare-delay-ms = <20>;
- disable-delay-ms = <20>;
- init-delay-ms = <120>;
- dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
- MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
- dsi,format = <MIPI_DSI_FMT_RGB888>;
- dsi,lanes = <4>;
- panel-init-sequence = [
- // Set EXTC
- 39 00 04 B9 FF 83 99
- // Set Power
- 39 00 10 B1 02 04 6C 8C 01 32 33 11 11 53 48 01 73 02 02
- // Set Display
- 39 00 0C B2 00 80 80 AE 05 07 5A 11 00 10 10
- // Set CYC
- 39 00 2D B4 00 FF 00 AC 00 9C 00 00 08 00 00 02 00 26 02 07 09 21 03 00 00 04 A4 88 00 AC 00 9C 00 00 08 00 00 02 00 24 02 07 09 00 00 04 A4 12
- // Set GIP_0
- 39 00 22 D3 00 00 00 00 00 00 00 00 32 10 05 00 05 00 00 00 00 00 00 00 00 00 00 01 00 07 07 03 00 00 00 05 40
- // Set GIP_1
- 39 00 21 D5 00 00 00 01 02 03 00 00 00 00 19 00 18 00 20 21 00 18 00 00 00 00 00 00 00 00 31 31 30 30 2F 2F
- // Set GIP_2
- 39 00 21 D6 40 40 03 02 01 00 40 40 40 40 18 40 19 40 21 20 40 18 40 40 40 40 40 40 40 40 31 31 30 30 2F 2F
- // Set GIP_3_0
- 39 00 11 D8 28 02 00 2A 28 02 C0 2A 00 00 00 00 00 00 00 00
- // Set Bank
- 39 00 02 BD 01
- // Set GIP_3_1
- 39 00 11 D8 00 00 00 00 00 00 00 00 28 2A 00 2A 28 02 C0 2A
- // Set Bank
- 39 00 02 BD 02
- // Set GIP_3_2
- 39 00 09 D8 28 2A 00 2A 28 02 C0 2A
- // Set Bank
- 39 00 02 BD 00
- //Set VCOM
- 39 00 03 B6 7D 7D
- //Set VREF
- 39 00 02 D2 33
- // Set Panel
- 39 00 02 CC 08
- // Set GAMMA
- 39 00 37 E0 01 2E 38 31 6A 71 7B 76 78 7F 86 88 8E 90 98 9C 9D A7 A8 AB A7 A9 A8 59 52 5D 69 01 2E 38 31 6A 71 7B 76 78 7F 86 88 8E 90 98 9C 9D A7 A8 AB A7 A9 A8 59 52 5D 69
- // Checksum Enable
- 39 00 02 D0 39
- 05 78 01 11
- 05 14 01 29
- ];
-
- panel-exit-sequence = [
- 05 00 01 28
- 05 00 01 10
- ];
-
- disp_timings1: display-timings {
- native-mode = <&dsi1_timing0>;
- dsi1_timing0: timing0 {
- clock-frequency = <120000000>;
- hactive = <1080>; //与 LCDTiming.LCDH 对应
- vactive = <1920>; //与 LCDTiming.LCDV 对应
- hfront-porch = <32>; //与 LCDTiming.HFPD 对应
- hsync-len = <4>; //与 LCDTiming.HSPW 对应
- hback-porch = <32>; //与 LCDTiming.HBPD 对应
- vfront-porch = <9>; //与 LCDTiming.VEPD 对应
- vsync-len = <4>; //与 LCDTiming.VsPW 对应
- vback-porch = <3>; //与 LCDTiming.VBPD 对应
- hsync-active = <0>;
- vsync-active = <0>;
- de-active = <0>;
- pixelclk-active = <0>;
- };
- };
-
- ports {
- #address-cells = <1>;
- #size-cells = <0>;
-
- port@0 {
- reg = <0>;
- panel_in_dsi1: endpoint {
- remote-endpoint = <&dsi1_out_panel>;
- };
- };
- };
- };
-
- ports {
- #address-cells = <1>;
- #size-cells = <0>;
-
- port@1 {
- reg = <1>;
- dsi1_out_panel: endpoint {
- remote-endpoint = <&panel_in_dsi1>;
- };
- };
- };
-
-};
+/*********************************************************************
+ * 立创开发板不靠卖板赚钱,以培养中国工程师为己任
+ * 泰山派软硬件资料与相关扩展板软硬件资料官网全部开源
+ * 开发板官网:www.lckfb.com
+ * 立创论坛:oshwhub.com/forum
+ * 关注B站:【立创开发板】,掌握我们的最新动态!
+ *********************************************************************
+ * 文件名:tspi-rk3566-dsi-v10.dtsi
+ * 描述:mipi 屏幕
+ * 更新:
+ * 时间 作者 联系 说明
+ * 2023-09-13 吴才成 1378913492@qq.com v1.0.0
+ * 2024-01-19 风漠兮 578118086@qq.com Fit D310T9362V1
+ * 2024-06-08 千古长夜 36076779@qq.com 适配小海豚手机扩展版第二版,修改PWM输出为PWM6
+ *********************************************************************/
+/ {
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ pwms = <&pwm6 0 25000 0>;
+ brightness-levels = <
+ 0 20 20 21 21 22 22 23
+ 23 24 24 25 25 26 26 27
+ 27 28 28 29 29 30 30 31
+ 31 32 32 33 33 34 34 35
+ 35 36 36 37 37 38 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 = <255>;
+ };
+};
+
+&pwm6 {
+ status = "okay";
+};
+
+&i2c1 {
+ status = "okay";
+ clock-frequency = <400000>;
+
+ tp@38 {
+ status = "okay";
+ pinctrl-0 = <&touch_gpio>;
+ compatible = "hyn,cst128a";
+ reg = <0x38>;
+ reset-gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_LOW>;
+ irq-gpios = <&gpio1 RK_PA0 IRQ_TYPE_LEVEL_LOW>;
+ };
+};
+
+
+&pinctrl {
+ dsi1 {
+ dsi1_rst_gpio: dsi1-rst-gpio {
+ rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ touch_gpio: touch-gpio {
+ rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
+ };
+ };
+};
+
+/*
+ * video_phy1 needs to be enabled
+ * when dsi1 is enabled
+ */
+&dsi1 {
+ status = "okay";
+};
+
+&dsi1_in_vp0 {
+ status = "disabled";
+};
+
+&dsi1_in_vp1 {
+ status = "okay";
+};
+
+&video_phy1 {
+ status = "okay";
+};
+
+&route_dsi1 {
+ status = "okay";//wucaicheng mipi okay
+ connect = <&vp1_out_dsi1>;
+};
+
+// D310T9362V1
+&dsi1 {
+ status = "okay";
+ rockchip,lane-rate = <480>;//(480+50+60+10)*(800+20+34+2)*60*3*8/2,+100mhz
+ dsi1_panel: panel@0 {
+ status = "okay";
+ compatible = "simple-panel-dsi";
+ reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_LOW>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&dsi1_rst_gpio>;
+ reg = <0>;
+ backlight = <&backlight>;
+ reset-delay-ms = <200>;
+ enable-delay-ms = <100>;
+ prepare-delay-ms = <20>;
+ unprepare-delay-ms = <20>;
+ disable-delay-ms = <20>;
+ init-delay-ms = <120>;
+ dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+ MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
+ dsi,format = <MIPI_DSI_FMT_RGB888>;
+ dsi,lanes = <2>;
+ panel-init-sequence = [
+ // init code
+ 05 78 01 01
+ 05 78 01 11
+ 39 0A 06 FF 77 01 00 00 11
+ 15 0A 02 D1 11
+ 15 0A 02 55 B0 // 80 90 b0
+ 39 0A 06 FF 77 01 00 00 10
+ 39 0A 03 C0 63 00
+ 39 0A 03 C1 09 02
+ 39 0A 03 C2 37 08
+ 15 0A 02 C7 00 // x-dir rotate 0:0x00,rotate 180:0x04
+ 15 0A 02 CC 38
+ 39 0A 11 B0 00 11 19 0C 10 06 07 0A 09 22 04 10 0E 28 30 1C
+ 39 6E 11 B1 00 12 19 0D 10 04 06 07 08 23 04 12 11 28 30 1C
+ 39 0A 06 FF 77 01 00 00 11 // enable bk fun of command 2 BK1
+ 15 0A 02 B0 4D
+ 15 0A 02 B1 60 // 0x56 0x4a 0x5b
+ 15 0A 02 B2 07
+ 15 6E 02 B3 80
+ 15 0A 02 B5 47
+ 15 0A 02 B7 8A
+ 15 0A 02 B8 21
+ 15 0A 02 C1 78
+ 15 0A 02 C2 78
+ 15 0A 02 D0 88
+ 39 0A 04 E0 00 00 02
+ 39 0A 0C E1 01 A0 03 A0 02 A0 04 A0 00 44 44
+ 39 0A 0D E2 00 00 00 00 00 00 00 00 00 00 00 00
+ 39 0A 05 E3 00 00 33 33
+ 39 0A 03 E4 44 44
+ 39 0A 11 E5 01 26 A0 A0 03 28 A0 A0 05 2A A0 A0 07 2C A0 A0
+ 39 0A 05 E6 00 00 33 33
+ 39 0A 03 E7 44 44
+ 39 0A 11 E8 02 26 A0 A0 04 28 A0 A0 06 2A A0 A0 08 2C A0 A0
+ 39 0A 08 EB 00 01 E4 E4 44 00 40
+ 39 0A 11 ED FF F7 65 4F 0B A1 CF FF FF FC 1A B0 F4 56 7F FF
+ 15 0A 02 EE 42 // missing?
+ 39 0A 06 FF 77 01 00 00 00
+ 15 0A 02 36 00 //U&D Y-DIR rotate 0:0x00,rotate 180:0x10
+ 15 0A 02 3A 55
+ 05 78 01 11
+ 05 14 01 29
+ ];
+
+ panel-exit-sequence = [
+ 05 00 01 28
+ 05 00 01 10
+ ];
+
+ disp_timings1: display-timings {
+ native-mode = <&dsi1_timing0>;
+ dsi1_timing0: timing0 {
+ clock-frequency = <30816000>;// (480+50+60+10)*(800+20+34+2)*60
+
+ hactive = <480>;
+ hfront-porch = <50>;
+ hback-porch = <60>;
+ hsync-len = <10>;
+
+ vactive = <800>;
+ vfront-porch = <20>;
+ vback-porch = <34>;
+ vsync-len = <2>;
+
+ hsync-active = <0>;
+ vsync-active = <0>;
+ de-active = <0>;
+ pixelclk-active = <0>;
+
+ swap-rb = <0>;
+ swap-rg = <0>;
+ swap-gb = <0>;
+ };
+ };
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ panel_in_dsi1: endpoint {
+ remote-endpoint = <&dsi1_out_panel>;
+ };
+ };
+ };
+ };
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@1 {
+ reg = <1>;
+ dsi1_out_panel: endpoint {
+ remote-endpoint = <&panel_in_dsi1>;
+ };
+ };
+ };
+
+};
\ No newline at end of file
diff --git a/arch/arm64/boot/dts/rockchip/tspi-rk3566-user-v10.dts b/arch/arm64/boot/dts/rockchip/tspi-rk3566-user-v10.dts
index bb7e7f13678c..e3369ba87261 100755
--- a/arch/arm64/boot/dts/rockchip/tspi-rk3566-user-v10.dts
+++ b/arch/arm64/boot/dts/rockchip/tspi-rk3566-user-v10.dts
@@ -15,6 +15,7 @@
* 更新:
* 时间 作者 联系 说明
* 2023-07-21 吴才成 1378913492@qq.com v1.0.0
+ * 2024-05-13 千古长夜 36076779@qq.com v2.0.0 添加4g模块电源开关
*********************************************************************/
/dts-v1/;
@@ -32,7 +33,7 @@
// #include "tspi-rk3566-edp-v10.dtsi"
//【开/关】mipi 显示屏幕配置,用户可以基于此复制自己的屏幕,注意EDP与MIPI屏幕互斥,因为共用了VOP如果需要同显自行修改
-// #include "tspi-rk3566-dsi-v10.dtsi"
+#include "tspi-rk3566-dsi-v10.dtsi"
//【开/关】HDMI 显示屏幕配置,里面内容几乎可以不用动,如果不需要hdmi显示直接注释掉即可
#include "tspi-rk3566-hdmi-v10.dtsi"
@@ -48,6 +49,13 @@
model = "lckfb tspi V10 Board";
compatible = "lckfb,tspi-v10", "rockchip,rk3566";
+ // 控制移远4EC20 4G模块电源开关
+ ec20_power:ec20_power {
+ compatible = "ec20_power";
+ ec20power-gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
+ status = "okay"; //“okay” 开启 “false” 关闭
+ };
+
rk_headset: rk-headset {
compatible = "rockchip_headset";
headset_gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>;
diff --git a/arch/arm64/configs/tspi_defconfig b/arch/arm64/configs/tspi_defconfig
index 6cd3c5e09934..b0c49e102a21 100755
--- a/arch/arm64/configs/tspi_defconfig
+++ b/arch/arm64/configs/tspi_defconfig
@@ -455,8 +455,9 @@ CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_GSLX6801=y
CONFIG_TOUCHSCREEN_GSLX680_PAD=y
CONFIG_TOUCHSCREEN_GSLX680_VR=y
-CONFIG_TOUCHSCREEN_GSL3673=y
-CONFIG_TOUCHSCREEN_GSL3673_800X1280=y
+; CONFIG_TOUCHSCREEN_GSL3673=y
+; CONFIG_TOUCHSCREEN_GSL3673_800X1280=y
+CONFIG_TOUCHSCREEN_CST128A_CUST=y
CONFIG_TOUCHSCREEN_GSL3676=y
CONFIG_TOUCHSCREEN_GT9XX=y
CONFIG_TOUCHSCREEN_HYN_CST2XX=y
@@ -541,6 +542,7 @@ CONFIG_BATTERY_RK817=y
CONFIG_CHARGER_RK817=y
CONFIG_BATTERY_RK818=y
CONFIG_CHARGER_RK818=y
+CONFIG_EC20_POWER=y
CONFIG_THERMAL=y
CONFIG_THERMAL_WRITABLE_TRIPS=y
CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index ed7e7602924e..43b5bf224a53 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -1410,5 +1410,6 @@ config TOUCHSCREEN_FT5436
If unsure, say N.
source "drivers/input/touchscreen/cyttsp5/Kconfig"
+source "drivers/input/touchscreen/cst128a_cust/Kconfig"
endif
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index effe2cf060ad..f1d1f44e8976 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -128,3 +128,4 @@ obj-$(CONFIG_TOUCHSCREEN_HYN_CST2XX) += hyn_cst2xx/
obj-$(CONFIG_TOUCHSCREEN_FTS) += focaltech_touch/
obj-$(CONFIG_TOUCHSCREEN_FT5436) += focaltech_touch_ft5436/
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5) += cyttsp5/
+obj-$(CONFIG_TOUCHSCREEN_CST128A_CUST) += cst128a_cust/
diff --git a/drivers/input/touchscreen/cst128a_cust/Kconfig b/drivers/input/touchscreen/cst128a_cust/Kconfig
new file mode 100644
index 000000000000..0d601df0c45c
--- /dev/null
+++ b/drivers/input/touchscreen/cst128a_cust/Kconfig
@@ -0,0 +1,7 @@
+config TOUCHSCREEN_CST128A_CUST
+ tristate "CST128A Touchscreen"
+ depends on I2C
+ default n
+ help
+ Say Y here if you have CST128A touch panel.
+ If unsure, say N.
\ No newline at end of file
diff --git a/drivers/input/touchscreen/cst128a_cust/Makefile b/drivers/input/touchscreen/cst128a_cust/Makefile
new file mode 100644
index 000000000000..1cb7a4386a2c
--- /dev/null
+++ b/drivers/input/touchscreen/cst128a_cust/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_TOUCHSCREEN_CST128A_CUST) += cst128a_ts.o
diff --git a/drivers/input/touchscreen/cst128a_cust/cst128a_ts.c b/drivers/input/touchscreen/cst128a_cust/cst128a_ts.c
new file mode 100644
index 000000000000..c26fb4886e11
--- /dev/null
+++ b/drivers/input/touchscreen/cst128a_cust/cst128a_ts.c
@@ -0,0 +1,288 @@
+/***************************************************************
+本驱动由正点原子的ft5426驱动修改而来
+ ***************************************************************/
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/input/mt.h>
+#include <linux/of_gpio.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+
+/* CST128寄存器相关宏定义 */
+#define CST128_DEVIDE_MODE_REG 0x00 // 模式寄存器
+#define CST128_TD_STATUS_REG 0x02 // 状态寄存器
+#define CST128_TOUCH_DATA_REG 0x03 // 触摸数据读取的起始寄存器
+#define CST128_ID_G_MODE_REG 0xA4 // 中断模式寄存器
+
+#define MAX_SUPPORT_POINTS 5 // cst128最大支持5点触摸
+
+#define TOUCH_EVENT_DOWN 0x00 // 按下
+#define TOUCH_EVENT_UP 0x01 // 抬起
+#define TOUCH_EVENT_ON 0x02 // 接触
+#define TOUCH_EVENT_RESERVED 0x03 // 保留
+
+
+struct hyn_cst128_dev {
+ struct i2c_client *client;
+ struct input_dev *input;
+ int reset_gpio;
+ int irq_gpio;
+};
+
+static int hyn_cst128_ts_write(struct hyn_cst128_dev *cst128,
+ u8 addr, u8 *buf, u16 len)
+{
+ struct i2c_client *client = cst128->client;
+ struct i2c_msg msg;
+ u8 send_buf[6] = {0};
+ int ret;
+
+ send_buf[0] = addr;
+ memcpy(&send_buf[1], buf, len);
+
+ msg.flags = 0; //i2c写
+ msg.addr = client->addr;
+ msg.buf = send_buf;
+ msg.len = len + 1;
+
+ ret = i2c_transfer(client->adapter, &msg, 1);
+ if (1 == ret)
+ return 0;
+ else {
+ dev_err(&client->dev, "%s: write error, addr=0x%x len=%d.\n",
+ __func__, addr, len);
+ return -1;
+ }
+}
+
+static int hyn_cst128_ts_read(struct hyn_cst128_dev *cst128,
+ u8 addr, u8 *buf, u16 len)
+{
+ struct i2c_client *client = cst128->client;
+ struct i2c_msg msg[2];
+ int ret;
+
+ msg[0].flags = 0; // i2c写
+ msg[0].addr = client->addr;
+ msg[0].buf = &addr;
+ msg[0].len = 1; // 1个字节
+
+ msg[1].flags = I2C_M_RD; //i2c读
+ msg[1].addr = client->addr;
+ msg[1].buf = buf;
+ msg[1].len = len;
+
+ ret = i2c_transfer(client->adapter, msg, 2);
+ if (2 == ret)
+ return 0;
+ else {
+ dev_err(&client->dev, "%s: read error, addr=0x%x len=%d.\n",
+ __func__, addr, len);
+ return -1;
+ }
+}
+
+static int hyn_cst128_ts_reset(struct hyn_cst128_dev *cst128)
+{
+ struct i2c_client *client = cst128->client;
+ int ret;
+
+ /* 从设备树中获取复位管脚 */
+ cst128->reset_gpio = of_get_named_gpio(client->dev.of_node, "reset-gpios", 0);
+ if (!gpio_is_valid(cst128->reset_gpio)) {
+ dev_err(&client->dev, "Failed to get ts reset gpio\n");
+ return cst128->reset_gpio;
+ }
+
+ /* 申请使用管脚 */
+ ret = devm_gpio_request_one(&client->dev, cst128->reset_gpio,
+ GPIOF_OUT_INIT_HIGH, "cst128 reset");
+ if (ret < 0)
+ return ret;
+
+ msleep(20);
+ gpio_set_value_cansleep(cst128->reset_gpio, 0); // 拉低复位引脚
+ msleep(5);
+ gpio_set_value_cansleep(cst128->reset_gpio, 1); // 拉高复位引脚,结束复位
+
+ return 0;
+}
+
+static irqreturn_t hyn_cst128_ts_isr(int irq, void *dev_id)
+{
+ struct hyn_cst128_dev *cst128 = dev_id;
+ u8 rdbuf[30] = {0};
+ int i, type, x, y, id;
+ bool down;
+ int ret;
+
+ /* 读取CST128触摸点坐标从0x02寄存器开始,连续读取29个寄存器 */
+ ret = hyn_cst128_ts_read(cst128, CST128_TD_STATUS_REG, rdbuf, 29);
+ if (ret)
+ goto out;
+
+ for (i = 0; i < MAX_SUPPORT_POINTS; i++) {
+
+ u8 *buf = &rdbuf[i * 6 + 1];
+
+ /* 以第一个触摸点为例,寄存器TOUCH1_XH(地址0x03),各bit位描述如下:
+ * bit7:6 Event flag 0:按下 1:释放 2:接触 3:没有事件
+ * bit5:4 保留
+ * bit3:0 X轴触摸点的11~8位
+ */
+ type = buf[0] >> 6; // 获取触摸点的Event Flag
+ if (type == TOUCH_EVENT_RESERVED)
+ continue;
+
+ y = ((buf[2] << 8) | buf[3]) & 0x0fff;
+ x = (((buf[0] << 8) | buf[1]) & 0x0fff);
+ x = 480 - x;
+
+ /* 以第一个触摸点为例,寄存器TOUCH1_YH(地址0x05),各bit位描述如下:
+ * bit7:4 Touch ID 触摸ID,表示是哪个触摸点
+ * bit3:0 Y轴触摸点的11~8位。
+ */
+ id = (buf[2] >> 4) & 0x0f;
+ down = type != TOUCH_EVENT_UP;
+
+ input_mt_slot(cst128->input, id);
+ input_mt_report_slot_state(cst128->input, MT_TOOL_FINGER, down);
+
+ if (!down)
+ continue;
+
+ input_report_abs(cst128->input, ABS_MT_POSITION_X, x);
+ input_report_abs(cst128->input, ABS_MT_POSITION_Y, y);
+ }
+
+ input_mt_report_pointer_emulation(cst128->input, true);
+ input_sync(cst128->input);
+
+out:
+ return IRQ_HANDLED;
+}
+
+static int hyn_cst128_ts_irq(struct hyn_cst128_dev *cst128)
+{
+ struct i2c_client *client = cst128->client;
+ int ret;
+
+ /* 从设备树中获取中断管脚 */
+ cst128->irq_gpio = of_get_named_gpio(client->dev.of_node, "irq-gpios", 0);
+ if (!gpio_is_valid(cst128->irq_gpio)) {
+ dev_err(&client->dev, "Failed to get ts interrupt gpio\n");
+ return cst128->irq_gpio;
+ }
+
+ /* 申请使用管脚 */
+ ret = devm_gpio_request_one(&client->dev, cst128->irq_gpio,
+ GPIOF_IN, "cst128 interrupt");
+ if (ret < 0)
+ return ret;
+
+ /* 注册中断服务函数 */
+ ret = devm_request_threaded_irq(&client->dev, gpio_to_irq(cst128->irq_gpio),
+ NULL, hyn_cst128_ts_isr, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ client->name, cst128);
+ if (ret) {
+ dev_err(&client->dev, "Failed to request touchscreen IRQ.\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static int hyn_cst128_ts_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ struct hyn_cst128_dev *cst128;
+ struct input_dev *input;
+ u8 data;
+ int ret;
+
+ /* 实例化一个struct hyn_cst128_dev对象 */
+ cst128 = devm_kzalloc(&client->dev, sizeof(struct hyn_cst128_dev), GFP_KERNEL);
+ if (!cst128) {
+ dev_err(&client->dev, "Failed to allocate cst128 driver data.\n");
+ return -ENOMEM;
+ }
+
+ cst128->client = client;
+
+ /* 复位CST128触摸芯片 */
+ ret = hyn_cst128_ts_reset(cst128);
+ if (ret)
+ return ret;
+
+ msleep(5);
+
+ /* 初始化CST128 */
+ data = 0;
+ hyn_cst128_ts_write(cst128, CST128_DEVIDE_MODE_REG, &data, 1);
+ data = 1;
+ hyn_cst128_ts_write(cst128, CST128_ID_G_MODE_REG, &data, 1);
+
+ /* 申请、注册中断服务函数 */
+ ret = hyn_cst128_ts_irq(cst128);
+ if (ret)
+ return ret;
+
+ /* 注册input设备 */
+ input = devm_input_allocate_device(&client->dev);
+ if (!input) {
+ dev_err(&client->dev, "Failed to allocate input device.\n");
+ return -ENOMEM;
+ }
+
+ cst128->input = input;
+ input->name = "CST128 TouchScreen";
+ input->id.bustype = BUS_I2C;
+
+ input_set_abs_params(input, ABS_MT_POSITION_X,
+ 0, 480, 0, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
+ 0, 800, 0, 0);
+
+ ret = input_mt_init_slots(input, MAX_SUPPORT_POINTS, INPUT_MT_DIRECT);
+ if (ret) {
+ dev_err(&client->dev, "Failed to init MT slots.\n");
+ return ret;
+ }
+
+ ret = input_register_device(input);
+ if (ret)
+ return ret;
+
+ i2c_set_clientdata(client, cst128);
+ return 0;
+}
+
+static int hyn_cst128_ts_remove(struct i2c_client *client)
+{
+ struct hyn_cst128_dev *cst128 = i2c_get_clientdata(client);
+ input_unregister_device(cst128->input);
+ return 0;
+}
+
+static const struct of_device_id hyn_cst128_of_match[] = {
+ { .compatible = "hyn,cst128a", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, hyn_cst128_of_match);
+
+static struct i2c_driver hyn_cst128_ts_driver = {
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "hyn_cst128a",
+ .of_match_table = of_match_ptr(hyn_cst128_of_match),
+ },
+ .probe = hyn_cst128_ts_probe,
+ .remove = hyn_cst128_ts_remove,
+};
+
+module_i2c_driver(hyn_cst128_ts_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("leefei");
+MODULE_INFO(intree, "Y");
+
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index ab9fdd0721bc..2dacadb793da 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -695,4 +695,6 @@ config CHARGER_RK818
If you say yes here you will get support for the charger of RK818 PMIC.
This driver can give support for Rk818 Charger Interface.
+source "drivers/power/supply/ec20_power/Kconfig"
+
endif # POWER_SUPPLY
diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
index 4e8be4a2f1e0..1acf518a0b66 100644
--- a/drivers/power/supply/Makefile
+++ b/drivers/power/supply/Makefile
@@ -92,3 +92,4 @@ obj-$(CONFIG_BATTERY_RK817) += rk817_battery.o
obj-$(CONFIG_CHARGER_RK817) += rk817_charger.o
obj-$(CONFIG_BATTERY_RK818) += rk818_battery.o
obj-$(CONFIG_CHARGER_RK818) += rk818_charger.o
+obj-$(CONFIG_EC20_POWER) += ec20_power/
\ No newline at end of file
diff --git a/drivers/power/supply/ec20_power/Kconfig b/drivers/power/supply/ec20_power/Kconfig
new file mode 100644
index 000000000000..e24214d7bc2e
--- /dev/null
+++ b/drivers/power/supply/ec20_power/Kconfig
@@ -0,0 +1,7 @@
+config EC20_POWER
+ tristate "EC20 POWER"
+ depends on GPIOLIB
+ default n
+ help
+ Say Y here if you have EC20 module.
+ If unsure, say N.
\ No newline at end of file
diff --git a/drivers/power/supply/ec20_power/Makefile b/drivers/power/supply/ec20_power/Makefile
new file mode 100644
index 000000000000..6cd90188504f
--- /dev/null
+++ b/drivers/power/supply/ec20_power/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_EC20_POWER) += ec20_power.o
diff --git a/drivers/power/supply/ec20_power/ec20_power.c b/drivers/power/supply/ec20_power/ec20_power.c
new file mode 100644
index 000000000000..96627e0db44b
--- /dev/null
+++ b/drivers/power/supply/ec20_power/ec20_power.c
@@ -0,0 +1,250 @@
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/ide.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/gpio.h>
+#include <linux/cdev.h>
+#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_gpio.h>
+#include <asm/uaccess.h>
+#include <asm/io.h>
+/***************************************************************
+文件名 : ec20_power.c
+作者 : 千古长夜
+版本 : V1.0
+描述 : EC20 4g模块电源控制。
+***************************************************************/
+#define EC20POWER_CNT 1 /* 设备号个数 */
+#define EC20POWER_NAME "ec20_power" /* 名字 */
+#define EC20POWEROFF 0 /* 关灯 */
+#define EC20POWERON 1 /* 开灯 */
+
+/* ec20_power设备结构体 */
+struct ec20_power_dev{
+ dev_t devid; /* 设备号 */
+ struct cdev cdev; /* cdev */
+ struct class *class; /* 类 */
+ struct device *device; /* 设备 */
+ int major; /* 主设备号 */
+ int minor; /* 次设备号 */
+ struct device_node *nd; /* 设备节点 */
+ int pwd_gpio; /* ec20power所使用的GPIO编号 */
+};
+
+struct ec20_power_dev ec20_power; /* ec20power设备 */
+
+/*
+ * @description : 打开设备
+ * @param – inode : 传递给驱动的inode
+ * @param - filp : 设备文件,file结构体有个叫做private_data的成员变量
+ * 一般在open的时候将private_data指向设备结构体。
+ * @return : 0 成功;其他 失败
+ */
+static int ec20power_open(struct inode *inode, struct file *filp)
+{
+ filp->private_data = &ec20_power; /* 设置私有数据 */
+ return 0;
+}
+
+/*
+ * @description : 从设备读取数据
+ * @param - filp : 要打开的设备文件(文件描述符)
+ * @param - buf : 返回给用户空间的数据缓冲区
+ * @param - cnt : 要读取的数据长度
+ * @param - offt : 相对于文件首地址的偏移
+ * @return : 读取的字节数,如果为负值,表示读取失败
+ */
+static ssize_t ec20power_read(struct file *filp, char __user *buf, size_t cnt, loff_t *offt)
+{
+ return 0;
+}
+
+/*
+ * @description : 向设备写数据
+ * @param - filp : 设备文件,表示打开的文件描述符
+ * @param - buf : 要写给设备写入的数据
+ * @param - cnt : 要写入的数据长度
+ * @param - offt : 相对于文件首地址的偏移
+ * @return : 写入的字节数,如果为负值,表示写入失败
+ */
+static ssize_t ec20power_write(struct file *filp, const char __user *buf,
+ size_t cnt, loff_t *offt)
+{
+ int retvalue;
+ unsigned char databuf[1];
+ unsigned char ec20powerstat;
+ struct ec20_power_dev *dev = filp->private_data;
+
+ retvalue = copy_from_user(databuf, buf, cnt);
+ if(retvalue < 0) {
+ printk("kernel write failed!\r\n");
+ return -EFAULT;
+ }
+
+ ec20powerstat = databuf[0]; /* 获取状态值 */
+
+ if(ec20powerstat == EC20POWERON) {
+ gpio_set_value(dev->pwd_gpio, 1); /* 打开EC20POWER */
+ } else if(ec20powerstat == EC20POWEROFF) {
+ gpio_set_value(dev->pwd_gpio, 0); /* 关闭EC20POWER */
+ }
+ return 0;
+}
+
+/*
+ * @description : 关闭/释放设备
+ * @param - filp : 要关闭的设备文件(文件描述符)
+ * @return : 0 成功;其他 失败
+ */
+static int ec20power_release(struct inode *inode, struct file *filp)
+{
+ return 0;
+}
+
+/* 设备操作函数 */
+static struct file_operations ec20_power_fops = {
+ .owner = THIS_MODULE,
+ .open = ec20power_open,
+ .read = ec20power_read,
+ .write = ec20power_write,
+ .release = ec20power_release,
+};
+
+/*
+ * @description : 驱动出口函数
+ * @param : 无
+ * @return : 无
+ */
+static int __init ec20power_init(void)
+{
+ int ret = 0;
+ const char *str;
+
+ /* 设置所使用的GPIO */
+ /* 1、获取设备节点:ec20_power */
+ ec20_power.nd = of_find_node_by_path("/ec20_power");
+ if(ec20_power.nd == NULL) {
+ printk("ec20_power node not find!\r\n");
+ return -EINVAL;
+ }
+
+ /* 2.读取status属性 */
+ ret = of_property_read_string(ec20_power.nd, "status", &str);
+ if(ret < 0)
+ return -EINVAL;
+
+ if (strcmp(str, "okay"))
+ return -EINVAL;
+
+ /* 3、获取compatible属性值并进行匹配 */
+ ret = of_property_read_string(ec20_power.nd, "compatible", &str);
+ if(ret < 0) {
+ printk("ec20_power: Failed to get compatible property\n");
+ return -EINVAL;
+ }
+
+ if (strcmp(str, "ec20_power")) {
+ printk("ec20_power: Compatible match failed\n");
+ return -EINVAL;
+ }
+
+ /* 4、 获取设备树中的gpio属性,得到所使用的编号 */
+ ec20_power.pwd_gpio = of_get_named_gpio(ec20_power.nd, "ec20power-gpio", 0);
+ if(ec20_power.pwd_gpio < 0) {
+ printk("can't get ec20power-gpio");
+ return -EINVAL;
+ }
+ printk("ec20power-gpio num = %d\r\n", ec20_power.pwd_gpio);
+
+ /* 5.向gpio子系统申请使用GPIO */
+ ret = gpio_request(ec20_power.pwd_gpio, "EC20POWER-GPIO");
+ if (ret) {
+ printk(KERN_ERR "ec20_power: Failed to request ec20power-gpio\n");
+ return ret;
+ }
+
+ /* 6、设置GPIO为输出,并且输出高电平,默认开启EC20 */
+ ret = gpio_direction_output(ec20_power.pwd_gpio, 1);
+ if(ret < 0) {
+ printk("can't set gpio!\r\n");
+ }
+
+ /* 注册字符设备驱动 */
+ /* 1、创建设备号 */
+ if (ec20_power.major) { /* 定义了设备号 */
+ ec20_power.devid = MKDEV(ec20_power.major, 0);
+ ret = register_chrdev_region(ec20_power.devid, EC20POWER_CNT, EC20POWER_NAME);
+ if(ret < 0) {
+ pr_err("cannot register %s char driver [ret=%d]\n", EC20POWER_NAME, EC20POWER_CNT);
+ goto free_gpio;
+ }
+ } else { /* 没有定义设备号 */
+ ret = alloc_chrdev_region(&ec20_power.devid, 0, EC20POWER_CNT, EC20POWER_NAME); /* 申请设备号 */
+ if(ret < 0) {
+ pr_err("%s Couldn't alloc_chrdev_region, ret=%d\r\n", EC20POWER_NAME, ret);
+ goto free_gpio;
+ }
+ ec20_power.major = MAJOR(ec20_power.devid); /* 获取分配号的主设备号 */
+ ec20_power.minor = MINOR(ec20_power.devid); /* 获取分配号的次设备号 */
+ }
+ printk("ec20_power major=%d,minor=%d\r\n",ec20_power.major, ec20_power.minor);
+
+ /* 2、初始化cdev */
+ ec20_power.cdev.owner = THIS_MODULE;
+ cdev_init(&ec20_power.cdev, &ec20_power_fops);
+
+ /* 3、添加一个cdev */
+ cdev_add(&ec20_power.cdev, ec20_power.devid, EC20POWER_CNT);
+ if(ret < 0)
+ goto del_unregister;
+
+ /* 4、创建类 */
+ ec20_power.class = class_create(THIS_MODULE, EC20POWER_NAME);
+ if (IS_ERR(ec20_power.class)) {
+ goto del_cdev;
+ }
+
+ /* 5、创建设备 */
+ ec20_power.device = device_create(ec20_power.class, NULL, ec20_power.devid, NULL, EC20POWER_NAME);
+ if (IS_ERR(ec20_power.device)) {
+ goto destroy_class;
+ }
+ return 0;
+
+destroy_class:
+ class_destroy(ec20_power.class);
+del_cdev:
+ cdev_del(&ec20_power.cdev);
+del_unregister:
+ unregister_chrdev_region(ec20_power.devid, EC20POWER_CNT);
+free_gpio:
+ gpio_free(ec20_power.pwd_gpio);
+ return -EIO;
+}
+
+/*
+ * @description : 驱动出口函数
+ * @param : 无
+ * @return : 无
+ */
+static void __exit ec20power_exit(void)
+{
+ /* 注销字符设备驱动 */
+ cdev_del(&ec20_power.cdev);/* 删除cdev */
+ unregister_chrdev_region(ec20_power.devid, EC20POWER_CNT);
+ device_destroy(ec20_power.class, ec20_power.devid);/* 注销设备 */
+ class_destroy(ec20_power.class);/* 注销类 */
+ gpio_free(ec20_power.pwd_gpio); /* 释放GPIO */
+}
+
+module_init(ec20power_init);
+module_exit(ec20power_exit);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("YOUMENG");
+MODULE_INFO(intree, "Y");
+
--
2.17.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/faltering_and_small_white/tspi-phone-ext.git
git@gitee.com:faltering_and_small_white/tspi-phone-ext.git
faltering_and_small_white
tspi-phone-ext
TSPiPhoneEXT
master

搜索帮助