* [PATCH] dma: add support for reporting pause and resume separately [not found] <CGME20180702130819eucas1p2e11d8fabec93ba78d9e84f4ca6e5fd65@eucas1p2.samsung.com> @ 2018-07-02 13:08 ` Marek Szyprowski 2018-07-04 7:00 ` Vinod 2018-07-09 17:29 ` Vinod 0 siblings, 2 replies; 7+ messages in thread From: Marek Szyprowski @ 2018-07-02 13:08 UTC (permalink / raw) To: dmaengine, alsa-devel, linux-kernel Cc: Marek Szyprowski, Vinod Koul, Dan Williams, Lars-Peter Clausen, Mark Brown, Bartlomiej Zolnierkiewicz 'cmd_pause' DMA channel capability means that respective DMA engine supports both pausing and resuming given DMA channel. However, in some cases it is important to know if DMA channel can be paused without the need to resume it. This is a typical requirement for proper residue reading on transfer timeout in UART drivers. There are also some DMA engines with limited hardware, which doesn't really support resuming. Reporting pause and resume capabilities separately allows UART drivers to properly check for the really required capabilities and operate in DMA mode also in systems with limited DMA hardware. On the other hand drivers, which rely on full channel suspend/resume support, should now check for both 'pause' and 'resume' features. Existing clients of dma_get_slave_caps() have been checked and the only driver which rely on proper channel resuming is soc-generic-dmaengine-pcm driver, which has been updated to check the newly added capability. Existing 'cmd_pause' now only indicates that DMA engine support pausing given DMA channel. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- This patch is a follow-up of the Vinod's advise from the following discussion: https://www.spinics.net/lists/linux-samsung-soc/msg63166.html --- drivers/dma/dmaengine.c | 8 ++------ include/linux/dmaengine.h | 5 ++++- sound/soc/soc-generic-dmaengine-pcm.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 08ba8473a284..84ac38dbdb65 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -500,12 +500,8 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) caps->max_burst = device->max_burst; caps->residue_granularity = device->residue_granularity; caps->descriptor_reuse = device->descriptor_reuse; - - /* - * Some devices implement only pause (e.g. to get residuum) but no - * resume. However cmd_pause is advertised as pause AND resume. - */ - caps->cmd_pause = !!(device->device_pause && device->device_resume); + caps->cmd_pause = !!device->device_pause; + caps->cmd_resume = !!device->device_resume; caps->cmd_terminate = !!device->device_terminate_all; return 0; diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 861be5cab1df..c8c3a7a93802 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -415,7 +415,9 @@ enum dma_residue_granularity { * each type, the dma controller should set BIT(<TYPE>) and same * should be checked by controller as well * @max_burst: max burst capability per-transfer - * @cmd_pause: true, if pause and thereby resume is supported + * @cmd_pause: true, if pause is supported (i.e. for reading residue or + * for resume later) + * @cmd_resume: true, if resume is supported * @cmd_terminate: true, if terminate cmd is supported * @residue_granularity: granularity of the reported transfer residue * @descriptor_reuse: if a descriptor can be reused by client and @@ -427,6 +429,7 @@ struct dma_slave_caps { u32 directions; u32 max_burst; bool cmd_pause; + bool cmd_resume; bool cmd_terminate; enum dma_residue_granularity residue_granularity; bool descriptor_reuse; diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 56a541b9ff9e..76c46d793843 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -156,7 +156,7 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea ret = dma_get_slave_caps(chan, &dma_caps); if (ret == 0) { - if (dma_caps.cmd_pause) + if (dma_caps.cmd_pause && dma_caps.cmd_resume) hw.info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME; if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT) hw.info |= SNDRV_PCM_INFO_BATCH; -- 2.17.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] dma: add support for reporting pause and resume separately 2018-07-02 13:08 ` [PATCH] dma: add support for reporting pause and resume separately Marek Szyprowski @ 2018-07-04 7:00 ` Vinod 2018-07-04 10:38 ` Andy Shevchenko 2018-07-09 11:17 ` Mark Brown 2018-07-09 17:29 ` Vinod 1 sibling, 2 replies; 7+ messages in thread From: Vinod @ 2018-07-04 7:00 UTC (permalink / raw) To: Marek Szyprowski, Mark Brown, Lars-Peter Clausen Cc: dmaengine, alsa-devel, linux-kernel, Dan Williams, Bartlomiej Zolnierkiewicz Hi Marek, On 02-07-18, 15:08, Marek Szyprowski wrote: > 'cmd_pause' DMA channel capability means that respective DMA engine > supports both pausing and resuming given DMA channel. However, in some > cases it is important to know if DMA channel can be paused without the > need to resume it. This is a typical requirement for proper residue > reading on transfer timeout in UART drivers. There are also some DMA > engines with limited hardware, which doesn't really support resuming. Am curious given that your hardware does not support resume, what was motivation for adding pause? > Reporting pause and resume capabilities separately allows UART drivers to > properly check for the really required capabilities and operate in DMA > mode also in systems with limited DMA hardware. On the other hand drivers, > which rely on full channel suspend/resume support, should now check for > both 'pause' and 'resume' features. > > Existing clients of dma_get_slave_caps() have been checked and the only > driver which rely on proper channel resuming is soc-generic-dmaengine-pcm > driver, which has been updated to check the newly added capability. > Existing 'cmd_pause' now only indicates that DMA engine support pausing > given DMA channel. The change looks fine to me. I was hoping that serial would also check this.. Mark, Lars you okay with this? > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > This patch is a follow-up of the Vinod's advise from the following > discussion: > https://www.spinics.net/lists/linux-samsung-soc/msg63166.html > --- > drivers/dma/dmaengine.c | 8 ++------ > include/linux/dmaengine.h | 5 ++++- > sound/soc/soc-generic-dmaengine-pcm.c | 2 +- > 3 files changed, 7 insertions(+), 8 deletions(-) > > diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c > index 08ba8473a284..84ac38dbdb65 100644 > --- a/drivers/dma/dmaengine.c > +++ b/drivers/dma/dmaengine.c > @@ -500,12 +500,8 @@ int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) > caps->max_burst = device->max_burst; > caps->residue_granularity = device->residue_granularity; > caps->descriptor_reuse = device->descriptor_reuse; > - > - /* > - * Some devices implement only pause (e.g. to get residuum) but no > - * resume. However cmd_pause is advertised as pause AND resume. > - */ > - caps->cmd_pause = !!(device->device_pause && device->device_resume); > + caps->cmd_pause = !!device->device_pause; > + caps->cmd_resume = !!device->device_resume; > caps->cmd_terminate = !!device->device_terminate_all; > > return 0; > diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h > index 861be5cab1df..c8c3a7a93802 100644 > --- a/include/linux/dmaengine.h > +++ b/include/linux/dmaengine.h > @@ -415,7 +415,9 @@ enum dma_residue_granularity { > * each type, the dma controller should set BIT(<TYPE>) and same > * should be checked by controller as well > * @max_burst: max burst capability per-transfer > - * @cmd_pause: true, if pause and thereby resume is supported > + * @cmd_pause: true, if pause is supported (i.e. for reading residue or > + * for resume later) > + * @cmd_resume: true, if resume is supported > * @cmd_terminate: true, if terminate cmd is supported > * @residue_granularity: granularity of the reported transfer residue > * @descriptor_reuse: if a descriptor can be reused by client and > @@ -427,6 +429,7 @@ struct dma_slave_caps { > u32 directions; > u32 max_burst; > bool cmd_pause; > + bool cmd_resume; > bool cmd_terminate; > enum dma_residue_granularity residue_granularity; > bool descriptor_reuse; > diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c > index 56a541b9ff9e..76c46d793843 100644 > --- a/sound/soc/soc-generic-dmaengine-pcm.c > +++ b/sound/soc/soc-generic-dmaengine-pcm.c > @@ -156,7 +156,7 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea > > ret = dma_get_slave_caps(chan, &dma_caps); > if (ret == 0) { > - if (dma_caps.cmd_pause) > + if (dma_caps.cmd_pause && dma_caps.cmd_resume) > hw.info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME; > if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT) > hw.info |= SNDRV_PCM_INFO_BATCH; > -- > 2.17.1 > > -- > To unsubscribe from this list: send the line "unsubscribe dmaengine" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- ~Vinod ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dma: add support for reporting pause and resume separately 2018-07-04 7:00 ` Vinod @ 2018-07-04 10:38 ` Andy Shevchenko 2018-07-06 6:00 ` Vinod 2018-07-09 11:17 ` Mark Brown 1 sibling, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2018-07-04 10:38 UTC (permalink / raw) To: Vinod Cc: Marek Szyprowski, Mark Brown, Lars-Peter Clausen, dmaengine, ALSA Development Mailing List, Linux Kernel Mailing List, Dan Williams, Bartlomiej Zolnierkiewicz On Wed, Jul 4, 2018 at 10:00 AM, Vinod <vkoul@kernel.org> wrote: > Hi Marek, > > On 02-07-18, 15:08, Marek Szyprowski wrote: >> 'cmd_pause' DMA channel capability means that respective DMA engine >> supports both pausing and resuming given DMA channel. However, in some >> cases it is important to know if DMA channel can be paused without the >> need to resume it. This is a typical requirement for proper residue >> reading on transfer timeout in UART drivers. There are also some DMA >> engines with limited hardware, which doesn't really support resuming. > > Am curious given that your hardware does not support resume, what was motivation > for adding pause? > >> Reporting pause and resume capabilities separately allows UART drivers to >> properly check for the really required capabilities and operate in DMA >> mode also in systems with limited DMA hardware. On the other hand drivers, >> which rely on full channel suspend/resume support, should now check for >> both 'pause' and 'resume' features. >> >> Existing clients of dma_get_slave_caps() have been checked and the only >> driver which rely on proper channel resuming is soc-generic-dmaengine-pcm >> driver, which has been updated to check the newly added capability. >> Existing 'cmd_pause' now only indicates that DMA engine support pausing >> given DMA channel. > > The change looks fine to me. I was hoping that serial would also check > this.. AFAIU serial does not need to resume. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dma: add support for reporting pause and resume separately 2018-07-04 10:38 ` Andy Shevchenko @ 2018-07-06 6:00 ` Vinod 2018-07-06 6:22 ` Marek Szyprowski 0 siblings, 1 reply; 7+ messages in thread From: Vinod @ 2018-07-06 6:00 UTC (permalink / raw) To: Andy Shevchenko Cc: Marek Szyprowski, Mark Brown, Lars-Peter Clausen, dmaengine, ALSA Development Mailing List, Linux Kernel Mailing List, Dan Williams, Bartlomiej Zolnierkiewicz On 04-07-18, 13:38, Andy Shevchenko wrote: > On Wed, Jul 4, 2018 at 10:00 AM, Vinod <vkoul@kernel.org> wrote: > > Hi Marek, > > > > On 02-07-18, 15:08, Marek Szyprowski wrote: > >> 'cmd_pause' DMA channel capability means that respective DMA engine > >> supports both pausing and resuming given DMA channel. However, in some > >> cases it is important to know if DMA channel can be paused without the > >> need to resume it. This is a typical requirement for proper residue > >> reading on transfer timeout in UART drivers. There are also some DMA > >> engines with limited hardware, which doesn't really support resuming. > > > > Am curious given that your hardware does not support resume, what was motivation > > for adding pause? > > > >> Reporting pause and resume capabilities separately allows UART drivers to > >> properly check for the really required capabilities and operate in DMA > >> mode also in systems with limited DMA hardware. On the other hand drivers, > >> which rely on full channel suspend/resume support, should now check for > >> both 'pause' and 'resume' features. > >> > >> Existing clients of dma_get_slave_caps() have been checked and the only > >> driver which rely on proper channel resuming is soc-generic-dmaengine-pcm > >> driver, which has been updated to check the newly added capability. > >> Existing 'cmd_pause' now only indicates that DMA engine support pausing > >> given DMA channel. > > > > The change looks fine to me. I was hoping that serial would also check > > this.. > > AFAIU serial does not need to resume. I meant the serial should check for Pause capability.. -- ~Vinod ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dma: add support for reporting pause and resume separately 2018-07-06 6:00 ` Vinod @ 2018-07-06 6:22 ` Marek Szyprowski 0 siblings, 0 replies; 7+ messages in thread From: Marek Szyprowski @ 2018-07-06 6:22 UTC (permalink / raw) To: Vinod, Andy Shevchenko Cc: Mark Brown, Lars-Peter Clausen, dmaengine, ALSA Development Mailing List, Linux Kernel Mailing List, Dan Williams, Bartlomiej Zolnierkiewicz Hi Vinod, On 2018-07-06 08:00, Vinod wrote: > On 04-07-18, 13:38, Andy Shevchenko wrote: >> On Wed, Jul 4, 2018 at 10:00 AM, Vinod <vkoul@kernel.org> wrote: >>> Hi Marek, >>> >>> On 02-07-18, 15:08, Marek Szyprowski wrote: >>>> 'cmd_pause' DMA channel capability means that respective DMA engine >>>> supports both pausing and resuming given DMA channel. However, in some >>>> cases it is important to know if DMA channel can be paused without the >>>> need to resume it. This is a typical requirement for proper residue >>>> reading on transfer timeout in UART drivers. There are also some DMA >>>> engines with limited hardware, which doesn't really support resuming. >>> Am curious given that your hardware does not support resume, what was motivation >>> for adding pause? >>> >>>> Reporting pause and resume capabilities separately allows UART drivers to >>>> properly check for the really required capabilities and operate in DMA >>>> mode also in systems with limited DMA hardware. On the other hand drivers, >>>> which rely on full channel suspend/resume support, should now check for >>>> both 'pause' and 'resume' features. >>>> >>>> Existing clients of dma_get_slave_caps() have been checked and the only >>>> driver which rely on proper channel resuming is soc-generic-dmaengine-pcm >>>> driver, which has been updated to check the newly added capability. >>>> Existing 'cmd_pause' now only indicates that DMA engine support pausing >>>> given DMA channel. >>> The change looks fine to me. I was hoping that serial would also check >>> this.. >> AFAIU serial does not need to resume. > I meant the serial should check for Pause capability.. Yes, I want to add such check to Samsung Exynos serial driver once this change is merged. PL330 DMA engine (which is used in Samsung Exynos SoCs) supports only pause, it is not possible to check that functionality from serial driver yet. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dma: add support for reporting pause and resume separately 2018-07-04 7:00 ` Vinod 2018-07-04 10:38 ` Andy Shevchenko @ 2018-07-09 11:17 ` Mark Brown 1 sibling, 0 replies; 7+ messages in thread From: Mark Brown @ 2018-07-09 11:17 UTC (permalink / raw) To: Vinod Cc: Marek Szyprowski, Lars-Peter Clausen, dmaengine, alsa-devel, linux-kernel, Dan Williams, Bartlomiej Zolnierkiewicz [-- Attachment #1: Type: text/plain, Size: 541 bytes --] On Wed, Jul 04, 2018 at 12:30:33PM +0530, Vinod wrote: > > Existing clients of dma_get_slave_caps() have been checked and the only > > driver which rely on proper channel resuming is soc-generic-dmaengine-pcm > > driver, which has been updated to check the newly added capability. > > Existing 'cmd_pause' now only indicates that DMA engine support pausing > > given DMA channel. > The change looks fine to me. I was hoping that serial would also check > this.. > Mark, Lars you okay with this? Acked-by: Mark Brown <broonie@kernel.org> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] dma: add support for reporting pause and resume separately 2018-07-02 13:08 ` [PATCH] dma: add support for reporting pause and resume separately Marek Szyprowski 2018-07-04 7:00 ` Vinod @ 2018-07-09 17:29 ` Vinod 1 sibling, 0 replies; 7+ messages in thread From: Vinod @ 2018-07-09 17:29 UTC (permalink / raw) To: Marek Szyprowski Cc: dmaengine, alsa-devel, linux-kernel, Dan Williams, Lars-Peter Clausen, Mark Brown, Bartlomiej Zolnierkiewicz On 02-07-18, 15:08, Marek Szyprowski wrote: > 'cmd_pause' DMA channel capability means that respective DMA engine > supports both pausing and resuming given DMA channel. However, in some > cases it is important to know if DMA channel can be paused without the > need to resume it. This is a typical requirement for proper residue > reading on transfer timeout in UART drivers. There are also some DMA > engines with limited hardware, which doesn't really support resuming. > > Reporting pause and resume capabilities separately allows UART drivers to > properly check for the really required capabilities and operate in DMA > mode also in systems with limited DMA hardware. On the other hand drivers, > which rely on full channel suspend/resume support, should now check for > both 'pause' and 'resume' features. > > Existing clients of dma_get_slave_caps() have been checked and the only > driver which rely on proper channel resuming is soc-generic-dmaengine-pcm > driver, which has been updated to check the newly added capability. > Existing 'cmd_pause' now only indicates that DMA engine support pausing > given DMA channel. Applied after fixing the subsystem name, thanks -- ~Vinod ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-09 17:30 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20180702130819eucas1p2e11d8fabec93ba78d9e84f4ca6e5fd65@eucas1p2.samsung.com> 2018-07-02 13:08 ` [PATCH] dma: add support for reporting pause and resume separately Marek Szyprowski 2018-07-04 7:00 ` Vinod 2018-07-04 10:38 ` Andy Shevchenko 2018-07-06 6:00 ` Vinod 2018-07-06 6:22 ` Marek Szyprowski 2018-07-09 11:17 ` Mark Brown 2018-07-09 17:29 ` Vinod
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).