Commit 12f5ad6c authored by Sean Paul's avatar Sean Paul Committed by Inki Dae

drm/exynos: Implement dpms display callback in DP

This patch implements the dpms display callback for the DP driver.
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 1417f109
...@@ -915,10 +915,78 @@ static int exynos_dp_check_mode(struct exynos_drm_display *display, ...@@ -915,10 +915,78 @@ static int exynos_dp_check_mode(struct exynos_drm_display *display,
return 0; return 0;
} }
static void exynos_dp_phy_init(struct exynos_dp_device *dp)
{
if (dp->phy) {
phy_power_on(dp->phy);
} else if (dp->phy_addr) {
u32 reg;
reg = __raw_readl(dp->phy_addr);
reg |= dp->enable_mask;
__raw_writel(reg, dp->phy_addr);
}
}
static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
{
if (dp->phy) {
phy_power_off(dp->phy);
} else if (dp->phy_addr) {
u32 reg;
reg = __raw_readl(dp->phy_addr);
reg &= ~(dp->enable_mask);
__raw_writel(reg, dp->phy_addr);
}
}
static void exynos_dp_poweron(struct exynos_dp_device *dp)
{
if (dp->dpms_mode == DRM_MODE_DPMS_ON)
return;
clk_prepare_enable(dp->clock);
exynos_dp_phy_init(dp);
exynos_dp_init_dp(dp);
enable_irq(dp->irq);
}
static void exynos_dp_poweroff(struct exynos_dp_device *dp)
{
if (dp->dpms_mode != DRM_MODE_DPMS_ON)
return;
disable_irq(dp->irq);
flush_work(&dp->hotplug_work);
exynos_dp_phy_exit(dp);
clk_disable_unprepare(dp->clock);
}
static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
{
struct exynos_dp_device *dp = display->ctx;
switch (mode) {
case DRM_MODE_DPMS_ON:
exynos_dp_poweron(dp);
break;
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
exynos_dp_poweroff(dp);
break;
default:
break;
};
dp->dpms_mode = mode;
}
static struct exynos_drm_display_ops exynos_dp_display_ops = { static struct exynos_drm_display_ops exynos_dp_display_ops = {
.is_connected = exynos_dp_display_is_connected, .is_connected = exynos_dp_display_is_connected,
.get_panel = exynos_dp_get_panel, .get_panel = exynos_dp_get_panel,
.check_mode = exynos_dp_check_mode, .check_mode = exynos_dp_check_mode,
.dpms = exynos_dp_dpms,
}; };
static struct exynos_drm_display exynos_dp_display = { static struct exynos_drm_display exynos_dp_display = {
...@@ -1040,54 +1108,6 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp) ...@@ -1040,54 +1108,6 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
return 0; return 0;
} }
static void exynos_dp_phy_init(struct exynos_dp_device *dp)
{
if (dp->phy) {
phy_power_on(dp->phy);
} else if (dp->phy_addr) {
u32 reg;
reg = __raw_readl(dp->phy_addr);
reg |= dp->enable_mask;
__raw_writel(reg, dp->phy_addr);
}
}
static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
{
if (dp->phy) {
phy_power_off(dp->phy);
} else if (dp->phy_addr) {
u32 reg;
reg = __raw_readl(dp->phy_addr);
reg &= ~(dp->enable_mask);
__raw_writel(reg, dp->phy_addr);
}
}
void exynos_dp_poweron(struct exynos_dp_device *dp)
{
exynos_dp_phy_init(dp);
clk_prepare_enable(dp->clock);
exynos_dp_init_dp(dp);
enable_irq(dp->irq);
}
void exynos_dp_poweroff(struct exynos_dp_device *dp)
{
disable_irq(dp->irq);
flush_work(&dp->hotplug_work);
exynos_dp_phy_exit(dp);
clk_disable_unprepare(dp->clock);
}
static int exynos_dp_probe(struct platform_device *pdev) static int exynos_dp_probe(struct platform_device *pdev)
{ {
struct resource *res; struct resource *res;
...@@ -1103,6 +1123,7 @@ static int exynos_dp_probe(struct platform_device *pdev) ...@@ -1103,6 +1123,7 @@ static int exynos_dp_probe(struct platform_device *pdev)
} }
dp->dev = &pdev->dev; dp->dev = &pdev->dev;
dp->dpms_mode = DRM_MODE_DPMS_OFF;
dp->video_info = exynos_dp_dt_parse_pdata(&pdev->dev); dp->video_info = exynos_dp_dt_parse_pdata(&pdev->dev);
if (IS_ERR(dp->video_info)) if (IS_ERR(dp->video_info))
...@@ -1148,10 +1169,11 @@ static int exynos_dp_probe(struct platform_device *pdev) ...@@ -1148,10 +1169,11 @@ static int exynos_dp_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to request irq\n"); dev_err(&pdev->dev, "failed to request irq\n");
return ret; return ret;
} }
disable_irq(dp->irq);
platform_set_drvdata(pdev, dp);
exynos_dp_display.ctx = dp; exynos_dp_display.ctx = dp;
platform_set_drvdata(pdev, &exynos_dp_display);
exynos_drm_display_register(&exynos_dp_display); exynos_drm_display_register(&exynos_dp_display);
return 0; return 0;
...@@ -1159,34 +1181,30 @@ static int exynos_dp_probe(struct platform_device *pdev) ...@@ -1159,34 +1181,30 @@ static int exynos_dp_probe(struct platform_device *pdev)
static int exynos_dp_remove(struct platform_device *pdev) static int exynos_dp_remove(struct platform_device *pdev)
{ {
struct exynos_dp_device *dp = platform_get_drvdata(pdev); struct exynos_drm_display *display = platform_get_drvdata(pdev);
exynos_dp_dpms(display, DRM_MODE_DPMS_OFF);
exynos_drm_display_unregister(&exynos_dp_display); exynos_drm_display_unregister(&exynos_dp_display);
flush_work(&dp->hotplug_work);
exynos_dp_phy_exit(dp);
clk_disable_unprepare(dp->clock);
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int exynos_dp_suspend(struct device *dev) static int exynos_dp_suspend(struct device *dev)
{ {
struct exynos_dp_device *dp = dev_get_drvdata(dev); struct platform_device *pdev = to_platform_device(dev);
struct exynos_drm_display *display = platform_get_drvdata(pdev);
exynos_dp_poweroff(dp); exynos_dp_dpms(display, DRM_MODE_DPMS_OFF);
return 0; return 0;
} }
static int exynos_dp_resume(struct device *dev) static int exynos_dp_resume(struct device *dev)
{ {
struct exynos_dp_device *dp = dev_get_drvdata(dev); struct platform_device *pdev = to_platform_device(dev);
struct exynos_drm_display *display = platform_get_drvdata(pdev);
exynos_dp_poweron(dp); exynos_dp_dpms(display, DRM_MODE_DPMS_ON);
return 0; return 0;
} }
#endif #endif
......
...@@ -154,6 +154,7 @@ struct exynos_dp_device { ...@@ -154,6 +154,7 @@ struct exynos_dp_device {
struct link_train link_train; struct link_train link_train;
struct work_struct hotplug_work; struct work_struct hotplug_work;
struct phy *phy; struct phy *phy;
int dpms_mode;
struct exynos_drm_panel_info panel; struct exynos_drm_panel_info panel;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment