panel-orisetech-otm8009a.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) STMicroelectronics SA 2017
  4. *
  5. * Authors: Philippe Cornu <philippe.cornu@st.com>
  6. * Yannick Fertre <yannick.fertre@st.com>
  7. */
  8. #include <linux/backlight.h>
  9. #include <linux/delay.h>
  10. #include <linux/gpio/consumer.h>
  11. #include <linux/module.h>
  12. #include <linux/regulator/consumer.h>
  13. #include <video/mipi_display.h>
  14. #include <drm/drm_mipi_dsi.h>
  15. #include <drm/drm_modes.h>
  16. #include <drm/drm_panel.h>
  17. #define OTM8009A_BACKLIGHT_DEFAULT 240
  18. #define OTM8009A_BACKLIGHT_MAX 255
  19. /* Manufacturer Command Set */
  20. #define MCS_ADRSFT 0x0000 /* Address Shift Function */
  21. #define MCS_PANSET 0xB3A6 /* Panel Type Setting */
  22. #define MCS_SD_CTRL 0xC0A2 /* Source Driver Timing Setting */
  23. #define MCS_P_DRV_M 0xC0B4 /* Panel Driving Mode */
  24. #define MCS_OSC_ADJ 0xC181 /* Oscillator Adjustment for Idle/Normal mode */
  25. #define MCS_RGB_VID_SET 0xC1A1 /* RGB Video Mode Setting */
  26. #define MCS_SD_PCH_CTRL 0xC480 /* Source Driver Precharge Control */
  27. #define MCS_NO_DOC1 0xC48A /* Command not documented */
  28. #define MCS_PWR_CTRL1 0xC580 /* Power Control Setting 1 */
  29. #define MCS_PWR_CTRL2 0xC590 /* Power Control Setting 2 for Normal Mode */
  30. #define MCS_PWR_CTRL4 0xC5B0 /* Power Control Setting 4 for DC Voltage */
  31. #define MCS_PANCTRLSET1 0xCB80 /* Panel Control Setting 1 */
  32. #define MCS_PANCTRLSET2 0xCB90 /* Panel Control Setting 2 */
  33. #define MCS_PANCTRLSET3 0xCBA0 /* Panel Control Setting 3 */
  34. #define MCS_PANCTRLSET4 0xCBB0 /* Panel Control Setting 4 */
  35. #define MCS_PANCTRLSET5 0xCBC0 /* Panel Control Setting 5 */
  36. #define MCS_PANCTRLSET6 0xCBD0 /* Panel Control Setting 6 */
  37. #define MCS_PANCTRLSET7 0xCBE0 /* Panel Control Setting 7 */
  38. #define MCS_PANCTRLSET8 0xCBF0 /* Panel Control Setting 8 */
  39. #define MCS_PANU2D1 0xCC80 /* Panel U2D Setting 1 */
  40. #define MCS_PANU2D2 0xCC90 /* Panel U2D Setting 2 */
  41. #define MCS_PANU2D3 0xCCA0 /* Panel U2D Setting 3 */
  42. #define MCS_PAND2U1 0xCCB0 /* Panel D2U Setting 1 */
  43. #define MCS_PAND2U2 0xCCC0 /* Panel D2U Setting 2 */
  44. #define MCS_PAND2U3 0xCCD0 /* Panel D2U Setting 3 */
  45. #define MCS_GOAVST 0xCE80 /* GOA VST Setting */
  46. #define MCS_GOACLKA1 0xCEA0 /* GOA CLKA1 Setting */
  47. #define MCS_GOACLKA3 0xCEB0 /* GOA CLKA3 Setting */
  48. #define MCS_GOAECLK 0xCFC0 /* GOA ECLK Setting */
  49. #define MCS_NO_DOC2 0xCFD0 /* Command not documented */
  50. #define MCS_GVDDSET 0xD800 /* GVDD/NGVDD */
  51. #define MCS_VCOMDC 0xD900 /* VCOM Voltage Setting */
  52. #define MCS_GMCT2_2P 0xE100 /* Gamma Correction 2.2+ Setting */
  53. #define MCS_GMCT2_2N 0xE200 /* Gamma Correction 2.2- Setting */
  54. #define MCS_NO_DOC3 0xF5B6 /* Command not documented */
  55. #define MCS_CMD2_ENA1 0xFF00 /* Enable Access Command2 "CMD2" */
  56. #define MCS_CMD2_ENA2 0xFF80 /* Enable Access Orise Command2 */
  57. #define OTM8009A_HDISPLAY 480
  58. #define OTM8009A_VDISPLAY 800
  59. struct otm8009a {
  60. struct device *dev;
  61. struct drm_panel panel;
  62. struct backlight_device *bl_dev;
  63. struct gpio_desc *reset_gpio;
  64. struct regulator *supply;
  65. bool prepared;
  66. };
  67. static const struct drm_display_mode modes[] = {
  68. { /* 50 Hz, preferred */
  69. .clock = 29700,
  70. .hdisplay = 480,
  71. .hsync_start = 480 + 98,
  72. .hsync_end = 480 + 98 + 32,
  73. .htotal = 480 + 98 + 32 + 98,
  74. .vdisplay = 800,
  75. .vsync_start = 800 + 15,
  76. .vsync_end = 800 + 15 + 10,
  77. .vtotal = 800 + 15 + 10 + 14,
  78. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  79. .width_mm = 52,
  80. .height_mm = 86,
  81. },
  82. { /* 60 Hz */
  83. .clock = 33000,
  84. .hdisplay = 480,
  85. .hsync_start = 480 + 70,
  86. .hsync_end = 480 + 70 + 32,
  87. .htotal = 480 + 70 + 32 + 72,
  88. .vdisplay = 800,
  89. .vsync_start = 800 + 15,
  90. .vsync_end = 800 + 15 + 10,
  91. .vtotal = 800 + 15 + 10 + 16,
  92. .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
  93. .width_mm = 52,
  94. .height_mm = 86,
  95. },
  96. };
  97. static inline struct otm8009a *panel_to_otm8009a(struct drm_panel *panel)
  98. {
  99. return container_of(panel, struct otm8009a, panel);
  100. }
  101. static void otm8009a_dcs_write_buf(struct otm8009a *ctx, const void *data,
  102. size_t len)
  103. {
  104. struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
  105. if (mipi_dsi_dcs_write_buffer(dsi, data, len) < 0)
  106. dev_warn(ctx->dev, "mipi dsi dcs write buffer failed\n");
  107. }
  108. #define dcs_write_seq(ctx, seq...) \
  109. ({ \
  110. static const u8 d[] = { seq }; \
  111. otm8009a_dcs_write_buf(ctx, d, ARRAY_SIZE(d)); \
  112. })
  113. #define dcs_write_cmd_at(ctx, cmd, seq...) \
  114. ({ \
  115. dcs_write_seq(ctx, MCS_ADRSFT, (cmd) & 0xFF); \
  116. dcs_write_seq(ctx, (cmd) >> 8, seq); \
  117. })
  118. static int otm8009a_init_sequence(struct otm8009a *ctx)
  119. {
  120. struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
  121. int ret;
  122. /* Enter CMD2 */
  123. dcs_write_cmd_at(ctx, MCS_CMD2_ENA1, 0x80, 0x09, 0x01);
  124. /* Enter Orise Command2 */
  125. dcs_write_cmd_at(ctx, MCS_CMD2_ENA2, 0x80, 0x09);
  126. dcs_write_cmd_at(ctx, MCS_SD_PCH_CTRL, 0x30);
  127. mdelay(10);
  128. dcs_write_cmd_at(ctx, MCS_NO_DOC1, 0x40);
  129. mdelay(10);
  130. dcs_write_cmd_at(ctx, MCS_PWR_CTRL4 + 1, 0xA9);
  131. dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 1, 0x34);
  132. dcs_write_cmd_at(ctx, MCS_P_DRV_M, 0x50);
  133. dcs_write_cmd_at(ctx, MCS_VCOMDC, 0x4E);
  134. dcs_write_cmd_at(ctx, MCS_OSC_ADJ, 0x66); /* 65Hz */
  135. dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 2, 0x01);
  136. dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 5, 0x34);
  137. dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 4, 0x33);
  138. dcs_write_cmd_at(ctx, MCS_GVDDSET, 0x79, 0x79);
  139. dcs_write_cmd_at(ctx, MCS_SD_CTRL + 1, 0x1B);
  140. dcs_write_cmd_at(ctx, MCS_PWR_CTRL1 + 2, 0x83);
  141. dcs_write_cmd_at(ctx, MCS_SD_PCH_CTRL + 1, 0x83);
  142. dcs_write_cmd_at(ctx, MCS_RGB_VID_SET, 0x0E);
  143. dcs_write_cmd_at(ctx, MCS_PANSET, 0x00, 0x01);
  144. dcs_write_cmd_at(ctx, MCS_GOAVST, 0x85, 0x01, 0x00, 0x84, 0x01, 0x00);
  145. dcs_write_cmd_at(ctx, MCS_GOACLKA1, 0x18, 0x04, 0x03, 0x39, 0x00, 0x00,
  146. 0x00, 0x18, 0x03, 0x03, 0x3A, 0x00, 0x00, 0x00);
  147. dcs_write_cmd_at(ctx, MCS_GOACLKA3, 0x18, 0x02, 0x03, 0x3B, 0x00, 0x00,
  148. 0x00, 0x18, 0x01, 0x03, 0x3C, 0x00, 0x00, 0x00);
  149. dcs_write_cmd_at(ctx, MCS_GOAECLK, 0x01, 0x01, 0x20, 0x20, 0x00, 0x00,
  150. 0x01, 0x02, 0x00, 0x00);
  151. dcs_write_cmd_at(ctx, MCS_NO_DOC2, 0x00);
  152. dcs_write_cmd_at(ctx, MCS_PANCTRLSET1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  153. dcs_write_cmd_at(ctx, MCS_PANCTRLSET2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  154. 0, 0, 0, 0, 0);
  155. dcs_write_cmd_at(ctx, MCS_PANCTRLSET3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  156. 0, 0, 0, 0, 0);
  157. dcs_write_cmd_at(ctx, MCS_PANCTRLSET4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  158. dcs_write_cmd_at(ctx, MCS_PANCTRLSET5, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0,
  159. 0, 0, 0, 0, 0);
  160. dcs_write_cmd_at(ctx, MCS_PANCTRLSET6, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4,
  161. 4, 0, 0, 0, 0);
  162. dcs_write_cmd_at(ctx, MCS_PANCTRLSET7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  163. dcs_write_cmd_at(ctx, MCS_PANCTRLSET8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  164. 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
  165. dcs_write_cmd_at(ctx, MCS_PANU2D1, 0x00, 0x26, 0x09, 0x0B, 0x01, 0x25,
  166. 0x00, 0x00, 0x00, 0x00);
  167. dcs_write_cmd_at(ctx, MCS_PANU2D2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  168. 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x0A, 0x0C, 0x02);
  169. dcs_write_cmd_at(ctx, MCS_PANU2D3, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00,
  170. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
  171. dcs_write_cmd_at(ctx, MCS_PAND2U1, 0x00, 0x25, 0x0C, 0x0A, 0x02, 0x26,
  172. 0x00, 0x00, 0x00, 0x00);
  173. dcs_write_cmd_at(ctx, MCS_PAND2U2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  174. 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x0B, 0x09, 0x01);
  175. dcs_write_cmd_at(ctx, MCS_PAND2U3, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00,
  176. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
  177. dcs_write_cmd_at(ctx, MCS_PWR_CTRL1 + 1, 0x66);
  178. dcs_write_cmd_at(ctx, MCS_NO_DOC3, 0x06);
  179. dcs_write_cmd_at(ctx, MCS_GMCT2_2P, 0x00, 0x09, 0x0F, 0x0E, 0x07, 0x10,
  180. 0x0B, 0x0A, 0x04, 0x07, 0x0B, 0x08, 0x0F, 0x10, 0x0A,
  181. 0x01);
  182. dcs_write_cmd_at(ctx, MCS_GMCT2_2N, 0x00, 0x09, 0x0F, 0x0E, 0x07, 0x10,
  183. 0x0B, 0x0A, 0x04, 0x07, 0x0B, 0x08, 0x0F, 0x10, 0x0A,
  184. 0x01);
  185. /* Exit CMD2 */
  186. dcs_write_cmd_at(ctx, MCS_CMD2_ENA1, 0xFF, 0xFF, 0xFF);
  187. ret = mipi_dsi_dcs_nop(dsi);
  188. if (ret)
  189. return ret;
  190. ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
  191. if (ret)
  192. return ret;
  193. /* Wait for sleep out exit */
  194. mdelay(120);
  195. /* Default portrait 480x800 rgb24 */
  196. dcs_write_seq(ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
  197. ret = mipi_dsi_dcs_set_column_address(dsi, 0, OTM8009A_HDISPLAY - 1);
  198. if (ret)
  199. return ret;
  200. ret = mipi_dsi_dcs_set_page_address(dsi, 0, OTM8009A_VDISPLAY - 1);
  201. if (ret)
  202. return ret;
  203. /* See otm8009a driver documentation for pixel format descriptions */
  204. ret = mipi_dsi_dcs_set_pixel_format(dsi, MIPI_DCS_PIXEL_FMT_24BIT |
  205. MIPI_DCS_PIXEL_FMT_24BIT << 4);
  206. if (ret)
  207. return ret;
  208. /* Disable CABC feature */
  209. dcs_write_seq(ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00);
  210. ret = mipi_dsi_dcs_set_display_on(dsi);
  211. if (ret)
  212. return ret;
  213. ret = mipi_dsi_dcs_nop(dsi);
  214. if (ret)
  215. return ret;
  216. /* Send Command GRAM memory write (no parameters) */
  217. dcs_write_seq(ctx, MIPI_DCS_WRITE_MEMORY_START);
  218. /* Wait a short while to let the panel be ready before the 1st frame */
  219. mdelay(10);
  220. return 0;
  221. }
  222. static int otm8009a_disable(struct drm_panel *panel)
  223. {
  224. struct otm8009a *ctx = panel_to_otm8009a(panel);
  225. struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
  226. int ret;
  227. backlight_disable(ctx->bl_dev);
  228. ret = mipi_dsi_dcs_set_display_off(dsi);
  229. if (ret)
  230. return ret;
  231. ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
  232. if (ret)
  233. return ret;
  234. msleep(120);
  235. return 0;
  236. }
  237. static int otm8009a_unprepare(struct drm_panel *panel)
  238. {
  239. struct otm8009a *ctx = panel_to_otm8009a(panel);
  240. if (ctx->reset_gpio) {
  241. gpiod_set_value_cansleep(ctx->reset_gpio, 1);
  242. msleep(20);
  243. }
  244. regulator_disable(ctx->supply);
  245. ctx->prepared = false;
  246. return 0;
  247. }
  248. static int otm8009a_prepare(struct drm_panel *panel)
  249. {
  250. struct otm8009a *ctx = panel_to_otm8009a(panel);
  251. int ret;
  252. ret = regulator_enable(ctx->supply);
  253. if (ret < 0) {
  254. dev_err(panel->dev, "failed to enable supply: %d\n", ret);
  255. return ret;
  256. }
  257. if (ctx->reset_gpio) {
  258. gpiod_set_value_cansleep(ctx->reset_gpio, 0);
  259. gpiod_set_value_cansleep(ctx->reset_gpio, 1);
  260. msleep(20);
  261. gpiod_set_value_cansleep(ctx->reset_gpio, 0);
  262. msleep(100);
  263. }
  264. ret = otm8009a_init_sequence(ctx);
  265. if (ret)
  266. return ret;
  267. ctx->prepared = true;
  268. return 0;
  269. }
  270. static int otm8009a_enable(struct drm_panel *panel)
  271. {
  272. struct otm8009a *ctx = panel_to_otm8009a(panel);
  273. backlight_enable(ctx->bl_dev);
  274. return 0;
  275. }
  276. static int otm8009a_get_modes(struct drm_panel *panel,
  277. struct drm_connector *connector)
  278. {
  279. struct drm_display_mode *mode;
  280. unsigned int num_modes = ARRAY_SIZE(modes);
  281. unsigned int i;
  282. for (i = 0; i < num_modes; i++) {
  283. mode = drm_mode_duplicate(connector->dev, &modes[i]);
  284. if (!mode) {
  285. dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
  286. modes[i].hdisplay,
  287. modes[i].vdisplay,
  288. drm_mode_vrefresh(&modes[i]));
  289. return -ENOMEM;
  290. }
  291. mode->type = DRM_MODE_TYPE_DRIVER;
  292. /* Setting first mode as preferred */
  293. if (!i)
  294. mode->type |= DRM_MODE_TYPE_PREFERRED;
  295. drm_mode_set_name(mode);
  296. drm_mode_probed_add(connector, mode);
  297. }
  298. connector->display_info.width_mm = mode->width_mm;
  299. connector->display_info.height_mm = mode->height_mm;
  300. return num_modes;
  301. }
  302. static const struct drm_panel_funcs otm8009a_drm_funcs = {
  303. .disable = otm8009a_disable,
  304. .unprepare = otm8009a_unprepare,
  305. .prepare = otm8009a_prepare,
  306. .enable = otm8009a_enable,
  307. .get_modes = otm8009a_get_modes,
  308. };
  309. /*
  310. * DSI-BASED BACKLIGHT
  311. */
  312. static int otm8009a_backlight_update_status(struct backlight_device *bd)
  313. {
  314. struct otm8009a *ctx = bl_get_data(bd);
  315. u8 data[2];
  316. if (!ctx->prepared) {
  317. dev_dbg(&bd->dev, "lcd not ready yet for setting its backlight!\n");
  318. return -ENXIO;
  319. }
  320. if (bd->props.power <= BACKLIGHT_POWER_REDUCED) {
  321. /* Power on the backlight with the requested brightness
  322. * Note We can not use mipi_dsi_dcs_set_display_brightness()
  323. * as otm8009a driver support only 8-bit brightness (1 param).
  324. */
  325. data[0] = MIPI_DCS_SET_DISPLAY_BRIGHTNESS;
  326. data[1] = bd->props.brightness;
  327. otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
  328. /* set Brightness Control & Backlight on */
  329. data[1] = 0x24;
  330. } else {
  331. /* Power off the backlight: set Brightness Control & Bl off */
  332. data[1] = 0;
  333. }
  334. /* Update Brightness Control & Backlight */
  335. data[0] = MIPI_DCS_WRITE_CONTROL_DISPLAY;
  336. otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
  337. return 0;
  338. }
  339. static const struct backlight_ops otm8009a_backlight_ops = {
  340. .update_status = otm8009a_backlight_update_status,
  341. };
  342. static int otm8009a_probe(struct mipi_dsi_device *dsi)
  343. {
  344. struct device *dev = &dsi->dev;
  345. struct otm8009a *ctx;
  346. int ret;
  347. ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
  348. if (!ctx)
  349. return -ENOMEM;
  350. ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
  351. if (IS_ERR(ctx->reset_gpio)) {
  352. dev_err(dev, "cannot get reset-gpio\n");
  353. return PTR_ERR(ctx->reset_gpio);
  354. }
  355. ctx->supply = devm_regulator_get(dev, "power");
  356. if (IS_ERR(ctx->supply)) {
  357. ret = PTR_ERR(ctx->supply);
  358. if (ret != -EPROBE_DEFER)
  359. dev_err(dev, "failed to request regulator: %d\n", ret);
  360. return ret;
  361. }
  362. mipi_dsi_set_drvdata(dsi, ctx);
  363. ctx->dev = dev;
  364. dsi->lanes = 2;
  365. dsi->format = MIPI_DSI_FMT_RGB888;
  366. dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
  367. MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS;
  368. drm_panel_init(&ctx->panel, dev, &otm8009a_drm_funcs,
  369. DRM_MODE_CONNECTOR_DSI);
  370. ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev),
  371. dev, ctx,
  372. &otm8009a_backlight_ops,
  373. NULL);
  374. if (IS_ERR(ctx->bl_dev)) {
  375. ret = PTR_ERR(ctx->bl_dev);
  376. dev_err(dev, "failed to register backlight: %d\n", ret);
  377. return ret;
  378. }
  379. ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX;
  380. ctx->bl_dev->props.brightness = OTM8009A_BACKLIGHT_DEFAULT;
  381. ctx->bl_dev->props.power = BACKLIGHT_POWER_OFF;
  382. ctx->bl_dev->props.type = BACKLIGHT_RAW;
  383. drm_panel_add(&ctx->panel);
  384. ret = mipi_dsi_attach(dsi);
  385. if (ret < 0) {
  386. dev_err(dev, "mipi_dsi_attach failed. Is host ready?\n");
  387. drm_panel_remove(&ctx->panel);
  388. return ret;
  389. }
  390. return 0;
  391. }
  392. static void otm8009a_remove(struct mipi_dsi_device *dsi)
  393. {
  394. struct otm8009a *ctx = mipi_dsi_get_drvdata(dsi);
  395. mipi_dsi_detach(dsi);
  396. drm_panel_remove(&ctx->panel);
  397. }
  398. static const struct of_device_id orisetech_otm8009a_of_match[] = {
  399. { .compatible = "orisetech,otm8009a" },
  400. { }
  401. };
  402. MODULE_DEVICE_TABLE(of, orisetech_otm8009a_of_match);
  403. static struct mipi_dsi_driver orisetech_otm8009a_driver = {
  404. .probe = otm8009a_probe,
  405. .remove = otm8009a_remove,
  406. .driver = {
  407. .name = "panel-orisetech-otm8009a",
  408. .of_match_table = orisetech_otm8009a_of_match,
  409. },
  410. };
  411. module_mipi_dsi_driver(orisetech_otm8009a_driver);
  412. MODULE_AUTHOR("Philippe Cornu <philippe.cornu@st.com>");
  413. MODULE_AUTHOR("Yannick Fertre <yannick.fertre@st.com>");
  414. MODULE_DESCRIPTION("DRM driver for Orise Tech OTM8009A MIPI DSI panel");
  415. MODULE_LICENSE("GPL v2");