From patchwork Mon Jul 23 15:54:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10540545 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A653613BB for ; Mon, 23 Jul 2018 15:59:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93F4B28CDC for ; Mon, 23 Jul 2018 15:59:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D1728CF3; Mon, 23 Jul 2018 15:59:10 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID 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 D648528CDC for ; Mon, 23 Jul 2018 15:59:09 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 412FE267763; Mon, 23 Jul 2018 17:58:33 +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 D7D28267749; Mon, 23 Jul 2018 17:58:23 +0200 (CEST) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by alsa0.perex.cz (Postfix) with ESMTP id 32CCA26720C for ; Mon, 23 Jul 2018 17:58:21 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id s9-v6so1632909wmh.3 for ; Mon, 23 Jul 2018 08:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CzBFjPKScoyq8BRqzbqfUtYN9SRCEjh94Gk9yR48PY4=; b=Exd/jRYCdnfSbligYmk3crjO2fB9cN2/GDgfJ4B1iopHDyR02iJBZn4XjbvO+G1ARe 6Y/x4boHJ7ODa2Ilws/+HexkfYAMmNj61kr1vlEE4I2Ih9Nc0qRqiWcaw5kKHPHp3rj5 WLCKWFhVYOrADM+CkOID6mX6r/I9zpbsKoN2M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CzBFjPKScoyq8BRqzbqfUtYN9SRCEjh94Gk9yR48PY4=; b=mybOT8zP/3nZYL5HK2nGg2eTXGF+2QTt1lAR73DpL9PIzspW0pPd6ucAC8g2u4CvEX qm518LDmj3HM7yXAVysbrT1GnsbwU6lVTLKo17O2mT/YsWuDDQI8Ecvs0Ni2kU/Nfg4V d8u1q1Vbc4B5dAeRzhS7+VRHMqfzE0aXl5nVUEyivUG5mv0tlU+iA8jWZs5I8A4si4wJ qiQCn0pkooS/oRXAYRERaLbBJK+f6OBzs9vatgfOqcLVkUyjMMeGf7plvIS8UciVJztT 2lokjNleIxP5lZVzvgK8dxqmAsgwKwJxqJ59kfHdAjuRlFQmGFaQ0cs8Dy+PTvamFWln lvBA== X-Gm-Message-State: AOUpUlF9xtcgIN+/F9vS7c3cIli9RhVCQwKgZDgziueQLIcbvqt6DoH0 OnmuRwMb7LvKOJPvEPqPrYYuf4Te/Js= X-Google-Smtp-Source: AAOMgpdAoFdtunQpKzD4ENl3qlOWLmmLeTFznKqG8/wb/3yfFst00xxEsULR6wuGRmT+cYPBPK/WIA== X-Received: by 2002:a1c:93d3:: with SMTP id v202-v6mr8084643wmd.57.1532361501376; Mon, 23 Jul 2018 08:58:21 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 14-v6sm206385wmt.1.2018.07.23.08.58.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Jul 2018 08:58:20 -0700 (PDT) From: Srinivas Kandagatla To: lee.jones@linaro.org, robh+dt@kernel.org, broonie@kernel.org Date: Mon, 23 Jul 2018 16:54:03 +0100 Message-Id: <20180723155410.9494-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180723155410.9494-1-srinivas.kandagatla@linaro.org> References: <20180723155410.9494-1-srinivas.kandagatla@linaro.org> Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, bgoswami@codeaurora.org, tiwai@suse.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, vkoul@kernel.org, Srinivas Kandagatla Subject: [alsa-devel] [PATCH 05/12] ASoC: core: add support to snd_soc_dai_get_channel_map() 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 On Qualcomm platforms, specifically with SLIMbus interfaced codecs, the codec slim channel numbers are passed to DSP while configuring the slim audio path. Having get_channel_map() would allow dais to share such information across multiple dais. Signed-off-by: Srinivas Kandagatla --- include/sound/soc-dai.h | 8 ++++++++ sound/soc/soc-core.c | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index a14bc0608ae9..f5d70041108f 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -138,6 +138,11 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, int direction); + +int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, + unsigned int *tx_num, unsigned int *tx_slot, + unsigned int *rx_num, unsigned int *rx_slot); + int snd_soc_dai_is_dummy(struct snd_soc_dai *dai); struct snd_soc_dai_ops { @@ -165,6 +170,9 @@ struct snd_soc_dai_ops { int (*set_channel_map)(struct snd_soc_dai *dai, unsigned int tx_num, unsigned int *tx_slot, unsigned int rx_num, unsigned int *rx_slot); + int (*get_channel_map)(struct snd_soc_dai *dai, + unsigned int *tx_num, unsigned int *tx_slot, + unsigned int *rx_num, unsigned int *rx_slot); int (*set_tristate)(struct snd_soc_dai *dai, int tristate); int (*set_sdw_stream)(struct snd_soc_dai *dai, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ad5b0ef16d82..81b27923303d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2679,6 +2679,28 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, } EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map); +/** + * snd_soc_dai_get_channel_map - Get DAI audio channel map + * @dai: DAI + * @tx_num: how many TX channels + * @tx_slot: pointer to an array which imply the TX slot number channel + * 0~num-1 uses + * @rx_num: how many RX channels + * @rx_slot: pointer to an array which imply the RX slot number channel + * 0~num-1 uses + */ +int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, + unsigned int *tx_num, unsigned int *tx_slot, + unsigned int *rx_num, unsigned int *rx_slot) +{ + if (dai->driver->ops->get_channel_map) + return dai->driver->ops->get_channel_map(dai, tx_num, tx_slot, + rx_num, rx_slot); + else + return -ENOTSUPP; +} +EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map); + /** * snd_soc_dai_set_tristate - configure DAI system or master clock. * @dai: DAI