Commit | Line | Data |
---|---|---|
7258cc14 DL |
1 | /* linux/drivers/video/exynos/exynos_mipi_dsi.c |
2 | * | |
3 | * Samsung SoC MIPI-DSIM driver. | |
4 | * | |
5 | * Copyright (c) 2012 Samsung Electronics Co., Ltd | |
6 | * | |
7 | * InKi Dae, <inki.dae@samsung.com> | |
8 | * Donghwa Lee, <dh09.lee@samsung.com> | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 as | |
12 | * published by the Free Software Foundation. | |
13 | */ | |
14 | ||
15 | #include <linux/module.h> | |
16 | #include <linux/kernel.h> | |
17 | #include <linux/errno.h> | |
18 | #include <linux/clk.h> | |
19 | #include <linux/mutex.h> | |
20 | #include <linux/wait.h> | |
21 | #include <linux/fs.h> | |
22 | #include <linux/mm.h> | |
23 | #include <linux/fb.h> | |
24 | #include <linux/ctype.h> | |
25 | #include <linux/platform_device.h> | |
26 | #include <linux/io.h> | |
27 | #include <linux/irq.h> | |
28 | #include <linux/memory.h> | |
29 | #include <linux/delay.h> | |
30 | #include <linux/interrupt.h> | |
31 | #include <linux/kthread.h> | |
32 | #include <linux/notifier.h> | |
33 | #include <linux/regulator/consumer.h> | |
34 | #include <linux/pm_runtime.h> | |
35 | ||
36 | #include <video/exynos_mipi_dsim.h> | |
37 | ||
38 | #include <plat/fb.h> | |
39 | ||
40 | #include "exynos_mipi_dsi_common.h" | |
41 | #include "exynos_mipi_dsi_lowlevel.h" | |
42 | ||
43 | struct mipi_dsim_ddi { | |
44 | int bus_id; | |
45 | struct list_head list; | |
46 | struct mipi_dsim_lcd_device *dsim_lcd_dev; | |
47 | struct mipi_dsim_lcd_driver *dsim_lcd_drv; | |
48 | }; | |
49 | ||
50 | static LIST_HEAD(dsim_ddi_list); | |
51 | ||
52 | static DEFINE_MUTEX(mipi_dsim_lock); | |
53 | ||
54 | static struct mipi_dsim_platform_data *to_dsim_plat(struct platform_device | |
55 | *pdev) | |
56 | { | |
57 | return pdev->dev.platform_data; | |
58 | } | |
59 | ||
60 | static struct regulator_bulk_data supplies[] = { | |
66685aa0 | 61 | { .supply = "vdd11", }, |
7258cc14 DL |
62 | { .supply = "vdd18", }, |
63 | }; | |
64 | ||
65 | static int exynos_mipi_regulator_enable(struct mipi_dsim_device *dsim) | |
66 | { | |
67 | int ret; | |
68 | ||
69 | mutex_lock(&dsim->lock); | |
70 | ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies); | |
71 | mutex_unlock(&dsim->lock); | |
72 | ||
73 | return ret; | |
74 | } | |
75 | ||
76 | static int exynos_mipi_regulator_disable(struct mipi_dsim_device *dsim) | |
77 | { | |
78 | int ret; | |
79 | ||
80 | mutex_lock(&dsim->lock); | |
81 | ret = regulator_bulk_disable(ARRAY_SIZE(supplies), supplies); | |
82 | mutex_unlock(&dsim->lock); | |
83 | ||
84 | return ret; | |
85 | } | |
86 | ||
87 | /* update all register settings to MIPI DSI controller. */ | |
88 | static void exynos_mipi_update_cfg(struct mipi_dsim_device *dsim) | |
89 | { | |
90 | /* | |
91 | * data from Display controller(FIMD) is not transferred in video mode | |
92 | * but in case of command mode, all settings is not updated to | |
93 | * registers. | |
94 | */ | |
95 | exynos_mipi_dsi_stand_by(dsim, 0); | |
96 | ||
97 | exynos_mipi_dsi_init_dsim(dsim); | |
98 | exynos_mipi_dsi_init_link(dsim); | |
99 | ||
100 | exynos_mipi_dsi_set_hs_enable(dsim); | |
101 | ||
102 | /* set display timing. */ | |
103 | exynos_mipi_dsi_set_display_mode(dsim, dsim->dsim_config); | |
104 | ||
113b6684 DL |
105 | exynos_mipi_dsi_init_interrupt(dsim); |
106 | ||
7258cc14 DL |
107 | /* |
108 | * data from Display controller(FIMD) is transferred in video mode | |
ff0c2642 | 109 | * but in case of command mode, all settings are updated to registers. |
7258cc14 DL |
110 | */ |
111 | exynos_mipi_dsi_stand_by(dsim, 1); | |
112 | } | |
113 | ||
114 | static int exynos_mipi_dsi_early_blank_mode(struct mipi_dsim_device *dsim, | |
115 | int power) | |
116 | { | |
117 | struct mipi_dsim_lcd_driver *client_drv = dsim->dsim_lcd_drv; | |
118 | struct mipi_dsim_lcd_device *client_dev = dsim->dsim_lcd_dev; | |
119 | ||
120 | switch (power) { | |
121 | case FB_BLANK_POWERDOWN: | |
122 | if (dsim->suspended) | |
123 | return 0; | |
124 | ||
125 | if (client_drv && client_drv->suspend) | |
126 | client_drv->suspend(client_dev); | |
127 | ||
128 | clk_disable(dsim->clock); | |
129 | ||
130 | exynos_mipi_regulator_disable(dsim); | |
131 | ||
132 | dsim->suspended = true; | |
133 | ||
134 | break; | |
135 | default: | |
136 | break; | |
137 | } | |
138 | ||
139 | return 0; | |
140 | } | |
141 | ||
142 | static int exynos_mipi_dsi_blank_mode(struct mipi_dsim_device *dsim, int power) | |
143 | { | |
144 | struct platform_device *pdev = to_platform_device(dsim->dev); | |
145 | struct mipi_dsim_lcd_driver *client_drv = dsim->dsim_lcd_drv; | |
146 | struct mipi_dsim_lcd_device *client_dev = dsim->dsim_lcd_dev; | |
147 | ||
148 | switch (power) { | |
149 | case FB_BLANK_UNBLANK: | |
150 | if (!dsim->suspended) | |
151 | return 0; | |
152 | ||
153 | /* lcd panel power on. */ | |
154 | if (client_drv && client_drv->power_on) | |
155 | client_drv->power_on(client_dev, 1); | |
156 | ||
91d1cfa8 | 157 | exynos_mipi_regulator_enable(dsim); |
7258cc14 DL |
158 | |
159 | /* enable MIPI-DSI PHY. */ | |
160 | if (dsim->pd->phy_enable) | |
161 | dsim->pd->phy_enable(pdev, true); | |
162 | ||
163 | clk_enable(dsim->clock); | |
164 | ||
165 | exynos_mipi_update_cfg(dsim); | |
166 | ||
167 | /* set lcd panel sequence commands. */ | |
168 | if (client_drv && client_drv->set_sequence) | |
169 | client_drv->set_sequence(client_dev); | |
170 | ||
171 | dsim->suspended = false; | |
172 | ||
173 | break; | |
174 | case FB_BLANK_NORMAL: | |
175 | /* TODO. */ | |
176 | break; | |
177 | default: | |
178 | break; | |
179 | } | |
180 | ||
181 | return 0; | |
182 | } | |
183 | ||
184 | int exynos_mipi_dsi_register_lcd_device(struct mipi_dsim_lcd_device *lcd_dev) | |
185 | { | |
186 | struct mipi_dsim_ddi *dsim_ddi; | |
187 | ||
188 | if (!lcd_dev->name) { | |
189 | pr_err("dsim_lcd_device name is NULL.\n"); | |
190 | return -EFAULT; | |
191 | } | |
192 | ||
193 | dsim_ddi = kzalloc(sizeof(struct mipi_dsim_ddi), GFP_KERNEL); | |
194 | if (!dsim_ddi) { | |
195 | pr_err("failed to allocate dsim_ddi object.\n"); | |
196 | return -ENOMEM; | |
197 | } | |
198 | ||
199 | dsim_ddi->dsim_lcd_dev = lcd_dev; | |
200 | ||
201 | mutex_lock(&mipi_dsim_lock); | |
202 | list_add_tail(&dsim_ddi->list, &dsim_ddi_list); | |
203 | mutex_unlock(&mipi_dsim_lock); | |
204 | ||
205 | return 0; | |
206 | } | |
207 | ||
4c4ceee0 SK |
208 | static struct mipi_dsim_ddi *exynos_mipi_dsi_find_lcd_device( |
209 | struct mipi_dsim_lcd_driver *lcd_drv) | |
7258cc14 DL |
210 | { |
211 | struct mipi_dsim_ddi *dsim_ddi, *next; | |
212 | struct mipi_dsim_lcd_device *lcd_dev; | |
213 | ||
214 | mutex_lock(&mipi_dsim_lock); | |
215 | ||
216 | list_for_each_entry_safe(dsim_ddi, next, &dsim_ddi_list, list) { | |
217 | if (!dsim_ddi) | |
218 | goto out; | |
219 | ||
220 | lcd_dev = dsim_ddi->dsim_lcd_dev; | |
221 | if (!lcd_dev) | |
222 | continue; | |
223 | ||
224 | if ((strcmp(lcd_drv->name, lcd_dev->name)) == 0) { | |
225 | /** | |
226 | * bus_id would be used to identify | |
227 | * connected bus. | |
228 | */ | |
229 | dsim_ddi->bus_id = lcd_dev->bus_id; | |
230 | mutex_unlock(&mipi_dsim_lock); | |
231 | ||
232 | return dsim_ddi; | |
233 | } | |
234 | ||
235 | list_del(&dsim_ddi->list); | |
236 | kfree(dsim_ddi); | |
237 | } | |
238 | ||
239 | out: | |
240 | mutex_unlock(&mipi_dsim_lock); | |
241 | ||
242 | return NULL; | |
243 | } | |
244 | ||
245 | int exynos_mipi_dsi_register_lcd_driver(struct mipi_dsim_lcd_driver *lcd_drv) | |
246 | { | |
247 | struct mipi_dsim_ddi *dsim_ddi; | |
248 | ||
249 | if (!lcd_drv->name) { | |
250 | pr_err("dsim_lcd_driver name is NULL.\n"); | |
251 | return -EFAULT; | |
252 | } | |
253 | ||
254 | dsim_ddi = exynos_mipi_dsi_find_lcd_device(lcd_drv); | |
255 | if (!dsim_ddi) { | |
256 | pr_err("mipi_dsim_ddi object not found.\n"); | |
257 | return -EFAULT; | |
258 | } | |
259 | ||
260 | dsim_ddi->dsim_lcd_drv = lcd_drv; | |
261 | ||
262 | pr_info("registered panel driver(%s) to mipi-dsi driver.\n", | |
263 | lcd_drv->name); | |
264 | ||
265 | return 0; | |
266 | ||
267 | } | |
268 | ||
4c4ceee0 SK |
269 | static struct mipi_dsim_ddi *exynos_mipi_dsi_bind_lcd_ddi( |
270 | struct mipi_dsim_device *dsim, | |
7258cc14 DL |
271 | const char *name) |
272 | { | |
273 | struct mipi_dsim_ddi *dsim_ddi, *next; | |
274 | struct mipi_dsim_lcd_driver *lcd_drv; | |
275 | struct mipi_dsim_lcd_device *lcd_dev; | |
276 | int ret; | |
277 | ||
278 | mutex_lock(&dsim->lock); | |
279 | ||
280 | list_for_each_entry_safe(dsim_ddi, next, &dsim_ddi_list, list) { | |
281 | lcd_drv = dsim_ddi->dsim_lcd_drv; | |
282 | lcd_dev = dsim_ddi->dsim_lcd_dev; | |
283 | if (!lcd_drv || !lcd_dev || | |
284 | (dsim->id != dsim_ddi->bus_id)) | |
285 | continue; | |
286 | ||
287 | dev_dbg(dsim->dev, "lcd_drv->id = %d, lcd_dev->id = %d\n", | |
288 | lcd_drv->id, lcd_dev->id); | |
289 | dev_dbg(dsim->dev, "lcd_dev->bus_id = %d, dsim->id = %d\n", | |
290 | lcd_dev->bus_id, dsim->id); | |
291 | ||
292 | if ((strcmp(lcd_drv->name, name) == 0)) { | |
293 | lcd_dev->master = dsim; | |
294 | ||
295 | lcd_dev->dev.parent = dsim->dev; | |
296 | dev_set_name(&lcd_dev->dev, "%s", lcd_drv->name); | |
297 | ||
298 | ret = device_register(&lcd_dev->dev); | |
299 | if (ret < 0) { | |
300 | dev_err(dsim->dev, | |
301 | "can't register %s, status %d\n", | |
302 | dev_name(&lcd_dev->dev), ret); | |
303 | mutex_unlock(&dsim->lock); | |
304 | ||
305 | return NULL; | |
306 | } | |
307 | ||
308 | dsim->dsim_lcd_dev = lcd_dev; | |
309 | dsim->dsim_lcd_drv = lcd_drv; | |
310 | ||
311 | mutex_unlock(&dsim->lock); | |
312 | ||
313 | return dsim_ddi; | |
314 | } | |
315 | } | |
316 | ||
317 | mutex_unlock(&dsim->lock); | |
318 | ||
319 | return NULL; | |
320 | } | |
321 | ||
322 | /* define MIPI-DSI Master operations. */ | |
323 | static struct mipi_dsim_master_ops master_ops = { | |
324 | .cmd_read = exynos_mipi_dsi_rd_data, | |
325 | .cmd_write = exynos_mipi_dsi_wr_data, | |
326 | .get_dsim_frame_done = exynos_mipi_dsi_get_frame_done_status, | |
327 | .clear_dsim_frame_done = exynos_mipi_dsi_clear_frame_done, | |
328 | .set_early_blank_mode = exynos_mipi_dsi_early_blank_mode, | |
329 | .set_blank_mode = exynos_mipi_dsi_blank_mode, | |
330 | }; | |
331 | ||
332 | static int exynos_mipi_dsi_probe(struct platform_device *pdev) | |
333 | { | |
334 | struct resource *res; | |
335 | struct mipi_dsim_device *dsim; | |
336 | struct mipi_dsim_config *dsim_config; | |
337 | struct mipi_dsim_platform_data *dsim_pd; | |
338 | struct mipi_dsim_ddi *dsim_ddi; | |
339 | int ret = -EINVAL; | |
340 | ||
f18acdea SK |
341 | dsim = devm_kzalloc(&pdev->dev, sizeof(struct mipi_dsim_device), |
342 | GFP_KERNEL); | |
7258cc14 DL |
343 | if (!dsim) { |
344 | dev_err(&pdev->dev, "failed to allocate dsim object.\n"); | |
345 | return -ENOMEM; | |
346 | } | |
347 | ||
348 | dsim->pd = to_dsim_plat(pdev); | |
349 | dsim->dev = &pdev->dev; | |
350 | dsim->id = pdev->id; | |
351 | ||
352 | /* get mipi_dsim_platform_data. */ | |
353 | dsim_pd = (struct mipi_dsim_platform_data *)dsim->pd; | |
354 | if (dsim_pd == NULL) { | |
355 | dev_err(&pdev->dev, "failed to get platform data for dsim.\n"); | |
f18acdea | 356 | return -EINVAL; |
7258cc14 DL |
357 | } |
358 | /* get mipi_dsim_config. */ | |
359 | dsim_config = dsim_pd->dsim_config; | |
360 | if (dsim_config == NULL) { | |
361 | dev_err(&pdev->dev, "failed to get dsim config data.\n"); | |
f18acdea | 362 | return -EINVAL; |
7258cc14 DL |
363 | } |
364 | ||
365 | dsim->dsim_config = dsim_config; | |
366 | dsim->master_ops = &master_ops; | |
367 | ||
368 | mutex_init(&dsim->lock); | |
369 | ||
f18acdea SK |
370 | ret = devm_regulator_bulk_get(&pdev->dev, ARRAY_SIZE(supplies), |
371 | supplies); | |
7258cc14 DL |
372 | if (ret) { |
373 | dev_err(&pdev->dev, "Failed to get regulators: %d\n", ret); | |
f18acdea | 374 | return ret; |
7258cc14 DL |
375 | } |
376 | ||
f18acdea | 377 | dsim->clock = devm_clk_get(&pdev->dev, "dsim0"); |
7258cc14 DL |
378 | if (IS_ERR(dsim->clock)) { |
379 | dev_err(&pdev->dev, "failed to get dsim clock source\n"); | |
f18acdea | 380 | return -ENODEV; |
7258cc14 DL |
381 | } |
382 | ||
383 | clk_enable(dsim->clock); | |
384 | ||
385 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
7258cc14 | 386 | |
f18acdea | 387 | dsim->reg_base = devm_request_and_ioremap(&pdev->dev, res); |
7258cc14 DL |
388 | if (!dsim->reg_base) { |
389 | dev_err(&pdev->dev, "failed to remap io region\n"); | |
390 | ret = -ENOMEM; | |
f18acdea | 391 | goto error; |
7258cc14 DL |
392 | } |
393 | ||
394 | mutex_init(&dsim->lock); | |
395 | ||
396 | /* bind lcd ddi matched with panel name. */ | |
397 | dsim_ddi = exynos_mipi_dsi_bind_lcd_ddi(dsim, dsim_pd->lcd_panel_name); | |
398 | if (!dsim_ddi) { | |
399 | dev_err(&pdev->dev, "mipi_dsim_ddi object not found.\n"); | |
36141e56 | 400 | ret = -EINVAL; |
f18acdea | 401 | goto error; |
7258cc14 DL |
402 | } |
403 | ||
404 | dsim->irq = platform_get_irq(pdev, 0); | |
0c980826 | 405 | if (IS_ERR_VALUE(dsim->irq)) { |
7258cc14 DL |
406 | dev_err(&pdev->dev, "failed to request dsim irq resource\n"); |
407 | ret = -EINVAL; | |
f18acdea | 408 | goto error; |
7258cc14 DL |
409 | } |
410 | ||
b89e1399 SN |
411 | init_completion(&dsim_wr_comp); |
412 | init_completion(&dsim_rd_comp); | |
413 | platform_set_drvdata(pdev, dsim); | |
414 | ||
f18acdea SK |
415 | ret = devm_request_irq(&pdev->dev, dsim->irq, |
416 | exynos_mipi_dsi_interrupt_handler, | |
b89e1399 | 417 | IRQF_SHARED, dev_name(&pdev->dev), dsim); |
7258cc14 DL |
418 | if (ret != 0) { |
419 | dev_err(&pdev->dev, "failed to request dsim irq\n"); | |
420 | ret = -EINVAL; | |
f18acdea | 421 | goto error; |
7258cc14 DL |
422 | } |
423 | ||
b89e1399 | 424 | /* enable interrupts */ |
7258cc14 DL |
425 | exynos_mipi_dsi_init_interrupt(dsim); |
426 | ||
427 | /* initialize mipi-dsi client(lcd panel). */ | |
428 | if (dsim_ddi->dsim_lcd_drv && dsim_ddi->dsim_lcd_drv->probe) | |
429 | dsim_ddi->dsim_lcd_drv->probe(dsim_ddi->dsim_lcd_dev); | |
430 | ||
b89e1399 SN |
431 | /* in case mipi-dsi has been enabled by bootloader */ |
432 | if (dsim_pd->enabled) { | |
433 | exynos_mipi_regulator_enable(dsim); | |
434 | goto done; | |
435 | } | |
7258cc14 DL |
436 | |
437 | /* lcd panel power on. */ | |
438 | if (dsim_ddi->dsim_lcd_drv && dsim_ddi->dsim_lcd_drv->power_on) | |
439 | dsim_ddi->dsim_lcd_drv->power_on(dsim_ddi->dsim_lcd_dev, 1); | |
440 | ||
441 | exynos_mipi_regulator_enable(dsim); | |
442 | ||
443 | /* enable MIPI-DSI PHY. */ | |
444 | if (dsim->pd->phy_enable) | |
445 | dsim->pd->phy_enable(pdev, true); | |
446 | ||
447 | exynos_mipi_update_cfg(dsim); | |
448 | ||
449 | /* set lcd panel sequence commands. */ | |
450 | if (dsim_ddi->dsim_lcd_drv && dsim_ddi->dsim_lcd_drv->set_sequence) | |
451 | dsim_ddi->dsim_lcd_drv->set_sequence(dsim_ddi->dsim_lcd_dev); | |
452 | ||
453 | dsim->suspended = false; | |
454 | ||
b89e1399 | 455 | done: |
7258cc14 DL |
456 | platform_set_drvdata(pdev, dsim); |
457 | ||
4907cb7b | 458 | dev_dbg(&pdev->dev, "%s() completed successfully (%s mode)\n", __func__, |
b89e1399 | 459 | dsim_config->e_interface == DSIM_COMMAND ? "CPU" : "RGB"); |
7258cc14 DL |
460 | |
461 | return 0; | |
462 | ||
f18acdea | 463 | error: |
7258cc14 | 464 | clk_disable(dsim->clock); |
7258cc14 DL |
465 | return ret; |
466 | } | |
467 | ||
48c68c4f | 468 | static int exynos_mipi_dsi_remove(struct platform_device *pdev) |
7258cc14 DL |
469 | { |
470 | struct mipi_dsim_device *dsim = platform_get_drvdata(pdev); | |
471 | struct mipi_dsim_ddi *dsim_ddi, *next; | |
472 | struct mipi_dsim_lcd_driver *dsim_lcd_drv; | |
473 | ||
7258cc14 | 474 | clk_disable(dsim->clock); |
7258cc14 DL |
475 | |
476 | list_for_each_entry_safe(dsim_ddi, next, &dsim_ddi_list, list) { | |
477 | if (dsim_ddi) { | |
478 | if (dsim->id != dsim_ddi->bus_id) | |
479 | continue; | |
480 | ||
481 | dsim_lcd_drv = dsim_ddi->dsim_lcd_drv; | |
482 | ||
483 | if (dsim_lcd_drv->remove) | |
484 | dsim_lcd_drv->remove(dsim_ddi->dsim_lcd_dev); | |
485 | ||
486 | kfree(dsim_ddi); | |
487 | } | |
488 | } | |
489 | ||
7258cc14 DL |
490 | return 0; |
491 | } | |
492 | ||
3bfc9b83 SN |
493 | #ifdef CONFIG_PM_SLEEP |
494 | static int exynos_mipi_dsi_suspend(struct device *dev) | |
7258cc14 | 495 | { |
3bfc9b83 | 496 | struct platform_device *pdev = to_platform_device(dev); |
7258cc14 DL |
497 | struct mipi_dsim_device *dsim = platform_get_drvdata(pdev); |
498 | struct mipi_dsim_lcd_driver *client_drv = dsim->dsim_lcd_drv; | |
499 | struct mipi_dsim_lcd_device *client_dev = dsim->dsim_lcd_dev; | |
500 | ||
501 | disable_irq(dsim->irq); | |
502 | ||
503 | if (dsim->suspended) | |
504 | return 0; | |
505 | ||
506 | if (client_drv && client_drv->suspend) | |
507 | client_drv->suspend(client_dev); | |
508 | ||
509 | /* enable MIPI-DSI PHY. */ | |
510 | if (dsim->pd->phy_enable) | |
511 | dsim->pd->phy_enable(pdev, false); | |
512 | ||
513 | clk_disable(dsim->clock); | |
514 | ||
515 | exynos_mipi_regulator_disable(dsim); | |
516 | ||
517 | dsim->suspended = true; | |
518 | ||
519 | return 0; | |
520 | } | |
521 | ||
3bfc9b83 | 522 | static int exynos_mipi_dsi_resume(struct device *dev) |
7258cc14 | 523 | { |
3bfc9b83 | 524 | struct platform_device *pdev = to_platform_device(dev); |
7258cc14 DL |
525 | struct mipi_dsim_device *dsim = platform_get_drvdata(pdev); |
526 | struct mipi_dsim_lcd_driver *client_drv = dsim->dsim_lcd_drv; | |
527 | struct mipi_dsim_lcd_device *client_dev = dsim->dsim_lcd_dev; | |
528 | ||
529 | enable_irq(dsim->irq); | |
530 | ||
531 | if (!dsim->suspended) | |
532 | return 0; | |
533 | ||
534 | /* lcd panel power on. */ | |
535 | if (client_drv && client_drv->power_on) | |
536 | client_drv->power_on(client_dev, 1); | |
537 | ||
538 | exynos_mipi_regulator_enable(dsim); | |
539 | ||
540 | /* enable MIPI-DSI PHY. */ | |
541 | if (dsim->pd->phy_enable) | |
542 | dsim->pd->phy_enable(pdev, true); | |
543 | ||
544 | clk_enable(dsim->clock); | |
545 | ||
546 | exynos_mipi_update_cfg(dsim); | |
547 | ||
548 | /* set lcd panel sequence commands. */ | |
549 | if (client_drv && client_drv->set_sequence) | |
550 | client_drv->set_sequence(client_dev); | |
551 | ||
552 | dsim->suspended = false; | |
553 | ||
554 | return 0; | |
555 | } | |
7258cc14 DL |
556 | #endif |
557 | ||
3bfc9b83 SN |
558 | static const struct dev_pm_ops exynos_mipi_dsi_pm_ops = { |
559 | SET_SYSTEM_SLEEP_PM_OPS(exynos_mipi_dsi_suspend, exynos_mipi_dsi_resume) | |
560 | }; | |
561 | ||
7258cc14 DL |
562 | static struct platform_driver exynos_mipi_dsi_driver = { |
563 | .probe = exynos_mipi_dsi_probe, | |
48c68c4f | 564 | .remove = exynos_mipi_dsi_remove, |
7258cc14 DL |
565 | .driver = { |
566 | .name = "exynos-mipi-dsim", | |
567 | .owner = THIS_MODULE, | |
3bfc9b83 | 568 | .pm = &exynos_mipi_dsi_pm_ops, |
7258cc14 DL |
569 | }, |
570 | }; | |
571 | ||
572 | module_platform_driver(exynos_mipi_dsi_driver); | |
573 | ||
574 | MODULE_AUTHOR("InKi Dae <inki.dae@samsung.com>"); | |
575 | MODULE_DESCRIPTION("Samusung SoC MIPI-DSI driver"); | |
576 | MODULE_LICENSE("GPL"); |