lkml.org 
[lkml]   [2020]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v6 11/16] dmaengine: tegra-apb: Keep clock enabled only during of DMA transfer
From
Date
03.02.2020 14:37, Jon Hunter пишет:
>
> On 01/02/2020 15:13, Dmitry Osipenko wrote:
>> 31.01.2020 17:22, Dmitry Osipenko пишет:
>>> 31.01.2020 12:02, Jon Hunter пишет:
>>>>
>>>> On 30/01/2020 20:04, Dmitry Osipenko wrote:
>>>>
>>>> ...
>>>>
>>>>>>> The tegra_dma_stop() should put RPM anyways, which is missed in yours
>>>>>>> sample. Please see handle_continuous_head_request().
>>>>>>
>>>>>> Yes and that is deliberate. The cyclic transfers the transfers *should*
>>>>>> not stop until terminate_all is called. The tegra_dma_stop in
>>>>>> handle_continuous_head_request() is an error condition and so I am not
>>>>>> sure it is actually necessary to call pm_runtime_put() here.
>>>>>
>>>>> But then tegra_dma_stop() shouldn't unset the "busy" mark.
>>>>
>>>> True.
>>>>
>>>>>>> I'm also finding the explicit get/put a bit easier to follow in the
>>>>>>> code, don't you think so?
>>>>>>
>>>>>> I can see that, but I was thinking that in the case of cyclic transfers,
>>>>>> it should only really be necessary to call the get/put at the beginning
>>>>>> and end. So in my mind there should only be two exit points which are
>>>>>> the ISR handler for SG and terminate_all for SG and cyclic.
>>>>>
>>>>> Alright, I'll update this patch.
>>>>
>>>> Hmmm ... I am wondering if we should not mess with that and leave how
>>>> you have it.
>>>
>>> I took another look and seems my current v6 should be more correct because:
>>>
>>> 1. If "busy" is unset in tegra_dma_stop(), then the RPM should be put
>>> there since tegra_dma_terminate_all() won't put RPM in this case:
>>>
>>> if (!tdc->busy)
>>> goto skip_dma_stop;
>>>
>>> 2. We can't move the "busy" unsetting into the terminate because then
>>> tegra_dma_stop() will be invoked twice. Although, one option could be to
>>> remove the tegra_dma_stop() from the error paths of
>>> handle_continuous_head_request(), but I'm not sure that this is correct
>>> to do.
>>
>> Jon, I realized that my v6 variant is wrong too because
>> tegra_dma_terminate_all() -> tdc->isr_handler() will put RPM, and thus,
>> the RPM enable-count will be wrecked in this case.
>
> Did you see my other suggestion to move the pm_runtime_put() outside of
> tegra_dma_stop?

Yes, but seems I skimmed too quickly through the lines and failed to
recognize the point you made.

> There are only a few call sites for tegra_dma_stop and
> so if we call pm_runtime_put() after calling tegra_dma_stop this should
> simplify matters.

This is somewhat similar to what I made in the v7. Instead of adding
pm_runtime_put() after each tegra_dma_stop(), I removed the
tegra_dma_stop().

Looking at it once again, perhaps indeed it will be better to leave the
relevant tegra_dma_stop() in place (the irrelevant could be removed).

Please take a look at the v7, I'll drop the "[PATCH v7 13/19] dmaengine:
tegra-apb: Don't stop cyclic DMA in a case of error condition" and make
v8 after yours review of the v7. Thanks in advance!

\
 
 \ /
  Last update: 2020-02-03 17:24    [W:0.061 / U:2.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site