From patchwork Mon Jun 27 03:47:59 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: 9199863 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 D481860757 for ; Mon, 27 Jun 2016 03:57:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B97092856A for ; Mon, 27 Jun 2016 03:57:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABF812855B; Mon, 27 Jun 2016 03:57:07 +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 C921A2855B for ; Mon, 27 Jun 2016 03:57:06 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0D52426524F; Mon, 27 Jun 2016 05:57:00 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 370A6266685; Mon, 27 Jun 2016 05:53:46 +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 F10242664E9; Mon, 27 Jun 2016 05:53:44 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id CC7EC2664E9 for ; Mon, 27 Jun 2016 05:51:45 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 26 Jun 2016 20:51:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,535,1459839600"; d="scan'208";a="995573777" Received: from subhransu-desktop.iind.intel.com ([10.223.96.24]) by fmsmga001.fm.intel.com with ESMTP; 26 Jun 2016 20:51:42 -0700 From: "Subhransu S. Prusty" To: alsa-devel@alsa-project.org Date: Mon, 27 Jun 2016 09:17:59 +0530 Message-Id: <1466999284-14782-7-git-send-email-subhransu.s.prusty@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466999284-14782-1-git-send-email-subhransu.s.prusty@intel.com> References: <1466999284-14782-1-git-send-email-subhransu.s.prusty@intel.com> Cc: tiwai@suse.de, patches.audio@intel.com, broonie@kernel.org, "Subhransu S. Prusty" , lgirdwood@gmail.com Subject: [alsa-devel] [RFC 06/11] ASoC: dapm: Create API to add a single route element 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 is useful when one route element is added at a time. Signed-off-by: Subhransu S. Prusty --- include/sound/soc-dapm.h | 2 ++ sound/soc/soc-dapm.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 9706946..fffd1f1 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -396,6 +396,8 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card); void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm); int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_route *route, int num); +int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm, + const struct snd_soc_dapm_route *route); int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm, const struct snd_soc_dapm_route *route, int num); int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm, diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c446485..ad67647 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2802,6 +2802,27 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes); /** + * snd_soc_dapm_add_route_single - Add a single route + * @dapm: DAPM context + * @route: audio route element + * + * Connects 2 dapm widgets together via a named audio path. + * xxx_add_route is already managed through dapm lock. + */ +int snd_soc_dapm_add_route_single(struct snd_soc_dapm_context *dapm, + const struct snd_soc_dapm_route *route) +{ + int ret; + + mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); + ret = snd_soc_dapm_add_route(dapm, route); + mutex_unlock(&dapm->card->dapm_mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(snd_soc_dapm_add_route_single); + +/** * snd_soc_dapm_del_routes - Remove routes between DAPM widgets * @dapm: DAPM context * @route: audio routes