From patchwork Tue Apr 12 05:01:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Subhransu S. Prusty" X-Patchwork-Id: 8807051 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 D9D4B9F54F for ; Tue, 12 Apr 2016 05:05:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 054FB2035D for ; Tue, 12 Apr 2016 05:05:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0843A2015A for ; Tue, 12 Apr 2016 05:05:19 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1C389265A2D; Tue, 12 Apr 2016 07:05:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D09CA265B63; Tue, 12 Apr 2016 07:03:06 +0200 (CEST) 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 F3789265B63; Tue, 12 Apr 2016 07:03:05 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 5BECE265900 for ; Tue, 12 Apr 2016 07:02:37 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 11 Apr 2016 22:02:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,472,1455004800"; d="scan'208";a="930476647" Received: from subhransu-desktop.iind.intel.com ([10.223.96.24]) by orsmga001.jf.intel.com with ESMTP; 11 Apr 2016 22:02:34 -0700 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Tue, 12 Apr 2016 10:31:26 +0530 Message-Id: <1460437293-8509-5-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460437293-8509-1-git-send-email-subhransu.s.prusty@intel.com> References: <1460437293-8509-1-git-send-email-subhransu.s.prusty@intel.com> Cc: tiwai@suse.de, lgirdwood@gmail.com, patches.audio@intel.com, broonie@kernel.org, Vinod Koul , "Subhransu S. Prusty" Subject: [alsa-devel] [PATCH 04/11] ALSA: hda - add helper to get channels from cap bits 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 This helper is copied from legacy hda driver. Signed-off-by: Subhransu S. Prusty Signed-off-by: Vinod Koul --- sound/hda/local.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sound/hda/local.h b/sound/hda/local.h index d692f41..57f07d7 100644 --- a/sound/hda/local.h +++ b/sound/hda/local.h @@ -16,6 +16,16 @@ static inline int get_wcaps_type(unsigned int wcaps) return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; } +static inline unsigned int get_wcaps_channels(u32 wcaps) +{ + unsigned int chans; + + chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13; + chans = ((chans << 1) | 1) + 1; + + return chans; +} + extern const struct attribute_group *hdac_dev_attr_groups[]; int hda_widget_sysfs_init(struct hdac_device *codec); void hda_widget_sysfs_exit(struct hdac_device *codec);