panel-simple.c 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998
  1. /*
  2. * Copyright (C) 2013, NVIDIA Corporation. All rights reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sub license,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the
  12. * next paragraph) shall be included in all copies or substantial portions
  13. * of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. * DEALINGS IN THE SOFTWARE.
  22. */
  23. #include <linux/backlight.h>
  24. #include <linux/gpio/consumer.h>
  25. #include <linux/module.h>
  26. #include <linux/of_platform.h>
  27. #include <linux/platform_device.h>
  28. #include <linux/regulator/consumer.h>
  29. #include <drm/drmP.h>
  30. #include <drm/drm_crtc.h>
  31. #include <drm/drm_mipi_dsi.h>
  32. #include <drm/drm_panel.h>
  33. #include <video/display_timing.h>
  34. #include <video/videomode.h>
  35. struct panel_desc {
  36. const struct drm_display_mode *modes;
  37. unsigned int num_modes;
  38. const struct display_timing *timings;
  39. unsigned int num_timings;
  40. unsigned int bpc;
  41. /**
  42. * @width: width (in millimeters) of the panel's active display area
  43. * @height: height (in millimeters) of the panel's active display area
  44. */
  45. struct {
  46. unsigned int width;
  47. unsigned int height;
  48. } size;
  49. /**
  50. * @prepare: the time (in milliseconds) that it takes for the panel to
  51. * become ready and start receiving video data
  52. * @enable: the time (in milliseconds) that it takes for the panel to
  53. * display the first valid frame after starting to receive
  54. * video data
  55. * @disable: the time (in milliseconds) that it takes for the panel to
  56. * turn the display off (no content is visible)
  57. * @unprepare: the time (in milliseconds) that it takes for the panel
  58. * to power itself down completely
  59. */
  60. struct {
  61. unsigned int prepare;
  62. unsigned int enable;
  63. unsigned int disable;
  64. unsigned int unprepare;
  65. } delay;
  66. u32 bus_format;
  67. u32 bus_flags;
  68. };
  69. struct panel_simple {
  70. struct drm_panel base;
  71. bool prepared;
  72. bool enabled;
  73. const struct panel_desc *desc;
  74. struct backlight_device *backlight;
  75. struct regulator *supply;
  76. struct i2c_adapter *ddc;
  77. struct gpio_desc *enable_gpio;
  78. };
  79. static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
  80. {
  81. return container_of(panel, struct panel_simple, base);
  82. }
  83. static int panel_simple_get_fixed_modes(struct panel_simple *panel)
  84. {
  85. struct drm_connector *connector = panel->base.connector;
  86. struct drm_device *drm = panel->base.drm;
  87. struct drm_display_mode *mode;
  88. unsigned int i, num = 0;
  89. if (!panel->desc)
  90. return 0;
  91. for (i = 0; i < panel->desc->num_timings; i++) {
  92. const struct display_timing *dt = &panel->desc->timings[i];
  93. struct videomode vm;
  94. videomode_from_timing(dt, &vm);
  95. mode = drm_mode_create(drm);
  96. if (!mode) {
  97. dev_err(drm->dev, "failed to add mode %ux%u\n",
  98. dt->hactive.typ, dt->vactive.typ);
  99. continue;
  100. }
  101. drm_display_mode_from_videomode(&vm, mode);
  102. mode->type |= DRM_MODE_TYPE_DRIVER;
  103. if (panel->desc->num_modes == 1)
  104. mode->type |= DRM_MODE_TYPE_PREFERRED;
  105. drm_mode_probed_add(connector, mode);
  106. num++;
  107. }
  108. for (i = 0; i < panel->desc->num_modes; i++) {
  109. const struct drm_display_mode *m = &panel->desc->modes[i];
  110. mode = drm_mode_duplicate(drm, m);
  111. if (!mode) {
  112. dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
  113. m->hdisplay, m->vdisplay, m->vrefresh);
  114. continue;
  115. }
  116. mode->type |= DRM_MODE_TYPE_DRIVER;
  117. if (panel->desc->num_modes == 1)
  118. mode->type |= DRM_MODE_TYPE_PREFERRED;
  119. drm_mode_set_name(mode);
  120. drm_mode_probed_add(connector, mode);
  121. num++;
  122. }
  123. connector->display_info.bpc = panel->desc->bpc;
  124. connector->display_info.width_mm = panel->desc->size.width;
  125. connector->display_info.height_mm = panel->desc->size.height;
  126. if (panel->desc->bus_format)
  127. drm_display_info_set_bus_formats(&connector->display_info,
  128. &panel->desc->bus_format, 1);
  129. connector->display_info.bus_flags = panel->desc->bus_flags;
  130. return num;
  131. }
  132. static int panel_simple_disable(struct drm_panel *panel)
  133. {
  134. struct panel_simple *p = to_panel_simple(panel);
  135. if (!p->enabled)
  136. return 0;
  137. if (p->backlight) {
  138. p->backlight->props.power = FB_BLANK_POWERDOWN;
  139. p->backlight->props.state |= BL_CORE_FBBLANK;
  140. backlight_update_status(p->backlight);
  141. }
  142. if (p->desc->delay.disable)
  143. msleep(p->desc->delay.disable);
  144. p->enabled = false;
  145. return 0;
  146. }
  147. static int panel_simple_unprepare(struct drm_panel *panel)
  148. {
  149. struct panel_simple *p = to_panel_simple(panel);
  150. if (!p->prepared)
  151. return 0;
  152. if (p->enable_gpio)
  153. gpiod_set_value_cansleep(p->enable_gpio, 0);
  154. regulator_disable(p->supply);
  155. if (p->desc->delay.unprepare)
  156. msleep(p->desc->delay.unprepare);
  157. p->prepared = false;
  158. return 0;
  159. }
  160. static int panel_simple_prepare(struct drm_panel *panel)
  161. {
  162. struct panel_simple *p = to_panel_simple(panel);
  163. int err;
  164. if (p->prepared)
  165. return 0;
  166. err = regulator_enable(p->supply);
  167. if (err < 0) {
  168. dev_err(panel->dev, "failed to enable supply: %d\n", err);
  169. return err;
  170. }
  171. if (p->enable_gpio)
  172. gpiod_set_value_cansleep(p->enable_gpio, 1);
  173. if (p->desc->delay.prepare)
  174. msleep(p->desc->delay.prepare);
  175. p->prepared = true;
  176. return 0;
  177. }
  178. static int panel_simple_enable(struct drm_panel *panel)
  179. {
  180. struct panel_simple *p = to_panel_simple(panel);
  181. if (p->enabled)
  182. return 0;
  183. if (p->desc->delay.enable)
  184. msleep(p->desc->delay.enable);
  185. if (p->backlight) {
  186. p->backlight->props.state &= ~BL_CORE_FBBLANK;
  187. p->backlight->props.power = FB_BLANK_UNBLANK;
  188. backlight_update_status(p->backlight);
  189. }
  190. p->enabled = true;
  191. return 0;
  192. }
  193. static int panel_simple_get_modes(struct drm_panel *panel)
  194. {
  195. struct panel_simple *p = to_panel_simple(panel);
  196. int num = 0;
  197. /* probe EDID if a DDC bus is available */
  198. if (p->ddc) {
  199. struct edid *edid = drm_get_edid(panel->connector, p->ddc);
  200. drm_mode_connector_update_edid_property(panel->connector, edid);
  201. if (edid) {
  202. num += drm_add_edid_modes(panel->connector, edid);
  203. kfree(edid);
  204. }
  205. }
  206. /* add hard-coded panel modes */
  207. num += panel_simple_get_fixed_modes(p);
  208. return num;
  209. }
  210. static int panel_simple_get_timings(struct drm_panel *panel,
  211. unsigned int num_timings,
  212. struct display_timing *timings)
  213. {
  214. struct panel_simple *p = to_panel_simple(panel);
  215. unsigned int i;
  216. if (p->desc->num_timings < num_timings)
  217. num_timings = p->desc->num_timings;
  218. if (timings)
  219. for (i = 0; i < num_timings; i++)
  220. timings[i] = p->desc->timings[i];
  221. return p->desc->num_timings;
  222. }
  223. static const struct drm_panel_funcs panel_simple_funcs = {
  224. .disable = panel_simple_disable,
  225. .unprepare = panel_simple_unprepare,
  226. .prepare = panel_simple_prepare,
  227. .enable = panel_simple_enable,
  228. .get_modes = panel_simple_get_modes,
  229. .get_timings = panel_simple_get_timings,
  230. };
  231. static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
  232. {
  233. struct device_node *backlight, *ddc;
  234. struct panel_simple *panel;
  235. int err;
  236. panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
  237. if (!panel)
  238. return -ENOMEM;
  239. panel->enabled = false;
  240. panel->prepared = false;
  241. panel->desc = desc;
  242. panel->supply = devm_regulator_get(dev, "power");
  243. if (IS_ERR(panel->supply))
  244. return PTR_ERR(panel->supply);
  245. panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
  246. GPIOD_OUT_LOW);
  247. if (IS_ERR(panel->enable_gpio)) {
  248. err = PTR_ERR(panel->enable_gpio);
  249. dev_err(dev, "failed to request GPIO: %d\n", err);
  250. return err;
  251. }
  252. backlight = of_parse_phandle(dev->of_node, "backlight", 0);
  253. if (backlight) {
  254. panel->backlight = of_find_backlight_by_node(backlight);
  255. of_node_put(backlight);
  256. if (!panel->backlight)
  257. return -EPROBE_DEFER;
  258. }
  259. ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
  260. if (ddc) {
  261. panel->ddc = of_find_i2c_adapter_by_node(ddc);
  262. of_node_put(ddc);
  263. if (!panel->ddc) {
  264. err = -EPROBE_DEFER;
  265. goto free_backlight;
  266. }
  267. }
  268. drm_panel_init(&panel->base);
  269. panel->base.dev = dev;
  270. panel->base.funcs = &panel_simple_funcs;
  271. err = drm_panel_add(&panel->base);
  272. if (err < 0)
  273. goto free_ddc;
  274. dev_set_drvdata(dev, panel);
  275. return 0;
  276. free_ddc:
  277. if (panel->ddc)
  278. put_device(&panel->ddc->dev);
  279. free_backlight:
  280. if (panel->backlight)
  281. put_device(&panel->backlight->dev);
  282. return err;
  283. }
  284. static int panel_simple_remove(struct device *dev)
  285. {
  286. struct panel_simple *panel = dev_get_drvdata(dev);
  287. drm_panel_detach(&panel->base);
  288. drm_panel_remove(&panel->base);
  289. panel_simple_disable(&panel->base);
  290. if (panel->ddc)
  291. put_device(&panel->ddc->dev);
  292. if (panel->backlight)
  293. put_device(&panel->backlight->dev);
  294. return 0;
  295. }
  296. static void panel_simple_shutdown(struct device *dev)
  297. {
  298. struct panel_simple *panel = dev_get_drvdata(dev);
  299. panel_simple_disable(&panel->base);
  300. }
  301. static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
  302. .clock = 33333,
  303. .hdisplay = 800,
  304. .hsync_start = 800 + 0,
  305. .hsync_end = 800 + 0 + 255,
  306. .htotal = 800 + 0 + 255 + 0,
  307. .vdisplay = 480,
  308. .vsync_start = 480 + 2,
  309. .vsync_end = 480 + 2 + 45,
  310. .vtotal = 480 + 2 + 45 + 0,
  311. .vrefresh = 60,
  312. .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
  313. };
  314. static const struct panel_desc ampire_am800480r3tmqwa1h = {
  315. .modes = &ampire_am800480r3tmqwa1h_mode,
  316. .num_modes = 1,
  317. .bpc = 6,
  318. .size = {
  319. .width = 152,
  320. .height = 91,
  321. },
  322. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  323. };
  324. static const struct drm_display_mode auo_b101aw03_mode = {
  325. .clock = 51450,
  326. .hdisplay = 1024,
  327. .hsync_start = 1024 + 156,
  328. .hsync_end = 1024 + 156 + 8,
  329. .htotal = 1024 + 156 + 8 + 156,
  330. .vdisplay = 600,
  331. .vsync_start = 600 + 16,
  332. .vsync_end = 600 + 16 + 6,
  333. .vtotal = 600 + 16 + 6 + 16,
  334. .vrefresh = 60,
  335. };
  336. static const struct panel_desc auo_b101aw03 = {
  337. .modes = &auo_b101aw03_mode,
  338. .num_modes = 1,
  339. .bpc = 6,
  340. .size = {
  341. .width = 223,
  342. .height = 125,
  343. },
  344. };
  345. static const struct drm_display_mode auo_b101ean01_mode = {
  346. .clock = 72500,
  347. .hdisplay = 1280,
  348. .hsync_start = 1280 + 119,
  349. .hsync_end = 1280 + 119 + 32,
  350. .htotal = 1280 + 119 + 32 + 21,
  351. .vdisplay = 800,
  352. .vsync_start = 800 + 4,
  353. .vsync_end = 800 + 4 + 20,
  354. .vtotal = 800 + 4 + 20 + 8,
  355. .vrefresh = 60,
  356. };
  357. static const struct panel_desc auo_b101ean01 = {
  358. .modes = &auo_b101ean01_mode,
  359. .num_modes = 1,
  360. .bpc = 6,
  361. .size = {
  362. .width = 217,
  363. .height = 136,
  364. },
  365. };
  366. static const struct drm_display_mode auo_b101xtn01_mode = {
  367. .clock = 72000,
  368. .hdisplay = 1366,
  369. .hsync_start = 1366 + 20,
  370. .hsync_end = 1366 + 20 + 70,
  371. .htotal = 1366 + 20 + 70,
  372. .vdisplay = 768,
  373. .vsync_start = 768 + 14,
  374. .vsync_end = 768 + 14 + 42,
  375. .vtotal = 768 + 14 + 42,
  376. .vrefresh = 60,
  377. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  378. };
  379. static const struct panel_desc auo_b101xtn01 = {
  380. .modes = &auo_b101xtn01_mode,
  381. .num_modes = 1,
  382. .bpc = 6,
  383. .size = {
  384. .width = 223,
  385. .height = 125,
  386. },
  387. };
  388. static const struct drm_display_mode auo_b116xw03_mode = {
  389. .clock = 70589,
  390. .hdisplay = 1366,
  391. .hsync_start = 1366 + 40,
  392. .hsync_end = 1366 + 40 + 40,
  393. .htotal = 1366 + 40 + 40 + 32,
  394. .vdisplay = 768,
  395. .vsync_start = 768 + 10,
  396. .vsync_end = 768 + 10 + 12,
  397. .vtotal = 768 + 10 + 12 + 6,
  398. .vrefresh = 60,
  399. };
  400. static const struct panel_desc auo_b116xw03 = {
  401. .modes = &auo_b116xw03_mode,
  402. .num_modes = 1,
  403. .bpc = 6,
  404. .size = {
  405. .width = 256,
  406. .height = 144,
  407. },
  408. };
  409. static const struct drm_display_mode auo_b133xtn01_mode = {
  410. .clock = 69500,
  411. .hdisplay = 1366,
  412. .hsync_start = 1366 + 48,
  413. .hsync_end = 1366 + 48 + 32,
  414. .htotal = 1366 + 48 + 32 + 20,
  415. .vdisplay = 768,
  416. .vsync_start = 768 + 3,
  417. .vsync_end = 768 + 3 + 6,
  418. .vtotal = 768 + 3 + 6 + 13,
  419. .vrefresh = 60,
  420. };
  421. static const struct panel_desc auo_b133xtn01 = {
  422. .modes = &auo_b133xtn01_mode,
  423. .num_modes = 1,
  424. .bpc = 6,
  425. .size = {
  426. .width = 293,
  427. .height = 165,
  428. },
  429. };
  430. static const struct drm_display_mode auo_b133htn01_mode = {
  431. .clock = 150660,
  432. .hdisplay = 1920,
  433. .hsync_start = 1920 + 172,
  434. .hsync_end = 1920 + 172 + 80,
  435. .htotal = 1920 + 172 + 80 + 60,
  436. .vdisplay = 1080,
  437. .vsync_start = 1080 + 25,
  438. .vsync_end = 1080 + 25 + 10,
  439. .vtotal = 1080 + 25 + 10 + 10,
  440. .vrefresh = 60,
  441. };
  442. static const struct panel_desc auo_b133htn01 = {
  443. .modes = &auo_b133htn01_mode,
  444. .num_modes = 1,
  445. .bpc = 6,
  446. .size = {
  447. .width = 293,
  448. .height = 165,
  449. },
  450. .delay = {
  451. .prepare = 105,
  452. .enable = 20,
  453. .unprepare = 50,
  454. },
  455. };
  456. static const struct drm_display_mode avic_tm070ddh03_mode = {
  457. .clock = 51200,
  458. .hdisplay = 1024,
  459. .hsync_start = 1024 + 160,
  460. .hsync_end = 1024 + 160 + 4,
  461. .htotal = 1024 + 160 + 4 + 156,
  462. .vdisplay = 600,
  463. .vsync_start = 600 + 17,
  464. .vsync_end = 600 + 17 + 1,
  465. .vtotal = 600 + 17 + 1 + 17,
  466. .vrefresh = 60,
  467. };
  468. static const struct panel_desc avic_tm070ddh03 = {
  469. .modes = &avic_tm070ddh03_mode,
  470. .num_modes = 1,
  471. .bpc = 8,
  472. .size = {
  473. .width = 154,
  474. .height = 90,
  475. },
  476. .delay = {
  477. .prepare = 20,
  478. .enable = 200,
  479. .disable = 200,
  480. },
  481. };
  482. static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
  483. .clock = 72070,
  484. .hdisplay = 1366,
  485. .hsync_start = 1366 + 58,
  486. .hsync_end = 1366 + 58 + 58,
  487. .htotal = 1366 + 58 + 58 + 58,
  488. .vdisplay = 768,
  489. .vsync_start = 768 + 4,
  490. .vsync_end = 768 + 4 + 4,
  491. .vtotal = 768 + 4 + 4 + 4,
  492. .vrefresh = 60,
  493. };
  494. static const struct panel_desc chunghwa_claa101wa01a = {
  495. .modes = &chunghwa_claa101wa01a_mode,
  496. .num_modes = 1,
  497. .bpc = 6,
  498. .size = {
  499. .width = 220,
  500. .height = 120,
  501. },
  502. };
  503. static const struct drm_display_mode chunghwa_claa101wb01_mode = {
  504. .clock = 69300,
  505. .hdisplay = 1366,
  506. .hsync_start = 1366 + 48,
  507. .hsync_end = 1366 + 48 + 32,
  508. .htotal = 1366 + 48 + 32 + 20,
  509. .vdisplay = 768,
  510. .vsync_start = 768 + 16,
  511. .vsync_end = 768 + 16 + 8,
  512. .vtotal = 768 + 16 + 8 + 16,
  513. .vrefresh = 60,
  514. };
  515. static const struct panel_desc chunghwa_claa101wb01 = {
  516. .modes = &chunghwa_claa101wb01_mode,
  517. .num_modes = 1,
  518. .bpc = 6,
  519. .size = {
  520. .width = 223,
  521. .height = 125,
  522. },
  523. };
  524. static const struct drm_display_mode edt_et057090dhu_mode = {
  525. .clock = 25175,
  526. .hdisplay = 640,
  527. .hsync_start = 640 + 16,
  528. .hsync_end = 640 + 16 + 30,
  529. .htotal = 640 + 16 + 30 + 114,
  530. .vdisplay = 480,
  531. .vsync_start = 480 + 10,
  532. .vsync_end = 480 + 10 + 3,
  533. .vtotal = 480 + 10 + 3 + 32,
  534. .vrefresh = 60,
  535. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  536. };
  537. static const struct panel_desc edt_et057090dhu = {
  538. .modes = &edt_et057090dhu_mode,
  539. .num_modes = 1,
  540. .bpc = 6,
  541. .size = {
  542. .width = 115,
  543. .height = 86,
  544. },
  545. };
  546. static const struct drm_display_mode edt_etm0700g0dh6_mode = {
  547. .clock = 33260,
  548. .hdisplay = 800,
  549. .hsync_start = 800 + 40,
  550. .hsync_end = 800 + 40 + 128,
  551. .htotal = 800 + 40 + 128 + 88,
  552. .vdisplay = 480,
  553. .vsync_start = 480 + 10,
  554. .vsync_end = 480 + 10 + 2,
  555. .vtotal = 480 + 10 + 2 + 33,
  556. .vrefresh = 60,
  557. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  558. };
  559. static const struct panel_desc edt_etm0700g0dh6 = {
  560. .modes = &edt_etm0700g0dh6_mode,
  561. .num_modes = 1,
  562. .bpc = 6,
  563. .size = {
  564. .width = 152,
  565. .height = 91,
  566. },
  567. };
  568. static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
  569. .clock = 32260,
  570. .hdisplay = 800,
  571. .hsync_start = 800 + 168,
  572. .hsync_end = 800 + 168 + 64,
  573. .htotal = 800 + 168 + 64 + 88,
  574. .vdisplay = 480,
  575. .vsync_start = 480 + 37,
  576. .vsync_end = 480 + 37 + 2,
  577. .vtotal = 480 + 37 + 2 + 8,
  578. .vrefresh = 60,
  579. };
  580. static const struct panel_desc foxlink_fl500wvr00_a0t = {
  581. .modes = &foxlink_fl500wvr00_a0t_mode,
  582. .num_modes = 1,
  583. .bpc = 8,
  584. .size = {
  585. .width = 108,
  586. .height = 65,
  587. },
  588. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  589. };
  590. static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
  591. .clock = 9000,
  592. .hdisplay = 480,
  593. .hsync_start = 480 + 5,
  594. .hsync_end = 480 + 5 + 1,
  595. .htotal = 480 + 5 + 1 + 40,
  596. .vdisplay = 272,
  597. .vsync_start = 272 + 8,
  598. .vsync_end = 272 + 8 + 1,
  599. .vtotal = 272 + 8 + 1 + 8,
  600. .vrefresh = 60,
  601. };
  602. static const struct panel_desc giantplus_gpg482739qs5 = {
  603. .modes = &giantplus_gpg482739qs5_mode,
  604. .num_modes = 1,
  605. .bpc = 8,
  606. .size = {
  607. .width = 95,
  608. .height = 54,
  609. },
  610. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  611. };
  612. static const struct display_timing hannstar_hsd070pww1_timing = {
  613. .pixelclock = { 64300000, 71100000, 82000000 },
  614. .hactive = { 1280, 1280, 1280 },
  615. .hfront_porch = { 1, 1, 10 },
  616. .hback_porch = { 1, 1, 10 },
  617. /*
  618. * According to the data sheet, the minimum horizontal blanking interval
  619. * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
  620. * minimum working horizontal blanking interval to be 60 clocks.
  621. */
  622. .hsync_len = { 58, 158, 661 },
  623. .vactive = { 800, 800, 800 },
  624. .vfront_porch = { 1, 1, 10 },
  625. .vback_porch = { 1, 1, 10 },
  626. .vsync_len = { 1, 21, 203 },
  627. .flags = DISPLAY_FLAGS_DE_HIGH,
  628. };
  629. static const struct panel_desc hannstar_hsd070pww1 = {
  630. .timings = &hannstar_hsd070pww1_timing,
  631. .num_timings = 1,
  632. .bpc = 6,
  633. .size = {
  634. .width = 151,
  635. .height = 94,
  636. },
  637. .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
  638. };
  639. static const struct display_timing hannstar_hsd100pxn1_timing = {
  640. .pixelclock = { 55000000, 65000000, 75000000 },
  641. .hactive = { 1024, 1024, 1024 },
  642. .hfront_porch = { 40, 40, 40 },
  643. .hback_porch = { 220, 220, 220 },
  644. .hsync_len = { 20, 60, 100 },
  645. .vactive = { 768, 768, 768 },
  646. .vfront_porch = { 7, 7, 7 },
  647. .vback_porch = { 21, 21, 21 },
  648. .vsync_len = { 10, 10, 10 },
  649. .flags = DISPLAY_FLAGS_DE_HIGH,
  650. };
  651. static const struct panel_desc hannstar_hsd100pxn1 = {
  652. .timings = &hannstar_hsd100pxn1_timing,
  653. .num_timings = 1,
  654. .bpc = 6,
  655. .size = {
  656. .width = 203,
  657. .height = 152,
  658. },
  659. .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
  660. };
  661. static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
  662. .clock = 33333,
  663. .hdisplay = 800,
  664. .hsync_start = 800 + 85,
  665. .hsync_end = 800 + 85 + 86,
  666. .htotal = 800 + 85 + 86 + 85,
  667. .vdisplay = 480,
  668. .vsync_start = 480 + 16,
  669. .vsync_end = 480 + 16 + 13,
  670. .vtotal = 480 + 16 + 13 + 16,
  671. .vrefresh = 60,
  672. };
  673. static const struct panel_desc hitachi_tx23d38vm0caa = {
  674. .modes = &hitachi_tx23d38vm0caa_mode,
  675. .num_modes = 1,
  676. .bpc = 6,
  677. .size = {
  678. .width = 195,
  679. .height = 117,
  680. },
  681. };
  682. static const struct drm_display_mode innolux_at043tn24_mode = {
  683. .clock = 9000,
  684. .hdisplay = 480,
  685. .hsync_start = 480 + 2,
  686. .hsync_end = 480 + 2 + 41,
  687. .htotal = 480 + 2 + 41 + 2,
  688. .vdisplay = 272,
  689. .vsync_start = 272 + 2,
  690. .vsync_end = 272 + 2 + 11,
  691. .vtotal = 272 + 2 + 11 + 2,
  692. .vrefresh = 60,
  693. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  694. };
  695. static const struct panel_desc innolux_at043tn24 = {
  696. .modes = &innolux_at043tn24_mode,
  697. .num_modes = 1,
  698. .bpc = 8,
  699. .size = {
  700. .width = 95,
  701. .height = 54,
  702. },
  703. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  704. };
  705. static const struct drm_display_mode innolux_at070tn92_mode = {
  706. .clock = 33333,
  707. .hdisplay = 800,
  708. .hsync_start = 800 + 210,
  709. .hsync_end = 800 + 210 + 20,
  710. .htotal = 800 + 210 + 20 + 46,
  711. .vdisplay = 480,
  712. .vsync_start = 480 + 22,
  713. .vsync_end = 480 + 22 + 10,
  714. .vtotal = 480 + 22 + 23 + 10,
  715. .vrefresh = 60,
  716. };
  717. static const struct panel_desc innolux_at070tn92 = {
  718. .modes = &innolux_at070tn92_mode,
  719. .num_modes = 1,
  720. .size = {
  721. .width = 154,
  722. .height = 86,
  723. },
  724. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  725. };
  726. static const struct display_timing innolux_g101ice_l01_timing = {
  727. .pixelclock = { 60400000, 71100000, 74700000 },
  728. .hactive = { 1280, 1280, 1280 },
  729. .hfront_porch = { 41, 80, 100 },
  730. .hback_porch = { 40, 79, 99 },
  731. .hsync_len = { 1, 1, 1 },
  732. .vactive = { 800, 800, 800 },
  733. .vfront_porch = { 5, 11, 14 },
  734. .vback_porch = { 4, 11, 14 },
  735. .vsync_len = { 1, 1, 1 },
  736. .flags = DISPLAY_FLAGS_DE_HIGH,
  737. };
  738. static const struct panel_desc innolux_g101ice_l01 = {
  739. .timings = &innolux_g101ice_l01_timing,
  740. .num_timings = 1,
  741. .bpc = 8,
  742. .size = {
  743. .width = 217,
  744. .height = 135,
  745. },
  746. .delay = {
  747. .enable = 200,
  748. .disable = 200,
  749. },
  750. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  751. };
  752. static const struct drm_display_mode innolux_g121i1_l01_mode = {
  753. .clock = 71000,
  754. .hdisplay = 1280,
  755. .hsync_start = 1280 + 64,
  756. .hsync_end = 1280 + 64 + 32,
  757. .htotal = 1280 + 64 + 32 + 64,
  758. .vdisplay = 800,
  759. .vsync_start = 800 + 9,
  760. .vsync_end = 800 + 9 + 6,
  761. .vtotal = 800 + 9 + 6 + 9,
  762. .vrefresh = 60,
  763. };
  764. static const struct panel_desc innolux_g121i1_l01 = {
  765. .modes = &innolux_g121i1_l01_mode,
  766. .num_modes = 1,
  767. .bpc = 6,
  768. .size = {
  769. .width = 261,
  770. .height = 163,
  771. },
  772. };
  773. static const struct drm_display_mode innolux_g121x1_l03_mode = {
  774. .clock = 65000,
  775. .hdisplay = 1024,
  776. .hsync_start = 1024 + 0,
  777. .hsync_end = 1024 + 1,
  778. .htotal = 1024 + 0 + 1 + 320,
  779. .vdisplay = 768,
  780. .vsync_start = 768 + 38,
  781. .vsync_end = 768 + 38 + 1,
  782. .vtotal = 768 + 38 + 1 + 0,
  783. .vrefresh = 60,
  784. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  785. };
  786. static const struct panel_desc innolux_g121x1_l03 = {
  787. .modes = &innolux_g121x1_l03_mode,
  788. .num_modes = 1,
  789. .bpc = 6,
  790. .size = {
  791. .width = 246,
  792. .height = 185,
  793. },
  794. .delay = {
  795. .enable = 200,
  796. .unprepare = 200,
  797. .disable = 400,
  798. },
  799. };
  800. static const struct drm_display_mode innolux_n116bge_mode = {
  801. .clock = 76420,
  802. .hdisplay = 1366,
  803. .hsync_start = 1366 + 136,
  804. .hsync_end = 1366 + 136 + 30,
  805. .htotal = 1366 + 136 + 30 + 60,
  806. .vdisplay = 768,
  807. .vsync_start = 768 + 8,
  808. .vsync_end = 768 + 8 + 12,
  809. .vtotal = 768 + 8 + 12 + 12,
  810. .vrefresh = 60,
  811. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  812. };
  813. static const struct panel_desc innolux_n116bge = {
  814. .modes = &innolux_n116bge_mode,
  815. .num_modes = 1,
  816. .bpc = 6,
  817. .size = {
  818. .width = 256,
  819. .height = 144,
  820. },
  821. };
  822. static const struct drm_display_mode innolux_n156bge_l21_mode = {
  823. .clock = 69300,
  824. .hdisplay = 1366,
  825. .hsync_start = 1366 + 16,
  826. .hsync_end = 1366 + 16 + 34,
  827. .htotal = 1366 + 16 + 34 + 50,
  828. .vdisplay = 768,
  829. .vsync_start = 768 + 2,
  830. .vsync_end = 768 + 2 + 6,
  831. .vtotal = 768 + 2 + 6 + 12,
  832. .vrefresh = 60,
  833. };
  834. static const struct panel_desc innolux_n156bge_l21 = {
  835. .modes = &innolux_n156bge_l21_mode,
  836. .num_modes = 1,
  837. .bpc = 6,
  838. .size = {
  839. .width = 344,
  840. .height = 193,
  841. },
  842. };
  843. static const struct drm_display_mode innolux_zj070na_01p_mode = {
  844. .clock = 51501,
  845. .hdisplay = 1024,
  846. .hsync_start = 1024 + 128,
  847. .hsync_end = 1024 + 128 + 64,
  848. .htotal = 1024 + 128 + 64 + 128,
  849. .vdisplay = 600,
  850. .vsync_start = 600 + 16,
  851. .vsync_end = 600 + 16 + 4,
  852. .vtotal = 600 + 16 + 4 + 16,
  853. .vrefresh = 60,
  854. };
  855. static const struct panel_desc innolux_zj070na_01p = {
  856. .modes = &innolux_zj070na_01p_mode,
  857. .num_modes = 1,
  858. .bpc = 6,
  859. .size = {
  860. .width = 154,
  861. .height = 90,
  862. },
  863. };
  864. static const struct display_timing kyo_tcg121xglp_timing = {
  865. .pixelclock = { 52000000, 65000000, 71000000 },
  866. .hactive = { 1024, 1024, 1024 },
  867. .hfront_porch = { 2, 2, 2 },
  868. .hback_porch = { 2, 2, 2 },
  869. .hsync_len = { 86, 124, 244 },
  870. .vactive = { 768, 768, 768 },
  871. .vfront_porch = { 2, 2, 2 },
  872. .vback_porch = { 2, 2, 2 },
  873. .vsync_len = { 6, 34, 73 },
  874. .flags = DISPLAY_FLAGS_DE_HIGH,
  875. };
  876. static const struct panel_desc kyo_tcg121xglp = {
  877. .timings = &kyo_tcg121xglp_timing,
  878. .num_timings = 1,
  879. .bpc = 8,
  880. .size = {
  881. .width = 246,
  882. .height = 184,
  883. },
  884. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  885. };
  886. static const struct drm_display_mode lg_lb070wv8_mode = {
  887. .clock = 33246,
  888. .hdisplay = 800,
  889. .hsync_start = 800 + 88,
  890. .hsync_end = 800 + 88 + 80,
  891. .htotal = 800 + 88 + 80 + 88,
  892. .vdisplay = 480,
  893. .vsync_start = 480 + 10,
  894. .vsync_end = 480 + 10 + 25,
  895. .vtotal = 480 + 10 + 25 + 10,
  896. .vrefresh = 60,
  897. };
  898. static const struct panel_desc lg_lb070wv8 = {
  899. .modes = &lg_lb070wv8_mode,
  900. .num_modes = 1,
  901. .bpc = 16,
  902. .size = {
  903. .width = 151,
  904. .height = 91,
  905. },
  906. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  907. };
  908. static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
  909. .clock = 200000,
  910. .hdisplay = 1536,
  911. .hsync_start = 1536 + 12,
  912. .hsync_end = 1536 + 12 + 16,
  913. .htotal = 1536 + 12 + 16 + 48,
  914. .vdisplay = 2048,
  915. .vsync_start = 2048 + 8,
  916. .vsync_end = 2048 + 8 + 4,
  917. .vtotal = 2048 + 8 + 4 + 8,
  918. .vrefresh = 60,
  919. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  920. };
  921. static const struct panel_desc lg_lp079qx1_sp0v = {
  922. .modes = &lg_lp079qx1_sp0v_mode,
  923. .num_modes = 1,
  924. .size = {
  925. .width = 129,
  926. .height = 171,
  927. },
  928. };
  929. static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
  930. .clock = 205210,
  931. .hdisplay = 2048,
  932. .hsync_start = 2048 + 150,
  933. .hsync_end = 2048 + 150 + 5,
  934. .htotal = 2048 + 150 + 5 + 5,
  935. .vdisplay = 1536,
  936. .vsync_start = 1536 + 3,
  937. .vsync_end = 1536 + 3 + 1,
  938. .vtotal = 1536 + 3 + 1 + 9,
  939. .vrefresh = 60,
  940. };
  941. static const struct panel_desc lg_lp097qx1_spa1 = {
  942. .modes = &lg_lp097qx1_spa1_mode,
  943. .num_modes = 1,
  944. .size = {
  945. .width = 208,
  946. .height = 147,
  947. },
  948. };
  949. static const struct drm_display_mode lg_lp120up1_mode = {
  950. .clock = 162300,
  951. .hdisplay = 1920,
  952. .hsync_start = 1920 + 40,
  953. .hsync_end = 1920 + 40 + 40,
  954. .htotal = 1920 + 40 + 40+ 80,
  955. .vdisplay = 1280,
  956. .vsync_start = 1280 + 4,
  957. .vsync_end = 1280 + 4 + 4,
  958. .vtotal = 1280 + 4 + 4 + 12,
  959. .vrefresh = 60,
  960. };
  961. static const struct panel_desc lg_lp120up1 = {
  962. .modes = &lg_lp120up1_mode,
  963. .num_modes = 1,
  964. .bpc = 8,
  965. .size = {
  966. .width = 267,
  967. .height = 183,
  968. },
  969. };
  970. static const struct drm_display_mode lg_lp129qe_mode = {
  971. .clock = 285250,
  972. .hdisplay = 2560,
  973. .hsync_start = 2560 + 48,
  974. .hsync_end = 2560 + 48 + 32,
  975. .htotal = 2560 + 48 + 32 + 80,
  976. .vdisplay = 1700,
  977. .vsync_start = 1700 + 3,
  978. .vsync_end = 1700 + 3 + 10,
  979. .vtotal = 1700 + 3 + 10 + 36,
  980. .vrefresh = 60,
  981. };
  982. static const struct panel_desc lg_lp129qe = {
  983. .modes = &lg_lp129qe_mode,
  984. .num_modes = 1,
  985. .bpc = 8,
  986. .size = {
  987. .width = 272,
  988. .height = 181,
  989. },
  990. };
  991. static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
  992. .clock = 10870,
  993. .hdisplay = 480,
  994. .hsync_start = 480 + 2,
  995. .hsync_end = 480 + 2 + 41,
  996. .htotal = 480 + 2 + 41 + 2,
  997. .vdisplay = 272,
  998. .vsync_start = 272 + 2,
  999. .vsync_end = 272 + 2 + 4,
  1000. .vtotal = 272 + 2 + 4 + 2,
  1001. .vrefresh = 74,
  1002. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1003. };
  1004. static const struct panel_desc nec_nl4827hc19_05b = {
  1005. .modes = &nec_nl4827hc19_05b_mode,
  1006. .num_modes = 1,
  1007. .bpc = 8,
  1008. .size = {
  1009. .width = 95,
  1010. .height = 54,
  1011. },
  1012. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1013. .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
  1014. };
  1015. static const struct display_timing okaya_rs800480t_7x0gp_timing = {
  1016. .pixelclock = { 30000000, 30000000, 40000000 },
  1017. .hactive = { 800, 800, 800 },
  1018. .hfront_porch = { 40, 40, 40 },
  1019. .hback_porch = { 40, 40, 40 },
  1020. .hsync_len = { 1, 48, 48 },
  1021. .vactive = { 480, 480, 480 },
  1022. .vfront_porch = { 13, 13, 13 },
  1023. .vback_porch = { 29, 29, 29 },
  1024. .vsync_len = { 3, 3, 3 },
  1025. .flags = DISPLAY_FLAGS_DE_HIGH,
  1026. };
  1027. static const struct panel_desc okaya_rs800480t_7x0gp = {
  1028. .timings = &okaya_rs800480t_7x0gp_timing,
  1029. .num_timings = 1,
  1030. .bpc = 6,
  1031. .size = {
  1032. .width = 154,
  1033. .height = 87,
  1034. },
  1035. .delay = {
  1036. .prepare = 41,
  1037. .enable = 50,
  1038. .unprepare = 41,
  1039. .disable = 50,
  1040. },
  1041. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1042. };
  1043. static const struct drm_display_mode olimex_lcd_olinuxino_43ts_mode = {
  1044. .clock = 9000,
  1045. .hdisplay = 480,
  1046. .hsync_start = 480 + 5,
  1047. .hsync_end = 480 + 5 + 30,
  1048. .htotal = 480 + 5 + 30 + 10,
  1049. .vdisplay = 272,
  1050. .vsync_start = 272 + 8,
  1051. .vsync_end = 272 + 8 + 5,
  1052. .vtotal = 272 + 8 + 5 + 3,
  1053. .vrefresh = 60,
  1054. };
  1055. static const struct panel_desc olimex_lcd_olinuxino_43ts = {
  1056. .modes = &olimex_lcd_olinuxino_43ts_mode,
  1057. .num_modes = 1,
  1058. .size = {
  1059. .width = 105,
  1060. .height = 67,
  1061. },
  1062. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1063. };
  1064. /*
  1065. * 800x480 CVT. The panel appears to be quite accepting, at least as far as
  1066. * pixel clocks, but this is the timing that was being used in the Adafruit
  1067. * installation instructions.
  1068. */
  1069. static const struct drm_display_mode ontat_yx700wv03_mode = {
  1070. .clock = 29500,
  1071. .hdisplay = 800,
  1072. .hsync_start = 824,
  1073. .hsync_end = 896,
  1074. .htotal = 992,
  1075. .vdisplay = 480,
  1076. .vsync_start = 483,
  1077. .vsync_end = 493,
  1078. .vtotal = 500,
  1079. .vrefresh = 60,
  1080. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1081. };
  1082. /*
  1083. * Specification at:
  1084. * https://www.adafruit.com/images/product-files/2406/c3163.pdf
  1085. */
  1086. static const struct panel_desc ontat_yx700wv03 = {
  1087. .modes = &ontat_yx700wv03_mode,
  1088. .num_modes = 1,
  1089. .bpc = 8,
  1090. .size = {
  1091. .width = 154,
  1092. .height = 83,
  1093. },
  1094. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1095. };
  1096. static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
  1097. .clock = 25000,
  1098. .hdisplay = 480,
  1099. .hsync_start = 480 + 10,
  1100. .hsync_end = 480 + 10 + 10,
  1101. .htotal = 480 + 10 + 10 + 15,
  1102. .vdisplay = 800,
  1103. .vsync_start = 800 + 3,
  1104. .vsync_end = 800 + 3 + 3,
  1105. .vtotal = 800 + 3 + 3 + 3,
  1106. .vrefresh = 60,
  1107. };
  1108. static const struct panel_desc ortustech_com43h4m85ulc = {
  1109. .modes = &ortustech_com43h4m85ulc_mode,
  1110. .num_modes = 1,
  1111. .bpc = 8,
  1112. .size = {
  1113. .width = 56,
  1114. .height = 93,
  1115. },
  1116. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1117. .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE,
  1118. };
  1119. static const struct drm_display_mode qd43003c0_40_mode = {
  1120. .clock = 9000,
  1121. .hdisplay = 480,
  1122. .hsync_start = 480 + 8,
  1123. .hsync_end = 480 + 8 + 4,
  1124. .htotal = 480 + 8 + 4 + 39,
  1125. .vdisplay = 272,
  1126. .vsync_start = 272 + 4,
  1127. .vsync_end = 272 + 4 + 10,
  1128. .vtotal = 272 + 4 + 10 + 2,
  1129. .vrefresh = 60,
  1130. };
  1131. static const struct panel_desc qd43003c0_40 = {
  1132. .modes = &qd43003c0_40_mode,
  1133. .num_modes = 1,
  1134. .bpc = 8,
  1135. .size = {
  1136. .width = 95,
  1137. .height = 53,
  1138. },
  1139. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1140. };
  1141. static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
  1142. .clock = 271560,
  1143. .hdisplay = 2560,
  1144. .hsync_start = 2560 + 48,
  1145. .hsync_end = 2560 + 48 + 32,
  1146. .htotal = 2560 + 48 + 32 + 80,
  1147. .vdisplay = 1600,
  1148. .vsync_start = 1600 + 2,
  1149. .vsync_end = 1600 + 2 + 5,
  1150. .vtotal = 1600 + 2 + 5 + 57,
  1151. .vrefresh = 60,
  1152. };
  1153. static const struct panel_desc samsung_lsn122dl01_c01 = {
  1154. .modes = &samsung_lsn122dl01_c01_mode,
  1155. .num_modes = 1,
  1156. .size = {
  1157. .width = 263,
  1158. .height = 164,
  1159. },
  1160. };
  1161. static const struct drm_display_mode samsung_ltn101nt05_mode = {
  1162. .clock = 54030,
  1163. .hdisplay = 1024,
  1164. .hsync_start = 1024 + 24,
  1165. .hsync_end = 1024 + 24 + 136,
  1166. .htotal = 1024 + 24 + 136 + 160,
  1167. .vdisplay = 600,
  1168. .vsync_start = 600 + 3,
  1169. .vsync_end = 600 + 3 + 6,
  1170. .vtotal = 600 + 3 + 6 + 61,
  1171. .vrefresh = 60,
  1172. };
  1173. static const struct panel_desc samsung_ltn101nt05 = {
  1174. .modes = &samsung_ltn101nt05_mode,
  1175. .num_modes = 1,
  1176. .bpc = 6,
  1177. .size = {
  1178. .width = 223,
  1179. .height = 125,
  1180. },
  1181. };
  1182. static const struct drm_display_mode samsung_ltn140at29_301_mode = {
  1183. .clock = 76300,
  1184. .hdisplay = 1366,
  1185. .hsync_start = 1366 + 64,
  1186. .hsync_end = 1366 + 64 + 48,
  1187. .htotal = 1366 + 64 + 48 + 128,
  1188. .vdisplay = 768,
  1189. .vsync_start = 768 + 2,
  1190. .vsync_end = 768 + 2 + 5,
  1191. .vtotal = 768 + 2 + 5 + 17,
  1192. .vrefresh = 60,
  1193. };
  1194. static const struct panel_desc samsung_ltn140at29_301 = {
  1195. .modes = &samsung_ltn140at29_301_mode,
  1196. .num_modes = 1,
  1197. .bpc = 6,
  1198. .size = {
  1199. .width = 320,
  1200. .height = 187,
  1201. },
  1202. };
  1203. static const struct display_timing sharp_lq101k1ly04_timing = {
  1204. .pixelclock = { 60000000, 65000000, 80000000 },
  1205. .hactive = { 1280, 1280, 1280 },
  1206. .hfront_porch = { 20, 20, 20 },
  1207. .hback_porch = { 20, 20, 20 },
  1208. .hsync_len = { 10, 10, 10 },
  1209. .vactive = { 800, 800, 800 },
  1210. .vfront_porch = { 4, 4, 4 },
  1211. .vback_porch = { 4, 4, 4 },
  1212. .vsync_len = { 4, 4, 4 },
  1213. .flags = DISPLAY_FLAGS_PIXDATA_POSEDGE,
  1214. };
  1215. static const struct panel_desc sharp_lq101k1ly04 = {
  1216. .timings = &sharp_lq101k1ly04_timing,
  1217. .num_timings = 1,
  1218. .bpc = 8,
  1219. .size = {
  1220. .width = 217,
  1221. .height = 136,
  1222. },
  1223. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
  1224. };
  1225. static const struct drm_display_mode sharp_lq123p1jx31_mode = {
  1226. .clock = 252750,
  1227. .hdisplay = 2400,
  1228. .hsync_start = 2400 + 48,
  1229. .hsync_end = 2400 + 48 + 32,
  1230. .htotal = 2400 + 48 + 32 + 80,
  1231. .vdisplay = 1600,
  1232. .vsync_start = 1600 + 3,
  1233. .vsync_end = 1600 + 3 + 10,
  1234. .vtotal = 1600 + 3 + 10 + 33,
  1235. .vrefresh = 60,
  1236. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1237. };
  1238. static const struct panel_desc sharp_lq123p1jx31 = {
  1239. .modes = &sharp_lq123p1jx31_mode,
  1240. .num_modes = 1,
  1241. .size = {
  1242. .width = 259,
  1243. .height = 173,
  1244. },
  1245. .delay = {
  1246. .prepare = 110,
  1247. .enable = 50,
  1248. .unprepare = 550,
  1249. },
  1250. };
  1251. static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
  1252. .clock = 33300,
  1253. .hdisplay = 800,
  1254. .hsync_start = 800 + 1,
  1255. .hsync_end = 800 + 1 + 64,
  1256. .htotal = 800 + 1 + 64 + 64,
  1257. .vdisplay = 480,
  1258. .vsync_start = 480 + 1,
  1259. .vsync_end = 480 + 1 + 23,
  1260. .vtotal = 480 + 1 + 23 + 22,
  1261. .vrefresh = 60,
  1262. };
  1263. static const struct panel_desc shelly_sca07010_bfn_lnn = {
  1264. .modes = &shelly_sca07010_bfn_lnn_mode,
  1265. .num_modes = 1,
  1266. .size = {
  1267. .width = 152,
  1268. .height = 91,
  1269. },
  1270. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1271. };
  1272. static const struct drm_display_mode starry_kr122ea0sra_mode = {
  1273. .clock = 147000,
  1274. .hdisplay = 1920,
  1275. .hsync_start = 1920 + 16,
  1276. .hsync_end = 1920 + 16 + 16,
  1277. .htotal = 1920 + 16 + 16 + 32,
  1278. .vdisplay = 1200,
  1279. .vsync_start = 1200 + 15,
  1280. .vsync_end = 1200 + 15 + 2,
  1281. .vtotal = 1200 + 15 + 2 + 18,
  1282. .vrefresh = 60,
  1283. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1284. };
  1285. static const struct panel_desc starry_kr122ea0sra = {
  1286. .modes = &starry_kr122ea0sra_mode,
  1287. .num_modes = 1,
  1288. .size = {
  1289. .width = 263,
  1290. .height = 164,
  1291. },
  1292. };
  1293. static const struct drm_display_mode tpk_f07a_0102_mode = {
  1294. .clock = 33260,
  1295. .hdisplay = 800,
  1296. .hsync_start = 800 + 40,
  1297. .hsync_end = 800 + 40 + 128,
  1298. .htotal = 800 + 40 + 128 + 88,
  1299. .vdisplay = 480,
  1300. .vsync_start = 480 + 10,
  1301. .vsync_end = 480 + 10 + 2,
  1302. .vtotal = 480 + 10 + 2 + 33,
  1303. .vrefresh = 60,
  1304. };
  1305. static const struct panel_desc tpk_f07a_0102 = {
  1306. .modes = &tpk_f07a_0102_mode,
  1307. .num_modes = 1,
  1308. .size = {
  1309. .width = 152,
  1310. .height = 91,
  1311. },
  1312. .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
  1313. };
  1314. static const struct drm_display_mode tpk_f10a_0102_mode = {
  1315. .clock = 45000,
  1316. .hdisplay = 1024,
  1317. .hsync_start = 1024 + 176,
  1318. .hsync_end = 1024 + 176 + 5,
  1319. .htotal = 1024 + 176 + 5 + 88,
  1320. .vdisplay = 600,
  1321. .vsync_start = 600 + 20,
  1322. .vsync_end = 600 + 20 + 5,
  1323. .vtotal = 600 + 20 + 5 + 25,
  1324. .vrefresh = 60,
  1325. };
  1326. static const struct panel_desc tpk_f10a_0102 = {
  1327. .modes = &tpk_f10a_0102_mode,
  1328. .num_modes = 1,
  1329. .size = {
  1330. .width = 223,
  1331. .height = 125,
  1332. },
  1333. };
  1334. static const struct display_timing urt_umsh_8596md_timing = {
  1335. .pixelclock = { 33260000, 33260000, 33260000 },
  1336. .hactive = { 800, 800, 800 },
  1337. .hfront_porch = { 41, 41, 41 },
  1338. .hback_porch = { 216 - 128, 216 - 128, 216 - 128 },
  1339. .hsync_len = { 71, 128, 128 },
  1340. .vactive = { 480, 480, 480 },
  1341. .vfront_porch = { 10, 10, 10 },
  1342. .vback_porch = { 35 - 2, 35 - 2, 35 - 2 },
  1343. .vsync_len = { 2, 2, 2 },
  1344. .flags = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
  1345. DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
  1346. };
  1347. static const struct panel_desc urt_umsh_8596md_lvds = {
  1348. .timings = &urt_umsh_8596md_timing,
  1349. .num_timings = 1,
  1350. .bpc = 6,
  1351. .size = {
  1352. .width = 152,
  1353. .height = 91,
  1354. },
  1355. .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
  1356. };
  1357. static const struct panel_desc urt_umsh_8596md_parallel = {
  1358. .timings = &urt_umsh_8596md_timing,
  1359. .num_timings = 1,
  1360. .bpc = 6,
  1361. .size = {
  1362. .width = 152,
  1363. .height = 91,
  1364. },
  1365. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1366. };
  1367. static const struct of_device_id platform_of_match[] = {
  1368. {
  1369. .compatible = "ampire,am800480r3tmqwa1h",
  1370. .data = &ampire_am800480r3tmqwa1h,
  1371. }, {
  1372. .compatible = "auo,b101aw03",
  1373. .data = &auo_b101aw03,
  1374. }, {
  1375. .compatible = "auo,b101ean01",
  1376. .data = &auo_b101ean01,
  1377. }, {
  1378. .compatible = "auo,b101xtn01",
  1379. .data = &auo_b101xtn01,
  1380. }, {
  1381. .compatible = "auo,b116xw03",
  1382. .data = &auo_b116xw03,
  1383. }, {
  1384. .compatible = "auo,b133htn01",
  1385. .data = &auo_b133htn01,
  1386. }, {
  1387. .compatible = "auo,b133xtn01",
  1388. .data = &auo_b133xtn01,
  1389. }, {
  1390. .compatible = "avic,tm070ddh03",
  1391. .data = &avic_tm070ddh03,
  1392. }, {
  1393. .compatible = "chunghwa,claa101wa01a",
  1394. .data = &chunghwa_claa101wa01a
  1395. }, {
  1396. .compatible = "chunghwa,claa101wb01",
  1397. .data = &chunghwa_claa101wb01
  1398. }, {
  1399. .compatible = "edt,et057090dhu",
  1400. .data = &edt_et057090dhu,
  1401. }, {
  1402. .compatible = "edt,et070080dh6",
  1403. .data = &edt_etm0700g0dh6,
  1404. }, {
  1405. .compatible = "edt,etm0700g0dh6",
  1406. .data = &edt_etm0700g0dh6,
  1407. }, {
  1408. .compatible = "foxlink,fl500wvr00-a0t",
  1409. .data = &foxlink_fl500wvr00_a0t,
  1410. }, {
  1411. .compatible = "giantplus,gpg482739qs5",
  1412. .data = &giantplus_gpg482739qs5
  1413. }, {
  1414. .compatible = "hannstar,hsd070pww1",
  1415. .data = &hannstar_hsd070pww1,
  1416. }, {
  1417. .compatible = "hannstar,hsd100pxn1",
  1418. .data = &hannstar_hsd100pxn1,
  1419. }, {
  1420. .compatible = "hit,tx23d38vm0caa",
  1421. .data = &hitachi_tx23d38vm0caa
  1422. }, {
  1423. .compatible = "innolux,at043tn24",
  1424. .data = &innolux_at043tn24,
  1425. }, {
  1426. .compatible = "innolux,at070tn92",
  1427. .data = &innolux_at070tn92,
  1428. }, {
  1429. .compatible ="innolux,g101ice-l01",
  1430. .data = &innolux_g101ice_l01
  1431. }, {
  1432. .compatible ="innolux,g121i1-l01",
  1433. .data = &innolux_g121i1_l01
  1434. }, {
  1435. .compatible = "innolux,g121x1-l03",
  1436. .data = &innolux_g121x1_l03,
  1437. }, {
  1438. .compatible = "innolux,n116bge",
  1439. .data = &innolux_n116bge,
  1440. }, {
  1441. .compatible = "innolux,n156bge-l21",
  1442. .data = &innolux_n156bge_l21,
  1443. }, {
  1444. .compatible = "innolux,zj070na-01p",
  1445. .data = &innolux_zj070na_01p,
  1446. }, {
  1447. .compatible = "kyo,tcg121xglp",
  1448. .data = &kyo_tcg121xglp,
  1449. }, {
  1450. .compatible = "lg,lb070wv8",
  1451. .data = &lg_lb070wv8,
  1452. }, {
  1453. .compatible = "lg,lp079qx1-sp0v",
  1454. .data = &lg_lp079qx1_sp0v,
  1455. }, {
  1456. .compatible = "lg,lp097qx1-spa1",
  1457. .data = &lg_lp097qx1_spa1,
  1458. }, {
  1459. .compatible = "lg,lp120up1",
  1460. .data = &lg_lp120up1,
  1461. }, {
  1462. .compatible = "lg,lp129qe",
  1463. .data = &lg_lp129qe,
  1464. }, {
  1465. .compatible = "nec,nl4827hc19-05b",
  1466. .data = &nec_nl4827hc19_05b,
  1467. }, {
  1468. .compatible = "okaya,rs800480t-7x0gp",
  1469. .data = &okaya_rs800480t_7x0gp,
  1470. }, {
  1471. .compatible = "olimex,lcd-olinuxino-43-ts",
  1472. .data = &olimex_lcd_olinuxino_43ts,
  1473. }, {
  1474. .compatible = "ontat,yx700wv03",
  1475. .data = &ontat_yx700wv03,
  1476. }, {
  1477. .compatible = "ortustech,com43h4m85ulc",
  1478. .data = &ortustech_com43h4m85ulc,
  1479. }, {
  1480. .compatible = "qiaodian,qd43003c0-40",
  1481. .data = &qd43003c0_40,
  1482. }, {
  1483. .compatible = "samsung,lsn122dl01-c01",
  1484. .data = &samsung_lsn122dl01_c01,
  1485. }, {
  1486. .compatible = "samsung,ltn101nt05",
  1487. .data = &samsung_ltn101nt05,
  1488. }, {
  1489. .compatible = "samsung,ltn140at29-301",
  1490. .data = &samsung_ltn140at29_301,
  1491. }, {
  1492. .compatible = "sharp,lq101k1ly04",
  1493. .data = &sharp_lq101k1ly04,
  1494. }, {
  1495. .compatible = "sharp,lq123p1jx31",
  1496. .data = &sharp_lq123p1jx31,
  1497. }, {
  1498. .compatible = "shelly,sca07010-bfn-lnn",
  1499. .data = &shelly_sca07010_bfn_lnn,
  1500. }, {
  1501. .compatible = "starry,kr122ea0sra",
  1502. .data = &starry_kr122ea0sra,
  1503. }, {
  1504. .compatible = "tpk,f07a-0102",
  1505. .data = &tpk_f07a_0102,
  1506. }, {
  1507. .compatible = "tpk,f10a-0102",
  1508. .data = &tpk_f10a_0102,
  1509. }, {
  1510. .compatible = "urt,umsh-8596md-t",
  1511. .data = &urt_umsh_8596md_parallel,
  1512. }, {
  1513. .compatible = "urt,umsh-8596md-1t",
  1514. .data = &urt_umsh_8596md_parallel,
  1515. }, {
  1516. .compatible = "urt,umsh-8596md-7t",
  1517. .data = &urt_umsh_8596md_parallel,
  1518. }, {
  1519. .compatible = "urt,umsh-8596md-11t",
  1520. .data = &urt_umsh_8596md_lvds,
  1521. }, {
  1522. .compatible = "urt,umsh-8596md-19t",
  1523. .data = &urt_umsh_8596md_lvds,
  1524. }, {
  1525. .compatible = "urt,umsh-8596md-20t",
  1526. .data = &urt_umsh_8596md_parallel,
  1527. }, {
  1528. /* sentinel */
  1529. }
  1530. };
  1531. MODULE_DEVICE_TABLE(of, platform_of_match);
  1532. static int panel_simple_platform_probe(struct platform_device *pdev)
  1533. {
  1534. const struct of_device_id *id;
  1535. id = of_match_node(platform_of_match, pdev->dev.of_node);
  1536. if (!id)
  1537. return -ENODEV;
  1538. return panel_simple_probe(&pdev->dev, id->data);
  1539. }
  1540. static int panel_simple_platform_remove(struct platform_device *pdev)
  1541. {
  1542. return panel_simple_remove(&pdev->dev);
  1543. }
  1544. static void panel_simple_platform_shutdown(struct platform_device *pdev)
  1545. {
  1546. panel_simple_shutdown(&pdev->dev);
  1547. }
  1548. static struct platform_driver panel_simple_platform_driver = {
  1549. .driver = {
  1550. .name = "panel-simple",
  1551. .of_match_table = platform_of_match,
  1552. },
  1553. .probe = panel_simple_platform_probe,
  1554. .remove = panel_simple_platform_remove,
  1555. .shutdown = panel_simple_platform_shutdown,
  1556. };
  1557. struct panel_desc_dsi {
  1558. struct panel_desc desc;
  1559. unsigned long flags;
  1560. enum mipi_dsi_pixel_format format;
  1561. unsigned int lanes;
  1562. };
  1563. static const struct drm_display_mode auo_b080uan01_mode = {
  1564. .clock = 154500,
  1565. .hdisplay = 1200,
  1566. .hsync_start = 1200 + 62,
  1567. .hsync_end = 1200 + 62 + 4,
  1568. .htotal = 1200 + 62 + 4 + 62,
  1569. .vdisplay = 1920,
  1570. .vsync_start = 1920 + 9,
  1571. .vsync_end = 1920 + 9 + 2,
  1572. .vtotal = 1920 + 9 + 2 + 8,
  1573. .vrefresh = 60,
  1574. };
  1575. static const struct panel_desc_dsi auo_b080uan01 = {
  1576. .desc = {
  1577. .modes = &auo_b080uan01_mode,
  1578. .num_modes = 1,
  1579. .bpc = 8,
  1580. .size = {
  1581. .width = 108,
  1582. .height = 272,
  1583. },
  1584. },
  1585. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1586. .format = MIPI_DSI_FMT_RGB888,
  1587. .lanes = 4,
  1588. };
  1589. static const struct drm_display_mode boe_tv080wum_nl0_mode = {
  1590. .clock = 160000,
  1591. .hdisplay = 1200,
  1592. .hsync_start = 1200 + 120,
  1593. .hsync_end = 1200 + 120 + 20,
  1594. .htotal = 1200 + 120 + 20 + 21,
  1595. .vdisplay = 1920,
  1596. .vsync_start = 1920 + 21,
  1597. .vsync_end = 1920 + 21 + 3,
  1598. .vtotal = 1920 + 21 + 3 + 18,
  1599. .vrefresh = 60,
  1600. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1601. };
  1602. static const struct panel_desc_dsi boe_tv080wum_nl0 = {
  1603. .desc = {
  1604. .modes = &boe_tv080wum_nl0_mode,
  1605. .num_modes = 1,
  1606. .size = {
  1607. .width = 107,
  1608. .height = 172,
  1609. },
  1610. },
  1611. .flags = MIPI_DSI_MODE_VIDEO |
  1612. MIPI_DSI_MODE_VIDEO_BURST |
  1613. MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
  1614. .format = MIPI_DSI_FMT_RGB888,
  1615. .lanes = 4,
  1616. };
  1617. static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
  1618. .clock = 71000,
  1619. .hdisplay = 800,
  1620. .hsync_start = 800 + 32,
  1621. .hsync_end = 800 + 32 + 1,
  1622. .htotal = 800 + 32 + 1 + 57,
  1623. .vdisplay = 1280,
  1624. .vsync_start = 1280 + 28,
  1625. .vsync_end = 1280 + 28 + 1,
  1626. .vtotal = 1280 + 28 + 1 + 14,
  1627. .vrefresh = 60,
  1628. };
  1629. static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
  1630. .desc = {
  1631. .modes = &lg_ld070wx3_sl01_mode,
  1632. .num_modes = 1,
  1633. .bpc = 8,
  1634. .size = {
  1635. .width = 94,
  1636. .height = 151,
  1637. },
  1638. },
  1639. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1640. .format = MIPI_DSI_FMT_RGB888,
  1641. .lanes = 4,
  1642. };
  1643. static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
  1644. .clock = 67000,
  1645. .hdisplay = 720,
  1646. .hsync_start = 720 + 12,
  1647. .hsync_end = 720 + 12 + 4,
  1648. .htotal = 720 + 12 + 4 + 112,
  1649. .vdisplay = 1280,
  1650. .vsync_start = 1280 + 8,
  1651. .vsync_end = 1280 + 8 + 4,
  1652. .vtotal = 1280 + 8 + 4 + 12,
  1653. .vrefresh = 60,
  1654. };
  1655. static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
  1656. .desc = {
  1657. .modes = &lg_lh500wx1_sd03_mode,
  1658. .num_modes = 1,
  1659. .bpc = 8,
  1660. .size = {
  1661. .width = 62,
  1662. .height = 110,
  1663. },
  1664. },
  1665. .flags = MIPI_DSI_MODE_VIDEO,
  1666. .format = MIPI_DSI_FMT_RGB888,
  1667. .lanes = 4,
  1668. };
  1669. static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
  1670. .clock = 157200,
  1671. .hdisplay = 1920,
  1672. .hsync_start = 1920 + 154,
  1673. .hsync_end = 1920 + 154 + 16,
  1674. .htotal = 1920 + 154 + 16 + 32,
  1675. .vdisplay = 1200,
  1676. .vsync_start = 1200 + 17,
  1677. .vsync_end = 1200 + 17 + 2,
  1678. .vtotal = 1200 + 17 + 2 + 16,
  1679. .vrefresh = 60,
  1680. };
  1681. static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
  1682. .desc = {
  1683. .modes = &panasonic_vvx10f004b00_mode,
  1684. .num_modes = 1,
  1685. .bpc = 8,
  1686. .size = {
  1687. .width = 217,
  1688. .height = 136,
  1689. },
  1690. },
  1691. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
  1692. MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1693. .format = MIPI_DSI_FMT_RGB888,
  1694. .lanes = 4,
  1695. };
  1696. static const struct of_device_id dsi_of_match[] = {
  1697. {
  1698. .compatible = "auo,b080uan01",
  1699. .data = &auo_b080uan01
  1700. }, {
  1701. .compatible = "boe,tv080wum-nl0",
  1702. .data = &boe_tv080wum_nl0
  1703. }, {
  1704. .compatible = "lg,ld070wx3-sl01",
  1705. .data = &lg_ld070wx3_sl01
  1706. }, {
  1707. .compatible = "lg,lh500wx1-sd03",
  1708. .data = &lg_lh500wx1_sd03
  1709. }, {
  1710. .compatible = "panasonic,vvx10f004b00",
  1711. .data = &panasonic_vvx10f004b00
  1712. }, {
  1713. /* sentinel */
  1714. }
  1715. };
  1716. MODULE_DEVICE_TABLE(of, dsi_of_match);
  1717. static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
  1718. {
  1719. const struct panel_desc_dsi *desc;
  1720. const struct of_device_id *id;
  1721. int err;
  1722. id = of_match_node(dsi_of_match, dsi->dev.of_node);
  1723. if (!id)
  1724. return -ENODEV;
  1725. desc = id->data;
  1726. err = panel_simple_probe(&dsi->dev, &desc->desc);
  1727. if (err < 0)
  1728. return err;
  1729. dsi->mode_flags = desc->flags;
  1730. dsi->format = desc->format;
  1731. dsi->lanes = desc->lanes;
  1732. return mipi_dsi_attach(dsi);
  1733. }
  1734. static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
  1735. {
  1736. int err;
  1737. err = mipi_dsi_detach(dsi);
  1738. if (err < 0)
  1739. dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
  1740. return panel_simple_remove(&dsi->dev);
  1741. }
  1742. static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
  1743. {
  1744. panel_simple_shutdown(&dsi->dev);
  1745. }
  1746. static struct mipi_dsi_driver panel_simple_dsi_driver = {
  1747. .driver = {
  1748. .name = "panel-simple-dsi",
  1749. .of_match_table = dsi_of_match,
  1750. },
  1751. .probe = panel_simple_dsi_probe,
  1752. .remove = panel_simple_dsi_remove,
  1753. .shutdown = panel_simple_dsi_shutdown,
  1754. };
  1755. static int __init panel_simple_init(void)
  1756. {
  1757. int err;
  1758. err = platform_driver_register(&panel_simple_platform_driver);
  1759. if (err < 0)
  1760. return err;
  1761. if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
  1762. err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
  1763. if (err < 0)
  1764. return err;
  1765. }
  1766. return 0;
  1767. }
  1768. module_init(panel_simple_init);
  1769. static void __exit panel_simple_exit(void)
  1770. {
  1771. if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
  1772. mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
  1773. platform_driver_unregister(&panel_simple_platform_driver);
  1774. }
  1775. module_exit(panel_simple_exit);
  1776. MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
  1777. MODULE_DESCRIPTION("DRM Driver for Simple Panels");
  1778. MODULE_LICENSE("GPL and additional rights");