From: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Inki Dae <inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Krzysztof Kozlowski
<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Joonyoung Shim
<jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Seung-Woo Kim
<sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Andrzej Hajda <a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Javier Martinez Canillas
<javier-0uQlZySMnqxg9hUCZPvPmw@public.gmane.org>
Subject: Re: [PATCH v2 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()
Date: Fri, 12 Jun 2015 11:05:23 +0200 [thread overview]
Message-ID: <557AA0D3.8010808@samsung.com> (raw)
In-Reply-To: <5579A38C.8040604-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Hello,
On 2015-06-11 17:04, Inki Dae wrote:
> On 2015년 06월 03일 17:26, Marek Szyprowski wrote:
>> One should not do any assumptions on the stare of the fimd hardware
>> during driver initialization, so to properly reset fimd before enabling
>> IOMMU, one should ensure that all power domains and clocks are really
>> enabled. This patch adds pm_runtime and clocks management in the
>> fimd_clear_channel() function to ensure that any access to fimd
>> registers will be performed with clocks and power domains enabled.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> ---
>> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 22 ++++++++++++++++++----
>> 1 file changed, 18 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index 96618534358e..3ec9d4299a86 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -242,12 +242,21 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx,
>> writel(val, ctx->regs + SHADOWCON);
>> }
>>
>> +static int fimd_enable_vblank(struct exynos_drm_crtc *crtc);
>> +static void fimd_disable_vblank(struct exynos_drm_crtc *crtc);
> You can remove abvoe declarations. See the below comment.
>
>> +
>> static void fimd_clear_channel(struct fimd_context *ctx)
>> {
>> unsigned int win, ch_enabled = 0;
>>
>> DRM_DEBUG_KMS("%s\n", __FILE__);
>>
>> + /* Hardware is in unknown state, so ensure it gets enabled properly */
>> + pm_runtime_get_sync(ctx->dev);
>> +
>> + clk_prepare_enable(ctx->bus_clk);
>> + clk_prepare_enable(ctx->lcd_clk);
>> +
>> /* Check if any channel is enabled. */
>> for (win = 0; win < WINDOWS_NR; win++) {
>> u32 val = readl(ctx->regs + WINCON(win));
>> @@ -265,12 +274,17 @@ static void fimd_clear_channel(struct fimd_context *ctx)
>>
>> /* Wait for vsync, as disable channel takes effect at next vsync */
>> if (ch_enabled) {
>> - unsigned int state = ctx->suspended;
>> -
>> - ctx->suspended = 0;
>> + ctx->suspended = false;
>> + fimd_enable_vblank(ctx->crtc);
> I think you can call enable_vblank callback instead of
> fimd_enable_vblank function because ctx object has exynos_crtc object.
>
> i.e.,
> struct exynos_drm_crtc_ops *ops = ctx->crtc->ops;
> ...
> if (ops->enable_vblank)
> ops->enable_vblank(ctx->crtc);
> ...
Well, I don't like such indirect calls to known functions, but if you prefer
this approach I will send an updated patch in a minute. There is also
alternative
way of getting rid of forward declarations. Code of fimd_enable_vblank and
fimd_disable_vblank can be moved closer to fimd_wait_vblank function.
I will also send such alternative patch. Feel free to select the one
that better
fits your preferences.
>> fimd_wait_for_vblank(ctx->crtc);
>> - ctx->suspended = state;
>> + fimd_disable_vblank(ctx->crtc);
> Ditto.
>
> Thanks,
> Inki Dae
>
>> + ctx->suspended = true;
>> }
>> +
>> + clk_disable_unprepare(ctx->lcd_clk);
>> + clk_disable_unprepare(ctx->bus_clk);
>> +
>> + pm_runtime_put(ctx->dev);
>> }
>>
>> static int fimd_iommu_attach_devices(struct fimd_context *ctx,
>>
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2015-06-12 9:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 8:26 [PATCH v2 0/3] Exynos SYSMMU (IOMMU) updates for Exynos DRM Marek Szyprowski
[not found] ` <1433319984-18683-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-03 8:26 ` [PATCH v2 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel() Marek Szyprowski
[not found] ` <1433319984-18683-2-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-04 13:08 ` Inki Dae
[not found] ` <55704DC0.8000608-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-04 13:13 ` Inki Dae
[not found] ` <55704F04.7010808-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-08 8:22 ` Marek Szyprowski
2015-06-11 15:04 ` Inki Dae
[not found] ` <5579A38C.8040604-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-12 9:05 ` Marek Szyprowski [this message]
2015-06-12 9:07 ` [PATCH v3 " Marek Szyprowski
2015-06-12 9:07 ` [PATCH v3 (alternative) " Marek Szyprowski
2015-06-12 12:10 ` Inki Dae
2015-06-12 13:00 ` Marek Szyprowski
2015-06-15 7:18 ` Inki Dae
2015-06-15 13:36 ` [PATCH v4] " Marek Szyprowski
2015-06-12 13:51 ` [PATCH v3 (alternative) 1/3] " Inki Dae
2015-06-15 13:35 ` Marek Szyprowski
2015-06-12 9:08 ` [PATCH v2 " Inki Dae
2015-06-03 8:26 ` [PATCH v2 2/3] drm/exynos: iommu: detach from default dma-mapping domain on init Marek Szyprowski
2015-06-03 8:26 ` [PATCH v2 3/3] drm/exynos: iommu: improve a check for non-iommu dma_ops Marek Szyprowski
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=557AA0D3.8010808@samsung.com \
--to=m.szyprowski-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
--cc=a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=javier-0uQlZySMnqxg9hUCZPvPmw@public.gmane.org \
--cc=jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sw0312.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox