All of lore.kernel.org
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: iommu@lists.linux-foundation.org,
	linux-samsung-soc@vger.kernel.org,
	Joonyoung Shim <jy0922.shim@samsung.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Javier Martinez Canillas <javier@dowhile0.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Andrzej Hajda <a.hajda@samsung.com>
Subject: Re: [PATCH v2 1/3] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()
Date: Fri, 12 Jun 2015 18:08:19 +0900	[thread overview]
Message-ID: <557AA183.1070100@samsung.com> (raw)
In-Reply-To: <557AA0D3.8010808@samsung.com>

On 2015년 06월 12일 18:05, Marek Szyprowski wrote:
> 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.

Latter one it's better.

Thanks,
Inki Dae

> 
>>>           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

  parent reply	other threads:[~2015-06-12  9:08 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
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             ` Inki Dae [this message]
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=557AA183.1070100@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=javier@dowhile0.org \
    --cc=jy0922.shim@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=sw0312.kim@samsung.com \
    /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.