15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/errno.h>
20 #include <linux/wait.h>
24 #include <linux/ctype.h>
57 return pdev->
dev.platform_data;
61 { .supply =
"vdd11", },
62 { .supply =
"vdd18", },
125 if (client_drv && client_drv->
suspend)
126 client_drv->
suspend(client_dev);
130 exynos_mipi_regulator_disable(dsim);
142 static int exynos_mipi_dsi_blank_mode(
struct mipi_dsim_device *dsim,
int power)
154 if (client_drv && client_drv->
power_on)
155 client_drv->
power_on(client_dev, 1);
157 exynos_mipi_regulator_enable(dsim);
160 if (dsim->
pd->phy_enable)
161 dsim->
pd->phy_enable(pdev,
true);
165 exynos_mipi_update_cfg(dsim);
188 if (!lcd_dev->
name) {
189 pr_err(
"dsim_lcd_device name is NULL.\n");
195 pr_err(
"failed to allocate dsim_ddi object.\n");
208 static struct mipi_dsim_ddi *exynos_mipi_dsi_find_lcd_device(
249 if (!lcd_drv->
name) {
250 pr_err(
"dsim_lcd_driver name is NULL.\n");
254 dsim_ddi = exynos_mipi_dsi_find_lcd_device(lcd_drv);
256 pr_err(
"mipi_dsim_ddi object not found.\n");
262 pr_info(
"registered panel driver(%s) to mipi-dsi driver.\n",
283 if (!lcd_drv || !lcd_dev ||
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",
295 lcd_dev->
dev.parent = dsim->
dev;
301 "can't register %s, status %d\n",
302 dev_name(&lcd_dev->
dev), ret);
328 .set_early_blank_mode = exynos_mipi_dsi_early_blank_mode,
329 .set_blank_mode = exynos_mipi_dsi_blank_mode,
343 dev_err(&pdev->
dev,
"failed to allocate dsim object.\n");
347 dsim->
pd = to_dsim_plat(pdev);
354 dev_err(&pdev->
dev,
"failed to get platform data for dsim.\n");
359 if (dsim_config ==
NULL) {
360 dev_err(&pdev->
dev,
"failed to get dsim config data.\n");
371 dev_err(&pdev->
dev,
"Failed to get regulators: %d\n", ret);
376 if (IS_ERR(dsim->
clock)) {
377 dev_err(&pdev->
dev,
"failed to get dsim clock source\n");
386 dev_err(&pdev->
dev,
"failed to get io memory region\n");
388 goto err_platform_get;
392 dev_name(&pdev->
dev));
394 dev_err(&pdev->
dev,
"failed to request io memory region\n");
401 dev_err(&pdev->
dev,
"failed to remap io region\n");
409 dsim_ddi = exynos_mipi_dsi_bind_lcd_ddi(dsim, dsim_pd->
lcd_panel_name);
411 dev_err(&pdev->
dev,
"mipi_dsim_ddi object not found.\n");
418 dev_err(&pdev->
dev,
"failed to request dsim irq resource\n");
420 goto err_platform_get_irq;
423 init_completion(&dsim_wr_comp);
424 init_completion(&dsim_rd_comp);
425 platform_set_drvdata(pdev, dsim);
430 dev_err(&pdev->
dev,
"failed to request dsim irq\n");
444 exynos_mipi_regulator_enable(dsim);
452 exynos_mipi_regulator_enable(dsim);
455 if (dsim->
pd->phy_enable)
456 dsim->
pd->phy_enable(pdev,
true);
458 exynos_mipi_update_cfg(dsim);
467 platform_set_drvdata(pdev, dsim);
469 dev_dbg(&pdev->
dev,
"%s() completed successfully (%s mode)\n", __func__,
489 err_platform_get_irq:
527 #ifdef CONFIG_PM_SLEEP
528 static int exynos_mipi_dsi_suspend(
struct device *
dev)
540 if (client_drv && client_drv->
suspend)
541 client_drv->
suspend(client_dev);
544 if (dsim->
pd->phy_enable)
545 dsim->
pd->phy_enable(pdev,
false);
549 exynos_mipi_regulator_disable(dsim);
556 static int exynos_mipi_dsi_resume(
struct device *dev)
569 if (client_drv && client_drv->
power_on)
570 client_drv->
power_on(client_dev, 1);
572 exynos_mipi_regulator_enable(dsim);
575 if (dsim->
pd->phy_enable)
576 dsim->
pd->phy_enable(pdev,
true);
580 exynos_mipi_update_cfg(dsim);
592 static const struct dev_pm_ops exynos_mipi_dsi_pm_ops = {
597 .probe = exynos_mipi_dsi_probe,
600 .name =
"exynos-mipi-dsim",
602 .pm = &exynos_mipi_dsi_pm_ops,