From patchwork Tue Jan 30 09:34:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram Periyasamy X-Patchwork-Id: 10191483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F2E95601A0 for ; Tue, 30 Jan 2018 09:41:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC5E42858D for ; Tue, 30 Jan 2018 09:41:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0B1628998; Tue, 30 Jan 2018 09:41:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65D5D2858D for ; Tue, 30 Jan 2018 09:41:34 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F2059267537; Tue, 30 Jan 2018 10:41:30 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5F966267538; Tue, 30 Jan 2018 10:41:29 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 5D175267537 for ; Tue, 30 Jan 2018 10:41:26 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2018 01:41:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,434,1511856000"; d="scan'208";a="197291556" Received: from mtbf-optiplex-9010.iind.intel.com ([10.223.96.13]) by orsmga005.jf.intel.com with ESMTP; 30 Jan 2018 01:41:23 -0800 From: Sriram Periyasamy To: ALSA ML , Takashi Iwai Date: Tue, 30 Jan 2018 15:04:45 +0530 Message-Id: <1517304885-16750-1-git-send-email-sriramx.periyasamy@intel.com> X-Mailer: git-send-email 2.7.4 Cc: Patches Audio , Sriram Periyasamy , Ramesh Babu Subject: [alsa-devel] [alsa-utils] [PATCH] Add support for no-rewind flag in aplay utility X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ramesh Babu The "no-rewind" flag is introduced in alsa. Application can use this flag to assure kernel driver that rewind won't be exercised. Driver could use this flag to alter it's buffering scheme to optimize power and performance. Signed-off-by: Ramesh Babu Signed-off-by: Sriram Periyasamy --- aplay/aplay.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/aplay/aplay.c b/aplay/aplay.c index 6b740c281f8e..b50602a59024 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -108,6 +108,7 @@ static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK; static int mmap_flag = 0; static int interleaved = 1; static int nonblock = 0; +static int no_rewind = 0; static volatile sig_atomic_t in_aborting = 0; static u_char *audiobuf = NULL; static snd_pcm_uframes_t chunk_size = 0; @@ -229,6 +230,7 @@ _("Usage: %s [OPTION]... [FILE]...\n" "-I, --separate-channels one file for each channel\n" "-i, --interactive allow interactive operation from stdin\n" "-m, --chmap=ch1,ch2,.. Give the channel map to override or follow\n" +"-w, --no-rewind enables no rewind mode\n" " --disable-resample disable automatic rate resample\n" " --disable-channels disable automatic channel conversions\n" " --disable-format disable automatic format conversions\n" @@ -470,7 +472,7 @@ int main(int argc, char *argv[]) { int duration_or_sample = 0; int option_index; - static const char short_options[] = "hnlLD:qt:c:f:r:d:s:MNF:A:R:T:B:vV:IPCi" + static const char short_options[] = "hnlLD:qt:c:f:r:d:s:w:MNF:A:R:T:B:vV:IPCi" #ifdef CONFIG_SUPPORT_CHMAP "m:" #endif @@ -514,6 +516,7 @@ int main(int argc, char *argv[]) {"process-id-file", 1, 0, OPT_PROCESS_ID_FILE}, {"use-strftime", 0, 0, OPT_USE_STRFTIME}, {"interactive", 0, 0, 'i'}, + {"no-rewind", 0, 0, 'w'}, {"dump-hw-params", 0, 0, OPT_DUMP_HWPARAMS}, {"fatal-errors", 0, 0, OPT_FATAL_ERRORS}, #ifdef CONFIG_SUPPORT_CHMAP @@ -753,6 +756,9 @@ int main(int argc, char *argv[]) case 'i': interactive = 1; break; + case 'w': + no_rewind = 1; + break; case OPT_DISABLE_RESAMPLE: open_mode |= SND_PCM_NO_AUTO_RESAMPLE; break; @@ -1396,6 +1402,12 @@ static void set_params(void) &buffer_frames); } assert(err >= 0); + + if (no_rewind) { + err = snd_pcm_hw_params_set_no_rewind(handle, params, 1); + assert(err >= 0); + } + monotonic = snd_pcm_hw_params_is_monotonic(params); can_pause = snd_pcm_hw_params_can_pause(params); err = snd_pcm_hw_params(handle, params);