-samsung,lane-count:
number of lanes supported by the panel.
LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
+ - display-timings: timings for the connected panel as described by
+ Documentation/devicetree/bindings/video/display-timing.txt
Optional properties for dp-controller:
-interlaced:
samsung,color-depth = <1>;
samsung,link-rate = <0x0a>;
samsung,lane-count = <4>;
+
+ display-timings {
+ native-mode = <&lcd_timing>;
+ lcd_timing: 1366x768 {
+ clock-frequency = <70589280>;
+ hactive = <1366>;
+ vactive = <768>;
+ hfront-porch = <40>;
+ hback-porch = <40>;
+ hsync-len = <32>;
+ vback-porch = <10>;
+ vfront-porch = <12>;
+ vsync-len = <6>;
+ };
+ };
};
Optional Properties:
- samsung,power-domain: a phandle to FIMD power domain node.
+- samsung,invert-vden: video enable signal is inverted
+- samsung,invert-vclk: video clock signal is inverted
Example:
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/phy/phy.h>
+#include <video/of_display_timing.h>
+#include <video/of_videomode.h>
+#include <drm/drmP.h>
+
+#include "exynos_drm_drv.h"
#include "exynos_dp_core.h"
static int exynos_dp_init_dp(struct exynos_dp_device *dp)
dev_err(dp->dev, "unable to config video\n");
}
+static bool exynos_dp_display_is_connected(struct exynos_drm_display *display)
+{
+ return true;
+}
+
+static void *exynos_dp_get_panel(struct exynos_drm_display *display)
+{
+ struct exynos_dp_device *dp = display->ctx;
+
+ return &dp->panel;
+}
+
+static int exynos_dp_check_mode(struct exynos_drm_display *display,
+ struct drm_display_mode *mode)
+{
+ return 0;
+}
+
+static struct exynos_drm_display_ops exynos_dp_display_ops = {
+ .is_connected = exynos_dp_display_is_connected,
+ .get_panel = exynos_dp_get_panel,
+ .check_mode = exynos_dp_check_mode,
+};
+
+static struct exynos_drm_display exynos_dp_display = {
+ .type = EXYNOS_DISPLAY_TYPE_LCD,
+ .ops = &exynos_dp_display_ops,
+};
+
static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev)
{
struct device_node *dp_node = dev->of_node;
return ret;
}
+static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
+{
+ int ret;
+
+ ret = of_get_videomode(dp->dev->of_node, &dp->panel.vm,
+ OF_USE_NATIVE_MODE);
+ if (ret) {
+ DRM_ERROR("failed: of_get_videomode() : %d\n", ret);
+ return ret;
+ }
+ return 0;
+}
+
static void exynos_dp_phy_init(struct exynos_dp_device *dp)
{
if (dp->phy) {
}
}
+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)
{
struct resource *res;
if (ret)
return ret;
+ ret = exynos_dp_dt_parse_panel(dp);
+ if (ret)
+ return ret;
+
dp->clock = devm_clk_get(&pdev->dev, "dp");
if (IS_ERR(dp->clock)) {
dev_err(&pdev->dev, "failed to get clock\n");
platform_set_drvdata(pdev, dp);
+ exynos_dp_display.ctx = dp;
+ exynos_drm_display_register(&exynos_dp_display);
+
return 0;
}
{
struct exynos_dp_device *dp = platform_get_drvdata(pdev);
+ exynos_drm_display_unregister(&exynos_dp_display);
+
flush_work(&dp->hotplug_work);
exynos_dp_phy_exit(dp);
{
struct exynos_dp_device *dp = dev_get_drvdata(dev);
- disable_irq(dp->irq);
-
- flush_work(&dp->hotplug_work);
-
- exynos_dp_phy_exit(dp);
-
- clk_disable_unprepare(dp->clock);
-
+ exynos_dp_poweroff(dp);
return 0;
}
{
struct exynos_dp_device *dp = dev_get_drvdata(dev);
- exynos_dp_phy_init(dp);
-
- clk_prepare_enable(dp->clock);
-
- exynos_dp_init_dp(dp);
-
- enable_irq(dp->irq);
-
+ exynos_dp_poweron(dp);
return 0;
}
#endif
};
MODULE_DEVICE_TABLE(of, exynos_dp_match);
-static struct platform_driver exynos_dp_driver = {
+struct platform_driver dp_driver = {
.probe = exynos_dp_probe,
.remove = exynos_dp_remove,
.driver = {
},
};
-module_platform_driver(exynos_dp_driver);
-
MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>");
MODULE_DESCRIPTION("Samsung SoC DP Driver");
MODULE_LICENSE("GPL");
#ifndef _EXYNOS_DP_CORE_H
#define _EXYNOS_DP_CORE_H
+#include <drm/exynos_drm.h>
+
#define DP_TIMEOUT_LOOP_COUNT 100
#define MAX_CR_LOOP 5
#define MAX_EQ_LOOP 5
struct link_train link_train;
struct work_struct hotplug_work;
struct phy *phy;
+
+ struct exynos_drm_panel_info panel;
};
/* exynos_dp_reg.c */
{
int ret;
+#ifdef CONFIG_DRM_EXYNOS_DP
+ ret = platform_driver_register(&dp_driver);
+ if (ret < 0)
+ goto out_dp;
+#endif
+
#ifdef CONFIG_DRM_EXYNOS_FIMD
ret = platform_driver_register(&fimd_driver);
if (ret < 0)
platform_driver_unregister(&fimd_driver);
out_fimd:
#endif
+#ifdef CONFIG_DRM_EXYNOS_DP
+ platform_driver_unregister(&dp_driver);
+out_dp:
+#endif
return ret;
}
#ifdef CONFIG_DRM_EXYNOS_FIMD
platform_driver_unregister(&fimd_driver);
#endif
+
+#ifdef CONFIG_DRM_EXYNOS_DP
+ platform_driver_unregister(&dp_driver);
+#endif
}
module_init(exynos_drm_init);
*/
void exynos_platform_device_ipp_unregister(void);
+extern struct platform_driver dp_driver;
extern struct platform_driver fimd_driver;
extern struct platform_driver hdmi_driver;
extern struct platform_driver mixer_driver;
return (struct fimd_driver_data *)of_id->data;
}
-static bool fimd_display_is_connected(struct exynos_drm_display *display)
-{
- /* TODO. */
-
- return true;
-}
-
-static void *fimd_get_panel(struct exynos_drm_display *display)
-{
- struct fimd_context *ctx = display->ctx;
-
- return &ctx->panel;
-}
-
-static int fimd_check_mode(struct exynos_drm_display *display,
- struct drm_display_mode *mode)
-{
- /* TODO. */
-
- return 0;
-}
-
-static struct exynos_drm_display_ops fimd_display_ops = {
- .is_connected = fimd_display_is_connected,
- .get_panel = fimd_get_panel,
- .check_mode = fimd_check_mode,
-};
-
-static struct exynos_drm_display fimd_display = {
- .type = EXYNOS_DISPLAY_TYPE_LCD,
- .ops = &fimd_display_ops,
-};
-
static int fimd_mgr_initialize(struct exynos_drm_manager *mgr,
struct drm_device *drm_dev, int pipe)
{
struct fimd_context *ctx = mgr->ctx;
struct drm_display_mode *mode = &ctx->mode;
struct fimd_driver_data *driver_data;
- u32 val, clkdiv;
+ u32 val, clkdiv, vidcon1;
int hblank, vblank, vsync_len, vbpd, vfpd, hsync_len, hbpd, hfpd;
driver_data = ctx->driver_data;
if (mode->htotal == 0 || mode->vtotal == 0)
return;
- /* setup polarity values from machine code. */
- writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);
+ /* setup polarity values */
+ vidcon1 = ctx->vidcon1;
+ if (mode->flags & DRM_MODE_FLAG_NVSYNC)
+ vidcon1 |= VIDCON1_INV_VSYNC;
+ if (mode->flags & DRM_MODE_FLAG_NHSYNC)
+ vidcon1 |= VIDCON1_INV_HSYNC;
+ writel(vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);
/* setup vertical timing values. */
vblank = mode->crtc_vblank_end - mode->crtc_vblank_start;
return 0;
}
-static int fimd_get_platform_data(struct fimd_context *ctx, struct device *dev)
-{
- struct videomode *vm;
- int ret;
-
- vm = &ctx->panel.vm;
- ret = of_get_videomode(dev->of_node, vm, OF_USE_NATIVE_MODE);
- if (ret) {
- DRM_ERROR("failed: of_get_videomode() : %d\n", ret);
- return ret;
- }
-
- if (vm->flags & DISPLAY_FLAGS_VSYNC_LOW)
- ctx->vidcon1 |= VIDCON1_INV_VSYNC;
- if (vm->flags & DISPLAY_FLAGS_HSYNC_LOW)
- ctx->vidcon1 |= VIDCON1_INV_HSYNC;
- if (vm->flags & DISPLAY_FLAGS_DE_LOW)
- ctx->vidcon1 |= VIDCON1_INV_VDEN;
- if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
- ctx->vidcon1 |= VIDCON1_INV_VCLK;
-
- return 0;
-}
-
static int fimd_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
ctx->dev = dev;
- ret = fimd_get_platform_data(ctx, dev);
- if (ret)
- return ret;
+ if (of_property_read_bool(dev->of_node, "samsung,invert-vden"))
+ ctx->vidcon1 |= VIDCON1_INV_VDEN;
+ if (of_property_read_bool(dev->of_node, "samsung,invert-vclk"))
+ ctx->vidcon1 |= VIDCON1_INV_VCLK;
ctx->bus_clk = devm_clk_get(dev, "fimd");
if (IS_ERR(ctx->bus_clk)) {
fimd_manager.ctx = ctx;
exynos_drm_manager_register(&fimd_manager);
- fimd_display.ctx = ctx;
- exynos_drm_display_register(&fimd_display);
-
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
struct exynos_drm_manager *mgr = platform_get_drvdata(pdev);
struct fimd_context *ctx = mgr->ctx;
- exynos_drm_display_unregister(&fimd_display);
exynos_drm_manager_unregister(&fimd_manager);
if (ctx->suspended)