panel-simple.c 45 KB

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