panel-dsi-cm.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426
  1. /*
  2. * Generic DSI Command Mode panel driver
  3. *
  4. * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
  5. * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. */
  11. /* #define DEBUG */
  12. #include <linux/backlight.h>
  13. #include <linux/delay.h>
  14. #include <linux/gpio/consumer.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/jiffies.h>
  17. #include <linux/module.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/sched/signal.h>
  20. #include <linux/slab.h>
  21. #include <linux/workqueue.h>
  22. #include <linux/of_device.h>
  23. #include <linux/regulator/consumer.h>
  24. #include <video/mipi_display.h>
  25. #include <video/of_display_timing.h>
  26. #include "../dss/omapdss.h"
  27. /* DSI Virtual channel. Hardcoded for now. */
  28. #define TCH 0
  29. #define DCS_READ_NUM_ERRORS 0x05
  30. #define DCS_BRIGHTNESS 0x51
  31. #define DCS_CTRL_DISPLAY 0x53
  32. #define DCS_GET_ID1 0xda
  33. #define DCS_GET_ID2 0xdb
  34. #define DCS_GET_ID3 0xdc
  35. struct panel_drv_data {
  36. struct omap_dss_device dssdev;
  37. struct videomode vm;
  38. struct platform_device *pdev;
  39. struct mutex lock;
  40. struct backlight_device *bldev;
  41. struct backlight_device *extbldev;
  42. unsigned long hw_guard_end; /* next value of jiffies when we can
  43. * issue the next sleep in/out command
  44. */
  45. unsigned long hw_guard_wait; /* max guard time in jiffies */
  46. /* panel HW configuration from DT or platform data */
  47. struct gpio_desc *reset_gpio;
  48. struct gpio_desc *ext_te_gpio;
  49. struct regulator *vpnl;
  50. struct regulator *vddi;
  51. bool use_dsi_backlight;
  52. int width_mm;
  53. int height_mm;
  54. struct omap_dsi_pin_config pin_config;
  55. /* runtime variables */
  56. bool enabled;
  57. bool te_enabled;
  58. atomic_t do_update;
  59. int channel;
  60. struct delayed_work te_timeout_work;
  61. bool intro_printed;
  62. struct workqueue_struct *workqueue;
  63. bool ulps_enabled;
  64. unsigned int ulps_timeout;
  65. struct delayed_work ulps_work;
  66. };
  67. #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
  68. static irqreturn_t dsicm_te_isr(int irq, void *data);
  69. static void dsicm_te_timeout_work_callback(struct work_struct *work);
  70. static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
  71. static int dsicm_panel_reset(struct panel_drv_data *ddata);
  72. static void dsicm_ulps_work(struct work_struct *work);
  73. static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
  74. {
  75. struct backlight_device *backlight;
  76. if (ddata->bldev)
  77. backlight = ddata->bldev;
  78. else if (ddata->extbldev)
  79. backlight = ddata->extbldev;
  80. else
  81. return;
  82. if (enable) {
  83. backlight->props.fb_blank = FB_BLANK_UNBLANK;
  84. backlight->props.state = ~(BL_CORE_FBBLANK | BL_CORE_SUSPENDED);
  85. backlight->props.power = FB_BLANK_UNBLANK;
  86. } else {
  87. backlight->props.fb_blank = FB_BLANK_NORMAL;
  88. backlight->props.power = FB_BLANK_POWERDOWN;
  89. backlight->props.state |= BL_CORE_FBBLANK | BL_CORE_SUSPENDED;
  90. }
  91. backlight_update_status(backlight);
  92. }
  93. static void hw_guard_start(struct panel_drv_data *ddata, int guard_msec)
  94. {
  95. ddata->hw_guard_wait = msecs_to_jiffies(guard_msec);
  96. ddata->hw_guard_end = jiffies + ddata->hw_guard_wait;
  97. }
  98. static void hw_guard_wait(struct panel_drv_data *ddata)
  99. {
  100. unsigned long wait = ddata->hw_guard_end - jiffies;
  101. if ((long)wait > 0 && wait <= ddata->hw_guard_wait) {
  102. set_current_state(TASK_UNINTERRUPTIBLE);
  103. schedule_timeout(wait);
  104. }
  105. }
  106. static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
  107. {
  108. struct omap_dss_device *src = ddata->dssdev.src;
  109. int r;
  110. u8 buf[1];
  111. r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
  112. if (r < 0)
  113. return r;
  114. *data = buf[0];
  115. return 0;
  116. }
  117. static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
  118. {
  119. struct omap_dss_device *src = ddata->dssdev.src;
  120. return src->ops->dsi.dcs_write(src, ddata->channel, &dcs_cmd, 1);
  121. }
  122. static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
  123. {
  124. struct omap_dss_device *src = ddata->dssdev.src;
  125. u8 buf[2] = { dcs_cmd, param };
  126. return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
  127. }
  128. static int dsicm_sleep_in(struct panel_drv_data *ddata)
  129. {
  130. struct omap_dss_device *src = ddata->dssdev.src;
  131. u8 cmd;
  132. int r;
  133. hw_guard_wait(ddata);
  134. cmd = MIPI_DCS_ENTER_SLEEP_MODE;
  135. r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, &cmd, 1);
  136. if (r)
  137. return r;
  138. hw_guard_start(ddata, 120);
  139. usleep_range(5000, 10000);
  140. return 0;
  141. }
  142. static int dsicm_sleep_out(struct panel_drv_data *ddata)
  143. {
  144. int r;
  145. hw_guard_wait(ddata);
  146. r = dsicm_dcs_write_0(ddata, MIPI_DCS_EXIT_SLEEP_MODE);
  147. if (r)
  148. return r;
  149. hw_guard_start(ddata, 120);
  150. usleep_range(5000, 10000);
  151. return 0;
  152. }
  153. static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
  154. {
  155. int r;
  156. r = dsicm_dcs_read_1(ddata, DCS_GET_ID1, id1);
  157. if (r)
  158. return r;
  159. r = dsicm_dcs_read_1(ddata, DCS_GET_ID2, id2);
  160. if (r)
  161. return r;
  162. r = dsicm_dcs_read_1(ddata, DCS_GET_ID3, id3);
  163. if (r)
  164. return r;
  165. return 0;
  166. }
  167. static int dsicm_set_update_window(struct panel_drv_data *ddata,
  168. u16 x, u16 y, u16 w, u16 h)
  169. {
  170. struct omap_dss_device *src = ddata->dssdev.src;
  171. int r;
  172. u16 x1 = x;
  173. u16 x2 = x + w - 1;
  174. u16 y1 = y;
  175. u16 y2 = y + h - 1;
  176. u8 buf[5];
  177. buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
  178. buf[1] = (x1 >> 8) & 0xff;
  179. buf[2] = (x1 >> 0) & 0xff;
  180. buf[3] = (x2 >> 8) & 0xff;
  181. buf[4] = (x2 >> 0) & 0xff;
  182. r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
  183. if (r)
  184. return r;
  185. buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
  186. buf[1] = (y1 >> 8) & 0xff;
  187. buf[2] = (y1 >> 0) & 0xff;
  188. buf[3] = (y2 >> 8) & 0xff;
  189. buf[4] = (y2 >> 0) & 0xff;
  190. r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
  191. if (r)
  192. return r;
  193. src->ops->dsi.bta_sync(src, ddata->channel);
  194. return r;
  195. }
  196. static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
  197. {
  198. if (ddata->ulps_timeout > 0)
  199. queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
  200. msecs_to_jiffies(ddata->ulps_timeout));
  201. }
  202. static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
  203. {
  204. cancel_delayed_work(&ddata->ulps_work);
  205. }
  206. static int dsicm_enter_ulps(struct panel_drv_data *ddata)
  207. {
  208. struct omap_dss_device *src = ddata->dssdev.src;
  209. int r;
  210. if (ddata->ulps_enabled)
  211. return 0;
  212. dsicm_cancel_ulps_work(ddata);
  213. r = _dsicm_enable_te(ddata, false);
  214. if (r)
  215. goto err;
  216. if (ddata->ext_te_gpio)
  217. disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
  218. src->ops->dsi.disable(src, false, true);
  219. ddata->ulps_enabled = true;
  220. return 0;
  221. err:
  222. dev_err(&ddata->pdev->dev, "enter ULPS failed");
  223. dsicm_panel_reset(ddata);
  224. ddata->ulps_enabled = false;
  225. dsicm_queue_ulps_work(ddata);
  226. return r;
  227. }
  228. static int dsicm_exit_ulps(struct panel_drv_data *ddata)
  229. {
  230. struct omap_dss_device *src = ddata->dssdev.src;
  231. int r;
  232. if (!ddata->ulps_enabled)
  233. return 0;
  234. r = src->ops->enable(src);
  235. if (r) {
  236. dev_err(&ddata->pdev->dev, "failed to enable DSI\n");
  237. goto err1;
  238. }
  239. src->ops->dsi.enable_hs(src, ddata->channel, true);
  240. r = _dsicm_enable_te(ddata, true);
  241. if (r) {
  242. dev_err(&ddata->pdev->dev, "failed to re-enable TE");
  243. goto err2;
  244. }
  245. if (ddata->ext_te_gpio)
  246. enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
  247. dsicm_queue_ulps_work(ddata);
  248. ddata->ulps_enabled = false;
  249. return 0;
  250. err2:
  251. dev_err(&ddata->pdev->dev, "failed to exit ULPS");
  252. r = dsicm_panel_reset(ddata);
  253. if (!r) {
  254. if (ddata->ext_te_gpio)
  255. enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
  256. ddata->ulps_enabled = false;
  257. }
  258. err1:
  259. dsicm_queue_ulps_work(ddata);
  260. return r;
  261. }
  262. static int dsicm_wake_up(struct panel_drv_data *ddata)
  263. {
  264. if (ddata->ulps_enabled)
  265. return dsicm_exit_ulps(ddata);
  266. dsicm_cancel_ulps_work(ddata);
  267. dsicm_queue_ulps_work(ddata);
  268. return 0;
  269. }
  270. static int dsicm_bl_update_status(struct backlight_device *dev)
  271. {
  272. struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
  273. struct omap_dss_device *src = ddata->dssdev.src;
  274. int r = 0;
  275. int level;
  276. if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
  277. dev->props.power == FB_BLANK_UNBLANK)
  278. level = dev->props.brightness;
  279. else
  280. level = 0;
  281. dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
  282. mutex_lock(&ddata->lock);
  283. if (ddata->enabled) {
  284. src->ops->dsi.bus_lock(src);
  285. r = dsicm_wake_up(ddata);
  286. if (!r)
  287. r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
  288. src->ops->dsi.bus_unlock(src);
  289. }
  290. mutex_unlock(&ddata->lock);
  291. return r;
  292. }
  293. static int dsicm_bl_get_intensity(struct backlight_device *dev)
  294. {
  295. if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
  296. dev->props.power == FB_BLANK_UNBLANK)
  297. return dev->props.brightness;
  298. return 0;
  299. }
  300. static const struct backlight_ops dsicm_bl_ops = {
  301. .get_brightness = dsicm_bl_get_intensity,
  302. .update_status = dsicm_bl_update_status,
  303. };
  304. static ssize_t dsicm_num_errors_show(struct device *dev,
  305. struct device_attribute *attr, char *buf)
  306. {
  307. struct platform_device *pdev = to_platform_device(dev);
  308. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  309. struct omap_dss_device *src = ddata->dssdev.src;
  310. u8 errors = 0;
  311. int r;
  312. mutex_lock(&ddata->lock);
  313. if (ddata->enabled) {
  314. src->ops->dsi.bus_lock(src);
  315. r = dsicm_wake_up(ddata);
  316. if (!r)
  317. r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
  318. &errors);
  319. src->ops->dsi.bus_unlock(src);
  320. } else {
  321. r = -ENODEV;
  322. }
  323. mutex_unlock(&ddata->lock);
  324. if (r)
  325. return r;
  326. return snprintf(buf, PAGE_SIZE, "%d\n", errors);
  327. }
  328. static ssize_t dsicm_hw_revision_show(struct device *dev,
  329. struct device_attribute *attr, char *buf)
  330. {
  331. struct platform_device *pdev = to_platform_device(dev);
  332. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  333. struct omap_dss_device *src = ddata->dssdev.src;
  334. u8 id1, id2, id3;
  335. int r;
  336. mutex_lock(&ddata->lock);
  337. if (ddata->enabled) {
  338. src->ops->dsi.bus_lock(src);
  339. r = dsicm_wake_up(ddata);
  340. if (!r)
  341. r = dsicm_get_id(ddata, &id1, &id2, &id3);
  342. src->ops->dsi.bus_unlock(src);
  343. } else {
  344. r = -ENODEV;
  345. }
  346. mutex_unlock(&ddata->lock);
  347. if (r)
  348. return r;
  349. return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
  350. }
  351. static ssize_t dsicm_store_ulps(struct device *dev,
  352. struct device_attribute *attr,
  353. const char *buf, size_t count)
  354. {
  355. struct platform_device *pdev = to_platform_device(dev);
  356. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  357. struct omap_dss_device *src = ddata->dssdev.src;
  358. unsigned long t;
  359. int r;
  360. r = kstrtoul(buf, 0, &t);
  361. if (r)
  362. return r;
  363. mutex_lock(&ddata->lock);
  364. if (ddata->enabled) {
  365. src->ops->dsi.bus_lock(src);
  366. if (t)
  367. r = dsicm_enter_ulps(ddata);
  368. else
  369. r = dsicm_wake_up(ddata);
  370. src->ops->dsi.bus_unlock(src);
  371. }
  372. mutex_unlock(&ddata->lock);
  373. if (r)
  374. return r;
  375. return count;
  376. }
  377. static ssize_t dsicm_show_ulps(struct device *dev,
  378. struct device_attribute *attr,
  379. char *buf)
  380. {
  381. struct platform_device *pdev = to_platform_device(dev);
  382. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  383. unsigned int t;
  384. mutex_lock(&ddata->lock);
  385. t = ddata->ulps_enabled;
  386. mutex_unlock(&ddata->lock);
  387. return snprintf(buf, PAGE_SIZE, "%u\n", t);
  388. }
  389. static ssize_t dsicm_store_ulps_timeout(struct device *dev,
  390. struct device_attribute *attr,
  391. const char *buf, size_t count)
  392. {
  393. struct platform_device *pdev = to_platform_device(dev);
  394. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  395. struct omap_dss_device *src = ddata->dssdev.src;
  396. unsigned long t;
  397. int r;
  398. r = kstrtoul(buf, 0, &t);
  399. if (r)
  400. return r;
  401. mutex_lock(&ddata->lock);
  402. ddata->ulps_timeout = t;
  403. if (ddata->enabled) {
  404. /* dsicm_wake_up will restart the timer */
  405. src->ops->dsi.bus_lock(src);
  406. r = dsicm_wake_up(ddata);
  407. src->ops->dsi.bus_unlock(src);
  408. }
  409. mutex_unlock(&ddata->lock);
  410. if (r)
  411. return r;
  412. return count;
  413. }
  414. static ssize_t dsicm_show_ulps_timeout(struct device *dev,
  415. struct device_attribute *attr,
  416. char *buf)
  417. {
  418. struct platform_device *pdev = to_platform_device(dev);
  419. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  420. unsigned int t;
  421. mutex_lock(&ddata->lock);
  422. t = ddata->ulps_timeout;
  423. mutex_unlock(&ddata->lock);
  424. return snprintf(buf, PAGE_SIZE, "%u\n", t);
  425. }
  426. static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
  427. static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
  428. static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
  429. dsicm_show_ulps, dsicm_store_ulps);
  430. static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
  431. dsicm_show_ulps_timeout, dsicm_store_ulps_timeout);
  432. static struct attribute *dsicm_attrs[] = {
  433. &dev_attr_num_dsi_errors.attr,
  434. &dev_attr_hw_revision.attr,
  435. &dev_attr_ulps.attr,
  436. &dev_attr_ulps_timeout.attr,
  437. NULL,
  438. };
  439. static const struct attribute_group dsicm_attr_group = {
  440. .attrs = dsicm_attrs,
  441. };
  442. static void dsicm_hw_reset(struct panel_drv_data *ddata)
  443. {
  444. gpiod_set_value(ddata->reset_gpio, 1);
  445. udelay(10);
  446. /* reset the panel */
  447. gpiod_set_value(ddata->reset_gpio, 0);
  448. /* assert reset */
  449. udelay(10);
  450. gpiod_set_value(ddata->reset_gpio, 1);
  451. /* wait after releasing reset */
  452. usleep_range(5000, 10000);
  453. }
  454. static int dsicm_power_on(struct panel_drv_data *ddata)
  455. {
  456. struct omap_dss_device *src = ddata->dssdev.src;
  457. u8 id1, id2, id3;
  458. int r;
  459. struct omap_dss_dsi_config dsi_config = {
  460. .mode = OMAP_DSS_DSI_CMD_MODE,
  461. .pixel_format = OMAP_DSS_DSI_FMT_RGB888,
  462. .vm = &ddata->vm,
  463. .hs_clk_min = 150000000,
  464. .hs_clk_max = 300000000,
  465. .lp_clk_min = 7000000,
  466. .lp_clk_max = 10000000,
  467. };
  468. if (ddata->vpnl) {
  469. r = regulator_enable(ddata->vpnl);
  470. if (r) {
  471. dev_err(&ddata->pdev->dev,
  472. "failed to enable VPNL: %d\n", r);
  473. return r;
  474. }
  475. }
  476. if (ddata->vddi) {
  477. r = regulator_enable(ddata->vddi);
  478. if (r) {
  479. dev_err(&ddata->pdev->dev,
  480. "failed to enable VDDI: %d\n", r);
  481. goto err_vpnl;
  482. }
  483. }
  484. if (ddata->pin_config.num_pins > 0) {
  485. r = src->ops->dsi.configure_pins(src, &ddata->pin_config);
  486. if (r) {
  487. dev_err(&ddata->pdev->dev,
  488. "failed to configure DSI pins\n");
  489. goto err_vddi;
  490. }
  491. }
  492. r = src->ops->dsi.set_config(src, &dsi_config);
  493. if (r) {
  494. dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
  495. goto err_vddi;
  496. }
  497. r = src->ops->enable(src);
  498. if (r) {
  499. dev_err(&ddata->pdev->dev, "failed to enable DSI\n");
  500. goto err_vddi;
  501. }
  502. dsicm_hw_reset(ddata);
  503. src->ops->dsi.enable_hs(src, ddata->channel, false);
  504. r = dsicm_sleep_out(ddata);
  505. if (r)
  506. goto err;
  507. r = dsicm_get_id(ddata, &id1, &id2, &id3);
  508. if (r)
  509. goto err;
  510. r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
  511. if (r)
  512. goto err;
  513. r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
  514. (1<<2) | (1<<5)); /* BL | BCTRL */
  515. if (r)
  516. goto err;
  517. r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_PIXEL_FORMAT,
  518. MIPI_DCS_PIXEL_FMT_24BIT);
  519. if (r)
  520. goto err;
  521. r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_ON);
  522. if (r)
  523. goto err;
  524. r = _dsicm_enable_te(ddata, ddata->te_enabled);
  525. if (r)
  526. goto err;
  527. r = src->ops->dsi.enable_video_output(src, ddata->channel);
  528. if (r)
  529. goto err;
  530. ddata->enabled = 1;
  531. if (!ddata->intro_printed) {
  532. dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n",
  533. id1, id2, id3);
  534. ddata->intro_printed = true;
  535. }
  536. src->ops->dsi.enable_hs(src, ddata->channel, true);
  537. return 0;
  538. err:
  539. dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n");
  540. dsicm_hw_reset(ddata);
  541. src->ops->dsi.disable(src, true, false);
  542. err_vddi:
  543. if (ddata->vddi)
  544. regulator_disable(ddata->vddi);
  545. err_vpnl:
  546. if (ddata->vpnl)
  547. regulator_disable(ddata->vpnl);
  548. return r;
  549. }
  550. static void dsicm_power_off(struct panel_drv_data *ddata)
  551. {
  552. struct omap_dss_device *src = ddata->dssdev.src;
  553. int r;
  554. src->ops->dsi.disable_video_output(src, ddata->channel);
  555. r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_OFF);
  556. if (!r)
  557. r = dsicm_sleep_in(ddata);
  558. if (r) {
  559. dev_err(&ddata->pdev->dev,
  560. "error disabling panel, issuing HW reset\n");
  561. dsicm_hw_reset(ddata);
  562. }
  563. src->ops->dsi.disable(src, true, false);
  564. if (ddata->vddi)
  565. regulator_disable(ddata->vddi);
  566. if (ddata->vpnl)
  567. regulator_disable(ddata->vpnl);
  568. ddata->enabled = 0;
  569. }
  570. static int dsicm_panel_reset(struct panel_drv_data *ddata)
  571. {
  572. dev_err(&ddata->pdev->dev, "performing LCD reset\n");
  573. dsicm_power_off(ddata);
  574. dsicm_hw_reset(ddata);
  575. return dsicm_power_on(ddata);
  576. }
  577. static int dsicm_connect(struct omap_dss_device *src,
  578. struct omap_dss_device *dst)
  579. {
  580. struct panel_drv_data *ddata = to_panel_data(dst);
  581. struct device *dev = &ddata->pdev->dev;
  582. int r;
  583. r = src->ops->dsi.request_vc(src, &ddata->channel);
  584. if (r) {
  585. dev_err(dev, "failed to get virtual channel\n");
  586. return r;
  587. }
  588. r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
  589. if (r) {
  590. dev_err(dev, "failed to set VC_ID\n");
  591. src->ops->dsi.release_vc(src, ddata->channel);
  592. return r;
  593. }
  594. return 0;
  595. }
  596. static void dsicm_disconnect(struct omap_dss_device *src,
  597. struct omap_dss_device *dst)
  598. {
  599. struct panel_drv_data *ddata = to_panel_data(dst);
  600. src->ops->dsi.release_vc(src, ddata->channel);
  601. }
  602. static int dsicm_enable(struct omap_dss_device *dssdev)
  603. {
  604. struct panel_drv_data *ddata = to_panel_data(dssdev);
  605. struct omap_dss_device *src = dssdev->src;
  606. int r;
  607. dev_dbg(&ddata->pdev->dev, "enable\n");
  608. mutex_lock(&ddata->lock);
  609. if (!omapdss_device_is_connected(dssdev)) {
  610. r = -ENODEV;
  611. goto err;
  612. }
  613. if (omapdss_device_is_enabled(dssdev)) {
  614. r = 0;
  615. goto err;
  616. }
  617. src->ops->dsi.bus_lock(src);
  618. r = dsicm_power_on(ddata);
  619. src->ops->dsi.bus_unlock(src);
  620. if (r)
  621. goto err;
  622. dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
  623. mutex_unlock(&ddata->lock);
  624. dsicm_bl_power(ddata, true);
  625. return 0;
  626. err:
  627. dev_dbg(&ddata->pdev->dev, "enable failed\n");
  628. mutex_unlock(&ddata->lock);
  629. return r;
  630. }
  631. static void dsicm_disable(struct omap_dss_device *dssdev)
  632. {
  633. struct panel_drv_data *ddata = to_panel_data(dssdev);
  634. struct omap_dss_device *src = dssdev->src;
  635. int r;
  636. dev_dbg(&ddata->pdev->dev, "disable\n");
  637. dsicm_bl_power(ddata, false);
  638. mutex_lock(&ddata->lock);
  639. dsicm_cancel_ulps_work(ddata);
  640. src->ops->dsi.bus_lock(src);
  641. if (omapdss_device_is_enabled(dssdev)) {
  642. r = dsicm_wake_up(ddata);
  643. if (!r)
  644. dsicm_power_off(ddata);
  645. }
  646. src->ops->dsi.bus_unlock(src);
  647. dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
  648. mutex_unlock(&ddata->lock);
  649. }
  650. static void dsicm_framedone_cb(int err, void *data)
  651. {
  652. struct panel_drv_data *ddata = data;
  653. struct omap_dss_device *src = ddata->dssdev.src;
  654. dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err);
  655. src->ops->dsi.bus_unlock(src);
  656. }
  657. static irqreturn_t dsicm_te_isr(int irq, void *data)
  658. {
  659. struct panel_drv_data *ddata = data;
  660. struct omap_dss_device *src = ddata->dssdev.src;
  661. int old;
  662. int r;
  663. old = atomic_cmpxchg(&ddata->do_update, 1, 0);
  664. if (old) {
  665. cancel_delayed_work(&ddata->te_timeout_work);
  666. r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
  667. ddata);
  668. if (r)
  669. goto err;
  670. }
  671. return IRQ_HANDLED;
  672. err:
  673. dev_err(&ddata->pdev->dev, "start update failed\n");
  674. src->ops->dsi.bus_unlock(src);
  675. return IRQ_HANDLED;
  676. }
  677. static void dsicm_te_timeout_work_callback(struct work_struct *work)
  678. {
  679. struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
  680. te_timeout_work.work);
  681. struct omap_dss_device *src = ddata->dssdev.src;
  682. dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n");
  683. atomic_set(&ddata->do_update, 0);
  684. src->ops->dsi.bus_unlock(src);
  685. }
  686. static int dsicm_update(struct omap_dss_device *dssdev,
  687. u16 x, u16 y, u16 w, u16 h)
  688. {
  689. struct panel_drv_data *ddata = to_panel_data(dssdev);
  690. struct omap_dss_device *src = dssdev->src;
  691. int r;
  692. dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
  693. mutex_lock(&ddata->lock);
  694. src->ops->dsi.bus_lock(src);
  695. r = dsicm_wake_up(ddata);
  696. if (r)
  697. goto err;
  698. if (!ddata->enabled) {
  699. r = 0;
  700. goto err;
  701. }
  702. /* XXX no need to send this every frame, but dsi break if not done */
  703. r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
  704. ddata->vm.vactive);
  705. if (r)
  706. goto err;
  707. if (ddata->te_enabled && ddata->ext_te_gpio) {
  708. schedule_delayed_work(&ddata->te_timeout_work,
  709. msecs_to_jiffies(250));
  710. atomic_set(&ddata->do_update, 1);
  711. } else {
  712. r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
  713. ddata);
  714. if (r)
  715. goto err;
  716. }
  717. /* note: no bus_unlock here. unlock is src framedone_cb */
  718. mutex_unlock(&ddata->lock);
  719. return 0;
  720. err:
  721. src->ops->dsi.bus_unlock(src);
  722. mutex_unlock(&ddata->lock);
  723. return r;
  724. }
  725. static int dsicm_sync(struct omap_dss_device *dssdev)
  726. {
  727. struct panel_drv_data *ddata = to_panel_data(dssdev);
  728. struct omap_dss_device *src = dssdev->src;
  729. dev_dbg(&ddata->pdev->dev, "sync\n");
  730. mutex_lock(&ddata->lock);
  731. src->ops->dsi.bus_lock(src);
  732. src->ops->dsi.bus_unlock(src);
  733. mutex_unlock(&ddata->lock);
  734. dev_dbg(&ddata->pdev->dev, "sync done\n");
  735. return 0;
  736. }
  737. static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
  738. {
  739. struct omap_dss_device *src = ddata->dssdev.src;
  740. int r;
  741. if (enable)
  742. r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_TEAR_ON, 0);
  743. else
  744. r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF);
  745. if (!ddata->ext_te_gpio)
  746. src->ops->dsi.enable_te(src, enable);
  747. /* possible panel bug */
  748. msleep(100);
  749. return r;
  750. }
  751. static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
  752. {
  753. struct panel_drv_data *ddata = to_panel_data(dssdev);
  754. struct omap_dss_device *src = dssdev->src;
  755. int r;
  756. mutex_lock(&ddata->lock);
  757. if (ddata->te_enabled == enable)
  758. goto end;
  759. src->ops->dsi.bus_lock(src);
  760. if (ddata->enabled) {
  761. r = dsicm_wake_up(ddata);
  762. if (r)
  763. goto err;
  764. r = _dsicm_enable_te(ddata, enable);
  765. if (r)
  766. goto err;
  767. }
  768. ddata->te_enabled = enable;
  769. src->ops->dsi.bus_unlock(src);
  770. end:
  771. mutex_unlock(&ddata->lock);
  772. return 0;
  773. err:
  774. src->ops->dsi.bus_unlock(src);
  775. mutex_unlock(&ddata->lock);
  776. return r;
  777. }
  778. static int dsicm_get_te(struct omap_dss_device *dssdev)
  779. {
  780. struct panel_drv_data *ddata = to_panel_data(dssdev);
  781. int r;
  782. mutex_lock(&ddata->lock);
  783. r = ddata->te_enabled;
  784. mutex_unlock(&ddata->lock);
  785. return r;
  786. }
  787. static int dsicm_memory_read(struct omap_dss_device *dssdev,
  788. void *buf, size_t size,
  789. u16 x, u16 y, u16 w, u16 h)
  790. {
  791. struct panel_drv_data *ddata = to_panel_data(dssdev);
  792. struct omap_dss_device *src = dssdev->src;
  793. int r;
  794. int first = 1;
  795. int plen;
  796. unsigned int buf_used = 0;
  797. if (size < w * h * 3)
  798. return -ENOMEM;
  799. mutex_lock(&ddata->lock);
  800. if (!ddata->enabled) {
  801. r = -ENODEV;
  802. goto err1;
  803. }
  804. size = min((u32)w * h * 3,
  805. ddata->vm.hactive * ddata->vm.vactive * 3);
  806. src->ops->dsi.bus_lock(src);
  807. r = dsicm_wake_up(ddata);
  808. if (r)
  809. goto err2;
  810. /* plen 1 or 2 goes into short packet. until checksum error is fixed,
  811. * use short packets. plen 32 works, but bigger packets seem to cause
  812. * an error. */
  813. if (size % 2)
  814. plen = 1;
  815. else
  816. plen = 2;
  817. dsicm_set_update_window(ddata, x, y, w, h);
  818. r = src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, plen);
  819. if (r)
  820. goto err2;
  821. while (buf_used < size) {
  822. u8 dcs_cmd = first ? 0x2e : 0x3e;
  823. first = 0;
  824. r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd,
  825. buf + buf_used, size - buf_used);
  826. if (r < 0) {
  827. dev_err(dssdev->dev, "read error\n");
  828. goto err3;
  829. }
  830. buf_used += r;
  831. if (r < plen) {
  832. dev_err(&ddata->pdev->dev, "short read\n");
  833. break;
  834. }
  835. if (signal_pending(current)) {
  836. dev_err(&ddata->pdev->dev, "signal pending, "
  837. "aborting memory read\n");
  838. r = -ERESTARTSYS;
  839. goto err3;
  840. }
  841. }
  842. r = buf_used;
  843. err3:
  844. src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, 1);
  845. err2:
  846. src->ops->dsi.bus_unlock(src);
  847. err1:
  848. mutex_unlock(&ddata->lock);
  849. return r;
  850. }
  851. static void dsicm_ulps_work(struct work_struct *work)
  852. {
  853. struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
  854. ulps_work.work);
  855. struct omap_dss_device *dssdev = &ddata->dssdev;
  856. struct omap_dss_device *src = dssdev->src;
  857. mutex_lock(&ddata->lock);
  858. if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !ddata->enabled) {
  859. mutex_unlock(&ddata->lock);
  860. return;
  861. }
  862. src->ops->dsi.bus_lock(src);
  863. dsicm_enter_ulps(ddata);
  864. src->ops->dsi.bus_unlock(src);
  865. mutex_unlock(&ddata->lock);
  866. }
  867. static void dsicm_get_timings(struct omap_dss_device *dssdev,
  868. struct videomode *vm)
  869. {
  870. struct panel_drv_data *ddata = to_panel_data(dssdev);
  871. *vm = ddata->vm;
  872. }
  873. static int dsicm_check_timings(struct omap_dss_device *dssdev,
  874. struct videomode *vm)
  875. {
  876. struct panel_drv_data *ddata = to_panel_data(dssdev);
  877. int ret = 0;
  878. if (vm->hactive != ddata->vm.hactive)
  879. ret = -EINVAL;
  880. if (vm->vactive != ddata->vm.vactive)
  881. ret = -EINVAL;
  882. if (ret) {
  883. dev_warn(dssdev->dev, "wrong resolution: %d x %d",
  884. vm->hactive, vm->vactive);
  885. dev_warn(dssdev->dev, "panel resolution: %d x %d",
  886. ddata->vm.hactive, ddata->vm.vactive);
  887. }
  888. return ret;
  889. }
  890. static void dsicm_get_size(struct omap_dss_device *dssdev,
  891. unsigned int *width, unsigned int *height)
  892. {
  893. struct panel_drv_data *ddata = to_panel_data(dssdev);
  894. *width = ddata->width_mm;
  895. *height = ddata->height_mm;
  896. }
  897. static const struct omap_dss_device_ops dsicm_ops = {
  898. .connect = dsicm_connect,
  899. .disconnect = dsicm_disconnect,
  900. .enable = dsicm_enable,
  901. .disable = dsicm_disable,
  902. .get_timings = dsicm_get_timings,
  903. .check_timings = dsicm_check_timings,
  904. };
  905. static const struct omap_dss_driver dsicm_dss_driver = {
  906. .update = dsicm_update,
  907. .sync = dsicm_sync,
  908. .get_size = dsicm_get_size,
  909. .enable_te = dsicm_enable_te,
  910. .get_te = dsicm_get_te,
  911. .memory_read = dsicm_memory_read,
  912. };
  913. static int dsicm_probe_of(struct platform_device *pdev)
  914. {
  915. struct device_node *node = pdev->dev.of_node;
  916. struct device_node *backlight;
  917. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  918. struct display_timing timing;
  919. int err;
  920. ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
  921. if (IS_ERR(ddata->reset_gpio)) {
  922. err = PTR_ERR(ddata->reset_gpio);
  923. dev_err(&pdev->dev, "reset gpio request failed: %d", err);
  924. return err;
  925. }
  926. ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te",
  927. GPIOD_IN);
  928. if (IS_ERR(ddata->ext_te_gpio)) {
  929. err = PTR_ERR(ddata->ext_te_gpio);
  930. dev_err(&pdev->dev, "TE gpio request failed: %d", err);
  931. return err;
  932. }
  933. err = of_get_display_timing(node, "panel-timing", &timing);
  934. if (!err) {
  935. videomode_from_timing(&timing, &ddata->vm);
  936. if (!ddata->vm.pixelclock)
  937. ddata->vm.pixelclock =
  938. ddata->vm.hactive * ddata->vm.vactive * 60;
  939. } else {
  940. dev_warn(&pdev->dev,
  941. "failed to get video timing, using defaults\n");
  942. }
  943. ddata->width_mm = 0;
  944. of_property_read_u32(node, "width-mm", &ddata->width_mm);
  945. ddata->height_mm = 0;
  946. of_property_read_u32(node, "height-mm", &ddata->height_mm);
  947. ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
  948. if (IS_ERR(ddata->vpnl)) {
  949. err = PTR_ERR(ddata->vpnl);
  950. if (err == -EPROBE_DEFER)
  951. return err;
  952. ddata->vpnl = NULL;
  953. }
  954. ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
  955. if (IS_ERR(ddata->vddi)) {
  956. err = PTR_ERR(ddata->vddi);
  957. if (err == -EPROBE_DEFER)
  958. return err;
  959. ddata->vddi = NULL;
  960. }
  961. backlight = of_parse_phandle(node, "backlight", 0);
  962. if (backlight) {
  963. ddata->extbldev = of_find_backlight_by_node(backlight);
  964. of_node_put(backlight);
  965. if (!ddata->extbldev)
  966. return -EPROBE_DEFER;
  967. } else {
  968. /* assume native backlight support */
  969. ddata->use_dsi_backlight = true;
  970. }
  971. /* TODO: ulps */
  972. return 0;
  973. }
  974. static int dsicm_probe(struct platform_device *pdev)
  975. {
  976. struct panel_drv_data *ddata;
  977. struct backlight_device *bldev = NULL;
  978. struct device *dev = &pdev->dev;
  979. struct omap_dss_device *dssdev;
  980. int r;
  981. dev_dbg(dev, "probe\n");
  982. ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
  983. if (!ddata)
  984. return -ENOMEM;
  985. platform_set_drvdata(pdev, ddata);
  986. ddata->pdev = pdev;
  987. ddata->vm.hactive = 864;
  988. ddata->vm.vactive = 480;
  989. ddata->vm.pixelclock = 864 * 480 * 60;
  990. r = dsicm_probe_of(pdev);
  991. if (r)
  992. return r;
  993. dssdev = &ddata->dssdev;
  994. dssdev->dev = dev;
  995. dssdev->ops = &dsicm_ops;
  996. dssdev->driver = &dsicm_dss_driver;
  997. dssdev->type = OMAP_DISPLAY_TYPE_DSI;
  998. dssdev->owner = THIS_MODULE;
  999. dssdev->of_ports = BIT(0);
  1000. dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
  1001. OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
  1002. omapdss_display_init(dssdev);
  1003. omapdss_device_register(dssdev);
  1004. mutex_init(&ddata->lock);
  1005. atomic_set(&ddata->do_update, 0);
  1006. if (ddata->ext_te_gpio) {
  1007. r = devm_request_irq(dev, gpiod_to_irq(ddata->ext_te_gpio),
  1008. dsicm_te_isr,
  1009. IRQF_TRIGGER_RISING,
  1010. "taal vsync", ddata);
  1011. if (r) {
  1012. dev_err(dev, "IRQ request failed\n");
  1013. goto err_reg;
  1014. }
  1015. INIT_DEFERRABLE_WORK(&ddata->te_timeout_work,
  1016. dsicm_te_timeout_work_callback);
  1017. dev_dbg(dev, "Using GPIO TE\n");
  1018. }
  1019. ddata->workqueue = create_singlethread_workqueue("dsicm_wq");
  1020. if (!ddata->workqueue) {
  1021. r = -ENOMEM;
  1022. goto err_reg;
  1023. }
  1024. INIT_DELAYED_WORK(&ddata->ulps_work, dsicm_ulps_work);
  1025. dsicm_hw_reset(ddata);
  1026. if (ddata->use_dsi_backlight) {
  1027. struct backlight_properties props = { 0 };
  1028. props.max_brightness = 255;
  1029. props.type = BACKLIGHT_RAW;
  1030. bldev = devm_backlight_device_register(dev, dev_name(dev),
  1031. dev, ddata, &dsicm_bl_ops, &props);
  1032. if (IS_ERR(bldev)) {
  1033. r = PTR_ERR(bldev);
  1034. goto err_bl;
  1035. }
  1036. ddata->bldev = bldev;
  1037. }
  1038. r = sysfs_create_group(&dev->kobj, &dsicm_attr_group);
  1039. if (r) {
  1040. dev_err(dev, "failed to create sysfs files\n");
  1041. goto err_bl;
  1042. }
  1043. return 0;
  1044. err_bl:
  1045. destroy_workqueue(ddata->workqueue);
  1046. err_reg:
  1047. if (ddata->extbldev)
  1048. put_device(&ddata->extbldev->dev);
  1049. return r;
  1050. }
  1051. static int __exit dsicm_remove(struct platform_device *pdev)
  1052. {
  1053. struct panel_drv_data *ddata = platform_get_drvdata(pdev);
  1054. struct omap_dss_device *dssdev = &ddata->dssdev;
  1055. dev_dbg(&pdev->dev, "remove\n");
  1056. omapdss_device_unregister(dssdev);
  1057. dsicm_disable(dssdev);
  1058. omapdss_device_disconnect(dssdev->src, dssdev);
  1059. sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);
  1060. if (ddata->extbldev)
  1061. put_device(&ddata->extbldev->dev);
  1062. dsicm_cancel_ulps_work(ddata);
  1063. destroy_workqueue(ddata->workqueue);
  1064. /* reset, to be sure that the panel is in a valid state */
  1065. dsicm_hw_reset(ddata);
  1066. return 0;
  1067. }
  1068. static const struct of_device_id dsicm_of_match[] = {
  1069. { .compatible = "omapdss,panel-dsi-cm", },
  1070. {},
  1071. };
  1072. MODULE_DEVICE_TABLE(of, dsicm_of_match);
  1073. static struct platform_driver dsicm_driver = {
  1074. .probe = dsicm_probe,
  1075. .remove = __exit_p(dsicm_remove),
  1076. .driver = {
  1077. .name = "panel-dsi-cm",
  1078. .of_match_table = dsicm_of_match,
  1079. .suppress_bind_attrs = true,
  1080. },
  1081. };
  1082. module_platform_driver(dsicm_driver);
  1083. MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
  1084. MODULE_DESCRIPTION("Generic DSI Command Mode Panel Driver");
  1085. MODULE_LICENSE("GPL");