From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ulrich Hecht <uli+renesas@fpond.eu>
Cc: linux-renesas-soc@vger.kernel.org,
dri-devel@lists.freedesktop.org, jacopo+renesas@jmondi.org,
kieran.bingham+renesas@ideasonboard.com
Subject: Re: [PROTO][PATCH 02/10] drm: rcar-du: Add r8a77995 device support
Date: Mon, 20 Aug 2018 11:39:44 +0300 [thread overview]
Message-ID: <12609537.6v2WhfLlsh@avalon> (raw)
In-Reply-To: <1534254604-24204-3-git-send-email-uli+renesas@fpond.eu>
Hi Ulrich,
Thank you for the patch.
On Tuesday, 14 August 2018 16:49:56 EEST Ulrich Hecht wrote:
> Add support for the R-Car D3 (R8A77995) SoC to the R-Car DU driver.
>
> Based on patch by Koji Matsuoka <koji.matsuoka.xm@renesas.com>.
>
> Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 17 ++++++-----------
> drivers/gpu/drm/rcar-du/rcar_du_drv.c | 26 ++++++++++++++++++++++++++
> drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 +
> drivers/gpu/drm/rcar-du/rcar_du_group.c | 3 ++-
> 4 files changed, 35 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index cd6803a..9153e7a 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -53,14 +53,6 @@ static void rcar_du_crtc_clr(struct rcar_du_crtc *rcrtc,
> u32 reg, u32 clr) rcar_du_read(rcdu, rcrtc->mmio_offset + reg) & ~clr);
> }
>
> -static void rcar_du_crtc_set(struct rcar_du_crtc *rcrtc, u32 reg, u32 set)
> -{
> - struct rcar_du_device *rcdu = rcrtc->group->dev;
> -
> - rcar_du_write(rcdu, rcrtc->mmio_offset + reg,
> - rcar_du_read(rcdu, rcrtc->mmio_offset + reg) | set);
> -}
> -
> static void rcar_du_crtc_clr_set(struct rcar_du_crtc *rcrtc, u32 reg,
> u32 clr, u32 set)
> {
> @@ -527,7 +519,8 @@ static void rcar_du_crtc_start(struct rcar_du_crtc
> *rcrtc) * actively driven).
> */
> interlaced = rcrtc->crtc.mode.flags & DRM_MODE_FLAG_INTERLACE;
> - rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK | DSYSR_SCM_MASK,
> + rcar_du_crtc_clr_set(rcrtc, DSYSR,
> + DSYSR_TVM_MASK | DSYSR_SCM_MASK | DSYSR_ILTS,
The ILTS bit defaults to 0 so this shouldn't be needed. However, we never
initialize the DSYSR register completely but only modify bits. It would be
safer to write all bits at init time. I'll write a separate patch.
> (interlaced ? DSYSR_SCM_INT_VIDEO : 0) |
> DSYSR_TVM_MASTER);
>
> @@ -596,7 +589,9 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc
> *rcrtc) * Select switch sync mode. This stops display operation and
> configures * the HSYNC and VSYNC signals as inputs.
> */
> - rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK, DSYSR_TVM_SWITCH);
> + rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK | DSYSR_ILTS,
> + rcar_du_needs(rcrtc->group->dev, RCAR_DU_QUIRK_TVM_MASTER_ONLY) ?
> + DSYSR_TVM_MASTER : DSYSR_TVM_SWITCH);
Now this is a problem. The driver uses switch mode as a way to disable the
display output, as the display enable bits in the DSYSR register cover a group
of two DU channels. TVM switch mode was the only workaround I found to be able
to disable the display output. If the D3 and E3 SoCs don't implement TVM
switch mode we need a different mechanism.
> rcar_du_group_start_stop(rcrtc->group, false);
> }
> @@ -744,7 +739,7 @@ static int rcar_du_crtc_enable_vblank(struct drm_crtc
> *crtc) struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
>
> rcar_du_crtc_write(rcrtc, DSRCR, DSRCR_VBCL);
> - rcar_du_crtc_set(rcrtc, DIER, DIER_VBE);
> + rcar_du_crtc_clr_set(rcrtc, DIER, DIER_TVE | DIER_FRE, DIER_VBE);
> rcrtc->vblank_enable = true;
>
> return 0;
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 56f9472..5c2f764 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -294,6 +294,31 @@ static const struct rcar_du_device_info
> rcar_du_r8a77970_info = { .num_lvds = 1,
> };
>
> +static const struct rcar_du_device_info rcar_du_r8a77995_info = {
> + .gen = 3,
> + .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
> + | RCAR_DU_FEATURE_EXT_CTRL_REGS
> + | RCAR_DU_FEATURE_VSP1_SOURCE,
> + .quirks = RCAR_DU_QUIRK_TVM_MASTER_ONLY,
> + .channels_mask = BIT(1) | BIT(0),
> + .routes = {
> + /* R8A77995 has two LVDS output and one RGB output. */
> + [RCAR_DU_OUTPUT_DPAD0] = {
> + .possible_crtcs = BIT(0) | BIT(1),
> + .port = 0,
> + },
> + [RCAR_DU_OUTPUT_LVDS0] = {
> + .possible_crtcs = BIT(0),
> + .port = 1,
> + },
> + [RCAR_DU_OUTPUT_LVDS1] = {
> + .possible_crtcs = BIT(1),
> + .port = 2,
> + },
> + },
> + .num_lvds = 2,
> +};
> +
> static const struct of_device_id rcar_du_of_table[] = {
> { .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
> { .compatible = "renesas,du-r8a7745", .data = &rzg1_du_r8a7745_info },
> @@ -307,6 +332,7 @@ static const struct of_device_id rcar_du_of_table[] = {
> { .compatible = "renesas,du-r8a7796", .data = &rcar_du_r8a7796_info },
> { .compatible = "renesas,du-r8a77965", .data = &rcar_du_r8a77965_info },
> { .compatible = "renesas,du-r8a77970", .data = &rcar_du_r8a77970_info },
> + { .compatible = "renesas,du-r8a77995", .data = &rcar_du_r8a77995_info },
> { }
> };
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index b3a25e8..6257405 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -32,6 +32,7 @@ struct rcar_du_device;
> #define RCAR_DU_FEATURE_VSP1_SOURCE (1 << 2) /* Has inputs from VSP1 */
>
> #define RCAR_DU_QUIRK_ALIGN_128B (1 << 0) /* Align pitches to 128 bytes
*/
> +#define RCAR_DU_QUIRK_TVM_MASTER_ONLY (1 << 1) /* Does not have TV
> switch/sync modes */
>
> /*
> * struct rcar_du_output_routing - Output routing specification
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> b/drivers/gpu/drm/rcar-du/rcar_du_group.c index d539cb2..9a0a694 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> @@ -178,7 +178,8 @@ void rcar_du_group_put(struct rcar_du_group *rgrp)
> static void __rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool
> start) {
> rcar_du_group_write(rgrp, DSYSR,
> - (rcar_du_group_read(rgrp, DSYSR) & ~(DSYSR_DRES | DSYSR_DEN)) |
> + (rcar_du_group_read(rgrp, DSYSR) &
> + ~(DSYSR_DRES | DSYSR_DEN | DSYSR_ILTS)) |
> (start ? DSYSR_DEN : DSYSR_DRES));
> }
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ulrich Hecht <uli+renesas@fpond.eu>
Cc: linux-renesas-soc@vger.kernel.org,
kieran.bingham+renesas@ideasonboard.com,
jacopo+renesas@jmondi.org, dri-devel@lists.freedesktop.org
Subject: Re: [PROTO][PATCH 02/10] drm: rcar-du: Add r8a77995 device support
Date: Mon, 20 Aug 2018 11:39:44 +0300 [thread overview]
Message-ID: <12609537.6v2WhfLlsh@avalon> (raw)
In-Reply-To: <1534254604-24204-3-git-send-email-uli+renesas@fpond.eu>
Hi Ulrich,
Thank you for the patch.
On Tuesday, 14 August 2018 16:49:56 EEST Ulrich Hecht wrote:
> Add support for the R-Car D3 (R8A77995) SoC to the R-Car DU driver.
>
> Based on patch by Koji Matsuoka <koji.matsuoka.xm@renesas.com>.
>
> Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 17 ++++++-----------
> drivers/gpu/drm/rcar-du/rcar_du_drv.c | 26 ++++++++++++++++++++++++++
> drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 +
> drivers/gpu/drm/rcar-du/rcar_du_group.c | 3 ++-
> 4 files changed, 35 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index cd6803a..9153e7a 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -53,14 +53,6 @@ static void rcar_du_crtc_clr(struct rcar_du_crtc *rcrtc,
> u32 reg, u32 clr) rcar_du_read(rcdu, rcrtc->mmio_offset + reg) & ~clr);
> }
>
> -static void rcar_du_crtc_set(struct rcar_du_crtc *rcrtc, u32 reg, u32 set)
> -{
> - struct rcar_du_device *rcdu = rcrtc->group->dev;
> -
> - rcar_du_write(rcdu, rcrtc->mmio_offset + reg,
> - rcar_du_read(rcdu, rcrtc->mmio_offset + reg) | set);
> -}
> -
> static void rcar_du_crtc_clr_set(struct rcar_du_crtc *rcrtc, u32 reg,
> u32 clr, u32 set)
> {
> @@ -527,7 +519,8 @@ static void rcar_du_crtc_start(struct rcar_du_crtc
> *rcrtc) * actively driven).
> */
> interlaced = rcrtc->crtc.mode.flags & DRM_MODE_FLAG_INTERLACE;
> - rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK | DSYSR_SCM_MASK,
> + rcar_du_crtc_clr_set(rcrtc, DSYSR,
> + DSYSR_TVM_MASK | DSYSR_SCM_MASK | DSYSR_ILTS,
The ILTS bit defaults to 0 so this shouldn't be needed. However, we never
initialize the DSYSR register completely but only modify bits. It would be
safer to write all bits at init time. I'll write a separate patch.
> (interlaced ? DSYSR_SCM_INT_VIDEO : 0) |
> DSYSR_TVM_MASTER);
>
> @@ -596,7 +589,9 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc
> *rcrtc) * Select switch sync mode. This stops display operation and
> configures * the HSYNC and VSYNC signals as inputs.
> */
> - rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK, DSYSR_TVM_SWITCH);
> + rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK | DSYSR_ILTS,
> + rcar_du_needs(rcrtc->group->dev, RCAR_DU_QUIRK_TVM_MASTER_ONLY) ?
> + DSYSR_TVM_MASTER : DSYSR_TVM_SWITCH);
Now this is a problem. The driver uses switch mode as a way to disable the
display output, as the display enable bits in the DSYSR register cover a group
of two DU channels. TVM switch mode was the only workaround I found to be able
to disable the display output. If the D3 and E3 SoCs don't implement TVM
switch mode we need a different mechanism.
> rcar_du_group_start_stop(rcrtc->group, false);
> }
> @@ -744,7 +739,7 @@ static int rcar_du_crtc_enable_vblank(struct drm_crtc
> *crtc) struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
>
> rcar_du_crtc_write(rcrtc, DSRCR, DSRCR_VBCL);
> - rcar_du_crtc_set(rcrtc, DIER, DIER_VBE);
> + rcar_du_crtc_clr_set(rcrtc, DIER, DIER_TVE | DIER_FRE, DIER_VBE);
> rcrtc->vblank_enable = true;
>
> return 0;
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 56f9472..5c2f764 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -294,6 +294,31 @@ static const struct rcar_du_device_info
> rcar_du_r8a77970_info = { .num_lvds = 1,
> };
>
> +static const struct rcar_du_device_info rcar_du_r8a77995_info = {
> + .gen = 3,
> + .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
> + | RCAR_DU_FEATURE_EXT_CTRL_REGS
> + | RCAR_DU_FEATURE_VSP1_SOURCE,
> + .quirks = RCAR_DU_QUIRK_TVM_MASTER_ONLY,
> + .channels_mask = BIT(1) | BIT(0),
> + .routes = {
> + /* R8A77995 has two LVDS output and one RGB output. */
> + [RCAR_DU_OUTPUT_DPAD0] = {
> + .possible_crtcs = BIT(0) | BIT(1),
> + .port = 0,
> + },
> + [RCAR_DU_OUTPUT_LVDS0] = {
> + .possible_crtcs = BIT(0),
> + .port = 1,
> + },
> + [RCAR_DU_OUTPUT_LVDS1] = {
> + .possible_crtcs = BIT(1),
> + .port = 2,
> + },
> + },
> + .num_lvds = 2,
> +};
> +
> static const struct of_device_id rcar_du_of_table[] = {
> { .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
> { .compatible = "renesas,du-r8a7745", .data = &rzg1_du_r8a7745_info },
> @@ -307,6 +332,7 @@ static const struct of_device_id rcar_du_of_table[] = {
> { .compatible = "renesas,du-r8a7796", .data = &rcar_du_r8a7796_info },
> { .compatible = "renesas,du-r8a77965", .data = &rcar_du_r8a77965_info },
> { .compatible = "renesas,du-r8a77970", .data = &rcar_du_r8a77970_info },
> + { .compatible = "renesas,du-r8a77995", .data = &rcar_du_r8a77995_info },
> { }
> };
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index b3a25e8..6257405 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -32,6 +32,7 @@ struct rcar_du_device;
> #define RCAR_DU_FEATURE_VSP1_SOURCE (1 << 2) /* Has inputs from VSP1 */
>
> #define RCAR_DU_QUIRK_ALIGN_128B (1 << 0) /* Align pitches to 128 bytes
*/
> +#define RCAR_DU_QUIRK_TVM_MASTER_ONLY (1 << 1) /* Does not have TV
> switch/sync modes */
>
> /*
> * struct rcar_du_output_routing - Output routing specification
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> b/drivers/gpu/drm/rcar-du/rcar_du_group.c index d539cb2..9a0a694 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> @@ -178,7 +178,8 @@ void rcar_du_group_put(struct rcar_du_group *rgrp)
> static void __rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool
> start) {
> rcar_du_group_write(rgrp, DSYSR,
> - (rcar_du_group_read(rgrp, DSYSR) & ~(DSYSR_DRES | DSYSR_DEN)) |
> + (rcar_du_group_read(rgrp, DSYSR) &
> + ~(DSYSR_DRES | DSYSR_DEN | DSYSR_ILTS)) |
> (start ? DSYSR_DEN : DSYSR_DRES));
> }
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-08-20 11:53 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-14 13:49 [PROTO][PATCH 00/10] R-Car D3 LVDS/HDMI support (with PLL) Ulrich Hecht
2018-08-14 13:49 ` Ulrich Hecht
2018-08-14 13:49 ` [PROTO][PATCH 01/10] drm: rcar-du: Add clk_set_rate for external clock device Ulrich Hecht
2018-08-14 13:49 ` Ulrich Hecht
2018-08-20 10:10 ` Laurent Pinchart
2018-08-20 10:10 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 02/10] drm: rcar-du: Add r8a77995 device support Ulrich Hecht
2018-08-14 13:49 ` Ulrich Hecht
2018-08-20 8:39 ` Laurent Pinchart [this message]
2018-08-20 8:39 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 03/10] drm: rcar-du: Fix digital RGB routing for R8A77995 Ulrich Hecht
2018-08-14 13:49 ` Ulrich Hecht
2018-08-20 9:25 ` Laurent Pinchart
2018-08-20 9:25 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 04/10] drm: rcar-du: lvds: LVDS PLL support Ulrich Hecht
2018-08-14 13:49 ` Ulrich Hecht
2018-08-20 10:48 ` Laurent Pinchart
2018-08-20 10:48 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 05/10] drm/bridge: adv7511: Add max-clock, min-vrefresh options Ulrich Hecht
2018-08-14 13:49 ` Ulrich Hecht
2018-08-20 9:28 ` Laurent Pinchart
2018-08-20 9:28 ` Laurent Pinchart
2018-08-21 8:03 ` Ulrich Hecht
2018-08-21 8:03 ` Ulrich Hecht
2018-08-21 8:09 ` Laurent Pinchart
2018-08-21 8:09 ` Laurent Pinchart
2018-08-22 9:13 ` Ulrich Hecht
2018-08-22 9:13 ` Ulrich Hecht
2018-08-22 14:00 ` Laurent Pinchart
2018-08-22 14:00 ` Laurent Pinchart
2018-08-14 13:50 ` [PROTO][PATCH 06/10] drm: rcar-du: Fix procedure for extal and dotclkin selection Ulrich Hecht
2018-08-14 13:50 ` Ulrich Hecht
2018-08-20 9:40 ` Laurent Pinchart
2018-08-20 9:40 ` Laurent Pinchart
2018-08-14 13:50 ` [PROTO][PATCH 07/10] arm64: dts: r8a77995-draak: set external clock for DU Ulrich Hecht
2018-08-14 13:50 ` Ulrich Hecht
2018-08-20 10:51 ` Laurent Pinchart
2018-08-20 10:51 ` Laurent Pinchart
2018-08-14 13:50 ` [PROTO][PATCH 08/10] drm: rcar-du: lvds: Handle LVDS interface reset Ulrich Hecht
2018-08-14 13:50 ` Ulrich Hecht
2018-08-14 13:50 ` [PROTO][PATCH 09/10] arm64: dts: renesas: r8a77995: Add LVDS support Ulrich Hecht
2018-08-14 13:50 ` Ulrich Hecht
2018-08-14 13:50 ` [PROTO][PATCH 10/10] arm64: dts: renesas: r8a77995-draak: add HDMI output Ulrich Hecht
2018-08-14 13:50 ` Ulrich Hecht
2018-08-20 11:01 ` Laurent Pinchart
2018-08-20 11:01 ` Laurent Pinchart
2018-08-20 9:50 ` [PROTO][PATCH 00/10] R-Car D3 LVDS/HDMI support (with PLL) Laurent Pinchart
2018-08-20 9:50 ` Laurent Pinchart
2018-08-21 8:02 ` Ulrich Hecht
2018-08-21 8:02 ` Ulrich Hecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12609537.6v2WhfLlsh@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacopo+renesas@jmondi.org \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=uli+renesas@fpond.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.