From patchwork Wed Jul 4 09:49:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10506399 X-Patchwork-Delegate: agross@codeaurora.org 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 9E67860325 for ; Wed, 4 Jul 2018 09:52:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DBF828D0D for ; Wed, 4 Jul 2018 09:52:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9239E28D1A; Wed, 4 Jul 2018 09:52:36 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0892E28D0D for ; Wed, 4 Jul 2018 09:52:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932997AbeGDJv7 (ORCPT ); Wed, 4 Jul 2018 05:51:59 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:45786 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932717AbeGDJv4 (ORCPT ); Wed, 4 Jul 2018 05:51:56 -0400 Received: by mail-wr0-f195.google.com with SMTP id u7-v6so4661280wrn.12 for ; Wed, 04 Jul 2018 02:51:55 -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=J9NlNC+HBVbx9h/W6EWGYjYfY0/f9mmfn41Tkqa7hTE=; b=gE3WzwpVqU8ousmUcUUdG4i+ZlzO9CPG1V7XS53U2AjsUmUmN96l+QMpI6d+TynSt2 9UcxmbBH/CXuNPAVeCU0NI0MuIIMSdkWdei81q4cyHb5HgF5dqrCD7RrwnZjN0sbxsq0 B66xLBmif6AjUwznUKuIl18AlcJfGC0B9H3Mg= 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=J9NlNC+HBVbx9h/W6EWGYjYfY0/f9mmfn41Tkqa7hTE=; b=FUc8eOTMw5OX5B/8uJ/unM5EA3Akx3oAEGTYFtdA4p6DE9a5+epkvhCyQ5nOFtAQ9u mAKcmLbKekoRajXItKXCPJb6r6dzJSc6jPuclQmPXiIluH9K1uTvPyDdy5L2i1itwquG xj2kkLm7zxi7UEvlQcuUhhCzqZ/PPef/82fTERy186MaO/FmMZKHQhS/21ZyXtKqVKA1 HeuepZNgvQP0hDH+8A0435ApsTsECfp47SYVLoGJMQ8SO4ZgX6p//HbAODPyFGkGQpm1 FJ5TudK2OqMXyNHTK5shmjCWcymVUqkVqepahEI4I5CnXhtc+QR1nupBgObqELFkZxPl u1Vg== X-Gm-Message-State: APt69E28A+6/xfkF1WRd1pxauFsVsSRSN6TYtgDrlNeNeP/IoutuAfR6 0IDe6IvzVpldkj24jLdzhCNOrQ== X-Google-Smtp-Source: AAOMgpfPF2e/LpPusfdpUujZvLc2OCo/ivugPJkjnZE6c2g+0/94HAcIZGtpKG20lsVlo9SazhKArQ== X-Received: by 2002:adf:b3d4:: with SMTP id x20-v6mr1090402wrd.272.1530697915216; Wed, 04 Jul 2018 02:51:55 -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 125-v6sm6370089wmw.9.2018.07.04.02.51.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jul 2018 02:51:54 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, alsa-devel@alsa-project.org Cc: linux-arm-msm@vger.kernel.org, lgirdwood@gmail.com, bgoswami@codeaurora.org, tiwai@suse.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Srinivas Kandagatla Subject: [PATCH 2/6] ASoC: qdsp6: q6afe-dai: add support to slim tx dais Date: Wed, 4 Jul 2018 10:49:40 +0100 Message-Id: <20180704094944.16440-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180704094944.16440-1-srinivas.kandagatla@linaro.org> References: <20180704094944.16440-1-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support to SLIMbus TX dais in AFE module. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6afe-dai.c | 175 +++++++++++++++++++++++++++++++++++---- 1 file changed, 161 insertions(+), 14 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c index 1d2e5013c121..8dd3683eb367 100644 --- a/sound/soc/qcom/qdsp6/q6afe-dai.c +++ b/sound/soc/qcom/qdsp6/q6afe-dai.c @@ -382,23 +382,31 @@ static int q6slim_set_channel_map(struct snd_soc_dai *dai, struct q6afe_port_config *pcfg = &dai_data->port_config[dai->id]; int i; - if (!rx_slot) { - pr_err("%s: rx slot not found\n", __func__); - return -EINVAL; - } + if (dai->id & 0x1) { + /* TX */ + if (!tx_slot) { + pr_err("%s: tx slot not found\n", __func__); + return -EINVAL; + } - for (i = 0; i < rx_num; i++) { - pcfg->slim.ch_mapping[i] = rx_slot[i]; - pr_debug("%s: find number of channels[%d] ch[%d]\n", - __func__, i, rx_slot[i]); - } + for (i = 0; i < tx_num; i++) + pcfg->slim.ch_mapping[i] = tx_slot[i]; + + pcfg->slim.num_channels = tx_num; + + + } else { + if (!rx_slot) { + pr_err("%s: rx slot not found\n", __func__); + return -EINVAL; + } - pcfg->slim.num_channels = rx_num; + for (i = 0; i < rx_num; i++) + pcfg->slim.ch_mapping[i] = rx_slot[i]; - pr_debug("%s: SLIMBUS_%d_RX cnt[%d] ch[%d %d]\n", __func__, - (dai->id - SLIMBUS_0_RX) / 2, rx_num, - pcfg->slim.ch_mapping[0], - pcfg->slim.ch_mapping[1]); + pcfg->slim.num_channels = rx_num; + + } return 0; } @@ -443,6 +451,14 @@ static const struct snd_soc_dapm_route q6afe_dapm_routes[] = { {"Slimbus5 Playback", NULL, "SLIMBUS_5_RX"}, {"Slimbus6 Playback", NULL, "SLIMBUS_6_RX"}, + {"SLIMBUS_0_TX", NULL, "Slimbus Capture"}, + {"SLIMBUS_1_TX", NULL, "Slimbus1 Capture"}, + {"SLIMBUS_2_TX", NULL, "Slimbus2 Capture"}, + {"SLIMBUS_3_TX", NULL, "Slimbus3 Capture"}, + {"SLIMBUS_4_TX", NULL, "Slimbus4 Capture"}, + {"SLIMBUS_5_TX", NULL, "Slimbus5 Capture"}, + {"SLIMBUS_6_TX", NULL, "Slimbus6 Capture"}, + {"Primary MI2S Playback", NULL, "PRI_MI2S_RX"}, {"Secondary MI2S Playback", NULL, "SEC_MI2S_RX"}, {"Tertiary MI2S Playback", NULL, "TERT_MI2S_RX"}, @@ -636,6 +652,24 @@ static struct snd_soc_dai_driver q6afe_dais[] = { .rate_min = 8000, .rate_max = 192000, }, + }, { + .name = "SLIMBUS_0_TX", + .ops = &q6slim_ops, + .id = SLIMBUS_0_TX, + .probe = msm_dai_q6_dai_probe, + .remove = msm_dai_q6_dai_remove, + .capture = { + .stream_name = "Slimbus Capture", + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + .channels_min = 1, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 192000, + }, }, { .playback = { .stream_name = "Slimbus1 Playback", @@ -654,6 +688,24 @@ static struct snd_soc_dai_driver q6afe_dais[] = { .id = SLIMBUS_1_RX, .probe = msm_dai_q6_dai_probe, .remove = msm_dai_q6_dai_remove, + }, { + .name = "SLIMBUS_1_TX", + .ops = &q6slim_ops, + .id = SLIMBUS_1_TX, + .probe = msm_dai_q6_dai_probe, + .remove = msm_dai_q6_dai_remove, + .capture = { + .stream_name = "Slimbus1 Capture", + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + .channels_min = 1, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 192000, + }, }, { .playback = { .stream_name = "Slimbus2 Playback", @@ -672,6 +724,25 @@ static struct snd_soc_dai_driver q6afe_dais[] = { .id = SLIMBUS_2_RX, .probe = msm_dai_q6_dai_probe, .remove = msm_dai_q6_dai_remove, + + }, { + .name = "SLIMBUS_2_TX", + .ops = &q6slim_ops, + .id = SLIMBUS_2_TX, + .probe = msm_dai_q6_dai_probe, + .remove = msm_dai_q6_dai_remove, + .capture = { + .stream_name = "Slimbus2 Capture", + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + .channels_min = 1, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 192000, + }, }, { .playback = { .stream_name = "Slimbus3 Playback", @@ -690,6 +761,25 @@ static struct snd_soc_dai_driver q6afe_dais[] = { .id = SLIMBUS_3_RX, .probe = msm_dai_q6_dai_probe, .remove = msm_dai_q6_dai_remove, + + }, { + .name = "SLIMBUS_3_TX", + .ops = &q6slim_ops, + .id = SLIMBUS_3_TX, + .probe = msm_dai_q6_dai_probe, + .remove = msm_dai_q6_dai_remove, + .capture = { + .stream_name = "Slimbus3 Capture", + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + .channels_min = 1, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 192000, + }, }, { .playback = { .stream_name = "Slimbus4 Playback", @@ -708,6 +798,25 @@ static struct snd_soc_dai_driver q6afe_dais[] = { .id = SLIMBUS_4_RX, .probe = msm_dai_q6_dai_probe, .remove = msm_dai_q6_dai_remove, + + }, { + .name = "SLIMBUS_4_TX", + .ops = &q6slim_ops, + .id = SLIMBUS_4_TX, + .probe = msm_dai_q6_dai_probe, + .remove = msm_dai_q6_dai_remove, + .capture = { + .stream_name = "Slimbus4 Capture", + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + .channels_min = 1, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 192000, + }, }, { .playback = { .stream_name = "Slimbus5 Playback", @@ -726,6 +835,25 @@ static struct snd_soc_dai_driver q6afe_dais[] = { .id = SLIMBUS_5_RX, .probe = msm_dai_q6_dai_probe, .remove = msm_dai_q6_dai_remove, + + }, { + .name = "SLIMBUS_5_TX", + .ops = &q6slim_ops, + .id = SLIMBUS_5_TX, + .probe = msm_dai_q6_dai_probe, + .remove = msm_dai_q6_dai_remove, + .capture = { + .stream_name = "Slimbus5 Capture", + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + .channels_min = 1, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 192000, + }, }, { .playback = { .stream_name = "Slimbus6 Playback", @@ -744,6 +872,25 @@ static struct snd_soc_dai_driver q6afe_dais[] = { .id = SLIMBUS_6_RX, .probe = msm_dai_q6_dai_probe, .remove = msm_dai_q6_dai_remove, + + }, { + .name = "SLIMBUS_6_TX", + .ops = &q6slim_ops, + .id = SLIMBUS_6_TX, + .probe = msm_dai_q6_dai_probe, + .remove = msm_dai_q6_dai_remove, + .capture = { + .stream_name = "Slimbus6 Capture", + .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | + SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | + SNDRV_PCM_FMTBIT_S24_LE, + .channels_min = 1, + .channels_max = 8, + .rate_min = 8000, + .rate_max = 192000, + }, }, { .playback = { .stream_name = "Primary MI2S Playback",