Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp475824imm; Wed, 4 Jul 2018 00:02:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeiN94FvrYTvBF40XrFTHQPOGEYbbdue30G/4PHfOc3SYi5tukBcIuNt3os5a7Dxv6mhw5x X-Received: by 2002:a17:902:981:: with SMTP id 1-v6mr917516pln.11.1530687774209; Wed, 04 Jul 2018 00:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530687774; cv=none; d=google.com; s=arc-20160816; b=lZmFM72V7eRaZwmS1dLF/j3L/nyXilTQKhikcgmf91zsbFtuZq7QlXYo4VZb/TMs8j f4P9cHWKsq/IR00NbuNR116YDhiaD38uCcL+gcVAm26v+eP5BG3ekS+eNUUPXngs8KiV Lza3gFDlXhX/qPfdQgE8dq8VMn+8HZrpXZ3dHramGOMlBXhmncAJ+YzoUyq6ZeTUV7xv e2rdbVKraPIxouUhtTi7QXrIdfQ9YBgIu4ZYlDG09ZbE75gMMSFR2HCK0moe8rK2TlHV tqAsEUSfDZmnrz3e4hu0sTpvvcQmUhdLdhWW6kns/vL7hBi6yiUmBZsdBCQ2V5XCT8K7 w5lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=H786SxTSxjwamxtSi5WHyr8ktzscwsIhQqa5DIUBgHo=; b=1JOHISdxfVuZxZka6Q2yiocT2ETC/VIVrth1NIOnA9GDaVEHPLb3cwN88/Rb39/bH6 v2xAhl6Am/8gBb8GhE+OaPnDUzyKZXRTjwvm5NJPEJo67uUppLFychEoZvoEdjthkaBg BxdIu4EWNWu9Qz0c6su3hJ8pOYIwohm3awEI3ibBBckjupF2h22tdlXjmbG5NICMlgr3 dO7iP9DhTGjrLaQf4mLrELshQ1rFyCqvubWQduY0y3xoummwRkzGEG14KCiMMFxZWwfs 6cpnbfqPRLvOU3vkoHMO3Z+6sdJbzR1PHaHN3d2vDUBJGaiR3zeU+xkr52PdNnEs8AWk pNdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="D/sLG+b5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3-v6si2543325pgs.172.2018.07.04.00.02.39; Wed, 04 Jul 2018 00:02:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="D/sLG+b5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753609AbeGDHAo (ORCPT + 99 others); Wed, 4 Jul 2018 03:00:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:60614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752772AbeGDHAn (ORCPT ); Wed, 4 Jul 2018 03:00:43 -0400 Received: from localhost (unknown [122.178.204.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9EABC2473C; Wed, 4 Jul 2018 07:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530687642; bh=TziA6ne/lUrKxCsqb2jbjHSzGNMnU/LY9bsoGg44AYI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D/sLG+b5IABze7NXh1s3desasIKK+j86EAk6NRtP7a3hJnrUufODSTa3PuN06KG2l kFuvogNjg59OaDzYra88v8Ta/VA3VIUQ+0BVkmiGzGZ5kAmy/VUf8lEzUCAZ2+VSI1 emB8OC7AHbjBgZlVCtPguVEpoOK6JE1AyCTnH5K4= Date: Wed, 4 Jul 2018 12:30:33 +0530 From: Vinod To: Marek Szyprowski , Mark Brown , Lars-Peter Clausen Cc: dmaengine@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Dan Williams , Bartlomiej Zolnierkiewicz Subject: Re: [PATCH] dma: add support for reporting pause and resume separately Message-ID: <20180704070033.GA22377@vkoul-mobl> References: <20180702130819eucas1p2e11d8fabec93ba78d9e84f4ca6e5fd65~9jzNWZMqQ1216712167eucas1p27@eucas1p2.samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180702130819eucas1p2e11d8fabec93ba78d9e84f4ca6e5fd65~9jzNWZMqQ1216712167eucas1p27@eucas1p2.samsung.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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() 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