panel-simple.c 40 KB

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