From patchwork Mon Feb 9 08:18:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yang.a.fang@intel.com X-Patchwork-Id: 5799101 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 965849F36A for ; Mon, 9 Feb 2015 08:19:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D28A620123 for ; Mon, 9 Feb 2015 08:19:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DE8CA2010E for ; Mon, 9 Feb 2015 08:19:36 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 08D7326053D; Mon, 9 Feb 2015 09:19:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 2D92E2605C3; Mon, 9 Feb 2015 09:19:00 +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 EAB992605C3; Mon, 9 Feb 2015 09:18:58 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 303642605CC for ; Mon, 9 Feb 2015 09:18:33 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 09 Feb 2015 00:18:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,542,1418112000"; d="scan'208";a="524646975" Received: from mocha.sc.intel.com ([143.183.249.83]) by orsmga003.jf.intel.com with ESMTP; 09 Feb 2015 00:10:33 -0800 From: yang.a.fang@intel.com To: broonie@kernel.org, lgirdwood@gmail.com Date: Mon, 9 Feb 2015 00:18:11 -0800 Message-Id: <1423469892-48667-1-git-send-email-yang.a.fang@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1423440097-95191-1-git-send-email-yang.a.fang@intel.com> References: <1423440097-95191-1-git-send-email-yang.a.fang@intel.com> Cc: alsa-devel@alsa-project.org, denny.iriawan@intel.com, harshapriya.n@intel.com, praveen.k.jain@intel.com, kevin.strasser@intel.com, vinod.koul@intel.com, "Fang, Yang A" , tiwai@suse.de, mengdong.lin@intel.com Subject: [alsa-devel] [PATCH v3 1/2] ALSA: Add params_set_format helper 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: "Fang, Yang A" Add a helper to set pcm format directly from params Signed-off-by: Fang, Yang A --- include/sound/pcm_params.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 6b1c78f..f41a2d7 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -366,4 +366,11 @@ params_physical_width(const struct snd_pcm_hw_params *p) return snd_pcm_format_physical_width(params_format(p)); } +static inline void +params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) +{ + snd_mask_set(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT), + (__force int)fmt); +} + #endif /* __SOUND_PCM_PARAMS_H */