From patchwork Mon Aug 29 06:23:16 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: 9304199 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 9772C607F0 for ; Mon, 29 Aug 2016 17:35:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89274288BE for ; Mon, 29 Aug 2016 17:35:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78409288D0; Mon, 29 Aug 2016 17:35:24 +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 D9B17288BE for ; Mon, 29 Aug 2016 17:35:23 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E0479266DFE; Mon, 29 Aug 2016 19:35:22 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2D1BD267887; Mon, 29 Aug 2016 18:42:31 +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 1F250267884; Mon, 29 Aug 2016 18:42:29 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 91052266E08 for ; Mon, 29 Aug 2016 18:23:41 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP; 28 Aug 2016 23:29:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,595,1464678000"; d="scan'208";a="2203591" Received: from subhransu-desktop.iind.intel.com ([10.223.96.24]) by orsmga004.jf.intel.com with ESMTP; 28 Aug 2016 23:29:02 -0700 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Mon, 29 Aug 2016 11:53:16 +0530 Message-Id: <1472451806-10605-3-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472451806-10605-1-git-send-email-subhransu.s.prusty@intel.com> References: <1472451806-10605-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 02/12] ALSA: hda - Add macro to test pin widget's input capability 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 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 0d5bb15..a51f5f6 100644 --- a/sound/hda/local.h +++ b/sound/hda/local.h @@ -8,6 +8,16 @@ #define get_wcaps(codec, nid) \ snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP) +#define get_pcaps(codec, nid) \ + snd_hdac_read_parm(codec, nid, AC_PAR_PIN_CAP) + +static inline int is_input_pin(struct hdac_device *codec, hda_nid_t nid) +{ + unsigned int pincap = get_pcaps(codec, nid); + + return (pincap & AC_PINCAP_IN) != 0; +} + /* get the widget type from widget capability bits */ static inline int get_wcaps_type(unsigned int wcaps) {