panel-simple.c 45 KB

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