From patchwork Fri Feb 27 21:28:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5903551 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1DCE0BF440 for ; Fri, 27 Feb 2015 21:31:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3D9FE20256 for ; Fri, 27 Feb 2015 21:31:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 143D62022D for ; Fri, 27 Feb 2015 21:31:45 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 468EA2654BF; Fri, 27 Feb 2015 22:31:44 +0100 (CET) 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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id CD92026528B; Fri, 27 Feb 2015 22:28:45 +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 33D422651D3; Fri, 27 Feb 2015 22:28:38 +0100 (CET) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 0C08926519B for ; Fri, 27 Feb 2015 22:28:28 +0100 (CET) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5CF26ABF8 for ; Fri, 27 Feb 2015 21:28:27 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Fri, 27 Feb 2015 22:28:17 +0100 Message-Id: <1425072502-3204-3-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1425072502-3204-1-git-send-email-tiwai@suse.de> References: <1425072502-3204-1-git-send-email-tiwai@suse.de> Subject: [alsa-devel] [PATCH 2/7] ALSA: hda - Use regmap for codec parameter reads 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 Let's start converting the access functions to regmap. The first one is the simplest, just converting the codec parameter read helper function snd_hda_param_read(). Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 18 ++++++++++++++++++ sound/pci/hda/hda_codec.h | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0fd71131193a..3a209e8b6130 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -34,6 +34,7 @@ #include #include #include +#include "hda_regmap.h" #include "hda_local.h" #include "hda_beep.h" #include "hda_jack.h" @@ -255,6 +256,23 @@ void snd_hda_sequence_write(struct hda_codec *codec, const struct hda_verb *seq) EXPORT_SYMBOL_GPL(snd_hda_sequence_write); /** + * snd_hda_param_read - read a parameter + * @codec: the HDA codec + * @nid: NID to read + * @parm: parameter value + */ +int snd_hda_param_read(struct hda_codec *codec, hda_nid_t nid, int parm) +{ + unsigned int verb = (AC_VERB_PARAMETERS << 8) | (nid << 20) | parm; + unsigned int val; + + if (snd_hda_reg_raw_read(codec, verb, &val) < 0) + return -1; + return val; +} +EXPORT_SYMBOL_GPL(snd_hda_param_read); + +/** * snd_hda_get_sub_nodes - get the range of sub nodes * @codec: the HDA codec * @nid: NID to parse diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 3be4e1040036..db310e9c53ff 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -439,8 +439,7 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, unsigned int verb, unsigned int parm); int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags, unsigned int verb, unsigned int parm); -#define snd_hda_param_read(codec, nid, param) \ - snd_hda_codec_read(codec, nid, 0, AC_VERB_PARAMETERS, param) +int snd_hda_param_read(struct hda_codec *codec, hda_nid_t nid, int parm); int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid, hda_nid_t *start_id); int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,