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: 142618 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp6208502ljj; Mon, 23 Jul 2018 08:58:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchsxEl8UkuatUDJlQmX+wvVUEvLXevOMY094ui/WDR26Z+ufQK+pTaR30V+58eUMF5khgs X-Received: by 2002:a63:1315:: with SMTP id i21-v6mr12769289pgl.147.1532361507589; Mon, 23 Jul 2018 08:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532361507; cv=none; d=google.com; s=arc-20160816; b=cx3YGS+tzKM+Mj2N/14xWypg6KSsvdFEPb3Vj5SpOtupk197NjHhBMQvLkB4HZqJiG 8xVv2IT+cHG0cnUid4Bl5twFgWja6mzcgdRMVIR0edDe+f6VXAbXnXQo8GVmpzTutJGx agy1LnlA59E08Hmp6mM3KniPKDbFiTt2mjhbl4WL4tui5PfCRPsQaRrx2j+toY/4ft4u Yn0vKQLUVuA3QoFLVj/45WQhOzQ5GQOHe//t55a+To6xkJNrfvy535YxKRfYLP1RblkT OUVBTKM8rJcNeOM75AOrSnvqKvWzl7wtl6JinzDrWMmh4Dt5iUh0K/qn1kxE3Cp8TTXa Nhjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=CzBFjPKScoyq8BRqzbqfUtYN9SRCEjh94Gk9yR48PY4=; b=KBSOqoHfQIJklA4yQiz4JD9CG05ERUQ7u1zNYqwzgFyynGbaem0F5OW/hBtgA7Zkkm Gyt5fsqxkQtf6e6kFx9X9jkqTVHEksuuu1E0Y8zV0WS3vrEWqqTUoXaKnWJocxtm/Y4E QFSzb1+iWHswMcUE0eChqrFJGZoN3XWjrc0aF/qYyOnBuC/VSdwJHt3G7B4hjpkJHKd/ 72elpHCJqVlz57IUgrqc6dzVm7WF1MOVJXokNGAeeUcs3VttZt9TctlSSHMPcBz8gzdY hDSc86ntetnMMXfJ4hS0k3IUUu4yMuoA/V0yZY57b4OUO/8icUK0gDjttuJBvSrsjFkq NpLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Exd/jRYC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h86-v6si8891269pfj.120.2018.07.23.08.58.27; Mon, 23 Jul 2018 08:58:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Exd/jRYC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388817AbeGWRAP (ORCPT + 31 others); Mon, 23 Jul 2018 13:00:15 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:55145 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388624AbeGWRAO (ORCPT ); Mon, 23 Jul 2018 13:00:14 -0400 Received: by mail-wm0-f67.google.com with SMTP id c14-v6so1627855wmb.4 for ; Mon, 23 Jul 2018 08:58:22 -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=rhN9sBViQo51qTiC/KEwRphr7AEW97UepKjClRVaqHV7kJPZLAuqxn4JylOGqQf4X1 skpWJ/KFseEtjoJfUz7A/A+CHkYjNWjewM4JRq7yjO72e8IoTJU9AKzymGJpc7bgCfeE jzWllJKq26ccV+4chhpfOqmYoQWuZS2QBsAbyjTtC2LXIaV1QcBkSHy+nAwG+NuCUICy JnOgnt+AU76hzcqZZ2WwxSfIrRZumOwQC63APfjIhompg6zXxOLoguOBBN4Xd+oDOVR0 oTfP88TqhytLqiR75LgVW82hEm9+8uR+8zJGrogyLL/QARKU/EFid6Mq245nRvsLC7vX d/dA== X-Gm-Message-State: AOUpUlEwKtP2uLxjMRrmJ6nlMqo+8t9x+PiD0c6w3hxtX2LcuJNLKUbI bMWXTZoTsOLGDFRZ2nAN/BPgNQ== 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 Cc: mark.rutland@arm.com, lgirdwood@gmail.com, tiwai@suse.com, bgoswami@codeaurora.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, alsa-devel@alsa-project.org, Srinivas Kandagatla Subject: [PATCH 05/12] ASoC: core: add support to snd_soc_dai_get_channel_map() 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.16.2 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