panel-simple.c 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961
  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 drm_display_mode innolux_g121i1_l01_mode = {
  727. .clock = 71000,
  728. .hdisplay = 1280,
  729. .hsync_start = 1280 + 64,
  730. .hsync_end = 1280 + 64 + 32,
  731. .htotal = 1280 + 64 + 32 + 64,
  732. .vdisplay = 800,
  733. .vsync_start = 800 + 9,
  734. .vsync_end = 800 + 9 + 6,
  735. .vtotal = 800 + 9 + 6 + 9,
  736. .vrefresh = 60,
  737. };
  738. static const struct panel_desc innolux_g121i1_l01 = {
  739. .modes = &innolux_g121i1_l01_mode,
  740. .num_modes = 1,
  741. .bpc = 6,
  742. .size = {
  743. .width = 261,
  744. .height = 163,
  745. },
  746. };
  747. static const struct drm_display_mode innolux_g121x1_l03_mode = {
  748. .clock = 65000,
  749. .hdisplay = 1024,
  750. .hsync_start = 1024 + 0,
  751. .hsync_end = 1024 + 1,
  752. .htotal = 1024 + 0 + 1 + 320,
  753. .vdisplay = 768,
  754. .vsync_start = 768 + 38,
  755. .vsync_end = 768 + 38 + 1,
  756. .vtotal = 768 + 38 + 1 + 0,
  757. .vrefresh = 60,
  758. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  759. };
  760. static const struct panel_desc innolux_g121x1_l03 = {
  761. .modes = &innolux_g121x1_l03_mode,
  762. .num_modes = 1,
  763. .bpc = 6,
  764. .size = {
  765. .width = 246,
  766. .height = 185,
  767. },
  768. .delay = {
  769. .enable = 200,
  770. .unprepare = 200,
  771. .disable = 400,
  772. },
  773. };
  774. static const struct drm_display_mode innolux_n116bge_mode = {
  775. .clock = 76420,
  776. .hdisplay = 1366,
  777. .hsync_start = 1366 + 136,
  778. .hsync_end = 1366 + 136 + 30,
  779. .htotal = 1366 + 136 + 30 + 60,
  780. .vdisplay = 768,
  781. .vsync_start = 768 + 8,
  782. .vsync_end = 768 + 8 + 12,
  783. .vtotal = 768 + 8 + 12 + 12,
  784. .vrefresh = 60,
  785. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  786. };
  787. static const struct panel_desc innolux_n116bge = {
  788. .modes = &innolux_n116bge_mode,
  789. .num_modes = 1,
  790. .bpc = 6,
  791. .size = {
  792. .width = 256,
  793. .height = 144,
  794. },
  795. };
  796. static const struct drm_display_mode innolux_n156bge_l21_mode = {
  797. .clock = 69300,
  798. .hdisplay = 1366,
  799. .hsync_start = 1366 + 16,
  800. .hsync_end = 1366 + 16 + 34,
  801. .htotal = 1366 + 16 + 34 + 50,
  802. .vdisplay = 768,
  803. .vsync_start = 768 + 2,
  804. .vsync_end = 768 + 2 + 6,
  805. .vtotal = 768 + 2 + 6 + 12,
  806. .vrefresh = 60,
  807. };
  808. static const struct panel_desc innolux_n156bge_l21 = {
  809. .modes = &innolux_n156bge_l21_mode,
  810. .num_modes = 1,
  811. .bpc = 6,
  812. .size = {
  813. .width = 344,
  814. .height = 193,
  815. },
  816. };
  817. static const struct drm_display_mode innolux_zj070na_01p_mode = {
  818. .clock = 51501,
  819. .hdisplay = 1024,
  820. .hsync_start = 1024 + 128,
  821. .hsync_end = 1024 + 128 + 64,
  822. .htotal = 1024 + 128 + 64 + 128,
  823. .vdisplay = 600,
  824. .vsync_start = 600 + 16,
  825. .vsync_end = 600 + 16 + 4,
  826. .vtotal = 600 + 16 + 4 + 16,
  827. .vrefresh = 60,
  828. };
  829. static const struct panel_desc innolux_zj070na_01p = {
  830. .modes = &innolux_zj070na_01p_mode,
  831. .num_modes = 1,
  832. .bpc = 6,
  833. .size = {
  834. .width = 154,
  835. .height = 90,
  836. },
  837. };
  838. static const struct display_timing kyo_tcg121xglp_timing = {
  839. .pixelclock = { 52000000, 65000000, 71000000 },
  840. .hactive = { 1024, 1024, 1024 },
  841. .hfront_porch = { 2, 2, 2 },
  842. .hback_porch = { 2, 2, 2 },
  843. .hsync_len = { 86, 124, 244 },
  844. .vactive = { 768, 768, 768 },
  845. .vfront_porch = { 2, 2, 2 },
  846. .vback_porch = { 2, 2, 2 },
  847. .vsync_len = { 6, 34, 73 },
  848. .flags = DISPLAY_FLAGS_DE_HIGH,
  849. };
  850. static const struct panel_desc kyo_tcg121xglp = {
  851. .timings = &kyo_tcg121xglp_timing,
  852. .num_timings = 1,
  853. .bpc = 8,
  854. .size = {
  855. .width = 246,
  856. .height = 184,
  857. },
  858. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  859. };
  860. static const struct drm_display_mode lg_lb070wv8_mode = {
  861. .clock = 33246,
  862. .hdisplay = 800,
  863. .hsync_start = 800 + 88,
  864. .hsync_end = 800 + 88 + 80,
  865. .htotal = 800 + 88 + 80 + 88,
  866. .vdisplay = 480,
  867. .vsync_start = 480 + 10,
  868. .vsync_end = 480 + 10 + 25,
  869. .vtotal = 480 + 10 + 25 + 10,
  870. .vrefresh = 60,
  871. };
  872. static const struct panel_desc lg_lb070wv8 = {
  873. .modes = &lg_lb070wv8_mode,
  874. .num_modes = 1,
  875. .bpc = 16,
  876. .size = {
  877. .width = 151,
  878. .height = 91,
  879. },
  880. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
  881. };
  882. static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
  883. .clock = 200000,
  884. .hdisplay = 1536,
  885. .hsync_start = 1536 + 12,
  886. .hsync_end = 1536 + 12 + 16,
  887. .htotal = 1536 + 12 + 16 + 48,
  888. .vdisplay = 2048,
  889. .vsync_start = 2048 + 8,
  890. .vsync_end = 2048 + 8 + 4,
  891. .vtotal = 2048 + 8 + 4 + 8,
  892. .vrefresh = 60,
  893. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  894. };
  895. static const struct panel_desc lg_lp079qx1_sp0v = {
  896. .modes = &lg_lp079qx1_sp0v_mode,
  897. .num_modes = 1,
  898. .size = {
  899. .width = 129,
  900. .height = 171,
  901. },
  902. };
  903. static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
  904. .clock = 205210,
  905. .hdisplay = 2048,
  906. .hsync_start = 2048 + 150,
  907. .hsync_end = 2048 + 150 + 5,
  908. .htotal = 2048 + 150 + 5 + 5,
  909. .vdisplay = 1536,
  910. .vsync_start = 1536 + 3,
  911. .vsync_end = 1536 + 3 + 1,
  912. .vtotal = 1536 + 3 + 1 + 9,
  913. .vrefresh = 60,
  914. };
  915. static const struct panel_desc lg_lp097qx1_spa1 = {
  916. .modes = &lg_lp097qx1_spa1_mode,
  917. .num_modes = 1,
  918. .size = {
  919. .width = 208,
  920. .height = 147,
  921. },
  922. };
  923. static const struct drm_display_mode lg_lp120up1_mode = {
  924. .clock = 162300,
  925. .hdisplay = 1920,
  926. .hsync_start = 1920 + 40,
  927. .hsync_end = 1920 + 40 + 40,
  928. .htotal = 1920 + 40 + 40+ 80,
  929. .vdisplay = 1280,
  930. .vsync_start = 1280 + 4,
  931. .vsync_end = 1280 + 4 + 4,
  932. .vtotal = 1280 + 4 + 4 + 12,
  933. .vrefresh = 60,
  934. };
  935. static const struct panel_desc lg_lp120up1 = {
  936. .modes = &lg_lp120up1_mode,
  937. .num_modes = 1,
  938. .bpc = 8,
  939. .size = {
  940. .width = 267,
  941. .height = 183,
  942. },
  943. };
  944. static const struct drm_display_mode lg_lp129qe_mode = {
  945. .clock = 285250,
  946. .hdisplay = 2560,
  947. .hsync_start = 2560 + 48,
  948. .hsync_end = 2560 + 48 + 32,
  949. .htotal = 2560 + 48 + 32 + 80,
  950. .vdisplay = 1700,
  951. .vsync_start = 1700 + 3,
  952. .vsync_end = 1700 + 3 + 10,
  953. .vtotal = 1700 + 3 + 10 + 36,
  954. .vrefresh = 60,
  955. };
  956. static const struct panel_desc lg_lp129qe = {
  957. .modes = &lg_lp129qe_mode,
  958. .num_modes = 1,
  959. .bpc = 8,
  960. .size = {
  961. .width = 272,
  962. .height = 181,
  963. },
  964. };
  965. static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
  966. .clock = 10870,
  967. .hdisplay = 480,
  968. .hsync_start = 480 + 2,
  969. .hsync_end = 480 + 2 + 41,
  970. .htotal = 480 + 2 + 41 + 2,
  971. .vdisplay = 272,
  972. .vsync_start = 272 + 2,
  973. .vsync_end = 272 + 2 + 4,
  974. .vtotal = 272 + 2 + 4 + 2,
  975. .vrefresh = 74,
  976. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  977. };
  978. static const struct panel_desc nec_nl4827hc19_05b = {
  979. .modes = &nec_nl4827hc19_05b_mode,
  980. .num_modes = 1,
  981. .bpc = 8,
  982. .size = {
  983. .width = 95,
  984. .height = 54,
  985. },
  986. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  987. .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
  988. };
  989. static const struct display_timing okaya_rs800480t_7x0gp_timing = {
  990. .pixelclock = { 30000000, 30000000, 40000000 },
  991. .hactive = { 800, 800, 800 },
  992. .hfront_porch = { 40, 40, 40 },
  993. .hback_porch = { 40, 40, 40 },
  994. .hsync_len = { 1, 48, 48 },
  995. .vactive = { 480, 480, 480 },
  996. .vfront_porch = { 13, 13, 13 },
  997. .vback_porch = { 29, 29, 29 },
  998. .vsync_len = { 3, 3, 3 },
  999. .flags = DISPLAY_FLAGS_DE_HIGH,
  1000. };
  1001. static const struct panel_desc okaya_rs800480t_7x0gp = {
  1002. .timings = &okaya_rs800480t_7x0gp_timing,
  1003. .num_timings = 1,
  1004. .bpc = 6,
  1005. .size = {
  1006. .width = 154,
  1007. .height = 87,
  1008. },
  1009. .delay = {
  1010. .prepare = 41,
  1011. .enable = 50,
  1012. .unprepare = 41,
  1013. .disable = 50,
  1014. },
  1015. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1016. };
  1017. static const struct drm_display_mode olimex_lcd_olinuxino_43ts_mode = {
  1018. .clock = 9000,
  1019. .hdisplay = 480,
  1020. .hsync_start = 480 + 5,
  1021. .hsync_end = 480 + 5 + 30,
  1022. .htotal = 480 + 5 + 30 + 10,
  1023. .vdisplay = 272,
  1024. .vsync_start = 272 + 8,
  1025. .vsync_end = 272 + 8 + 5,
  1026. .vtotal = 272 + 8 + 5 + 3,
  1027. .vrefresh = 60,
  1028. };
  1029. static const struct panel_desc olimex_lcd_olinuxino_43ts = {
  1030. .modes = &olimex_lcd_olinuxino_43ts_mode,
  1031. .num_modes = 1,
  1032. .size = {
  1033. .width = 105,
  1034. .height = 67,
  1035. },
  1036. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1037. };
  1038. /*
  1039. * 800x480 CVT. The panel appears to be quite accepting, at least as far as
  1040. * pixel clocks, but this is the timing that was being used in the Adafruit
  1041. * installation instructions.
  1042. */
  1043. static const struct drm_display_mode ontat_yx700wv03_mode = {
  1044. .clock = 29500,
  1045. .hdisplay = 800,
  1046. .hsync_start = 824,
  1047. .hsync_end = 896,
  1048. .htotal = 992,
  1049. .vdisplay = 480,
  1050. .vsync_start = 483,
  1051. .vsync_end = 493,
  1052. .vtotal = 500,
  1053. .vrefresh = 60,
  1054. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1055. };
  1056. /*
  1057. * Specification at:
  1058. * https://www.adafruit.com/images/product-files/2406/c3163.pdf
  1059. */
  1060. static const struct panel_desc ontat_yx700wv03 = {
  1061. .modes = &ontat_yx700wv03_mode,
  1062. .num_modes = 1,
  1063. .bpc = 8,
  1064. .size = {
  1065. .width = 154,
  1066. .height = 83,
  1067. },
  1068. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1069. };
  1070. static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
  1071. .clock = 25000,
  1072. .hdisplay = 480,
  1073. .hsync_start = 480 + 10,
  1074. .hsync_end = 480 + 10 + 10,
  1075. .htotal = 480 + 10 + 10 + 15,
  1076. .vdisplay = 800,
  1077. .vsync_start = 800 + 3,
  1078. .vsync_end = 800 + 3 + 3,
  1079. .vtotal = 800 + 3 + 3 + 3,
  1080. .vrefresh = 60,
  1081. };
  1082. static const struct panel_desc ortustech_com43h4m85ulc = {
  1083. .modes = &ortustech_com43h4m85ulc_mode,
  1084. .num_modes = 1,
  1085. .bpc = 8,
  1086. .size = {
  1087. .width = 56,
  1088. .height = 93,
  1089. },
  1090. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1091. };
  1092. static const struct drm_display_mode qd43003c0_40_mode = {
  1093. .clock = 9000,
  1094. .hdisplay = 480,
  1095. .hsync_start = 480 + 8,
  1096. .hsync_end = 480 + 8 + 4,
  1097. .htotal = 480 + 8 + 4 + 39,
  1098. .vdisplay = 272,
  1099. .vsync_start = 272 + 4,
  1100. .vsync_end = 272 + 4 + 10,
  1101. .vtotal = 272 + 4 + 10 + 2,
  1102. .vrefresh = 60,
  1103. };
  1104. static const struct panel_desc qd43003c0_40 = {
  1105. .modes = &qd43003c0_40_mode,
  1106. .num_modes = 1,
  1107. .bpc = 8,
  1108. .size = {
  1109. .width = 95,
  1110. .height = 53,
  1111. },
  1112. .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
  1113. };
  1114. static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
  1115. .clock = 271560,
  1116. .hdisplay = 2560,
  1117. .hsync_start = 2560 + 48,
  1118. .hsync_end = 2560 + 48 + 32,
  1119. .htotal = 2560 + 48 + 32 + 80,
  1120. .vdisplay = 1600,
  1121. .vsync_start = 1600 + 2,
  1122. .vsync_end = 1600 + 2 + 5,
  1123. .vtotal = 1600 + 2 + 5 + 57,
  1124. .vrefresh = 60,
  1125. };
  1126. static const struct panel_desc samsung_lsn122dl01_c01 = {
  1127. .modes = &samsung_lsn122dl01_c01_mode,
  1128. .num_modes = 1,
  1129. .size = {
  1130. .width = 263,
  1131. .height = 164,
  1132. },
  1133. };
  1134. static const struct drm_display_mode samsung_ltn101nt05_mode = {
  1135. .clock = 54030,
  1136. .hdisplay = 1024,
  1137. .hsync_start = 1024 + 24,
  1138. .hsync_end = 1024 + 24 + 136,
  1139. .htotal = 1024 + 24 + 136 + 160,
  1140. .vdisplay = 600,
  1141. .vsync_start = 600 + 3,
  1142. .vsync_end = 600 + 3 + 6,
  1143. .vtotal = 600 + 3 + 6 + 61,
  1144. .vrefresh = 60,
  1145. };
  1146. static const struct panel_desc samsung_ltn101nt05 = {
  1147. .modes = &samsung_ltn101nt05_mode,
  1148. .num_modes = 1,
  1149. .bpc = 6,
  1150. .size = {
  1151. .width = 223,
  1152. .height = 125,
  1153. },
  1154. };
  1155. static const struct drm_display_mode samsung_ltn140at29_301_mode = {
  1156. .clock = 76300,
  1157. .hdisplay = 1366,
  1158. .hsync_start = 1366 + 64,
  1159. .hsync_end = 1366 + 64 + 48,
  1160. .htotal = 1366 + 64 + 48 + 128,
  1161. .vdisplay = 768,
  1162. .vsync_start = 768 + 2,
  1163. .vsync_end = 768 + 2 + 5,
  1164. .vtotal = 768 + 2 + 5 + 17,
  1165. .vrefresh = 60,
  1166. };
  1167. static const struct panel_desc samsung_ltn140at29_301 = {
  1168. .modes = &samsung_ltn140at29_301_mode,
  1169. .num_modes = 1,
  1170. .bpc = 6,
  1171. .size = {
  1172. .width = 320,
  1173. .height = 187,
  1174. },
  1175. };
  1176. static const struct display_timing sharp_lq101k1ly04_timing = {
  1177. .pixelclock = { 60000000, 65000000, 80000000 },
  1178. .hactive = { 1280, 1280, 1280 },
  1179. .hfront_porch = { 20, 20, 20 },
  1180. .hback_porch = { 20, 20, 20 },
  1181. .hsync_len = { 10, 10, 10 },
  1182. .vactive = { 800, 800, 800 },
  1183. .vfront_porch = { 4, 4, 4 },
  1184. .vback_porch = { 4, 4, 4 },
  1185. .vsync_len = { 4, 4, 4 },
  1186. .flags = DISPLAY_FLAGS_PIXDATA_POSEDGE,
  1187. };
  1188. static const struct panel_desc sharp_lq101k1ly04 = {
  1189. .timings = &sharp_lq101k1ly04_timing,
  1190. .num_timings = 1,
  1191. .bpc = 8,
  1192. .size = {
  1193. .width = 217,
  1194. .height = 136,
  1195. },
  1196. .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
  1197. };
  1198. static const struct drm_display_mode sharp_lq123p1jx31_mode = {
  1199. .clock = 252750,
  1200. .hdisplay = 2400,
  1201. .hsync_start = 2400 + 48,
  1202. .hsync_end = 2400 + 48 + 32,
  1203. .htotal = 2400 + 48 + 32 + 80,
  1204. .vdisplay = 1600,
  1205. .vsync_start = 1600 + 3,
  1206. .vsync_end = 1600 + 3 + 10,
  1207. .vtotal = 1600 + 3 + 10 + 33,
  1208. .vrefresh = 60,
  1209. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1210. };
  1211. static const struct panel_desc sharp_lq123p1jx31 = {
  1212. .modes = &sharp_lq123p1jx31_mode,
  1213. .num_modes = 1,
  1214. .size = {
  1215. .width = 259,
  1216. .height = 173,
  1217. },
  1218. };
  1219. static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
  1220. .clock = 33300,
  1221. .hdisplay = 800,
  1222. .hsync_start = 800 + 1,
  1223. .hsync_end = 800 + 1 + 64,
  1224. .htotal = 800 + 1 + 64 + 64,
  1225. .vdisplay = 480,
  1226. .vsync_start = 480 + 1,
  1227. .vsync_end = 480 + 1 + 23,
  1228. .vtotal = 480 + 1 + 23 + 22,
  1229. .vrefresh = 60,
  1230. };
  1231. static const struct panel_desc shelly_sca07010_bfn_lnn = {
  1232. .modes = &shelly_sca07010_bfn_lnn_mode,
  1233. .num_modes = 1,
  1234. .size = {
  1235. .width = 152,
  1236. .height = 91,
  1237. },
  1238. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1239. };
  1240. static const struct drm_display_mode starry_kr122ea0sra_mode = {
  1241. .clock = 147000,
  1242. .hdisplay = 1920,
  1243. .hsync_start = 1920 + 16,
  1244. .hsync_end = 1920 + 16 + 16,
  1245. .htotal = 1920 + 16 + 16 + 32,
  1246. .vdisplay = 1200,
  1247. .vsync_start = 1200 + 15,
  1248. .vsync_end = 1200 + 15 + 2,
  1249. .vtotal = 1200 + 15 + 2 + 18,
  1250. .vrefresh = 60,
  1251. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1252. };
  1253. static const struct panel_desc starry_kr122ea0sra = {
  1254. .modes = &starry_kr122ea0sra_mode,
  1255. .num_modes = 1,
  1256. .size = {
  1257. .width = 263,
  1258. .height = 164,
  1259. },
  1260. };
  1261. static const struct drm_display_mode tpk_f07a_0102_mode = {
  1262. .clock = 33260,
  1263. .hdisplay = 800,
  1264. .hsync_start = 800 + 40,
  1265. .hsync_end = 800 + 40 + 128,
  1266. .htotal = 800 + 40 + 128 + 88,
  1267. .vdisplay = 480,
  1268. .vsync_start = 480 + 10,
  1269. .vsync_end = 480 + 10 + 2,
  1270. .vtotal = 480 + 10 + 2 + 33,
  1271. .vrefresh = 60,
  1272. };
  1273. static const struct panel_desc tpk_f07a_0102 = {
  1274. .modes = &tpk_f07a_0102_mode,
  1275. .num_modes = 1,
  1276. .size = {
  1277. .width = 152,
  1278. .height = 91,
  1279. },
  1280. .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
  1281. };
  1282. static const struct drm_display_mode tpk_f10a_0102_mode = {
  1283. .clock = 45000,
  1284. .hdisplay = 1024,
  1285. .hsync_start = 1024 + 176,
  1286. .hsync_end = 1024 + 176 + 5,
  1287. .htotal = 1024 + 176 + 5 + 88,
  1288. .vdisplay = 600,
  1289. .vsync_start = 600 + 20,
  1290. .vsync_end = 600 + 20 + 5,
  1291. .vtotal = 600 + 20 + 5 + 25,
  1292. .vrefresh = 60,
  1293. };
  1294. static const struct panel_desc tpk_f10a_0102 = {
  1295. .modes = &tpk_f10a_0102_mode,
  1296. .num_modes = 1,
  1297. .size = {
  1298. .width = 223,
  1299. .height = 125,
  1300. },
  1301. };
  1302. static const struct display_timing urt_umsh_8596md_timing = {
  1303. .pixelclock = { 33260000, 33260000, 33260000 },
  1304. .hactive = { 800, 800, 800 },
  1305. .hfront_porch = { 41, 41, 41 },
  1306. .hback_porch = { 216 - 128, 216 - 128, 216 - 128 },
  1307. .hsync_len = { 71, 128, 128 },
  1308. .vactive = { 480, 480, 480 },
  1309. .vfront_porch = { 10, 10, 10 },
  1310. .vback_porch = { 35 - 2, 35 - 2, 35 - 2 },
  1311. .vsync_len = { 2, 2, 2 },
  1312. .flags = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
  1313. DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
  1314. };
  1315. static const struct panel_desc urt_umsh_8596md_lvds = {
  1316. .timings = &urt_umsh_8596md_timing,
  1317. .num_timings = 1,
  1318. .bpc = 6,
  1319. .size = {
  1320. .width = 152,
  1321. .height = 91,
  1322. },
  1323. .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
  1324. };
  1325. static const struct panel_desc urt_umsh_8596md_parallel = {
  1326. .timings = &urt_umsh_8596md_timing,
  1327. .num_timings = 1,
  1328. .bpc = 6,
  1329. .size = {
  1330. .width = 152,
  1331. .height = 91,
  1332. },
  1333. .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
  1334. };
  1335. static const struct of_device_id platform_of_match[] = {
  1336. {
  1337. .compatible = "ampire,am800480r3tmqwa1h",
  1338. .data = &ampire_am800480r3tmqwa1h,
  1339. }, {
  1340. .compatible = "auo,b101aw03",
  1341. .data = &auo_b101aw03,
  1342. }, {
  1343. .compatible = "auo,b101ean01",
  1344. .data = &auo_b101ean01,
  1345. }, {
  1346. .compatible = "auo,b101xtn01",
  1347. .data = &auo_b101xtn01,
  1348. }, {
  1349. .compatible = "auo,b116xw03",
  1350. .data = &auo_b116xw03,
  1351. }, {
  1352. .compatible = "auo,b133htn01",
  1353. .data = &auo_b133htn01,
  1354. }, {
  1355. .compatible = "auo,b133xtn01",
  1356. .data = &auo_b133xtn01,
  1357. }, {
  1358. .compatible = "avic,tm070ddh03",
  1359. .data = &avic_tm070ddh03,
  1360. }, {
  1361. .compatible = "chunghwa,claa101wa01a",
  1362. .data = &chunghwa_claa101wa01a
  1363. }, {
  1364. .compatible = "chunghwa,claa101wb01",
  1365. .data = &chunghwa_claa101wb01
  1366. }, {
  1367. .compatible = "edt,et057090dhu",
  1368. .data = &edt_et057090dhu,
  1369. }, {
  1370. .compatible = "edt,et070080dh6",
  1371. .data = &edt_etm0700g0dh6,
  1372. }, {
  1373. .compatible = "edt,etm0700g0dh6",
  1374. .data = &edt_etm0700g0dh6,
  1375. }, {
  1376. .compatible = "foxlink,fl500wvr00-a0t",
  1377. .data = &foxlink_fl500wvr00_a0t,
  1378. }, {
  1379. .compatible = "giantplus,gpg482739qs5",
  1380. .data = &giantplus_gpg482739qs5
  1381. }, {
  1382. .compatible = "hannstar,hsd070pww1",
  1383. .data = &hannstar_hsd070pww1,
  1384. }, {
  1385. .compatible = "hannstar,hsd100pxn1",
  1386. .data = &hannstar_hsd100pxn1,
  1387. }, {
  1388. .compatible = "hit,tx23d38vm0caa",
  1389. .data = &hitachi_tx23d38vm0caa
  1390. }, {
  1391. .compatible = "innolux,at043tn24",
  1392. .data = &innolux_at043tn24,
  1393. }, {
  1394. .compatible = "innolux,at070tn92",
  1395. .data = &innolux_at070tn92,
  1396. }, {
  1397. .compatible ="innolux,g121i1-l01",
  1398. .data = &innolux_g121i1_l01
  1399. }, {
  1400. .compatible = "innolux,g121x1-l03",
  1401. .data = &innolux_g121x1_l03,
  1402. }, {
  1403. .compatible = "innolux,n116bge",
  1404. .data = &innolux_n116bge,
  1405. }, {
  1406. .compatible = "innolux,n156bge-l21",
  1407. .data = &innolux_n156bge_l21,
  1408. }, {
  1409. .compatible = "innolux,zj070na-01p",
  1410. .data = &innolux_zj070na_01p,
  1411. }, {
  1412. .compatible = "kyo,tcg121xglp",
  1413. .data = &kyo_tcg121xglp,
  1414. }, {
  1415. .compatible = "lg,lb070wv8",
  1416. .data = &lg_lb070wv8,
  1417. }, {
  1418. .compatible = "lg,lp079qx1-sp0v",
  1419. .data = &lg_lp079qx1_sp0v,
  1420. }, {
  1421. .compatible = "lg,lp097qx1-spa1",
  1422. .data = &lg_lp097qx1_spa1,
  1423. }, {
  1424. .compatible = "lg,lp120up1",
  1425. .data = &lg_lp120up1,
  1426. }, {
  1427. .compatible = "lg,lp129qe",
  1428. .data = &lg_lp129qe,
  1429. }, {
  1430. .compatible = "nec,nl4827hc19-05b",
  1431. .data = &nec_nl4827hc19_05b,
  1432. }, {
  1433. .compatible = "okaya,rs800480t-7x0gp",
  1434. .data = &okaya_rs800480t_7x0gp,
  1435. }, {
  1436. .compatible = "olimex,lcd-olinuxino-43-ts",
  1437. .data = &olimex_lcd_olinuxino_43ts,
  1438. }, {
  1439. .compatible = "ontat,yx700wv03",
  1440. .data = &ontat_yx700wv03,
  1441. }, {
  1442. .compatible = "ortustech,com43h4m85ulc",
  1443. .data = &ortustech_com43h4m85ulc,
  1444. }, {
  1445. .compatible = "qiaodian,qd43003c0-40",
  1446. .data = &qd43003c0_40,
  1447. }, {
  1448. .compatible = "samsung,lsn122dl01-c01",
  1449. .data = &samsung_lsn122dl01_c01,
  1450. }, {
  1451. .compatible = "samsung,ltn101nt05",
  1452. .data = &samsung_ltn101nt05,
  1453. }, {
  1454. .compatible = "samsung,ltn140at29-301",
  1455. .data = &samsung_ltn140at29_301,
  1456. }, {
  1457. .compatible = "sharp,lq101k1ly04",
  1458. .data = &sharp_lq101k1ly04,
  1459. }, {
  1460. .compatible = "sharp,lq123p1jx31",
  1461. .data = &sharp_lq123p1jx31,
  1462. }, {
  1463. .compatible = "shelly,sca07010-bfn-lnn",
  1464. .data = &shelly_sca07010_bfn_lnn,
  1465. }, {
  1466. .compatible = "starry,kr122ea0sra",
  1467. .data = &starry_kr122ea0sra,
  1468. }, {
  1469. .compatible = "tpk,f07a-0102",
  1470. .data = &tpk_f07a_0102,
  1471. }, {
  1472. .compatible = "tpk,f10a-0102",
  1473. .data = &tpk_f10a_0102,
  1474. }, {
  1475. .compatible = "urt,umsh-8596md-t",
  1476. .data = &urt_umsh_8596md_parallel,
  1477. }, {
  1478. .compatible = "urt,umsh-8596md-1t",
  1479. .data = &urt_umsh_8596md_parallel,
  1480. }, {
  1481. .compatible = "urt,umsh-8596md-7t",
  1482. .data = &urt_umsh_8596md_parallel,
  1483. }, {
  1484. .compatible = "urt,umsh-8596md-11t",
  1485. .data = &urt_umsh_8596md_lvds,
  1486. }, {
  1487. .compatible = "urt,umsh-8596md-19t",
  1488. .data = &urt_umsh_8596md_lvds,
  1489. }, {
  1490. .compatible = "urt,umsh-8596md-20t",
  1491. .data = &urt_umsh_8596md_parallel,
  1492. }, {
  1493. /* sentinel */
  1494. }
  1495. };
  1496. MODULE_DEVICE_TABLE(of, platform_of_match);
  1497. static int panel_simple_platform_probe(struct platform_device *pdev)
  1498. {
  1499. const struct of_device_id *id;
  1500. id = of_match_node(platform_of_match, pdev->dev.of_node);
  1501. if (!id)
  1502. return -ENODEV;
  1503. return panel_simple_probe(&pdev->dev, id->data);
  1504. }
  1505. static int panel_simple_platform_remove(struct platform_device *pdev)
  1506. {
  1507. return panel_simple_remove(&pdev->dev);
  1508. }
  1509. static void panel_simple_platform_shutdown(struct platform_device *pdev)
  1510. {
  1511. panel_simple_shutdown(&pdev->dev);
  1512. }
  1513. static struct platform_driver panel_simple_platform_driver = {
  1514. .driver = {
  1515. .name = "panel-simple",
  1516. .of_match_table = platform_of_match,
  1517. },
  1518. .probe = panel_simple_platform_probe,
  1519. .remove = panel_simple_platform_remove,
  1520. .shutdown = panel_simple_platform_shutdown,
  1521. };
  1522. struct panel_desc_dsi {
  1523. struct panel_desc desc;
  1524. unsigned long flags;
  1525. enum mipi_dsi_pixel_format format;
  1526. unsigned int lanes;
  1527. };
  1528. static const struct drm_display_mode auo_b080uan01_mode = {
  1529. .clock = 154500,
  1530. .hdisplay = 1200,
  1531. .hsync_start = 1200 + 62,
  1532. .hsync_end = 1200 + 62 + 4,
  1533. .htotal = 1200 + 62 + 4 + 62,
  1534. .vdisplay = 1920,
  1535. .vsync_start = 1920 + 9,
  1536. .vsync_end = 1920 + 9 + 2,
  1537. .vtotal = 1920 + 9 + 2 + 8,
  1538. .vrefresh = 60,
  1539. };
  1540. static const struct panel_desc_dsi auo_b080uan01 = {
  1541. .desc = {
  1542. .modes = &auo_b080uan01_mode,
  1543. .num_modes = 1,
  1544. .bpc = 8,
  1545. .size = {
  1546. .width = 108,
  1547. .height = 272,
  1548. },
  1549. },
  1550. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1551. .format = MIPI_DSI_FMT_RGB888,
  1552. .lanes = 4,
  1553. };
  1554. static const struct drm_display_mode boe_tv080wum_nl0_mode = {
  1555. .clock = 160000,
  1556. .hdisplay = 1200,
  1557. .hsync_start = 1200 + 120,
  1558. .hsync_end = 1200 + 120 + 20,
  1559. .htotal = 1200 + 120 + 20 + 21,
  1560. .vdisplay = 1920,
  1561. .vsync_start = 1920 + 21,
  1562. .vsync_end = 1920 + 21 + 3,
  1563. .vtotal = 1920 + 21 + 3 + 18,
  1564. .vrefresh = 60,
  1565. .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
  1566. };
  1567. static const struct panel_desc_dsi boe_tv080wum_nl0 = {
  1568. .desc = {
  1569. .modes = &boe_tv080wum_nl0_mode,
  1570. .num_modes = 1,
  1571. .size = {
  1572. .width = 107,
  1573. .height = 172,
  1574. },
  1575. },
  1576. .flags = MIPI_DSI_MODE_VIDEO |
  1577. MIPI_DSI_MODE_VIDEO_BURST |
  1578. MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
  1579. .format = MIPI_DSI_FMT_RGB888,
  1580. .lanes = 4,
  1581. };
  1582. static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
  1583. .clock = 71000,
  1584. .hdisplay = 800,
  1585. .hsync_start = 800 + 32,
  1586. .hsync_end = 800 + 32 + 1,
  1587. .htotal = 800 + 32 + 1 + 57,
  1588. .vdisplay = 1280,
  1589. .vsync_start = 1280 + 28,
  1590. .vsync_end = 1280 + 28 + 1,
  1591. .vtotal = 1280 + 28 + 1 + 14,
  1592. .vrefresh = 60,
  1593. };
  1594. static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
  1595. .desc = {
  1596. .modes = &lg_ld070wx3_sl01_mode,
  1597. .num_modes = 1,
  1598. .bpc = 8,
  1599. .size = {
  1600. .width = 94,
  1601. .height = 151,
  1602. },
  1603. },
  1604. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1605. .format = MIPI_DSI_FMT_RGB888,
  1606. .lanes = 4,
  1607. };
  1608. static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
  1609. .clock = 67000,
  1610. .hdisplay = 720,
  1611. .hsync_start = 720 + 12,
  1612. .hsync_end = 720 + 12 + 4,
  1613. .htotal = 720 + 12 + 4 + 112,
  1614. .vdisplay = 1280,
  1615. .vsync_start = 1280 + 8,
  1616. .vsync_end = 1280 + 8 + 4,
  1617. .vtotal = 1280 + 8 + 4 + 12,
  1618. .vrefresh = 60,
  1619. };
  1620. static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
  1621. .desc = {
  1622. .modes = &lg_lh500wx1_sd03_mode,
  1623. .num_modes = 1,
  1624. .bpc = 8,
  1625. .size = {
  1626. .width = 62,
  1627. .height = 110,
  1628. },
  1629. },
  1630. .flags = MIPI_DSI_MODE_VIDEO,
  1631. .format = MIPI_DSI_FMT_RGB888,
  1632. .lanes = 4,
  1633. };
  1634. static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
  1635. .clock = 157200,
  1636. .hdisplay = 1920,
  1637. .hsync_start = 1920 + 154,
  1638. .hsync_end = 1920 + 154 + 16,
  1639. .htotal = 1920 + 154 + 16 + 32,
  1640. .vdisplay = 1200,
  1641. .vsync_start = 1200 + 17,
  1642. .vsync_end = 1200 + 17 + 2,
  1643. .vtotal = 1200 + 17 + 2 + 16,
  1644. .vrefresh = 60,
  1645. };
  1646. static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
  1647. .desc = {
  1648. .modes = &panasonic_vvx10f004b00_mode,
  1649. .num_modes = 1,
  1650. .bpc = 8,
  1651. .size = {
  1652. .width = 217,
  1653. .height = 136,
  1654. },
  1655. },
  1656. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
  1657. MIPI_DSI_CLOCK_NON_CONTINUOUS,
  1658. .format = MIPI_DSI_FMT_RGB888,
  1659. .lanes = 4,
  1660. };
  1661. static const struct of_device_id dsi_of_match[] = {
  1662. {
  1663. .compatible = "auo,b080uan01",
  1664. .data = &auo_b080uan01
  1665. }, {
  1666. .compatible = "boe,tv080wum-nl0",
  1667. .data = &boe_tv080wum_nl0
  1668. }, {
  1669. .compatible = "lg,ld070wx3-sl01",
  1670. .data = &lg_ld070wx3_sl01
  1671. }, {
  1672. .compatible = "lg,lh500wx1-sd03",
  1673. .data = &lg_lh500wx1_sd03
  1674. }, {
  1675. .compatible = "panasonic,vvx10f004b00",
  1676. .data = &panasonic_vvx10f004b00
  1677. }, {
  1678. /* sentinel */
  1679. }
  1680. };
  1681. MODULE_DEVICE_TABLE(of, dsi_of_match);
  1682. static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
  1683. {
  1684. const struct panel_desc_dsi *desc;
  1685. const struct of_device_id *id;
  1686. int err;
  1687. id = of_match_node(dsi_of_match, dsi->dev.of_node);
  1688. if (!id)
  1689. return -ENODEV;
  1690. desc = id->data;
  1691. err = panel_simple_probe(&dsi->dev, &desc->desc);
  1692. if (err < 0)
  1693. return err;
  1694. dsi->mode_flags = desc->flags;
  1695. dsi->format = desc->format;
  1696. dsi->lanes = desc->lanes;
  1697. return mipi_dsi_attach(dsi);
  1698. }
  1699. static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
  1700. {
  1701. int err;
  1702. err = mipi_dsi_detach(dsi);
  1703. if (err < 0)
  1704. dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
  1705. return panel_simple_remove(&dsi->dev);
  1706. }
  1707. static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
  1708. {
  1709. panel_simple_shutdown(&dsi->dev);
  1710. }
  1711. static struct mipi_dsi_driver panel_simple_dsi_driver = {
  1712. .driver = {
  1713. .name = "panel-simple-dsi",
  1714. .of_match_table = dsi_of_match,
  1715. },
  1716. .probe = panel_simple_dsi_probe,
  1717. .remove = panel_simple_dsi_remove,
  1718. .shutdown = panel_simple_dsi_shutdown,
  1719. };
  1720. static int __init panel_simple_init(void)
  1721. {
  1722. int err;
  1723. err = platform_driver_register(&panel_simple_platform_driver);
  1724. if (err < 0)
  1725. return err;
  1726. if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
  1727. err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
  1728. if (err < 0)
  1729. return err;
  1730. }
  1731. return 0;
  1732. }
  1733. module_init(panel_simple_init);
  1734. static void __exit panel_simple_exit(void)
  1735. {
  1736. if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
  1737. mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
  1738. platform_driver_unregister(&panel_simple_platform_driver);
  1739. }
  1740. module_exit(panel_simple_exit);
  1741. MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
  1742. MODULE_DESCRIPTION("DRM Driver for Simple Panels");
  1743. MODULE_LICENSE("GPL and additional rights");