panel-innolux-p079zca.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. /*
  2. * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #include <linux/backlight.h>
  10. #include <linux/gpio/consumer.h>
  11. #include <linux/module.h>
  12. #include <linux/of.h>
  13. #include <linux/of_device.h>
  14. #include <linux/regulator/consumer.h>
  15. #include <drm/drmP.h>
  16. #include <drm/drm_crtc.h>
  17. #include <drm/drm_mipi_dsi.h>
  18. #include <drm/drm_panel.h>
  19. #include <video/mipi_display.h>
  20. struct panel_init_cmd {
  21. size_t len;
  22. const char *data;
  23. };
  24. #define _INIT_CMD(...) { \
  25. .len = sizeof((char[]){__VA_ARGS__}), \
  26. .data = (char[]){__VA_ARGS__} }
  27. struct panel_desc {
  28. const struct drm_display_mode *mode;
  29. unsigned int bpc;
  30. struct {
  31. unsigned int width;
  32. unsigned int height;
  33. } size;
  34. unsigned long flags;
  35. enum mipi_dsi_pixel_format format;
  36. const struct panel_init_cmd *init_cmds;
  37. unsigned int lanes;
  38. const char * const *supply_names;
  39. unsigned int num_supplies;
  40. unsigned int sleep_mode_delay;
  41. unsigned int power_down_delay;
  42. };
  43. struct innolux_panel {
  44. struct drm_panel base;
  45. struct mipi_dsi_device *link;
  46. const struct panel_desc *desc;
  47. struct backlight_device *backlight;
  48. struct regulator_bulk_data *supplies;
  49. unsigned int num_supplies;
  50. struct gpio_desc *enable_gpio;
  51. bool prepared;
  52. bool enabled;
  53. };
  54. static inline struct innolux_panel *to_innolux_panel(struct drm_panel *panel)
  55. {
  56. return container_of(panel, struct innolux_panel, base);
  57. }
  58. static int innolux_panel_disable(struct drm_panel *panel)
  59. {
  60. struct innolux_panel *innolux = to_innolux_panel(panel);
  61. if (!innolux->enabled)
  62. return 0;
  63. backlight_disable(innolux->backlight);
  64. innolux->enabled = false;
  65. return 0;
  66. }
  67. static int innolux_panel_unprepare(struct drm_panel *panel)
  68. {
  69. struct innolux_panel *innolux = to_innolux_panel(panel);
  70. int err;
  71. if (!innolux->prepared)
  72. return 0;
  73. err = mipi_dsi_dcs_set_display_off(innolux->link);
  74. if (err < 0)
  75. DRM_DEV_ERROR(panel->dev, "failed to set display off: %d\n",
  76. err);
  77. err = mipi_dsi_dcs_enter_sleep_mode(innolux->link);
  78. if (err < 0) {
  79. DRM_DEV_ERROR(panel->dev, "failed to enter sleep mode: %d\n",
  80. err);
  81. return err;
  82. }
  83. if (innolux->desc->sleep_mode_delay)
  84. msleep(innolux->desc->sleep_mode_delay);
  85. gpiod_set_value_cansleep(innolux->enable_gpio, 0);
  86. if (innolux->desc->power_down_delay)
  87. msleep(innolux->desc->power_down_delay);
  88. err = regulator_bulk_disable(innolux->desc->num_supplies,
  89. innolux->supplies);
  90. if (err < 0)
  91. return err;
  92. innolux->prepared = false;
  93. return 0;
  94. }
  95. static int innolux_panel_prepare(struct drm_panel *panel)
  96. {
  97. struct innolux_panel *innolux = to_innolux_panel(panel);
  98. int err;
  99. if (innolux->prepared)
  100. return 0;
  101. gpiod_set_value_cansleep(innolux->enable_gpio, 0);
  102. err = regulator_bulk_enable(innolux->desc->num_supplies,
  103. innolux->supplies);
  104. if (err < 0)
  105. return err;
  106. /* p079zca: t2 (20ms), p097pfg: t4 (15ms) */
  107. usleep_range(20000, 21000);
  108. gpiod_set_value_cansleep(innolux->enable_gpio, 1);
  109. /* p079zca: t4, p097pfg: t5 */
  110. usleep_range(20000, 21000);
  111. if (innolux->desc->init_cmds) {
  112. const struct panel_init_cmd *cmds =
  113. innolux->desc->init_cmds;
  114. unsigned int i;
  115. for (i = 0; cmds[i].len != 0; i++) {
  116. const struct panel_init_cmd *cmd = &cmds[i];
  117. err = mipi_dsi_generic_write(innolux->link, cmd->data,
  118. cmd->len);
  119. if (err < 0) {
  120. dev_err(panel->dev,
  121. "failed to write command %u\n", i);
  122. goto poweroff;
  123. }
  124. /*
  125. * Included by random guessing, because without this
  126. * (or at least, some delay), the panel sometimes
  127. * didn't appear to pick up the command sequence.
  128. */
  129. err = mipi_dsi_dcs_nop(innolux->link);
  130. if (err < 0) {
  131. dev_err(panel->dev,
  132. "failed to send DCS nop: %d\n", err);
  133. goto poweroff;
  134. }
  135. }
  136. }
  137. err = mipi_dsi_dcs_exit_sleep_mode(innolux->link);
  138. if (err < 0) {
  139. DRM_DEV_ERROR(panel->dev, "failed to exit sleep mode: %d\n",
  140. err);
  141. goto poweroff;
  142. }
  143. /* T6: 120ms - 1000ms*/
  144. msleep(120);
  145. err = mipi_dsi_dcs_set_display_on(innolux->link);
  146. if (err < 0) {
  147. DRM_DEV_ERROR(panel->dev, "failed to set display on: %d\n",
  148. err);
  149. goto poweroff;
  150. }
  151. /* T7: 5ms */
  152. usleep_range(5000, 6000);
  153. innolux->prepared = true;
  154. return 0;
  155. poweroff:
  156. gpiod_set_value_cansleep(innolux->enable_gpio, 0);
  157. regulator_bulk_disable(innolux->desc->num_supplies, innolux->supplies);
  158. return err;
  159. }
  160. static int innolux_panel_enable(struct drm_panel *panel)
  161. {
  162. struct innolux_panel *innolux = to_innolux_panel(panel);
  163. int ret;
  164. if (innolux->enabled)
  165. return 0;
  166. ret = backlight_enable(innolux->backlight);
  167. if (ret) {
  168. DRM_DEV_ERROR(panel->drm->dev,
  169. "Failed to enable backlight %d\n", ret);
  170. return ret;
  171. }
  172. innolux->enabled = true;
  173. return 0;
  174. }
  175. static const char * const innolux_p079zca_supply_names[] = {
  176. "power",
  177. };
  178. static const struct drm_display_mode innolux_p079zca_mode = {
  179. .clock = 56900,
  180. .hdisplay = 768,
  181. .hsync_start = 768 + 40,
  182. .hsync_end = 768 + 40 + 40,
  183. .htotal = 768 + 40 + 40 + 40,
  184. .vdisplay = 1024,
  185. .vsync_start = 1024 + 20,
  186. .vsync_end = 1024 + 20 + 4,
  187. .vtotal = 1024 + 20 + 4 + 20,
  188. .vrefresh = 60,
  189. };
  190. static const struct panel_desc innolux_p079zca_panel_desc = {
  191. .mode = &innolux_p079zca_mode,
  192. .bpc = 8,
  193. .size = {
  194. .width = 120,
  195. .height = 160,
  196. },
  197. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
  198. MIPI_DSI_MODE_LPM,
  199. .format = MIPI_DSI_FMT_RGB888,
  200. .lanes = 4,
  201. .supply_names = innolux_p079zca_supply_names,
  202. .num_supplies = ARRAY_SIZE(innolux_p079zca_supply_names),
  203. .power_down_delay = 80, /* T8: 80ms - 1000ms */
  204. };
  205. static const char * const innolux_p097pfg_supply_names[] = {
  206. "avdd",
  207. "avee",
  208. };
  209. static const struct drm_display_mode innolux_p097pfg_mode = {
  210. .clock = 229000,
  211. .hdisplay = 1536,
  212. .hsync_start = 1536 + 100,
  213. .hsync_end = 1536 + 100 + 24,
  214. .htotal = 1536 + 100 + 24 + 100,
  215. .vdisplay = 2048,
  216. .vsync_start = 2048 + 100,
  217. .vsync_end = 2048 + 100 + 2,
  218. .vtotal = 2048 + 100 + 2 + 18,
  219. .vrefresh = 60,
  220. };
  221. /*
  222. * Display manufacturer failed to provide init sequencing according to
  223. * https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/+/892065/
  224. * so the init sequence stems from a register dump of a working panel.
  225. */
  226. static const struct panel_init_cmd innolux_p097pfg_init_cmds[] = {
  227. /* page 0 */
  228. _INIT_CMD(0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00),
  229. _INIT_CMD(0xB1, 0xE8, 0x11),
  230. _INIT_CMD(0xB2, 0x25, 0x02),
  231. _INIT_CMD(0xB5, 0x08, 0x00),
  232. _INIT_CMD(0xBC, 0x0F, 0x00),
  233. _INIT_CMD(0xB8, 0x03, 0x06, 0x00, 0x00),
  234. _INIT_CMD(0xBD, 0x01, 0x90, 0x14, 0x14),
  235. _INIT_CMD(0x6F, 0x01),
  236. _INIT_CMD(0xC0, 0x03),
  237. _INIT_CMD(0x6F, 0x02),
  238. _INIT_CMD(0xC1, 0x0D),
  239. _INIT_CMD(0xD9, 0x01, 0x09, 0x70),
  240. _INIT_CMD(0xC5, 0x12, 0x21, 0x00),
  241. _INIT_CMD(0xBB, 0x93, 0x93),
  242. /* page 1 */
  243. _INIT_CMD(0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01),
  244. _INIT_CMD(0xB3, 0x3C, 0x3C),
  245. _INIT_CMD(0xB4, 0x0F, 0x0F),
  246. _INIT_CMD(0xB9, 0x45, 0x45),
  247. _INIT_CMD(0xBA, 0x14, 0x14),
  248. _INIT_CMD(0xCA, 0x02),
  249. _INIT_CMD(0xCE, 0x04),
  250. _INIT_CMD(0xC3, 0x9B, 0x9B),
  251. _INIT_CMD(0xD8, 0xC0, 0x03),
  252. _INIT_CMD(0xBC, 0x82, 0x01),
  253. _INIT_CMD(0xBD, 0x9E, 0x01),
  254. /* page 2 */
  255. _INIT_CMD(0xF0, 0x55, 0xAA, 0x52, 0x08, 0x02),
  256. _INIT_CMD(0xB0, 0x82),
  257. _INIT_CMD(0xD1, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x82, 0x00, 0xA5,
  258. 0x00, 0xC1, 0x00, 0xEA, 0x01, 0x0D, 0x01, 0x40),
  259. _INIT_CMD(0xD2, 0x01, 0x6A, 0x01, 0xA8, 0x01, 0xDC, 0x02, 0x29,
  260. 0x02, 0x67, 0x02, 0x68, 0x02, 0xA8, 0x02, 0xF0),
  261. _INIT_CMD(0xD3, 0x03, 0x19, 0x03, 0x49, 0x03, 0x67, 0x03, 0x8C,
  262. 0x03, 0xA6, 0x03, 0xC7, 0x03, 0xDE, 0x03, 0xEC),
  263. _INIT_CMD(0xD4, 0x03, 0xFF, 0x03, 0xFF),
  264. _INIT_CMD(0xE0, 0x00, 0x00, 0x00, 0x86, 0x00, 0xC5, 0x00, 0xE5,
  265. 0x00, 0xFF, 0x01, 0x26, 0x01, 0x45, 0x01, 0x75),
  266. _INIT_CMD(0xE1, 0x01, 0x9C, 0x01, 0xD5, 0x02, 0x05, 0x02, 0x4D,
  267. 0x02, 0x86, 0x02, 0x87, 0x02, 0xC3, 0x03, 0x03),
  268. _INIT_CMD(0xE2, 0x03, 0x2A, 0x03, 0x56, 0x03, 0x72, 0x03, 0x94,
  269. 0x03, 0xAC, 0x03, 0xCB, 0x03, 0xE0, 0x03, 0xED),
  270. _INIT_CMD(0xE3, 0x03, 0xFF, 0x03, 0xFF),
  271. /* page 3 */
  272. _INIT_CMD(0xF0, 0x55, 0xAA, 0x52, 0x08, 0x03),
  273. _INIT_CMD(0xB0, 0x00, 0x00, 0x00, 0x00),
  274. _INIT_CMD(0xB1, 0x00, 0x00, 0x00, 0x00),
  275. _INIT_CMD(0xB2, 0x00, 0x00, 0x06, 0x04, 0x01, 0x40, 0x85),
  276. _INIT_CMD(0xB3, 0x10, 0x07, 0xFC, 0x04, 0x01, 0x40, 0x80),
  277. _INIT_CMD(0xB6, 0xF0, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01,
  278. 0x40, 0x80),
  279. _INIT_CMD(0xBA, 0xC5, 0x07, 0x00, 0x04, 0x11, 0x25, 0x8C),
  280. _INIT_CMD(0xBB, 0xC5, 0x07, 0x00, 0x03, 0x11, 0x25, 0x8C),
  281. _INIT_CMD(0xC0, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x80, 0x80),
  282. _INIT_CMD(0xC1, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x80, 0x80),
  283. _INIT_CMD(0xC4, 0x00, 0x00),
  284. _INIT_CMD(0xEF, 0x41),
  285. /* page 4 */
  286. _INIT_CMD(0xF0, 0x55, 0xAA, 0x52, 0x08, 0x04),
  287. _INIT_CMD(0xEC, 0x4C),
  288. /* page 5 */
  289. _INIT_CMD(0xF0, 0x55, 0xAA, 0x52, 0x08, 0x05),
  290. _INIT_CMD(0xB0, 0x13, 0x03, 0x03, 0x01),
  291. _INIT_CMD(0xB1, 0x30, 0x00),
  292. _INIT_CMD(0xB2, 0x02, 0x02, 0x00),
  293. _INIT_CMD(0xB3, 0x82, 0x23, 0x82, 0x9D),
  294. _INIT_CMD(0xB4, 0xC5, 0x75, 0x24, 0x57),
  295. _INIT_CMD(0xB5, 0x00, 0xD4, 0x72, 0x11, 0x11, 0xAB, 0x0A),
  296. _INIT_CMD(0xB6, 0x00, 0x00, 0xD5, 0x72, 0x24, 0x56),
  297. _INIT_CMD(0xB7, 0x5C, 0xDC, 0x5C, 0x5C),
  298. _INIT_CMD(0xB9, 0x0C, 0x00, 0x00, 0x01, 0x00),
  299. _INIT_CMD(0xC0, 0x75, 0x11, 0x11, 0x54, 0x05),
  300. _INIT_CMD(0xC6, 0x00, 0x00, 0x00, 0x00),
  301. _INIT_CMD(0xD0, 0x00, 0x48, 0x08, 0x00, 0x00),
  302. _INIT_CMD(0xD1, 0x00, 0x48, 0x09, 0x00, 0x00),
  303. /* page 6 */
  304. _INIT_CMD(0xF0, 0x55, 0xAA, 0x52, 0x08, 0x06),
  305. _INIT_CMD(0xB0, 0x02, 0x32, 0x32, 0x08, 0x2F),
  306. _INIT_CMD(0xB1, 0x2E, 0x15, 0x14, 0x13, 0x12),
  307. _INIT_CMD(0xB2, 0x11, 0x10, 0x00, 0x3D, 0x3D),
  308. _INIT_CMD(0xB3, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D),
  309. _INIT_CMD(0xB4, 0x3D, 0x32),
  310. _INIT_CMD(0xB5, 0x03, 0x32, 0x32, 0x09, 0x2F),
  311. _INIT_CMD(0xB6, 0x2E, 0x1B, 0x1A, 0x19, 0x18),
  312. _INIT_CMD(0xB7, 0x17, 0x16, 0x01, 0x3D, 0x3D),
  313. _INIT_CMD(0xB8, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D),
  314. _INIT_CMD(0xB9, 0x3D, 0x32),
  315. _INIT_CMD(0xC0, 0x01, 0x32, 0x32, 0x09, 0x2F),
  316. _INIT_CMD(0xC1, 0x2E, 0x1A, 0x1B, 0x16, 0x17),
  317. _INIT_CMD(0xC2, 0x18, 0x19, 0x03, 0x3D, 0x3D),
  318. _INIT_CMD(0xC3, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D),
  319. _INIT_CMD(0xC4, 0x3D, 0x32),
  320. _INIT_CMD(0xC5, 0x00, 0x32, 0x32, 0x08, 0x2F),
  321. _INIT_CMD(0xC6, 0x2E, 0x14, 0x15, 0x10, 0x11),
  322. _INIT_CMD(0xC7, 0x12, 0x13, 0x02, 0x3D, 0x3D),
  323. _INIT_CMD(0xC8, 0x3D, 0x3D, 0x3D, 0x3D, 0x3D),
  324. _INIT_CMD(0xC9, 0x3D, 0x32),
  325. {},
  326. };
  327. static const struct panel_desc innolux_p097pfg_panel_desc = {
  328. .mode = &innolux_p097pfg_mode,
  329. .bpc = 8,
  330. .size = {
  331. .width = 147,
  332. .height = 196,
  333. },
  334. .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
  335. MIPI_DSI_MODE_LPM,
  336. .format = MIPI_DSI_FMT_RGB888,
  337. .init_cmds = innolux_p097pfg_init_cmds,
  338. .lanes = 4,
  339. .supply_names = innolux_p097pfg_supply_names,
  340. .num_supplies = ARRAY_SIZE(innolux_p097pfg_supply_names),
  341. .sleep_mode_delay = 100, /* T15 */
  342. };
  343. static int innolux_panel_get_modes(struct drm_panel *panel)
  344. {
  345. struct innolux_panel *innolux = to_innolux_panel(panel);
  346. const struct drm_display_mode *m = innolux->desc->mode;
  347. struct drm_display_mode *mode;
  348. mode = drm_mode_duplicate(panel->drm, m);
  349. if (!mode) {
  350. DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
  351. m->hdisplay, m->vdisplay, m->vrefresh);
  352. return -ENOMEM;
  353. }
  354. drm_mode_set_name(mode);
  355. drm_mode_probed_add(panel->connector, mode);
  356. panel->connector->display_info.width_mm =
  357. innolux->desc->size.width;
  358. panel->connector->display_info.height_mm =
  359. innolux->desc->size.height;
  360. panel->connector->display_info.bpc = innolux->desc->bpc;
  361. return 1;
  362. }
  363. static const struct drm_panel_funcs innolux_panel_funcs = {
  364. .disable = innolux_panel_disable,
  365. .unprepare = innolux_panel_unprepare,
  366. .prepare = innolux_panel_prepare,
  367. .enable = innolux_panel_enable,
  368. .get_modes = innolux_panel_get_modes,
  369. };
  370. static const struct of_device_id innolux_of_match[] = {
  371. { .compatible = "innolux,p079zca",
  372. .data = &innolux_p079zca_panel_desc
  373. },
  374. { .compatible = "innolux,p097pfg",
  375. .data = &innolux_p097pfg_panel_desc
  376. },
  377. { }
  378. };
  379. MODULE_DEVICE_TABLE(of, innolux_of_match);
  380. static int innolux_panel_add(struct mipi_dsi_device *dsi,
  381. const struct panel_desc *desc)
  382. {
  383. struct innolux_panel *innolux;
  384. struct device *dev = &dsi->dev;
  385. int err, i;
  386. innolux = devm_kzalloc(dev, sizeof(*innolux), GFP_KERNEL);
  387. if (!innolux)
  388. return -ENOMEM;
  389. innolux->desc = desc;
  390. innolux->supplies = devm_kcalloc(dev, desc->num_supplies,
  391. sizeof(*innolux->supplies),
  392. GFP_KERNEL);
  393. if (!innolux->supplies)
  394. return -ENOMEM;
  395. for (i = 0; i < desc->num_supplies; i++)
  396. innolux->supplies[i].supply = desc->supply_names[i];
  397. err = devm_regulator_bulk_get(dev, desc->num_supplies,
  398. innolux->supplies);
  399. if (err < 0)
  400. return err;
  401. innolux->enable_gpio = devm_gpiod_get_optional(dev, "enable",
  402. GPIOD_OUT_HIGH);
  403. if (IS_ERR(innolux->enable_gpio)) {
  404. err = PTR_ERR(innolux->enable_gpio);
  405. dev_dbg(dev, "failed to get enable gpio: %d\n", err);
  406. innolux->enable_gpio = NULL;
  407. }
  408. innolux->backlight = devm_of_find_backlight(dev);
  409. if (IS_ERR(innolux->backlight))
  410. return PTR_ERR(innolux->backlight);
  411. drm_panel_init(&innolux->base);
  412. innolux->base.funcs = &innolux_panel_funcs;
  413. innolux->base.dev = dev;
  414. err = drm_panel_add(&innolux->base);
  415. if (err < 0)
  416. return err;
  417. mipi_dsi_set_drvdata(dsi, innolux);
  418. innolux->link = dsi;
  419. return 0;
  420. }
  421. static void innolux_panel_del(struct innolux_panel *innolux)
  422. {
  423. if (innolux->base.dev)
  424. drm_panel_remove(&innolux->base);
  425. }
  426. static int innolux_panel_probe(struct mipi_dsi_device *dsi)
  427. {
  428. const struct panel_desc *desc;
  429. int err;
  430. desc = of_device_get_match_data(&dsi->dev);
  431. dsi->mode_flags = desc->flags;
  432. dsi->format = desc->format;
  433. dsi->lanes = desc->lanes;
  434. err = innolux_panel_add(dsi, desc);
  435. if (err < 0)
  436. return err;
  437. return mipi_dsi_attach(dsi);
  438. }
  439. static int innolux_panel_remove(struct mipi_dsi_device *dsi)
  440. {
  441. struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi);
  442. int err;
  443. err = innolux_panel_unprepare(&innolux->base);
  444. if (err < 0)
  445. DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
  446. err);
  447. err = innolux_panel_disable(&innolux->base);
  448. if (err < 0)
  449. DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
  450. err = mipi_dsi_detach(dsi);
  451. if (err < 0)
  452. DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n",
  453. err);
  454. innolux_panel_del(innolux);
  455. return 0;
  456. }
  457. static void innolux_panel_shutdown(struct mipi_dsi_device *dsi)
  458. {
  459. struct innolux_panel *innolux = mipi_dsi_get_drvdata(dsi);
  460. innolux_panel_unprepare(&innolux->base);
  461. innolux_panel_disable(&innolux->base);
  462. }
  463. static struct mipi_dsi_driver innolux_panel_driver = {
  464. .driver = {
  465. .name = "panel-innolux-p079zca",
  466. .of_match_table = innolux_of_match,
  467. },
  468. .probe = innolux_panel_probe,
  469. .remove = innolux_panel_remove,
  470. .shutdown = innolux_panel_shutdown,
  471. };
  472. module_mipi_dsi_driver(innolux_panel_driver);
  473. MODULE_AUTHOR("Chris Zhong <zyw@rock-chips.com>");
  474. MODULE_AUTHOR("Lin Huang <hl@rock-chips.com>");
  475. MODULE_DESCRIPTION("Innolux P079ZCA panel driver");
  476. MODULE_LICENSE("GPL v2");