public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: liu kaiwei <liukaiwei086@gmail.com>, Vinod Koul <vkoul@kernel.org>
Cc: Kaiwei Liu <kaiwei.liu@unisoc.com>,
	Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wenming Wu <wenming.wu@unisoc.com>
Subject: Re: [PATCH 1/2] dmaengine: sprd: delete enable opreation in probe
Date: Tue, 19 Dec 2023 15:00:24 +0800	[thread overview]
Message-ID: <1b9a7d11-c91f-4b55-bf27-d7c703ed5c24@linux.alibaba.com> (raw)
In-Reply-To: <CAOgAA6FJrJ2kVg4hg3sAE_VAG8SyQ4UzKikU+Ofa=N2w0Q4Ghg@mail.gmail.com>



On 12/19/2023 1:21 PM, liu kaiwei wrote:
> On Mon, Dec 11, 2023 at 7:41 PM Vinod Koul <vkoul@kernel.org> wrote:
>>
>> On 06-12-23, 17:32, liu kaiwei wrote:
>>> On Fri, Nov 24, 2023 at 9:11 PM Vinod Koul <vkoul@kernel.org> wrote:
>>>>
>>>> On 02-11-23, 20:16, Kaiwei Liu wrote:
>>>>> From: "kaiwei.liu" <kaiwei.liu@unisoc.com>
>>>>
>>>> Typo is subject line
>>>>
>>>>>
>>>>> In the probe of dma, it will allocate device memory and do some
>>>>> initalization settings. All operations are only at the software
>>>>> level and don't need the DMA hardware power on. It doesn't need
>>>>> to resume the device and set the device active as well. here
>>>>> delete unnecessary operation.
>>>>
>>>> Don't you need to read or write to the device? Without enable that wont
>>>> work right?
>>>>
>>>
>>> Yes, it doesn't need to read or write to the device in the probe of DMA.
>>> We will enable the DMA when allocating the DMA channel.
>>
>> So you will probe even if device is not present! I think it makes sense
>> to access device registers in probe!
> 
> There is another reason why we delete enable/disable and not to access
> device in probe. The current driver is applicable to two DMA devices
> in different
> power domain. For some scenes, one of the domain is power off and when you
> probe,  enable the dma with the domain power off may cause crash.
> 
> For example, one case is for audio co-processor and DMA serves for it,
> DMA's power domain is off during initialization since audio is not used
> at that time, so we cannot read/write DMA's register for this kind of cases.
> 
> @Baolin Wang
> Hi baolin,what's your opinion?

Please add your explanation into the commit message.

Moreover, I think Vinod's concern is reasonable, so you can not move the 
pm_runtime_enable() after registering the devices, which means users can 
access the device without powering on.

To solve your problem, I think you can move the pm_runtime_enable() 
before dma_async_device_register(), then if users want to use DMA in 
probe stage, the dma_chan_get()--->sprd_dma_alloc_chan_resources() will 
help to power on it.

      reply	other threads:[~2023-12-19  7:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02 12:16 [PATCH 1/2] dmaengine: sprd: delete enable opreation in probe Kaiwei Liu
2023-11-24 13:11 ` Vinod Koul
2023-12-06  9:32   ` liu kaiwei
2023-12-11 11:40     ` Vinod Koul
2023-12-19  5:21       ` liu kaiwei
2023-12-19  7:00         ` Baolin Wang [this message]

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=1b9a7d11-c91f-4b55-bf27-d7c703ed5c24@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kaiwei.liu@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liukaiwei086@gmail.com \
    --cc=orsonzhai@gmail.com \
    --cc=vkoul@kernel.org \
    --cc=wenming.wu@unisoc.com \
    --cc=zhang.lyra@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox