This series is based on exynos-drm-next branch of Inki Dae's tree at: git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
This is originally a part of the bridge chip series: http://www.spinics.net/lists/linux-samsung-soc/msg34826.html
But, since we can handle panel and bridge chips seperately, I thought of seperating them.
This patchset basically extends the drm panel framework to accomodate wider range of panels with strict timing sequence for enabling panel power, backlight enable, etc.
I have tested this patchset on exynos5800-peach-pi board.
Thierry: As discussed, I have seperated patches such that they won't break the compilation in between. Also, I have incorporated all the comments given by you for panel patches. I assume you have already taken [PATCH 01/15] and hence it can be dropped from this patchset.
Ajay Kumar (15): [PATCH 01/15] drm/panel: add prepare and unprepare routines [PATCH 02/15] drm/panel: Add get_modes helper [PATCH 03/15] drm/panel: ld9040: Add dummy prepare and unprepare routines [PATCH 04/15] drm/panel: s6e8aa0: Add dummy prepare and unprepare routines [PATCH 05/15] drm/panel: simple: Add dummy prepare and unprepare routines [PATCH 06/15] drm/exynos: dpi: Add support for panel prepare and unprepare routines [PATCH 07/15] drm/exynos: dsi: Add support for panel prepare and unprepare routines [PATCH 08/15] drm/tegra: Add support for panel prepare and unprepare routines [PATCH 09/15] drm/panel: ld9040: Add proper definition for prepare and unprepare [PATCH 10/15] drm/panel: s6e8aa0: Add proper definition for prepare and unprepare [PATCH 11/15] drm/panel: simple: Add proper definition for prepare and unprepare [PATCH 12/15] drm/panel: simple: Support usage of delays in panel functions [PATCH 13/15] drm/panel: simple: Add support for auo_b133htn01 panel [PATCH 14/15] drm/exynos: Move DP setup into commit() [PATCH 15/15] drm/exynos: dp: Modify driver to support drm_panel
.../devicetree/bindings/panel/auo,b133htn01.txt | 7 ++ drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 112 +++++++++++++++----- drivers/gpu/drm/exynos/exynos_dp_core.h | 3 +- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 +- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 ++- drivers/gpu/drm/panel/panel-ld9040.c | 16 ++- drivers/gpu/drm/panel/panel-s6e8aa0.c | 16 ++- drivers/gpu/drm/panel/panel-simple.c | 96 ++++++++++++++++- drivers/gpu/drm/tegra/output.c | 2 + include/drm/drm_panel.h | 26 +++++ 11 files changed, 262 insertions(+), 37 deletions(-) create mode 100644 Documentation/devicetree/bindings/panel/auo,b133htn01.txt
Most of the panels need an init sequence as mentioned below: -- poweron LCD unit/LCD_EN -- start video data -- poweron LED unit/BACKLIGHT_EN And, a de-init sequence as mentioned below: -- poweroff LED unit/BACKLIGHT_EN -- stop video data -- poweroff LCD unit/LCD_EN With existing callbacks for drm panel, we cannot accomodate such panels, since only two callbacks, i.e "panel_enable" and panel_disable are supported.
This patch adds: -- "prepare" callback which can be called before the actual video data is on, and then call the "enable" callback after the video data is available.
-- "unprepare" callback which can be called after the video data is off, and use "disable" callback to do something before switching off the video data.
Now, we can easily map the above scenario as shown below: poweron LCD unit/LCD_EN = "prepare" callback poweron LED unit/BACKLIGHT_EN = "enable" callback poweroff LED unit/BACKLIGHT_EN = "disable" callback poweroff LCD unit/LCD_EN = "unprepare" callback
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- include/drm/drm_panel.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index c2ab77a..9addc69 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -31,7 +31,9 @@ struct drm_device; struct drm_panel;
struct drm_panel_funcs { + int (*unprepare)(struct drm_panel *panel); int (*disable)(struct drm_panel *panel); + int (*prepare)(struct drm_panel *panel); int (*enable)(struct drm_panel *panel); int (*get_modes)(struct drm_panel *panel); }; @@ -46,6 +48,14 @@ struct drm_panel { struct list_head list; };
+static inline int drm_panel_unprepare(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->unprepare) + return panel->funcs->unprepare(panel); + + return panel ? -ENOSYS : -EINVAL; +} + static inline int drm_panel_disable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->disable) @@ -54,6 +64,14 @@ static inline int drm_panel_disable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; }
+static inline int drm_panel_prepare(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->prepare) + return panel->funcs->prepare(panel); + + return panel ? -ENOSYS : -EINVAL; +} + static inline int drm_panel_enable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->enable)
Hi Ajay,
[RESEND with reconstructed mail receivers, sorry for noise]
I am glad we have finally more fine-grained callbacks. Just few nitpicks.
On 07/31/2014 07:42 PM, Ajay Kumar wrote:
Most of the panels need an init sequence as mentioned below: -- poweron LCD unit/LCD_EN -- start video data -- poweron LED unit/BACKLIGHT_EN And, a de-init sequence as mentioned below: -- poweroff LED unit/BACKLIGHT_EN -- stop video data -- poweroff LCD unit/LCD_EN With existing callbacks for drm panel, we cannot accomodate such panels, since only two callbacks, i.e "panel_enable" and panel_disable are supported.
This patch adds: -- "prepare" callback which can be called before the actual video data is on, and then call the "enable" callback after the video data is available.
-- "unprepare" callback which can be called after the video data is off, and use "disable" callback to do something before switching off the video data.
Now, we can easily map the above scenario as shown below: poweron LCD unit/LCD_EN = "prepare" callback poweron LED unit/BACKLIGHT_EN = "enable" callback poweroff LED unit/BACKLIGHT_EN = "disable" callback poweroff LCD unit/LCD_EN = "unprepare" callback
Signed-off-by: Ajay Kumar ajaykumar.rs-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org
include/drm/drm_panel.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index c2ab77a..9addc69 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -31,7 +31,9 @@ struct drm_device; struct drm_panel;
struct drm_panel_funcs {
- int (*unprepare)(struct drm_panel *panel); int (*disable)(struct drm_panel *panel);
- int (*prepare)(struct drm_panel *panel); int (*enable)(struct drm_panel *panel); int (*get_modes)(struct drm_panel *panel);
}; @@ -46,6 +48,14 @@ struct drm_panel { struct list_head list; };
+static inline int drm_panel_unprepare(struct drm_panel *panel) +{
- if (panel && panel->funcs && panel->funcs->unprepare)
return panel->funcs->unprepare(panel);
- return panel ? -ENOSYS : -EINVAL;
+}
Wouldn't be better to return 0 in case there is no callback. In such case we could avoid implementing ugly dummy callbacks in each panel driver. This is true for all prepare/unprepare/enable/disable callbacks.
Regards Andrzej
static inline int drm_panel_disable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->disable) @@ -54,6 +64,14 @@ static inline int drm_panel_disable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; }
+static inline int drm_panel_prepare(struct drm_panel *panel) +{
- if (panel && panel->funcs && panel->funcs->prepare)
return panel->funcs->prepare(panel);
- return panel ? -ENOSYS : -EINVAL;
+}
static inline int drm_panel_enable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->enable)
Add a helper function drm_panel_get_modes to get modes from the panel.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- include/drm/drm_panel.h | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 9addc69..efc63cc 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -80,6 +80,14 @@ static inline int drm_panel_enable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; }
+static inline int drm_panel_get_modes(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->get_modes) + return panel->funcs->get_modes(panel); + + return 0; +} + void drm_panel_init(struct drm_panel *panel);
int drm_panel_add(struct drm_panel *panel);
This patch adds dummy definition for prepare and unprepare routines to ld9040 panel driver.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/panel/panel-ld9040.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-ld9040.c b/drivers/gpu/drm/panel/panel-ld9040.c index db1601f..9b40bd05 100644 --- a/drivers/gpu/drm/panel/panel-ld9040.c +++ b/drivers/gpu/drm/panel/panel-ld9040.c @@ -228,6 +228,16 @@ static int ld9040_disable(struct drm_panel *panel) return ld9040_power_off(ctx); }
+static int ld9040_unprepare(struct drm_panel *panel) +{ + return 0; +} + +static int ld9040_prepare(struct drm_panel *panel) +{ + return 0; +} + static int ld9040_enable(struct drm_panel *panel) { struct ld9040 *ctx = panel_to_ld9040(panel); @@ -273,6 +283,8 @@ static int ld9040_get_modes(struct drm_panel *panel)
static const struct drm_panel_funcs ld9040_drm_funcs = { .disable = ld9040_disable, + .unprepare = ld9040_unprepare, + .prepare = ld9040_prepare, .enable = ld9040_enable, .get_modes = ld9040_get_modes, };
This patch adds dummy definition for prepare and unprepare routines to s6e8aa0 panel driver.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/panel/panel-s6e8aa0.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c index 06e57a2..60694dd 100644 --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c @@ -900,6 +900,16 @@ static int s6e8aa0_disable(struct drm_panel *panel) return s6e8aa0_power_off(ctx); }
+static int s6e8aa0_unprepare(struct drm_panel *panel) +{ + return 0; +} + +static int s6e8aa0_prepare(struct drm_panel *panel) +{ + return 0; +} + static int s6e8aa0_enable(struct drm_panel *panel) { struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel); @@ -944,6 +954,8 @@ static int s6e8aa0_get_modes(struct drm_panel *panel)
static const struct drm_panel_funcs s6e8aa0_drm_funcs = { .disable = s6e8aa0_disable, + .unprepare = s6e8aa0_unprepare, + .prepare = s6e8aa0_prepare, .enable = s6e8aa0_enable, .get_modes = s6e8aa0_get_modes, };
This patch adds dummy definition for prepare and unprepare routines to simple panel driver.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/panel/panel-simple.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index a251361..2e51c34 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -114,6 +114,16 @@ static int panel_simple_disable(struct drm_panel *panel) return 0; }
+static int panel_simple_unprepare(struct drm_panel *panel) +{ + return 0; +} + +static int panel_simple_prepare(struct drm_panel *panel) +{ + return 0; +} + static int panel_simple_enable(struct drm_panel *panel) { struct panel_simple *p = to_panel_simple(panel); @@ -164,6 +174,8 @@ static int panel_simple_get_modes(struct drm_panel *panel)
static const struct drm_panel_funcs panel_simple_funcs = { .disable = panel_simple_disable, + .unprepare = panel_simple_unprepare, + .prepare = panel_simple_prepare, .enable = panel_simple_enable, .get_modes = panel_simple_get_modes, };
Modify exynos_dpi driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 3aa1c7e..fa08f05 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c @@ -125,14 +125,18 @@ static int exynos_dpi_create_connector(struct exynos_drm_display *display,
static void exynos_dpi_poweron(struct exynos_dpi *ctx) { - if (ctx->panel) + if (ctx->panel) { + drm_panel_prepare(ctx->panel); drm_panel_enable(ctx->panel); + } }
static void exynos_dpi_poweroff(struct exynos_dpi *ctx) { - if (ctx->panel) + if (ctx->panel) { drm_panel_disable(ctx->panel); + drm_panel_unprepare(ctx->panel); + } }
static void exynos_dpi_dpms(struct exynos_drm_display *display, int mode)
On Thu, Jul 31, 2014 at 11:12:05PM +0530, Ajay Kumar wrote:
Modify exynos_dpi driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Looks good to me. Inki, can I have your Acked-by to take this through the panel tree?
Thierry
On 2014년 08월 01일 18:04, Thierry Reding wrote:
On Thu, Jul 31, 2014 at 11:12:05PM +0530, Ajay Kumar wrote:
Modify exynos_dpi driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Looks good to me. Inki, can I have your Acked-by to take this through the panel tree?
Of course.
Acked-by: Inki Dae inki.dae@samsung.com
Thanks, Inki Dae
Thierry
On Fri, Aug 01, 2014 at 06:24:42PM +0900, Inki Dae wrote:
On 2014년 08월 01일 18:04, Thierry Reding wrote:
On Thu, Jul 31, 2014 at 11:12:05PM +0530, Ajay Kumar wrote:
Modify exynos_dpi driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_drm_dpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Looks good to me. Inki, can I have your Acked-by to take this through the panel tree?
Of course.
Acked-by: Inki Dae inki.dae@samsung.com
I'll take it that this Acked-by applies also to patch 07/15?
Thierry
Modify exynos_dsi driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index dc7c80b..4834932 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1351,7 +1351,7 @@ static int exynos_dsi_enable(struct exynos_dsi *dsi) if (ret < 0) return ret;
- ret = drm_panel_enable(dsi->panel); + ret = drm_panel_prepare(dsi->panel); if (ret < 0) { exynos_dsi_poweroff(dsi); return ret; @@ -1360,6 +1360,13 @@ static int exynos_dsi_enable(struct exynos_dsi *dsi) exynos_dsi_set_display_mode(dsi); exynos_dsi_set_display_enable(dsi, true);
+ ret = drm_panel_enable(dsi->panel); + if (ret < 0) { + exynos_dsi_set_display_enable(dsi, false); + exynos_dsi_poweroff(dsi); + return ret; + } + dsi->state |= DSIM_STATE_ENABLED;
return 0; @@ -1370,8 +1377,9 @@ static void exynos_dsi_disable(struct exynos_dsi *dsi) if (!(dsi->state & DSIM_STATE_ENABLED)) return;
- exynos_dsi_set_display_enable(dsi, false); drm_panel_disable(dsi->panel); + exynos_dsi_set_display_enable(dsi, false); + drm_panel_unprepare(dsi->panel); exynos_dsi_poweroff(dsi);
dsi->state &= ~DSIM_STATE_ENABLED;
On Thu, Jul 31, 2014 at 11:12:06PM +0530, Ajay Kumar wrote:
Modify exynos_dsi driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
And this one as well.
Thierry
2014-08-01 18:05 GMT+09:00 Thierry Reding thierry.reding@gmail.com:
On Thu, Jul 31, 2014 at 11:12:06PM +0530, Ajay Kumar wrote:
Modify exynos_dsi driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
And this one as well.
Acked-by: Inki Dae inki.dae@samsung.com
Thanks, Inki Dae
Thierry
dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Modify tegra output driver to support the new panel calls: prepare and unprepare.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/tegra/output.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 446837e..0c67d7e 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -140,7 +140,9 @@ static void tegra_encoder_dpms(struct drm_encoder *encoder, int mode) if (mode != DRM_MODE_DPMS_ON) { drm_panel_disable(panel); tegra_output_disable(output); + drm_panel_unprepare(panel); } else { + drm_panel_prepare(panel); tegra_output_enable(output); drm_panel_enable(panel); }
Move out code from enable and disable routines to prepare and unprepare routines, so that functionality is properly distributed across all the panel functions.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/panel/panel-ld9040.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-ld9040.c b/drivers/gpu/drm/panel/panel-ld9040.c index 9b40bd05..c6aa7f7 100644 --- a/drivers/gpu/drm/panel/panel-ld9040.c +++ b/drivers/gpu/drm/panel/panel-ld9040.c @@ -216,6 +216,11 @@ static int ld9040_power_off(struct ld9040 *ctx)
static int ld9040_disable(struct drm_panel *panel) { + return 0; +} + +static int ld9040_unprepare(struct drm_panel *panel) +{ struct ld9040 *ctx = panel_to_ld9040(panel);
msleep(120); @@ -228,18 +233,8 @@ static int ld9040_disable(struct drm_panel *panel) return ld9040_power_off(ctx); }
-static int ld9040_unprepare(struct drm_panel *panel) -{ - return 0; -} - static int ld9040_prepare(struct drm_panel *panel) { - return 0; -} - -static int ld9040_enable(struct drm_panel *panel) -{ struct ld9040 *ctx = panel_to_ld9040(panel); int ret;
@@ -252,11 +247,16 @@ static int ld9040_enable(struct drm_panel *panel) ret = ld9040_clear_error(ctx);
if (ret < 0) - ld9040_disable(panel); + ld9040_unprepare(panel);
return ret; }
+static int ld9040_enable(struct drm_panel *panel) +{ + return 0; +} + static int ld9040_get_modes(struct drm_panel *panel) { struct drm_connector *connector = panel->connector;
Move out code from enable and disable routines to prepare and unprepare routines, so that functionality is properly distributed across all the panel functions.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/panel/panel-s6e8aa0.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c index 60694dd..cf4be7f 100644 --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c @@ -889,6 +889,11 @@ static int s6e8aa0_power_off(struct s6e8aa0 *ctx)
static int s6e8aa0_disable(struct drm_panel *panel) { + return 0; +} + +static int s6e8aa0_unprepare(struct drm_panel *panel) +{ struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel);
s6e8aa0_dcs_write_seq_static(ctx, MIPI_DCS_ENTER_SLEEP_MODE); @@ -900,18 +905,8 @@ static int s6e8aa0_disable(struct drm_panel *panel) return s6e8aa0_power_off(ctx); }
-static int s6e8aa0_unprepare(struct drm_panel *panel) -{ - return 0; -} - static int s6e8aa0_prepare(struct drm_panel *panel) { - return 0; -} - -static int s6e8aa0_enable(struct drm_panel *panel) -{ struct s6e8aa0 *ctx = panel_to_s6e8aa0(panel); int ret;
@@ -923,11 +918,16 @@ static int s6e8aa0_enable(struct drm_panel *panel) ret = ctx->error;
if (ret < 0) - s6e8aa0_disable(panel); + s6e8aa0_unprepare(panel);
return ret; }
+static int s6e8aa0_enable(struct drm_panel *panel) +{ + return 0; +} + static int s6e8aa0_get_modes(struct drm_panel *panel) { struct drm_connector *connector = panel->connector;
Move out code from enable and disable routines to prepare and unprepare routines, so that functionality is properly distributed across all the panel functions.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/panel/panel-simple.c | 37 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 2e51c34..9801728 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -45,6 +45,7 @@ struct panel_desc {
struct panel_simple { struct drm_panel base; + bool prepared; bool enabled;
const struct panel_desc *desc; @@ -105,10 +106,6 @@ static int panel_simple_disable(struct drm_panel *panel) backlight_update_status(p->backlight); }
- if (p->enable_gpio) - gpiod_set_value_cansleep(p->enable_gpio, 0); - - regulator_disable(p->supply); p->enabled = false;
return 0; @@ -116,20 +113,27 @@ static int panel_simple_disable(struct drm_panel *panel)
static int panel_simple_unprepare(struct drm_panel *panel) { - return 0; -} + struct panel_simple *p = to_panel_simple(panel); + + if (!p->prepared) + return 0; + + if (p->enable_gpio) + gpiod_set_value_cansleep(p->enable_gpio, 0); + + regulator_disable(p->supply); + + p->prepared = false;
-static int panel_simple_prepare(struct drm_panel *panel) -{ return 0; }
-static int panel_simple_enable(struct drm_panel *panel) +static int panel_simple_prepare(struct drm_panel *panel) { struct panel_simple *p = to_panel_simple(panel); int err;
- if (p->enabled) + if (p->prepared) return 0;
err = regulator_enable(p->supply); @@ -141,6 +145,18 @@ static int panel_simple_enable(struct drm_panel *panel) if (p->enable_gpio) gpiod_set_value_cansleep(p->enable_gpio, 1);
+ p->prepared = true; + + return 0; +} + +static int panel_simple_enable(struct drm_panel *panel) +{ + struct panel_simple *p = to_panel_simple(panel); + + if (p->enabled) + return 0; + if (p->backlight) { p->backlight->props.power = FB_BLANK_UNBLANK; backlight_update_status(p->backlight); @@ -191,6 +207,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) return -ENOMEM;
panel->enabled = false; + panel->prepared = false; panel->desc = desc;
panel->supply = devm_regulator_get(dev, "power");
For most of the panels, we need to provide delays during various stages of panel powerup/powerdown.
So, Add a structure to hold those delay values and use them in corresponding functions.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/panel/panel-simple.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 9801728..d6e92ea 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -41,6 +41,24 @@ struct panel_desc { unsigned int width; unsigned int height; } size; + + /** + * @prepare: the time (in milliseconds) that it takes for the panel + * to become ready and start receiving video data + * @enable: the time (in milliseconds) that it takes for the panel + * to display the first valid frame after starting to + * receive video data + * @disable: the time (in milliseconds) that it takes for the panel + * to turn the display off (no content is visible) + * @unprepare: the time (in milliseconds) that it takes for the panel + * to power down itself completely + */ + struct { + unsigned int prepare; + unsigned int enable; + unsigned int disable; + unsigned int unprepare; + } delay; };
struct panel_simple { @@ -106,6 +124,9 @@ static int panel_simple_disable(struct drm_panel *panel) backlight_update_status(p->backlight); }
+ if (p->desc->delay.disable) + msleep(p->desc->delay.disable); + p->enabled = false;
return 0; @@ -123,6 +144,9 @@ static int panel_simple_unprepare(struct drm_panel *panel)
regulator_disable(p->supply);
+ if (p->desc->delay.unprepare) + msleep(p->desc->delay.unprepare); + p->prepared = false;
return 0; @@ -145,6 +169,9 @@ static int panel_simple_prepare(struct drm_panel *panel) if (p->enable_gpio) gpiod_set_value_cansleep(p->enable_gpio, 1);
+ if (p->desc->delay.prepare) + msleep(p->desc->delay.prepare); + p->prepared = true;
return 0; @@ -157,6 +184,9 @@ static int panel_simple_enable(struct drm_panel *panel) if (p->enabled) return 0;
+ if (p->desc->delay.enable) + msleep(p->desc->delay.enable); + if (p->backlight) { p->backlight->props.power = FB_BLANK_UNBLANK; backlight_update_status(p->backlight);
Add panel_desc structure for auo_b133htn01 eDP panel.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- .../devicetree/bindings/panel/auo,b133htn01.txt | 7 +++++ drivers/gpu/drm/panel/panel-simple.c | 31 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/auo,b133htn01.txt
diff --git a/Documentation/devicetree/bindings/panel/auo,b133htn01.txt b/Documentation/devicetree/bindings/panel/auo,b133htn01.txt new file mode 100644 index 0000000..302226b --- /dev/null +++ b/Documentation/devicetree/bindings/panel/auo,b133htn01.txt @@ -0,0 +1,7 @@ +AU Optronics Corporation 13.3" FHD (1920x1080) color TFT-LCD panel + +Required properties: +- compatible: should be "auo,b133htn01" + +This binding is compatible with the simple-panel binding, which is specified +in simple-panel.txt in this directory. diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index d6e92ea..a4fa7c7 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -166,6 +166,7 @@ static int panel_simple_prepare(struct drm_panel *panel) return err; }
+ if (p->enable_gpio) gpiod_set_value_cansleep(p->enable_gpio, 1);
@@ -372,6 +373,33 @@ static const struct panel_desc auo_b133xtn01 = { }, };
+static const struct drm_display_mode auo_b133htn01_mode = { + .clock = 150660, + .hdisplay = 1920, + .hsync_start = 1920 + 172, + .hsync_end = 1920 + 172 + 80, + .htotal = 1920 + 172 + 80 + 60, + .vdisplay = 1080, + .vsync_start = 1080 + 25, + .vsync_end = 1080 + 25 + 10, + .vtotal = 1080 + 25 + 10 + 10, + .vrefresh = 60, +}; + +static const struct panel_desc auo_b133htn01 = { + .modes = &auo_b133htn01_mode, + .num_modes = 1, + .size = { + .width = 293, + .height = 165, + }, + .delay = { + .prepare = 105, + .enable = 20, + .unprepare = 50, + }, +}; + static const struct drm_display_mode chunghwa_claa101wa01a_mode = { .clock = 72070, .hdisplay = 1366, @@ -511,6 +539,9 @@ static const struct of_device_id platform_of_match[] = { .compatible = "auo,b101aw03", .data = &auo_b101aw03, }, { + .compatible = "auo,b133htn01", + .data = &auo_b133htn01, + }, { .compatible = "auo,b133xtn01", .data = &auo_b133xtn01, }, {
Add commit callback for exynos_dp, and move the DP link training, video configuration code from the hotplug handler into commit().
Signed-off-by: Sean Paul seanpaul@chromium.org Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/exynos/exynos_dp_core.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 31c3de9..347dec9 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg) static void exynos_dp_hotplug(struct work_struct *work) { struct exynos_dp_device *dp; - int ret;
dp = container_of(work, struct exynos_dp_device, hotplug_work);
+ if (dp->drm_dev) + drm_helper_hpd_irq_event(dp->drm_dev); +} + +static void exynos_dp_commit(struct exynos_drm_display *display) +{ + struct exynos_dp_device *dp = display->ctx; + int ret; + ret = exynos_dp_detect_hpd(dp); if (ret) { /* Cable has been disconnected, we're done */ @@ -1050,8 +1058,10 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) } }
-static void exynos_dp_poweron(struct exynos_dp_device *dp) +static void exynos_dp_poweron(struct exynos_drm_display *display) { + struct exynos_dp_device *dp = display->ctx; + if (dp->dpms_mode == DRM_MODE_DPMS_ON) return;
@@ -1059,10 +1069,13 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) exynos_dp_phy_init(dp); exynos_dp_init_dp(dp); enable_irq(dp->irq); + exynos_dp_commit(display); }
-static void exynos_dp_poweroff(struct exynos_dp_device *dp) +static void exynos_dp_poweroff(struct exynos_drm_display *display) { + struct exynos_dp_device *dp = display->ctx; + if (dp->dpms_mode != DRM_MODE_DPMS_ON) return;
@@ -1078,12 +1091,12 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
switch (mode) { case DRM_MODE_DPMS_ON: - exynos_dp_poweron(dp); + exynos_dp_poweron(display); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF: - exynos_dp_poweroff(dp); + exynos_dp_poweroff(display); break; default: break; @@ -1094,6 +1107,7 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) static struct exynos_drm_display_ops exynos_dp_display_ops = { .create_connector = exynos_dp_create_connector, .dpms = exynos_dp_dpms, + .commit = exynos_dp_commit, };
static struct exynos_drm_display exynos_dp_display = {
On Thu, Jul 31, 2014 at 11:12:13PM +0530, Ajay Kumar wrote:
Add commit callback for exynos_dp, and move the DP link training, video configuration code from the hotplug handler into commit().
Signed-off-by: Sean Paul seanpaul@chromium.org Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_dp_core.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
This is not related to the other patches in the series, so it can be applied independently.
Sean, this looks like a back-/forward-port of the patch you linked to in reply to an earlier version of the series, does this still correspond to what you think it should be doing? (hence not trimming the quote)
Thierry
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 31c3de9..347dec9 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg) static void exynos_dp_hotplug(struct work_struct *work) { struct exynos_dp_device *dp;
int ret;
dp = container_of(work, struct exynos_dp_device, hotplug_work);
- if (dp->drm_dev)
drm_helper_hpd_irq_event(dp->drm_dev);
+}
+static void exynos_dp_commit(struct exynos_drm_display *display) +{
- struct exynos_dp_device *dp = display->ctx;
- int ret;
- ret = exynos_dp_detect_hpd(dp); if (ret) { /* Cable has been disconnected, we're done */
@@ -1050,8 +1058,10 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) } }
-static void exynos_dp_poweron(struct exynos_dp_device *dp) +static void exynos_dp_poweron(struct exynos_drm_display *display) {
- struct exynos_dp_device *dp = display->ctx;
- if (dp->dpms_mode == DRM_MODE_DPMS_ON) return;
@@ -1059,10 +1069,13 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) exynos_dp_phy_init(dp); exynos_dp_init_dp(dp); enable_irq(dp->irq);
- exynos_dp_commit(display);
}
-static void exynos_dp_poweroff(struct exynos_dp_device *dp) +static void exynos_dp_poweroff(struct exynos_drm_display *display) {
- struct exynos_dp_device *dp = display->ctx;
- if (dp->dpms_mode != DRM_MODE_DPMS_ON) return;
@@ -1078,12 +1091,12 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
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_poweron(display);
exynos_dp_poweroff(dp);
break; default: break;exynos_dp_poweroff(display);
@@ -1094,6 +1107,7 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) static struct exynos_drm_display_ops exynos_dp_display_ops = { .create_connector = exynos_dp_create_connector, .dpms = exynos_dp_dpms,
- .commit = exynos_dp_commit,
};
static struct exynos_drm_display exynos_dp_display = {
1.7.9.5
On Fri, Aug 1, 2014 at 2:48 PM, Thierry Reding thierry.reding@gmail.com wrote:
On Thu, Jul 31, 2014 at 11:12:13PM +0530, Ajay Kumar wrote:
Add commit callback for exynos_dp, and move the DP link training, video configuration code from the hotplug handler into commit().
Signed-off-by: Sean Paul seanpaul@chromium.org Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_dp_core.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
This is not related to the other patches in the series, so it can be applied independently.
This patch should go in this series only. [PATCH 15/15] has dependency on this because it modifies exynos_dp_commit().
Sean, this looks like a back-/forward-port of the patch you linked to in reply to an earlier version of the series, does this still correspond to what you think it should be doing? (hence not trimming the quote)
Sean said one of his test app fails since exynos_dp_commit was missing in previous version of this patch. Now, I have added exynos_dp_commit as he suggested, and the side effect because of this addition (video reconfiguration glitch) is taken care by the panel calls in the next patch [PATCH 15/15].
Ajay
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 31c3de9..347dec9 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -875,10 +875,18 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg) static void exynos_dp_hotplug(struct work_struct *work) { struct exynos_dp_device *dp;
int ret; dp = container_of(work, struct exynos_dp_device, hotplug_work);
if (dp->drm_dev)
drm_helper_hpd_irq_event(dp->drm_dev);
+}
+static void exynos_dp_commit(struct exynos_drm_display *display) +{
struct exynos_dp_device *dp = display->ctx;
int ret;
ret = exynos_dp_detect_hpd(dp); if (ret) { /* Cable has been disconnected, we're done */
@@ -1050,8 +1058,10 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) } }
-static void exynos_dp_poweron(struct exynos_dp_device *dp) +static void exynos_dp_poweron(struct exynos_drm_display *display) {
struct exynos_dp_device *dp = display->ctx;
if (dp->dpms_mode == DRM_MODE_DPMS_ON) return;
@@ -1059,10 +1069,13 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) exynos_dp_phy_init(dp); exynos_dp_init_dp(dp); enable_irq(dp->irq);
exynos_dp_commit(display);
}
-static void exynos_dp_poweroff(struct exynos_dp_device *dp) +static void exynos_dp_poweroff(struct exynos_drm_display *display) {
struct exynos_dp_device *dp = display->ctx;
if (dp->dpms_mode != DRM_MODE_DPMS_ON) return;
@@ -1078,12 +1091,12 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode)
switch (mode) { case DRM_MODE_DPMS_ON:
exynos_dp_poweron(dp);
exynos_dp_poweron(display); break; case DRM_MODE_DPMS_STANDBY: case DRM_MODE_DPMS_SUSPEND: case DRM_MODE_DPMS_OFF:
exynos_dp_poweroff(dp);
exynos_dp_poweroff(display); break; default: break;
@@ -1094,6 +1107,7 @@ static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) static struct exynos_drm_display_ops exynos_dp_display_ops = { .create_connector = exynos_dp_create_connector, .dpms = exynos_dp_dpms,
.commit = exynos_dp_commit,
};
static struct exynos_drm_display exynos_dp_display = {
1.7.9.5
On Fri, Aug 01, 2014 at 03:11:37PM +0530, Ajay kumar wrote:
On Fri, Aug 1, 2014 at 2:48 PM, Thierry Reding thierry.reding@gmail.com wrote:
On Thu, Jul 31, 2014 at 11:12:13PM +0530, Ajay Kumar wrote:
Add commit callback for exynos_dp, and move the DP link training, video configuration code from the hotplug handler into commit().
Signed-off-by: Sean Paul seanpaul@chromium.org Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/exynos_dp_core.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
This is not related to the other patches in the series, so it can be applied independently.
This patch should go in this series only. [PATCH 15/15] has dependency on this because it modifies exynos_dp_commit().
Okay, I'll apply it to the panel tree. Inki, can I assume your Acked-by from patch 06/15 applies to this one as well?
Thierry
Add drm_panel controls to support powerup/down of the eDP panel, if one is present at the sink side.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com --- drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 88 ++++++++++++++++++++++++------- drivers/gpu/drm/exynos/exynos_dp_core.h | 3 +- 3 files changed, 71 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 9ba1aae..7f9f6f9 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -53,6 +53,7 @@ config DRM_EXYNOS_DP bool "EXYNOS DRM DP driver support" depends on DRM_EXYNOS_FIMD && ARCH_EXYNOS && (DRM_PTN3460=n || DRM_PTN3460=y || DRM_PTN3460=DRM_EXYNOS) default DRM_EXYNOS + select DRM_PANEL help This enables support for DP device.
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 347dec9..4f3c7eb 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -16,7 +16,6 @@ #include <linux/clk.h> #include <linux/io.h> #include <linux/interrupt.h> -#include <linux/delay.h> #include <linux/of.h> #include <linux/of_gpio.h> #include <linux/gpio.h> @@ -28,6 +27,7 @@ #include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_panel.h> #include <drm/bridge/ptn3460.h>
#include "exynos_drm_drv.h" @@ -41,7 +41,7 @@ struct bridge_init { struct device_node *node; };
-static int exynos_dp_init_dp(struct exynos_dp_device *dp) +static void exynos_dp_init_dp(struct exynos_dp_device *dp) { exynos_dp_reset(dp);
@@ -58,8 +58,6 @@ static int exynos_dp_init_dp(struct exynos_dp_device *dp)
exynos_dp_init_hpd(dp); exynos_dp_init_aux(dp); - - return 0; }
static int exynos_dp_detect_hpd(struct exynos_dp_device *dp) @@ -887,6 +885,12 @@ static void exynos_dp_commit(struct exynos_drm_display *display) struct exynos_dp_device *dp = display->ctx; int ret;
+ /* Keep the panel disabled while we configure video */ + if (dp->panel) { + if (drm_panel_disable(dp->panel)) + DRM_ERROR("failed to disable the panel\n"); + } + ret = exynos_dp_detect_hpd(dp); if (ret) { /* Cable has been disconnected, we're done */ @@ -917,6 +921,12 @@ static void exynos_dp_commit(struct exynos_drm_display *display) ret = exynos_dp_config_video(dp); if (ret) dev_err(dp->dev, "unable to config video\n"); + + /* Safe to enable the panel now */ + if (dp->panel) { + if (drm_panel_enable(dp->panel)) + DRM_ERROR("failed to enable the panel\n"); + } }
static enum drm_connector_status exynos_dp_detect( @@ -941,15 +951,18 @@ static int exynos_dp_get_modes(struct drm_connector *connector) struct exynos_dp_device *dp = ctx_from_connector(connector); struct drm_display_mode *mode;
+ if (dp->panel) + return drm_panel_get_modes(dp->panel); + mode = drm_mode_create(connector->dev); if (!mode) { DRM_ERROR("failed to create a new display mode.\n"); return 0; }
- drm_display_mode_from_videomode(&dp->panel.vm, mode); - mode->width_mm = dp->panel.width_mm; - mode->height_mm = dp->panel.height_mm; + drm_display_mode_from_videomode(&dp->priv.vm, mode); + mode->width_mm = dp->priv.width_mm; + mode->height_mm = dp->priv.height_mm; connector->display_info.width_mm = mode->width_mm; connector->display_info.height_mm = mode->height_mm;
@@ -1029,7 +1042,10 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, drm_connector_register(connector); drm_mode_connector_attach_encoder(connector, encoder);
- return 0; + if (dp->panel) + ret = drm_panel_attach(dp->panel, &dp->connector); + + return ret; }
static void exynos_dp_phy_init(struct exynos_dp_device *dp) @@ -1065,6 +1081,13 @@ static void exynos_dp_poweron(struct exynos_drm_display *display) if (dp->dpms_mode == DRM_MODE_DPMS_ON) return;
+ if (dp->panel) { + if (drm_panel_prepare(dp->panel)) { + DRM_ERROR("failed to setup the panel\n"); + return; + } + } + clk_prepare_enable(dp->clock); exynos_dp_phy_init(dp); exynos_dp_init_dp(dp); @@ -1079,10 +1102,22 @@ static void exynos_dp_poweroff(struct exynos_drm_display *display) if (dp->dpms_mode != DRM_MODE_DPMS_ON) return;
+ if (dp->panel) { + if (drm_panel_disable(dp->panel)) { + DRM_ERROR("failed to disable the panel\n"); + return; + } + } + disable_irq(dp->irq); flush_work(&dp->hotplug_work); exynos_dp_phy_exit(dp); clk_disable_unprepare(dp->clock); + + if (dp->panel) { + if (drm_panel_unprepare(dp->panel)) + DRM_ERROR("failed to turnoff the panel\n"); + } }
static void exynos_dp_dpms(struct exynos_drm_display *display, int mode) @@ -1215,7 +1250,7 @@ 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, + ret = of_get_videomode(dp->dev->of_node, &dp->priv.vm, OF_USE_NATIVE_MODE); if (ret) { DRM_ERROR("failed: of_get_videomode() : %d\n", ret); @@ -1229,16 +1264,10 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm_dev = data; struct resource *res; - struct exynos_dp_device *dp; + struct exynos_dp_device *dp = exynos_dp_display.ctx; unsigned int irq_flags; - int ret = 0;
- dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), - GFP_KERNEL); - if (!dp) - return -ENOMEM; - dp->dev = &pdev->dev; dp->dpms_mode = DRM_MODE_DPMS_OFF;
@@ -1250,9 +1279,11 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) if (ret) return ret;
- ret = exynos_dp_dt_parse_panel(dp); - if (ret) - return ret; + if (!dp->panel) { + ret = exynos_dp_dt_parse_panel(dp); + if (ret) + return ret; + }
dp->clock = devm_clk_get(&pdev->dev, "dp"); if (IS_ERR(dp->clock)) { @@ -1312,7 +1343,6 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) disable_irq(dp->irq);
dp->drm_dev = drm_dev; - exynos_dp_display.ctx = dp;
platform_set_drvdata(pdev, &exynos_dp_display);
@@ -1339,6 +1369,9 @@ static const struct component_ops exynos_dp_ops = {
static int exynos_dp_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + struct device_node *panel_node; + struct exynos_dp_device *dp; int ret;
ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR, @@ -1346,6 +1379,21 @@ static int exynos_dp_probe(struct platform_device *pdev) if (ret) return ret;
+ dp = devm_kzalloc(&pdev->dev, sizeof(struct exynos_dp_device), + GFP_KERNEL); + if (!dp) + return -ENOMEM; + + panel_node = of_parse_phandle(dev->of_node, "panel", 0); + if (panel_node) { + dp->panel = of_drm_find_panel(panel_node); + of_node_put(panel_node); + if (!dp->panel) + return -EPROBE_DEFER; + } + + exynos_dp_display.ctx = dp; + ret = component_add(&pdev->dev, &exynos_dp_ops); if (ret) exynos_drm_component_del(&pdev->dev, diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h index 02cc4f9..a1aee69 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.h +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h @@ -149,6 +149,7 @@ struct exynos_dp_device { struct drm_device *drm_dev; struct drm_connector connector; struct drm_encoder *encoder; + struct drm_panel *panel; struct clk *clock; unsigned int irq; void __iomem *reg_base; @@ -162,7 +163,7 @@ struct exynos_dp_device { int dpms_mode; int hpd_gpio;
- struct exynos_drm_panel_info panel; + struct exynos_drm_panel_info priv; };
/* exynos_dp_reg.c */
On Thu, Jul 31, 2014 at 11:12:14PM +0530, Ajay Kumar wrote:
Add drm_panel controls to support powerup/down of the eDP panel, if one is present at the sink side.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 88 ++++++++++++++++++++++++------- drivers/gpu/drm/exynos/exynos_dp_core.h | 3 +- 3 files changed, 71 insertions(+), 21 deletions(-)
Inki, I'll need an Acked-by from you on this one as well. It has a build time dependency on earlier patches in this series, so taking it through the panel tree along with the rest is probably easiest.
Thierry
On 2014년 08월 01일 18:09, Thierry Reding wrote:
On Thu, Jul 31, 2014 at 11:12:14PM +0530, Ajay Kumar wrote:
Add drm_panel controls to support powerup/down of the eDP panel, if one is present at the sink side.
Signed-off-by: Ajay Kumar ajaykumar.rs@samsung.com
drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 88 ++++++++++++++++++++++++------- drivers/gpu/drm/exynos/exynos_dp_core.h | 3 +- 3 files changed, 71 insertions(+), 21 deletions(-)
Inki, I'll need an Acked-by from you on this one as well. It has a build time dependency on earlier patches in this series, so taking it through the panel tree along with the rest is probably easiest.
Acked-by: Inki Dae inki.dae@samsung.com
Thanks, Inki Dae
Thierry
On Thu, Jul 31, 2014 at 11:11:59PM +0530, Ajay Kumar wrote:
This series is based on exynos-drm-next branch of Inki Dae's tree at: git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
This is originally a part of the bridge chip series: http://www.spinics.net/lists/linux-samsung-soc/msg34826.html
But, since we can handle panel and bridge chips seperately, I thought of seperating them.
This patchset basically extends the drm panel framework to accomodate wider range of panels with strict timing sequence for enabling panel power, backlight enable, etc.
I have tested this patchset on exynos5800-peach-pi board.
Thierry: As discussed, I have seperated patches such that they won't break the compilation in between. Also, I have incorporated all the comments given by you for panel patches. I assume you have already taken [PATCH 01/15] and hence it can be dropped from this patchset.
Ajay Kumar (15): [PATCH 01/15] drm/panel: add prepare and unprepare routines [PATCH 02/15] drm/panel: Add get_modes helper [PATCH 03/15] drm/panel: ld9040: Add dummy prepare and unprepare routines [PATCH 04/15] drm/panel: s6e8aa0: Add dummy prepare and unprepare routines [PATCH 05/15] drm/panel: simple: Add dummy prepare and unprepare routines [PATCH 06/15] drm/exynos: dpi: Add support for panel prepare and unprepare routines [PATCH 07/15] drm/exynos: dsi: Add support for panel prepare and unprepare routines [PATCH 08/15] drm/tegra: Add support for panel prepare and unprepare routines [PATCH 09/15] drm/panel: ld9040: Add proper definition for prepare and unprepare [PATCH 10/15] drm/panel: s6e8aa0: Add proper definition for prepare and unprepare [PATCH 11/15] drm/panel: simple: Add proper definition for prepare and unprepare [PATCH 12/15] drm/panel: simple: Support usage of delays in panel functions [PATCH 13/15] drm/panel: simple: Add support for auo_b133htn01 panel [PATCH 14/15] drm/exynos: Move DP setup into commit() [PATCH 15/15] drm/exynos: dp: Modify driver to support drm_panel
I already had patches 01/15 and 02/15, but I've applied the rest of the series. I went out on a limb and applied Inki's Acked-by to all Exynos- related patches, assuming that was the intention.
Thierry
dri-devel@lists.freedesktop.org