panel-simple.c 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113
  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 auo_t215hvn01_mode = {
  457. .clock = 148800,
  458. .hdisplay = 1920,
  459. .hsync_start = 1920 + 88,
  460. .hsync_end = 1920 + 88 + 44,
  461. .htotal = 1920 + 88 + 44 + 148,
  462. .vdisplay = 1080,
  463. .vsync_start = 1080 + 4,
  464. .vsync_end = 1080 + 4 + 5,
  465. .vtotal = 1080 + 4 + 5 + 36,
  466. .vrefresh = 60,
  467. };
  468. static const struct panel_desc auo_t215hvn01 = {
  469. .modes = &auo_t215hvn01_mode,
  470. .num_modes = 1,
  471. .bpc = 8,
  472. .size = {
  473. .width = 430,
  474. .height = 270,
  475. },
  476. .delay = {
  477. .disable = 5,
  478. .unprepare = 1000,
  479. }
  480. };
  481. static const struct drm_display_mode avic_tm070ddh03_mode = {
  482. .clock = 51200,
  483. .hdisplay = 1024,
  484. .hsync_start = 1024 + 160,
  485. .hsync_end = 1024 + 160 + 4,
  486. .htotal = 1024 + 160 + 4 + 156,
  487. .vdisplay = 600,
  488. .vsync_start = 600 + 17,
  489. .vsync_end = 600 + 17 + 1,
  490. .vtotal = 600 + 17 + 1 + 17,
  491. .vrefresh = 60,
  492. };
  493. static const struct panel_desc avic_tm070ddh03 = {
  494. .modes = &avic_tm070ddh03_mode,
  495. .num_modes = 1,
  496. .bpc = 8,
  497. .size = {
  498. .width = 154,
  499. .height = 90,
  500. },
  501. .delay = {
  502. .prepare = 20,
  503. .enable = 200,
  504. .disable = 200,
  505. },
  506. };
  507. static const struct drm_display_mode chunghwa_claa070wp03xg_mode = {
  508. .clock = 66770,
  509. .hdisplay = 800,
  510. .hsync_start = 800 + 49,
  511. .hsync_end = 800 + 49 + 33,
  512. .htotal = 800 + 49 + 33 + 17,
  513. .vdisplay = 1280,
  514. .vsync_start = 1280 + 1,
  515. .vsync_end = 1280 + 1 + 7,
  516. .vtotal = 1280 + 1 + 7 + 15,
  517. .vrefresh = 60,
  518. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  519. };
  520. static const struct panel_desc chunghwa_claa070wp03xg = {
  521. .modes = &chunghwa_claa070wp03xg_mode,
  522. .num_modes = 1,
  523. .bpc = 6,
  524. .size = {
  525. .width = 94,
  526. .height = 150,
  527. },
  528. };
  529. static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
  530. .clock = 72070,
  531. .hdisplay = 1366,
  532. .hsync_start = 1366 + 58,
  533. .hsync_end = 1366 + 58 + 58,
  534. .htotal = 1366 + 58 + 58 + 58,
  535. .vdisplay = 768,
  536. .vsync_start = 768 + 4,
  537. .vsync_end = 768 + 4 + 4,
  538. .vtotal = 768 + 4 + 4 + 4,
  539. .vrefresh = 60,
  540. };
  541. static const struct panel_desc chunghwa_claa101wa01a = {
  542. .modes = &chunghwa_claa101wa01a_mode,
  543. .num_modes = 1,
  544. .bpc = 6,
  545. .size = {
  546. .width = 220,
  547. .height = 120,
  548. },
  549. };
  550. static const struct drm_display_mode chunghwa_claa101wb01_mode = {
  551. .clock = 69300,
  552. .hdisplay = 1366,
  553. .hsync_start = 1366 + 48,
  554. .hsync_end = 1366 + 48 + 32,
  555. .htotal = 1366 + 48 + 32 + 20,
  556. .vdisplay = 768,
  557. .vsync_start = 768 + 16,
  558. .vsync_end = 768 + 16 + 8,
  559. .vtotal = 768 + 16 + 8 + 16,
  560. .vrefresh = 60,
  561. };
  562. static const struct panel_desc chunghwa_claa101wb01 = {
  563. .modes = &chunghwa_claa101wb01_mode,
  564. .num_modes = 1,
  565. .bpc = 6,
  566. .size = {
  567. .width = 223,
  568. .height = 125,
  569. },
  570. };
  571. static const struct drm_display_mode edt_et057090dhu_mode = {
  572. .clock = 25175,
  573. .hdisplay = 640,
  574. .hsync_start = 640 + 16,
  575. .hsync_end = 640 + 16 + 30,
  576. .htotal = 640 + 16 + 30 + 114,
  577. .vdisplay = 480,
  578. .vsync_start = 480 + 10,
  579. .vsync_end = 480 + 10 + 3,
  580. .vtotal = 480 + 10 + 3 + 32,
  581. .vrefresh = 60,
  582. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  583. };
  584. static const struct panel_desc edt_et057090dhu = {
  585. .modes = &edt_et057090dhu_mode,
  586. .num_modes = 1,
  587. .bpc = 6,
  588. .size = {
  589. .width = 115,
  590. .height = 86,
  591. },
  592. };
  593. static const struct drm_display_mode edt_etm0700g0dh6_mode = {
  594. .clock = 33260,
  595. .hdisplay = 800,
  596. .hsync_start = 800 + 40,
  597. .hsync_end = 800 + 40 + 128,
  598. .htotal = 800 + 40 + 128 + 88,
  599. .vdisplay = 480,
  600. .vsync_start = 480 + 10,
  601. .vsync_end = 480 + 10 + 2,
  602. .vtotal = 480 + 10 + 2 + 33,
  603. .vrefresh = 60,
  604. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  605. };
  606. static const struct panel_desc edt_etm0700g0dh6 = {
  607. .modes = &edt_etm0700g0dh6_mode,
  608. .num_modes = 1,
  609. .bpc = 6,
  610. .size = {
  611. .width = 152,
  612. .height = 91,
  613. },
  614. };
  615. static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
  616. .clock = 32260,
  617. .hdisplay = 800,
  618. .hsync_start = 800 + 168,
  619. .hsync_end = 800 + 168 + 64,
  620. .htotal = 800 + 168 + 64 + 88,
  621. .vdisplay = 480,
  622. .vsync_start = 480 + 37,
  623. .vsync_end = 480 + 37 + 2,
  624. .vtotal = 480 + 37 + 2 + 8,
  625. .vrefresh = 60,
  626. };
  627. static const struct panel_desc foxlink_fl500wvr00_a0t = {
  628. .modes = &foxlink_fl500wvr00_a0t_mode,
  629. .num_modes = 1,
  630. .bpc = 8,
  631. .size = {
  632. .width = 108,
  633. .height = 65,
  634. },
  635. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  636. };
  637. static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
  638. .clock = 9000,
  639. .hdisplay = 480,
  640. .hsync_start = 480 + 5,
  641. .hsync_end = 480 + 5 + 1,
  642. .htotal = 480 + 5 + 1 + 40,
  643. .vdisplay = 272,
  644. .vsync_start = 272 + 8,
  645. .vsync_end = 272 + 8 + 1,
  646. .vtotal = 272 + 8 + 1 + 8,
  647. .vrefresh = 60,
  648. };
  649. static const struct panel_desc giantplus_gpg482739qs5 = {
  650. .modes = &giantplus_gpg482739qs5_mode,
  651. .num_modes = 1,
  652. .bpc = 8,
  653. .size = {
  654. .width = 95,
  655. .height = 54,
  656. },
  657. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  658. };
  659. static const struct display_timing hannstar_hsd070pww1_timing = {
  660. .pixelclock = { 64300000, 71100000, 82000000 },
  661. .hactive = { 1280, 1280, 1280 },
  662. .hfront_porch = { 1, 1, 10 },
  663. .hback_porch = { 1, 1, 10 },
  664. /*
  665. * According to the data sheet, the minimum horizontal blanking interval
  666. * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
  667. * minimum working horizontal blanking interval to be 60 clocks.
  668. */
  669. .hsync_len = { 58, 158, 661 },
  670. .vactive = { 800, 800, 800 },
  671. .vfront_porch = { 1, 1, 10 },
  672. .vback_porch = { 1, 1, 10 },
  673. .vsync_len = { 1, 21, 203 },
  674. .flags = DISPLAY_FLAGS_DE_HIGH,
  675. };
  676. static const struct panel_desc hannstar_hsd070pww1 = {
  677. .timings = &hannstar_hsd070pww1_timing,
  678. .num_timings = 1,
  679. .bpc = 6,
  680. .size = {
  681. .width = 151,
  682. .height = 94,
  683. },
  684. .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
  685. };
  686. static const struct display_timing hannstar_hsd100pxn1_timing = {
  687. .pixelclock = { 55000000, 65000000, 75000000 },
  688. .hactive = { 1024, 1024, 1024 },
  689. .hfront_porch = { 40, 40, 40 },
  690. .hback_porch = { 220, 220, 220 },
  691. .hsync_len = { 20, 60, 100 },
  692. .vactive = { 768, 768, 768 },
  693. .vfront_porch = { 7, 7, 7 },
  694. .vback_porch = { 21, 21, 21 },
  695. .vsync_len = { 10, 10, 10 },
  696. .flags = DISPLAY_FLAGS_DE_HIGH,
  697. };
  698. static const struct panel_desc hannstar_hsd100pxn1 = {
  699. .timings = &hannstar_hsd100pxn1_timing,
  700. .num_timings = 1,
  701. .bpc = 6,
  702. .size = {
  703. .width = 203,
  704. .height = 152,
  705. },
  706. .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
  707. };
  708. static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
  709. .clock = 33333,
  710. .hdisplay = 800,
  711. .hsync_start = 800 + 85,
  712. .hsync_end = 800 + 85 + 86,
  713. .htotal = 800 + 85 + 86 + 85,
  714. .vdisplay = 480,
  715. .vsync_start = 480 + 16,
  716. .vsync_end = 480 + 16 + 13,
  717. .vtotal = 480 + 16 + 13 + 16,
  718. .vrefresh = 60,
  719. };
  720. static const struct panel_desc hitachi_tx23d38vm0caa = {
  721. .modes = &hitachi_tx23d38vm0caa_mode,
  722. .num_modes = 1,
  723. .bpc = 6,
  724. .size = {
  725. .width = 195,
  726. .height = 117,
  727. },
  728. };
  729. static const struct drm_display_mode innolux_at043tn24_mode = {
  730. .clock = 9000,
  731. .hdisplay = 480,
  732. .hsync_start = 480 + 2,
  733. .hsync_end = 480 + 2 + 41,
  734. .htotal = 480 + 2 + 41 + 2,
  735. .vdisplay = 272,
  736. .vsync_start = 272 + 2,
  737. .vsync_end = 272 + 2 + 11,
  738. .vtotal = 272 + 2 + 11 + 2,
  739. .vrefresh = 60,
  740. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  741. };
  742. static const struct panel_desc innolux_at043tn24 = {
  743. .modes = &innolux_at043tn24_mode,
  744. .num_modes = 1,
  745. .bpc = 8,
  746. .size = {
  747. .width = 95,
  748. .height = 54,
  749. },
  750. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  751. };
  752. static const struct drm_display_mode innolux_at070tn92_mode = {
  753. .clock = 33333,
  754. .hdisplay = 800,
  755. .hsync_start = 800 + 210,
  756. .hsync_end = 800 + 210 + 20,
  757. .htotal = 800 + 210 + 20 + 46,
  758. .vdisplay = 480,
  759. .vsync_start = 480 + 22,
  760. .vsync_end = 480 + 22 + 10,
  761. .vtotal = 480 + 22 + 23 + 10,
  762. .vrefresh = 60,
  763. };
  764. static const struct panel_desc innolux_at070tn92 = {
  765. .modes = &innolux_at070tn92_mode,
  766. .num_modes = 1,
  767. .size = {
  768. .width = 154,
  769. .height = 86,
  770. },
  771. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  772. };
  773. static const struct display_timing innolux_g101ice_l01_timing = {
  774. .pixelclock = { 60400000, 71100000, 74700000 },
  775. .hactive = { 1280, 1280, 1280 },
  776. .hfront_porch = { 41, 80, 100 },
  777. .hback_porch = { 40, 79, 99 },
  778. .hsync_len = { 1, 1, 1 },
  779. .vactive = { 800, 800, 800 },
  780. .vfront_porch = { 5, 11, 14 },
  781. .vback_porch = { 4, 11, 14 },
  782. .vsync_len = { 1, 1, 1 },
  783. .flags = DISPLAY_FLAGS_DE_HIGH,
  784. };
  785. static const struct panel_desc innolux_g101ice_l01 = {
  786. .timings = &innolux_g101ice_l01_timing,
  787. .num_timings = 1,
  788. .bpc = 8,
  789. .size = {
  790. .width = 217,
  791. .height = 135,
  792. },
  793. .delay = {
  794. .enable = 200,
  795. .disable = 200,
  796. },
  797. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  798. };
  799. static const struct drm_display_mode innolux_g121i1_l01_mode = {
  800. .clock = 71000,
  801. .hdisplay = 1280,
  802. .hsync_start = 1280 + 64,
  803. .hsync_end = 1280 + 64 + 32,
  804. .htotal = 1280 + 64 + 32 + 64,
  805. .vdisplay = 800,
  806. .vsync_start = 800 + 9,
  807. .vsync_end = 800 + 9 + 6,
  808. .vtotal = 800 + 9 + 6 + 9,
  809. .vrefresh = 60,
  810. };
  811. static const struct panel_desc innolux_g121i1_l01 = {
  812. .modes = &innolux_g121i1_l01_mode,
  813. .num_modes = 1,
  814. .bpc = 6,
  815. .size = {
  816. .width = 261,
  817. .height = 163,
  818. },
  819. };
  820. static const struct drm_display_mode innolux_g121x1_l03_mode = {
  821. .clock = 65000,
  822. .hdisplay = 1024,
  823. .hsync_start = 1024 + 0,
  824. .hsync_end = 1024 + 1,
  825. .htotal = 1024 + 0 + 1 + 320,
  826. .vdisplay = 768,
  827. .vsync_start = 768 + 38,
  828. .vsync_end = 768 + 38 + 1,
  829. .vtotal = 768 + 38 + 1 + 0,
  830. .vrefresh = 60,
  831. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  832. };
  833. static const struct panel_desc innolux_g121x1_l03 = {
  834. .modes = &innolux_g121x1_l03_mode,
  835. .num_modes = 1,
  836. .bpc = 6,
  837. .size = {
  838. .width = 246,
  839. .height = 185,
  840. },
  841. .delay = {
  842. .enable = 200,
  843. .unprepare = 200,
  844. .disable = 400,
  845. },
  846. };
  847. static const struct drm_display_mode innolux_n116bge_mode = {
  848. .clock = 76420,
  849. .hdisplay = 1366,
  850. .hsync_start = 1366 + 136,
  851. .hsync_end = 1366 + 136 + 30,
  852. .htotal = 1366 + 136 + 30 + 60,
  853. .vdisplay = 768,
  854. .vsync_start = 768 + 8,
  855. .vsync_end = 768 + 8 + 12,
  856. .vtotal = 768 + 8 + 12 + 12,
  857. .vrefresh = 60,
  858. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  859. };
  860. static const struct panel_desc innolux_n116bge = {
  861. .modes = &innolux_n116bge_mode,
  862. .num_modes = 1,
  863. .bpc = 6,
  864. .size = {
  865. .width = 256,
  866. .height = 144,
  867. },
  868. };
  869. static const struct drm_display_mode innolux_n156bge_l21_mode = {
  870. .clock = 69300,
  871. .hdisplay = 1366,
  872. .hsync_start = 1366 + 16,
  873. .hsync_end = 1366 + 16 + 34,
  874. .htotal = 1366 + 16 + 34 + 50,
  875. .vdisplay = 768,
  876. .vsync_start = 768 + 2,
  877. .vsync_end = 768 + 2 + 6,
  878. .vtotal = 768 + 2 + 6 + 12,
  879. .vrefresh = 60,
  880. };
  881. static const struct panel_desc innolux_n156bge_l21 = {
  882. .modes = &innolux_n156bge_l21_mode,
  883. .num_modes = 1,
  884. .bpc = 6,
  885. .size = {
  886. .width = 344,
  887. .height = 193,
  888. },
  889. };
  890. static const struct drm_display_mode innolux_zj070na_01p_mode = {
  891. .clock = 51501,
  892. .hdisplay = 1024,
  893. .hsync_start = 1024 + 128,
  894. .hsync_end = 1024 + 128 + 64,
  895. .htotal = 1024 + 128 + 64 + 128,
  896. .vdisplay = 600,
  897. .vsync_start = 600 + 16,
  898. .vsync_end = 600 + 16 + 4,
  899. .vtotal = 600 + 16 + 4 + 16,
  900. .vrefresh = 60,
  901. };
  902. static const struct panel_desc innolux_zj070na_01p = {
  903. .modes = &innolux_zj070na_01p_mode,
  904. .num_modes = 1,
  905. .bpc = 6,
  906. .size = {
  907. .width = 154,
  908. .height = 90,
  909. },
  910. };
  911. static const struct display_timing kyo_tcg121xglp_timing = {
  912. .pixelclock = { 52000000, 65000000, 71000000 },
  913. .hactive = { 1024, 1024, 1024 },
  914. .hfront_porch = { 2, 2, 2 },
  915. .hback_porch = { 2, 2, 2 },
  916. .hsync_len = { 86, 124, 244 },
  917. .vactive = { 768, 768, 768 },
  918. .vfront_porch = { 2, 2, 2 },
  919. .vback_porch = { 2, 2, 2 },
  920. .vsync_len = { 6, 34, 73 },
  921. .flags = DISPLAY_FLAGS_DE_HIGH,
  922. };
  923. static const struct panel_desc kyo_tcg121xglp = {
  924. .timings = &kyo_tcg121xglp_timing,
  925. .num_timings = 1,
  926. .bpc = 8,
  927. .size = {
  928. .width = 246,
  929. .height = 184,
  930. },
  931. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  932. };
  933. static const struct drm_display_mode lg_lb070wv8_mode = {
  934. .clock = 33246,
  935. .hdisplay = 800,
  936. .hsync_start = 800 + 88,
  937. .hsync_end = 800 + 88 + 80,
  938. .htotal = 800 + 88 + 80 + 88,
  939. .vdisplay = 480,
  940. .vsync_start = 480 + 10,
  941. .vsync_end = 480 + 10 + 25,
  942. .vtotal = 480 + 10 + 25 + 10,
  943. .vrefresh = 60,
  944. };
  945. static const struct panel_desc lg_lb070wv8 = {
  946. .modes = &lg_lb070wv8_mode,
  947. .num_modes = 1,
  948. .bpc = 16,
  949. .size = {
  950. .width = 151,
  951. .height = 91,
  952. },
  953. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  954. };
  955. static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
  956. .clock = 200000,
  957. .hdisplay = 1536,
  958. .hsync_start = 1536 + 12,
  959. .hsync_end = 1536 + 12 + 16,
  960. .htotal = 1536 + 12 + 16 + 48,
  961. .vdisplay = 2048,
  962. .vsync_start = 2048 + 8,
  963. .vsync_end = 2048 + 8 + 4,
  964. .vtotal = 2048 + 8 + 4 + 8,
  965. .vrefresh = 60,
  966. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  967. };
  968. static const struct panel_desc lg_lp079qx1_sp0v = {
  969. .modes = &lg_lp079qx1_sp0v_mode,
  970. .num_modes = 1,
  971. .size = {
  972. .width = 129,
  973. .height = 171,
  974. },
  975. };
  976. static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
  977. .clock = 205210,
  978. .hdisplay = 2048,
  979. .hsync_start = 2048 + 150,
  980. .hsync_end = 2048 + 150 + 5,
  981. .htotal = 2048 + 150 + 5 + 5,
  982. .vdisplay = 1536,
  983. .vsync_start = 1536 + 3,
  984. .vsync_end = 1536 + 3 + 1,
  985. .vtotal = 1536 + 3 + 1 + 9,
  986. .vrefresh = 60,
  987. };
  988. static const struct panel_desc lg_lp097qx1_spa1 = {
  989. .modes = &lg_lp097qx1_spa1_mode,
  990. .num_modes = 1,
  991. .size = {
  992. .width = 208,
  993. .height = 147,
  994. },
  995. };
  996. static const struct drm_display_mode lg_lp120up1_mode = {
  997. .clock = 162300,
  998. .hdisplay = 1920,
  999. .hsync_start = 1920 + 40,
  1000. .hsync_end = 1920 + 40 + 40,
  1001. .htotal = 1920 + 40 + 40+ 80,
  1002. .vdisplay = 1280,
  1003. .vsync_start = 1280 + 4,
  1004. .vsync_end = 1280 + 4 + 4,
  1005. .vtotal = 1280 + 4 + 4 + 12,
  1006. .vrefresh = 60,
  1007. };
  1008. static const struct panel_desc lg_lp120up1 = {
  1009. .modes = &lg_lp120up1_mode,
  1010. .num_modes = 1,
  1011. .bpc = 8,
  1012. .size = {
  1013. .width = 267,
  1014. .height = 183,
  1015. },
  1016. };
  1017. static const struct drm_display_mode lg_lp129qe_mode = {
  1018. .clock = 285250,
  1019. .hdisplay = 2560,
  1020. .hsync_start = 2560 + 48,
  1021. .hsync_end = 2560 + 48 + 32,
  1022. .htotal = 2560 + 48 + 32 + 80,
  1023. .vdisplay = 1700,
  1024. .vsync_start = 1700 + 3,
  1025. .vsync_end = 1700 + 3 + 10,
  1026. .vtotal = 1700 + 3 + 10 + 36,
  1027. .vrefresh = 60,
  1028. };
  1029. static const struct panel_desc lg_lp129qe = {
  1030. .modes = &lg_lp129qe_mode,
  1031. .num_modes = 1,
  1032. .bpc = 8,
  1033. .size = {
  1034. .width = 272,
  1035. .height = 181,
  1036. },
  1037. };
  1038. static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
  1039. .clock = 10870,
  1040. .hdisplay = 480,
  1041. .hsync_start = 480 + 2,
  1042. .hsync_end = 480 + 2 + 41,
  1043. .htotal = 480 + 2 + 41 + 2,
  1044. .vdisplay = 272,
  1045. .vsync_start = 272 + 2,
  1046. .vsync_end = 272 + 2 + 4,
  1047. .vtotal = 272 + 2 + 4 + 2,
  1048. .vrefresh = 74,
  1049. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1050. };
  1051. static const struct panel_desc nec_nl4827hc19_05b = {
  1052. .modes = &nec_nl4827hc19_05b_mode,
  1053. .num_modes = 1,
  1054. .bpc = 8,
  1055. .size = {
  1056. .width = 95,
  1057. .height = 54,
  1058. },
  1059. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1060. .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
  1061. };
  1062. static const struct drm_display_mode nvd_9128_mode = {
  1063. .clock = 29500,
  1064. .hdisplay = 800,
  1065. .hsync_start = 800 + 130,
  1066. .hsync_end = 800 + 130 + 98,
  1067. .htotal = 800 + 0 + 130 + 98,
  1068. .vdisplay = 480,
  1069. .vsync_start = 480 + 10,
  1070. .vsync_end = 480 + 10 + 50,
  1071. .vtotal = 480 + 0 + 10 + 50,
  1072. };
  1073. static const struct panel_desc nvd_9128 = {
  1074. .modes = &nvd_9128_mode,
  1075. .num_modes = 1,
  1076. .bpc = 8,
  1077. .size = {
  1078. .width = 156,
  1079. .height = 88,
  1080. },
  1081. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  1082. };
  1083. static const struct display_timing okaya_rs800480t_7x0gp_timing = {
  1084. .pixelclock = { 30000000, 30000000, 40000000 },
  1085. .hactive = { 800, 800, 800 },
  1086. .hfront_porch = { 40, 40, 40 },
  1087. .hback_porch = { 40, 40, 40 },
  1088. .hsync_len = { 1, 48, 48 },
  1089. .vactive = { 480, 480, 480 },
  1090. .vfront_porch = { 13, 13, 13 },
  1091. .vback_porch = { 29, 29, 29 },
  1092. .vsync_len = { 3, 3, 3 },
  1093. .flags = DISPLAY_FLAGS_DE_HIGH,
  1094. };
  1095. static const struct panel_desc okaya_rs800480t_7x0gp = {
  1096. .timings = &okaya_rs800480t_7x0gp_timing,
  1097. .num_timings = 1,
  1098. .bpc = 6,
  1099. .size = {
  1100. .width = 154,
  1101. .height = 87,
  1102. },
  1103. .delay = {
  1104. .prepare = 41,
  1105. .enable = 50,
  1106. .unprepare = 41,
  1107. .disable = 50,
  1108. },
  1109. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1110. };
  1111. static const struct drm_display_mode olimex_lcd_olinuxino_43ts_mode = {
  1112. .clock = 9000,
  1113. .hdisplay = 480,
  1114. .hsync_start = 480 + 5,
  1115. .hsync_end = 480 + 5 + 30,
  1116. .htotal = 480 + 5 + 30 + 10,
  1117. .vdisplay = 272,
  1118. .vsync_start = 272 + 8,
  1119. .vsync_end = 272 + 8 + 5,
  1120. .vtotal = 272 + 8 + 5 + 3,
  1121. .vrefresh = 60,
  1122. };
  1123. static const struct panel_desc olimex_lcd_olinuxino_43ts = {
  1124. .modes = &olimex_lcd_olinuxino_43ts_mode,
  1125. .num_modes = 1,
  1126. .size = {
  1127. .width = 105,
  1128. .height = 67,
  1129. },
  1130. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1131. };
  1132. /*
  1133. * 800x480 CVT. The panel appears to be quite accepting, at least as far as
  1134. * pixel clocks, but this is the timing that was being used in the Adafruit
  1135. * installation instructions.
  1136. */
  1137. static const struct drm_display_mode ontat_yx700wv03_mode = {
  1138. .clock = 29500,
  1139. .hdisplay = 800,
  1140. .hsync_start = 824,
  1141. .hsync_end = 896,
  1142. .htotal = 992,
  1143. .vdisplay = 480,
  1144. .vsync_start = 483,
  1145. .vsync_end = 493,
  1146. .vtotal = 500,
  1147. .vrefresh = 60,
  1148. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1149. };
  1150. /*
  1151. * Specification at:
  1152. * https://www.adafruit.com/images/product-files/2406/c3163.pdf
  1153. */
  1154. static const struct panel_desc ontat_yx700wv03 = {
  1155. .modes = &ontat_yx700wv03_mode,
  1156. .num_modes = 1,
  1157. .bpc = 8,
  1158. .size = {
  1159. .width = 154,
  1160. .height = 83,
  1161. },
  1162. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1163. };
  1164. static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
  1165. .clock = 25000,
  1166. .hdisplay = 480,
  1167. .hsync_start = 480 + 10,
  1168. .hsync_end = 480 + 10 + 10,
  1169. .htotal = 480 + 10 + 10 + 15,
  1170. .vdisplay = 800,
  1171. .vsync_start = 800 + 3,
  1172. .vsync_end = 800 + 3 + 3,
  1173. .vtotal = 800 + 3 + 3 + 3,
  1174. .vrefresh = 60,
  1175. };
  1176. static const struct panel_desc ortustech_com43h4m85ulc = {
  1177. .modes = &ortustech_com43h4m85ulc_mode,
  1178. .num_modes = 1,
  1179. .bpc = 8,
  1180. .size = {
  1181. .width = 56,
  1182. .height = 93,
  1183. },
  1184. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1185. .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE,
  1186. };
  1187. static const struct drm_display_mode qd43003c0_40_mode = {
  1188. .clock = 9000,
  1189. .hdisplay = 480,
  1190. .hsync_start = 480 + 8,
  1191. .hsync_end = 480 + 8 + 4,
  1192. .htotal = 480 + 8 + 4 + 39,
  1193. .vdisplay = 272,
  1194. .vsync_start = 272 + 4,
  1195. .vsync_end = 272 + 4 + 10,
  1196. .vtotal = 272 + 4 + 10 + 2,
  1197. .vrefresh = 60,
  1198. };
  1199. static const struct panel_desc qd43003c0_40 = {
  1200. .modes = &qd43003c0_40_mode,
  1201. .num_modes = 1,
  1202. .bpc = 8,
  1203. .size = {
  1204. .width = 95,
  1205. .height = 53,
  1206. },
  1207. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1208. };
  1209. static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
  1210. .clock = 271560,
  1211. .hdisplay = 2560,
  1212. .hsync_start = 2560 + 48,
  1213. .hsync_end = 2560 + 48 + 32,
  1214. .htotal = 2560 + 48 + 32 + 80,
  1215. .vdisplay = 1600,
  1216. .vsync_start = 1600 + 2,
  1217. .vsync_end = 1600 + 2 + 5,
  1218. .vtotal = 1600 + 2 + 5 + 57,
  1219. .vrefresh = 60,
  1220. };
  1221. static const struct panel_desc samsung_lsn122dl01_c01 = {
  1222. .modes = &samsung_lsn122dl01_c01_mode,
  1223. .num_modes = 1,
  1224. .size = {
  1225. .width = 263,
  1226. .height = 164,
  1227. },
  1228. };
  1229. static const struct drm_display_mode samsung_ltn101nt05_mode = {
  1230. .clock = 54030,
  1231. .hdisplay = 1024,
  1232. .hsync_start = 1024 + 24,
  1233. .hsync_end = 1024 + 24 + 136,
  1234. .htotal = 1024 + 24 + 136 + 160,
  1235. .vdisplay = 600,
  1236. .vsync_start = 600 + 3,
  1237. .vsync_end = 600 + 3 + 6,
  1238. .vtotal = 600 + 3 + 6 + 61,
  1239. .vrefresh = 60,
  1240. };
  1241. static const struct panel_desc samsung_ltn101nt05 = {
  1242. .modes = &samsung_ltn101nt05_mode,
  1243. .num_modes = 1,
  1244. .bpc = 6,
  1245. .size = {
  1246. .width = 223,
  1247. .height = 125,
  1248. },
  1249. };
  1250. static const struct drm_display_mode samsung_ltn140at29_301_mode = {
  1251. .clock = 76300,
  1252. .hdisplay = 1366,
  1253. .hsync_start = 1366 + 64,
  1254. .hsync_end = 1366 + 64 + 48,
  1255. .htotal = 1366 + 64 + 48 + 128,
  1256. .vdisplay = 768,
  1257. .vsync_start = 768 + 2,
  1258. .vsync_end = 768 + 2 + 5,
  1259. .vtotal = 768 + 2 + 5 + 17,
  1260. .vrefresh = 60,
  1261. };
  1262. static const struct panel_desc samsung_ltn140at29_301 = {
  1263. .modes = &samsung_ltn140at29_301_mode,
  1264. .num_modes = 1,
  1265. .bpc = 6,
  1266. .size = {
  1267. .width = 320,
  1268. .height = 187,
  1269. },
  1270. };
  1271. static const struct display_timing sharp_lq101k1ly04_timing = {
  1272. .pixelclock = { 60000000, 65000000, 80000000 },
  1273. .hactive = { 1280, 1280, 1280 },
  1274. .hfront_porch = { 20, 20, 20 },
  1275. .hback_porch = { 20, 20, 20 },
  1276. .hsync_len = { 10, 10, 10 },
  1277. .vactive = { 800, 800, 800 },
  1278. .vfront_porch = { 4, 4, 4 },
  1279. .vback_porch = { 4, 4, 4 },
  1280. .vsync_len = { 4, 4, 4 },
  1281. .flags = DISPLAY_FLAGS_PIXDATA_POSEDGE,
  1282. };
  1283. static const struct panel_desc sharp_lq101k1ly04 = {
  1284. .timings = &sharp_lq101k1ly04_timing,
  1285. .num_timings = 1,
  1286. .bpc = 8,
  1287. .size = {
  1288. .width = 217,
  1289. .height = 136,
  1290. },
  1291. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
  1292. };
  1293. static const struct drm_display_mode sharp_lq123p1jx31_mode = {
  1294. .clock = 252750,
  1295. .hdisplay = 2400,
  1296. .hsync_start = 2400 + 48,
  1297. .hsync_end = 2400 + 48 + 32,
  1298. .htotal = 2400 + 48 + 32 + 80,
  1299. .vdisplay = 1600,
  1300. .vsync_start = 1600 + 3,
  1301. .vsync_end = 1600 + 3 + 10,
  1302. .vtotal = 1600 + 3 + 10 + 33,
  1303. .vrefresh = 60,
  1304. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1305. };
  1306. static const struct panel_desc sharp_lq123p1jx31 = {
  1307. .modes = &sharp_lq123p1jx31_mode,
  1308. .num_modes = 1,
  1309. .size = {
  1310. .width = 259,
  1311. .height = 173,
  1312. },
  1313. .delay = {
  1314. .prepare = 110,
  1315. .enable = 50,
  1316. .unprepare = 550,
  1317. },
  1318. };
  1319. static const struct drm_display_mode sharp_lq150x1lg11_mode = {
  1320. .clock = 71100,
  1321. .hdisplay = 1024,
  1322. .hsync_start = 1024 + 168,
  1323. .hsync_end = 1024 + 168 + 64,
  1324. .htotal = 1024 + 168 + 64 + 88,
  1325. .vdisplay = 768,
  1326. .vsync_start = 768 + 37,
  1327. .vsync_end = 768 + 37 + 2,
  1328. .vtotal = 768 + 37 + 2 + 8,
  1329. .vrefresh = 60,
  1330. };
  1331. static const struct panel_desc sharp_lq150x1lg11 = {
  1332. .modes = &sharp_lq150x1lg11_mode,
  1333. .num_modes = 1,
  1334. .bpc = 6,
  1335. .size = {
  1336. .width = 304,
  1337. .height = 228,
  1338. },
  1339. .bus_format = MEDIA_BUS_FMT_RGB565_1X16,
  1340. };
  1341. static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
  1342. .clock = 33300,
  1343. .hdisplay = 800,
  1344. .hsync_start = 800 + 1,
  1345. .hsync_end = 800 + 1 + 64,
  1346. .htotal = 800 + 1 + 64 + 64,
  1347. .vdisplay = 480,
  1348. .vsync_start = 480 + 1,
  1349. .vsync_end = 480 + 1 + 23,
  1350. .vtotal = 480 + 1 + 23 + 22,
  1351. .vrefresh = 60,
  1352. };
  1353. static const struct panel_desc shelly_sca07010_bfn_lnn = {
  1354. .modes = &shelly_sca07010_bfn_lnn_mode,
  1355. .num_modes = 1,
  1356. .size = {
  1357. .width = 152,
  1358. .height = 91,
  1359. },
  1360. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1361. };
  1362. static const struct drm_display_mode starry_kr122ea0sra_mode = {
  1363. .clock = 147000,
  1364. .hdisplay = 1920,
  1365. .hsync_start = 1920 + 16,
  1366. .hsync_end = 1920 + 16 + 16,
  1367. .htotal = 1920 + 16 + 16 + 32,
  1368. .vdisplay = 1200,
  1369. .vsync_start = 1200 + 15,
  1370. .vsync_end = 1200 + 15 + 2,
  1371. .vtotal = 1200 + 15 + 2 + 18,
  1372. .vrefresh = 60,
  1373. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1374. };
  1375. static const struct panel_desc starry_kr122ea0sra = {
  1376. .modes = &starry_kr122ea0sra_mode,
  1377. .num_modes = 1,
  1378. .size = {
  1379. .width = 263,
  1380. .height = 164,
  1381. },
  1382. .delay = {
  1383. .prepare = 10 + 200,
  1384. .enable = 50,
  1385. .unprepare = 10 + 500,
  1386. },
  1387. };
  1388. static const struct drm_display_mode tpk_f07a_0102_mode = {
  1389. .clock = 33260,
  1390. .hdisplay = 800,
  1391. .hsync_start = 800 + 40,
  1392. .hsync_end = 800 + 40 + 128,
  1393. .htotal = 800 + 40 + 128 + 88,
  1394. .vdisplay = 480,
  1395. .vsync_start = 480 + 10,
  1396. .vsync_end = 480 + 10 + 2,
  1397. .vtotal = 480 + 10 + 2 + 33,
  1398. .vrefresh = 60,
  1399. };
  1400. static const struct panel_desc tpk_f07a_0102 = {
  1401. .modes = &tpk_f07a_0102_mode,
  1402. .num_modes = 1,
  1403. .size = {
  1404. .width = 152,
  1405. .height = 91,
  1406. },
  1407. .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
  1408. };
  1409. static const struct drm_display_mode tpk_f10a_0102_mode = {
  1410. .clock = 45000,
  1411. .hdisplay = 1024,
  1412. .hsync_start = 1024 + 176,
  1413. .hsync_end = 1024 + 176 + 5,
  1414. .htotal = 1024 + 176 + 5 + 88,
  1415. .vdisplay = 600,
  1416. .vsync_start = 600 + 20,
  1417. .vsync_end = 600 + 20 + 5,
  1418. .vtotal = 600 + 20 + 5 + 25,
  1419. .vrefresh = 60,
  1420. };
  1421. static const struct panel_desc tpk_f10a_0102 = {
  1422. .modes = &tpk_f10a_0102_mode,
  1423. .num_modes = 1,
  1424. .size = {
  1425. .width = 223,
  1426. .height = 125,
  1427. },
  1428. };
  1429. static const struct display_timing urt_umsh_8596md_timing = {
  1430. .pixelclock = { 33260000, 33260000, 33260000 },
  1431. .hactive = { 800, 800, 800 },
  1432. .hfront_porch = { 41, 41, 41 },
  1433. .hback_porch = { 216 - 128, 216 - 128, 216 - 128 },
  1434. .hsync_len = { 71, 128, 128 },
  1435. .vactive = { 480, 480, 480 },
  1436. .vfront_porch = { 10, 10, 10 },
  1437. .vback_porch = { 35 - 2, 35 - 2, 35 - 2 },
  1438. .vsync_len = { 2, 2, 2 },
  1439. .flags = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
  1440. DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
  1441. };
  1442. static const struct panel_desc urt_umsh_8596md_lvds = {
  1443. .timings = &urt_umsh_8596md_timing,
  1444. .num_timings = 1,
  1445. .bpc = 6,
  1446. .size = {
  1447. .width = 152,
  1448. .height = 91,
  1449. },
  1450. .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
  1451. };
  1452. static const struct panel_desc urt_umsh_8596md_parallel = {
  1453. .timings = &urt_umsh_8596md_timing,
  1454. .num_timings = 1,
  1455. .bpc = 6,
  1456. .size = {
  1457. .width = 152,
  1458. .height = 91,
  1459. },
  1460. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1461. };
  1462. static const struct of_device_id platform_of_match[] = {
  1463. {
  1464. .compatible = "ampire,am800480r3tmqwa1h",
  1465. .data = &ampire_am800480r3tmqwa1h,
  1466. }, {
  1467. .compatible = "auo,b101aw03",
  1468. .data = &auo_b101aw03,
  1469. }, {
  1470. .compatible = "auo,b101ean01",
  1471. .data = &auo_b101ean01,
  1472. }, {
  1473. .compatible = "auo,b101xtn01",
  1474. .data = &auo_b101xtn01,
  1475. }, {
  1476. .compatible = "auo,b116xw03",
  1477. .data = &auo_b116xw03,
  1478. }, {
  1479. .compatible = "auo,b133htn01",
  1480. .data = &auo_b133htn01,
  1481. }, {
  1482. .compatible = "auo,b133xtn01",
  1483. .data = &auo_b133xtn01,
  1484. }, {
  1485. .compatible = "auo,t215hvn01",
  1486. .data = &auo_t215hvn01,
  1487. }, {
  1488. .compatible = "avic,tm070ddh03",
  1489. .data = &avic_tm070ddh03,
  1490. }, {
  1491. .compatible = "chunghwa,claa070wp03xg",
  1492. .data = &chunghwa_claa070wp03xg,
  1493. }, {
  1494. .compatible = "chunghwa,claa101wa01a",
  1495. .data = &chunghwa_claa101wa01a
  1496. }, {
  1497. .compatible = "chunghwa,claa101wb01",
  1498. .data = &chunghwa_claa101wb01
  1499. }, {
  1500. .compatible = "edt,et057090dhu",
  1501. .data = &edt_et057090dhu,
  1502. }, {
  1503. .compatible = "edt,et070080dh6",
  1504. .data = &edt_etm0700g0dh6,
  1505. }, {
  1506. .compatible = "edt,etm0700g0dh6",
  1507. .data = &edt_etm0700g0dh6,
  1508. }, {
  1509. .compatible = "foxlink,fl500wvr00-a0t",
  1510. .data = &foxlink_fl500wvr00_a0t,
  1511. }, {
  1512. .compatible = "giantplus,gpg482739qs5",
  1513. .data = &giantplus_gpg482739qs5
  1514. }, {
  1515. .compatible = "hannstar,hsd070pww1",
  1516. .data = &hannstar_hsd070pww1,
  1517. }, {
  1518. .compatible = "hannstar,hsd100pxn1",
  1519. .data = &hannstar_hsd100pxn1,
  1520. }, {
  1521. .compatible = "hit,tx23d38vm0caa",
  1522. .data = &hitachi_tx23d38vm0caa
  1523. }, {
  1524. .compatible = "innolux,at043tn24",
  1525. .data = &innolux_at043tn24,
  1526. }, {
  1527. .compatible = "innolux,at070tn92",
  1528. .data = &innolux_at070tn92,
  1529. }, {
  1530. .compatible ="innolux,g101ice-l01",
  1531. .data = &innolux_g101ice_l01
  1532. }, {
  1533. .compatible ="innolux,g121i1-l01",
  1534. .data = &innolux_g121i1_l01
  1535. }, {
  1536. .compatible = "innolux,g121x1-l03",
  1537. .data = &innolux_g121x1_l03,
  1538. }, {
  1539. .compatible = "innolux,n116bge",
  1540. .data = &innolux_n116bge,
  1541. }, {
  1542. .compatible = "innolux,n156bge-l21",
  1543. .data = &innolux_n156bge_l21,
  1544. }, {
  1545. .compatible = "innolux,zj070na-01p",
  1546. .data = &innolux_zj070na_01p,
  1547. }, {
  1548. .compatible = "kyo,tcg121xglp",
  1549. .data = &kyo_tcg121xglp,
  1550. }, {
  1551. .compatible = "lg,lb070wv8",
  1552. .data = &lg_lb070wv8,
  1553. }, {
  1554. .compatible = "lg,lp079qx1-sp0v",
  1555. .data = &lg_lp079qx1_sp0v,
  1556. }, {
  1557. .compatible = "lg,lp097qx1-spa1",
  1558. .data = &lg_lp097qx1_spa1,
  1559. }, {
  1560. .compatible = "lg,lp120up1",
  1561. .data = &lg_lp120up1,
  1562. }, {
  1563. .compatible = "lg,lp129qe",
  1564. .data = &lg_lp129qe,
  1565. }, {
  1566. .compatible = "nec,nl4827hc19-05b",
  1567. .data = &nec_nl4827hc19_05b,
  1568. }, {
  1569. .compatible = "nvd,9128",
  1570. .data = &nvd_9128,
  1571. }, {
  1572. .compatible = "okaya,rs800480t-7x0gp",
  1573. .data = &okaya_rs800480t_7x0gp,
  1574. }, {
  1575. .compatible = "olimex,lcd-olinuxino-43-ts",
  1576. .data = &olimex_lcd_olinuxino_43ts,
  1577. }, {
  1578. .compatible = "ontat,yx700wv03",
  1579. .data = &ontat_yx700wv03,
  1580. }, {
  1581. .compatible = "ortustech,com43h4m85ulc",
  1582. .data = &ortustech_com43h4m85ulc,
  1583. }, {
  1584. .compatible = "qiaodian,qd43003c0-40",
  1585. .data = &qd43003c0_40,
  1586. }, {
  1587. .compatible = "samsung,lsn122dl01-c01",
  1588. .data = &samsung_lsn122dl01_c01,
  1589. }, {
  1590. .compatible = "samsung,ltn101nt05",
  1591. .data = &samsung_ltn101nt05,
  1592. }, {
  1593. .compatible = "samsung,ltn140at29-301",
  1594. .data = &samsung_ltn140at29_301,
  1595. }, {
  1596. .compatible = "sharp,lq101k1ly04",
  1597. .data = &sharp_lq101k1ly04,
  1598. }, {
  1599. .compatible = "sharp,lq123p1jx31",
  1600. .data = &sharp_lq123p1jx31,
  1601. }, {
  1602. .compatible = "sharp,lq150x1lg11",
  1603. .data = &sharp_lq150x1lg11,
  1604. }, {
  1605. .compatible = "shelly,sca07010-bfn-lnn",
  1606. .data = &shelly_sca07010_bfn_lnn,
  1607. }, {
  1608. .compatible = "starry,kr122ea0sra",
  1609. .data = &starry_kr122ea0sra,
  1610. }, {
  1611. .compatible = "tpk,f07a-0102",
  1612. .data = &tpk_f07a_0102,
  1613. }, {
  1614. .compatible = "tpk,f10a-0102",
  1615. .data = &tpk_f10a_0102,
  1616. }, {
  1617. .compatible = "urt,umsh-8596md-t",
  1618. .data = &urt_umsh_8596md_parallel,
  1619. }, {
  1620. .compatible = "urt,umsh-8596md-1t",
  1621. .data = &urt_umsh_8596md_parallel,
  1622. }, {
  1623. .compatible = "urt,umsh-8596md-7t",
  1624. .data = &urt_umsh_8596md_parallel,
  1625. }, {
  1626. .compatible = "urt,umsh-8596md-11t",
  1627. .data = &urt_umsh_8596md_lvds,
  1628. }, {
  1629. .compatible = "urt,umsh-8596md-19t",
  1630. .data = &urt_umsh_8596md_lvds,
  1631. }, {
  1632. .compatible = "urt,umsh-8596md-20t",
  1633. .data = &urt_umsh_8596md_parallel,
  1634. }, {
  1635. /* sentinel */
  1636. }
  1637. };
  1638. MODULE_DEVICE_TABLE(of, platform_of_match);
  1639. static int panel_simple_platform_probe(struct platform_device *pdev)
  1640. {
  1641. const struct of_device_id *id;
  1642. id = of_match_node(platform_of_match, pdev->dev.of_node);
  1643. if (!id)
  1644. return -ENODEV;
  1645. return panel_simple_probe(&pdev->dev, id->data);
  1646. }
  1647. static int panel_simple_platform_remove(struct platform_device *pdev)
  1648. {
  1649. return panel_simple_remove(&pdev->dev);
  1650. }
  1651. static void panel_simple_platform_shutdown(struct platform_device *pdev)
  1652. {
  1653. panel_simple_shutdown(&pdev->dev);
  1654. }
  1655. static struct platform_driver panel_simple_platform_driver = {
  1656. .driver = {
  1657. .name = "panel-simple",
  1658. .of_match_table = platform_of_match,
  1659. },
  1660. .probe = panel_simple_platform_probe,
  1661. .remove = panel_simple_platform_remove,
  1662. .shutdown = panel_simple_platform_shutdown,
  1663. };
  1664. struct panel_desc_dsi {
  1665. struct panel_desc desc;
  1666. unsigned long flags;
  1667. enum mipi_dsi_pixel_format format;
  1668. unsigned int lanes;
  1669. };
  1670. static const struct drm_display_mode auo_b080uan01_mode = {
  1671. .clock = 154500,
  1672. .hdisplay = 1200,
  1673. .hsync_start = 1200 + 62,
  1674. .hsync_end = 1200 + 62 + 4,
  1675. .htotal = 1200 + 62 + 4 + 62,
  1676. .vdisplay = 1920,
  1677. .vsync_start = 1920 + 9,
  1678. .vsync_end = 1920 + 9 + 2,
  1679. .vtotal = 1920 + 9 + 2 + 8,
  1680. .vrefresh = 60,
  1681. };
  1682. static const struct panel_desc_dsi auo_b080uan01 = {
  1683. .desc = {
  1684. .modes = &auo_b080uan01_mode,
  1685. .num_modes = 1,
  1686. .bpc = 8,
  1687. .size = {
  1688. .width = 108,
  1689. .height = 272,
  1690. },
  1691. },
  1692. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1693. .format = MIPI_DSI_FMT_RGB888,
  1694. .lanes = 4,
  1695. };
  1696. static const struct drm_display_mode boe_tv080wum_nl0_mode = {
  1697. .clock = 160000,
  1698. .hdisplay = 1200,
  1699. .hsync_start = 1200 + 120,
  1700. .hsync_end = 1200 + 120 + 20,
  1701. .htotal = 1200 + 120 + 20 + 21,
  1702. .vdisplay = 1920,
  1703. .vsync_start = 1920 + 21,
  1704. .vsync_end = 1920 + 21 + 3,
  1705. .vtotal = 1920 + 21 + 3 + 18,
  1706. .vrefresh = 60,
  1707. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1708. };
  1709. static const struct panel_desc_dsi boe_tv080wum_nl0 = {
  1710. .desc = {
  1711. .modes = &boe_tv080wum_nl0_mode,
  1712. .num_modes = 1,
  1713. .size = {
  1714. .width = 107,
  1715. .height = 172,
  1716. },
  1717. },
  1718. .flags = MIPI_DSI_MODE_VIDEO |
  1719. MIPI_DSI_MODE_VIDEO_BURST |
  1720. MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
  1721. .format = MIPI_DSI_FMT_RGB888,
  1722. .lanes = 4,
  1723. };
  1724. static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
  1725. .clock = 71000,
  1726. .hdisplay = 800,
  1727. .hsync_start = 800 + 32,
  1728. .hsync_end = 800 + 32 + 1,
  1729. .htotal = 800 + 32 + 1 + 57,
  1730. .vdisplay = 1280,
  1731. .vsync_start = 1280 + 28,
  1732. .vsync_end = 1280 + 28 + 1,
  1733. .vtotal = 1280 + 28 + 1 + 14,
  1734. .vrefresh = 60,
  1735. };
  1736. static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
  1737. .desc = {
  1738. .modes = &lg_ld070wx3_sl01_mode,
  1739. .num_modes = 1,
  1740. .bpc = 8,
  1741. .size = {
  1742. .width = 94,
  1743. .height = 151,
  1744. },
  1745. },
  1746. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1747. .format = MIPI_DSI_FMT_RGB888,
  1748. .lanes = 4,
  1749. };
  1750. static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
  1751. .clock = 67000,
  1752. .hdisplay = 720,
  1753. .hsync_start = 720 + 12,
  1754. .hsync_end = 720 + 12 + 4,
  1755. .htotal = 720 + 12 + 4 + 112,
  1756. .vdisplay = 1280,
  1757. .vsync_start = 1280 + 8,
  1758. .vsync_end = 1280 + 8 + 4,
  1759. .vtotal = 1280 + 8 + 4 + 12,
  1760. .vrefresh = 60,
  1761. };
  1762. static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
  1763. .desc = {
  1764. .modes = &lg_lh500wx1_sd03_mode,
  1765. .num_modes = 1,
  1766. .bpc = 8,
  1767. .size = {
  1768. .width = 62,
  1769. .height = 110,
  1770. },
  1771. },
  1772. .flags = MIPI_DSI_MODE_VIDEO,
  1773. .format = MIPI_DSI_FMT_RGB888,
  1774. .lanes = 4,
  1775. };
  1776. static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
  1777. .clock = 157200,
  1778. .hdisplay = 1920,
  1779. .hsync_start = 1920 + 154,
  1780. .hsync_end = 1920 + 154 + 16,
  1781. .htotal = 1920 + 154 + 16 + 32,
  1782. .vdisplay = 1200,
  1783. .vsync_start = 1200 + 17,
  1784. .vsync_end = 1200 + 17 + 2,
  1785. .vtotal = 1200 + 17 + 2 + 16,
  1786. .vrefresh = 60,
  1787. };
  1788. static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
  1789. .desc = {
  1790. .modes = &panasonic_vvx10f004b00_mode,
  1791. .num_modes = 1,
  1792. .bpc = 8,
  1793. .size = {
  1794. .width = 217,
  1795. .height = 136,
  1796. },
  1797. },
  1798. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
  1799. MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1800. .format = MIPI_DSI_FMT_RGB888,
  1801. .lanes = 4,
  1802. };
  1803. static const struct of_device_id dsi_of_match[] = {
  1804. {
  1805. .compatible = "auo,b080uan01",
  1806. .data = &auo_b080uan01
  1807. }, {
  1808. .compatible = "boe,tv080wum-nl0",
  1809. .data = &boe_tv080wum_nl0
  1810. }, {
  1811. .compatible = "lg,ld070wx3-sl01",
  1812. .data = &lg_ld070wx3_sl01
  1813. }, {
  1814. .compatible = "lg,lh500wx1-sd03",
  1815. .data = &lg_lh500wx1_sd03
  1816. }, {
  1817. .compatible = "panasonic,vvx10f004b00",
  1818. .data = &panasonic_vvx10f004b00
  1819. }, {
  1820. /* sentinel */
  1821. }
  1822. };
  1823. MODULE_DEVICE_TABLE(of, dsi_of_match);
  1824. static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
  1825. {
  1826. const struct panel_desc_dsi *desc;
  1827. const struct of_device_id *id;
  1828. int err;
  1829. id = of_match_node(dsi_of_match, dsi->dev.of_node);
  1830. if (!id)
  1831. return -ENODEV;
  1832. desc = id->data;
  1833. err = panel_simple_probe(&dsi->dev, &desc->desc);
  1834. if (err < 0)
  1835. return err;
  1836. dsi->mode_flags = desc->flags;
  1837. dsi->format = desc->format;
  1838. dsi->lanes = desc->lanes;
  1839. return mipi_dsi_attach(dsi);
  1840. }
  1841. static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
  1842. {
  1843. int err;
  1844. err = mipi_dsi_detach(dsi);
  1845. if (err < 0)
  1846. dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
  1847. return panel_simple_remove(&dsi->dev);
  1848. }
  1849. static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
  1850. {
  1851. panel_simple_shutdown(&dsi->dev);
  1852. }
  1853. static struct mipi_dsi_driver panel_simple_dsi_driver = {
  1854. .driver = {
  1855. .name = "panel-simple-dsi",
  1856. .of_match_table = dsi_of_match,
  1857. },
  1858. .probe = panel_simple_dsi_probe,
  1859. .remove = panel_simple_dsi_remove,
  1860. .shutdown = panel_simple_dsi_shutdown,
  1861. };
  1862. static int __init panel_simple_init(void)
  1863. {
  1864. int err;
  1865. err = platform_driver_register(&panel_simple_platform_driver);
  1866. if (err < 0)
  1867. return err;
  1868. if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
  1869. err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
  1870. if (err < 0)
  1871. return err;
  1872. }
  1873. return 0;
  1874. }
  1875. module_init(panel_simple_init);
  1876. static void __exit panel_simple_exit(void)
  1877. {
  1878. if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
  1879. mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
  1880. platform_driver_unregister(&panel_simple_platform_driver);
  1881. }
  1882. module_exit(panel_simple_exit);
  1883. MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
  1884. MODULE_DESCRIPTION("DRM Driver for Simple Panels");
  1885. MODULE_LICENSE("GPL and additional rights");