From patchwork Tue Feb 13 16:58:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 128262 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4457280ljc; Tue, 13 Feb 2018 09:01:39 -0800 (PST) X-Google-Smtp-Source: AH8x224Dknrcz2a7eVKpARRHCULxXylKliqfsjt+4F6F7VUIq6aEeLZ/D07VJjLyEmcucTyZJYAR X-Received: by 10.98.36.81 with SMTP id r78mr1883309pfj.196.1518541298997; Tue, 13 Feb 2018 09:01:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518541298; cv=none; d=google.com; s=arc-20160816; b=xXYjELGvd8Dm+5bAVd0wHGgUzF/GFf1uMwYKuTO8rYvz5WTDVIe41bi8PGh51QEp+k EdKjegCPd8SLrnmAxixsBl9c21IvcHzYnByDgXXYwwbb/7528lsHtDiSOWI1dRd7LGlG m7CKyti7LSxTLIuNSUkNEigY4gBFqPuvf2WdPQAgIfDZ3pV54+So54veN8CIEaHScl/1 0lTjKmoG9XFT2z8eEpECaQzRU+Arzsndaa7FaBHcKUu2ashFl7YOyZTvCCjHiVYGDigg uecdmqIQlV7YQYTeUJfJzP48JGfq6KoQZUEgX+KJ4bz5wXpnE3bO3l23Dv2Ey2kWicKv vtqw== 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=xidcTIE7SrRiVoWh23a4kC4IN5IoGcGY30Wp+GPklBU=; b=eGFzVxdcd+vCZIt56Sx4sz3IVuhu75MMRxfd+/R5THt51/MrDFE6jNH7iv//VMXvwg nOPW4HxHkZ4HMLyDe3UtMg4j+5qpJanE56k7t3PqWqe9bHuGUEIet9B/dPRFjdkNe5Au zE2HrxNr3HUziUfLNfcTPpuPbGG+Rx4xxn60JMx8YcXxNJfy+7oZ0On0y8bSXsCrCUHE OG51A0gD/KHLAm5zV1YWk3DD9JXPhn6vbpgq5lDghV1j3vTL3gHc4TeJJnOET/d+FaY6 3TeVoHROZPI/zpy9j/IbSgaPcI+EgXCLWfwRI4dyZdHCI2L3TLfiLBDZlLoaVYMJTzx8 Y2yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jZjpP19o; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (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 bc11-v6si7528083plb.688.2018.02.13.09.01.38; Tue, 13 Feb 2018 09:01:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jZjpP19o; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965428AbeBMRB0 (ORCPT + 6 others); Tue, 13 Feb 2018 12:01:26 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:51352 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965144AbeBMRBU (ORCPT ); Tue, 13 Feb 2018 12:01:20 -0500 Received: by mail-wm0-f65.google.com with SMTP id r71so17415797wmd.1 for ; Tue, 13 Feb 2018 09:01:20 -0800 (PST) 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=jhdcbiKz2Td+mlYElzEBOMwo944IbX1u5Rx7uh5b5sQ=; b=jZjpP19oaUKiRQ3yvuNj43pVPFydEkpM1Dtf0M64tKMKA4OI5gP0Dz7wJy/QHPm+wb 2x5yKCFLI56gE/MJSXyVyJ00aFordYlTu6ss2lj6RC7BxwbzgzjR5XlHORXAyAZlzxaY miwqcSvY9tJZI5WjAG9QTIUJsxQN5C6gkrC7I= 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=jhdcbiKz2Td+mlYElzEBOMwo944IbX1u5Rx7uh5b5sQ=; b=sicSeh93yo7vSNOF/1s9hFOusNwZeDzC/aXDAY7bmNPNol1VU8erPWx+faibaWbk7r uK6j5jXz8qqKEtJZnCd5glrC9g4dyPwzm8vTkrUX/zfuv5N5Y04/KQ1iOQwW/xLLgy0u rzh+o0qO5tsPuoT2bVZuhRvVwBMq+KRUkbjbplpE0g/pyL4yIrfmPaasrjd/jzAPEz3c 9Qaz2SE0F5g34QHa656BviYwH0ITQutd6qzt8L95UdfotMnSOBgZlLhD73AsNdIL2cbI pv6ctxdY2gAhkB1YXBnk+fusgAXxI0rNw/k/RqVAWBYYXJJ1pMA4Q0v/WsiW7/WkgsUm POAQ== X-Gm-Message-State: APf1xPCWSKYlfcAGKEjFsRvlPdC4Dde6/mpVv2k+yVlVtBaKvID6RnZj o+ngIflW8stn+5K0yanRt4AFHQ== X-Received: by 10.28.113.150 with SMTP id d22mr1816629wmi.127.1518541279020; Tue, 13 Feb 2018 09:01:19 -0800 (PST) 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 y145sm7432723wmd.43.2018.02.13.09.01.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Feb 2018 09:01:18 -0800 (PST) From: srinivas.kandagatla@linaro.org To: andy.gross@linaro.org, broonie@kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org Cc: david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, lgirdwood@gmail.com, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rohkumar@qti.qualcomm.com, spatakok@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH v3 03/25] ASoC: qcom: qdsp6: Add common qdsp6 helper functions Date: Tue, 13 Feb 2018 16:58:15 +0000 Message-Id: <20180213165837.1620-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180213165837.1620-1-srinivas.kandagatla@linaro.org> References: <20180213165837.1620-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla This patch adds some common helper functions like translating dsp error to linux error codes and channel mappings etc. These functions are used in all the following qdsp6 drivers. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/Kconfig | 14 ++++++ sound/soc/qcom/qdsp6/Makefile | 1 + sound/soc/qcom/qdsp6/q6dsp-common.c | 67 +++++++++++++++++++++++++ sound/soc/qcom/qdsp6/q6dsp-common.h | 24 +++++++++ sound/soc/qcom/qdsp6/q6dsp-errno.h | 97 +++++++++++++++++++++++++++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 sound/soc/qcom/qdsp6/Makefile create mode 100644 sound/soc/qcom/qdsp6/q6dsp-common.c create mode 100644 sound/soc/qcom/qdsp6/q6dsp-common.h create mode 100644 sound/soc/qcom/qdsp6/q6dsp-errno.h -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig index 8ec9a074b38b..b01f347b427d 100644 --- a/sound/soc/qcom/Kconfig +++ b/sound/soc/qcom/Kconfig @@ -43,3 +43,17 @@ config SND_SOC_APQ8016_SBC Support for Qualcomm Technologies LPASS audio block in APQ8016 SOC-based systems. Say Y if you want to use audio devices on MI2S. + +config SND_SOC_QDSP6_COMMON + tristate + default n + +config SND_SOC_QDSP6 + tristate "SoC ALSA audio driver for QDSP6" + depends on QCOM_APR && HAS_DMA + select SND_SOC_QDSP6_COMMON + help + To add support for MSM QDSP6 Soc Audio. + This will enable sound soc platform specific + audio drivers. This includes q6asm, q6adm, + q6afe interfaces to DSP using apr. diff --git a/sound/soc/qcom/qdsp6/Makefile b/sound/soc/qcom/qdsp6/Makefile new file mode 100644 index 000000000000..accebdb49306 --- /dev/null +++ b/sound/soc/qcom/qdsp6/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_SND_SOC_QDSP6_COMMON) += q6dsp-common.o diff --git a/sound/soc/qcom/qdsp6/q6dsp-common.c b/sound/soc/qcom/qdsp6/q6dsp-common.c new file mode 100644 index 000000000000..3fe5b7942c4c --- /dev/null +++ b/sound/soc/qcom/qdsp6/q6dsp-common.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2011-2017, The Linux Foundation + * Copyright (c) 2018, Linaro Limited + */ +#include "q6dsp-common.h" +#include +#include +#include +#include + +int q6dsp_map_channels(u8 ch_map[PCM_FORMAT_MAX_NUM_CHANNEL], int ch) +{ + memset(ch_map, 0, PCM_FORMAT_MAX_NUM_CHANNEL); + + switch (ch) { + case 1: + ch_map[0] = PCM_CHANNEL_FC; + break; + case 2: + ch_map[0] = PCM_CHANNEL_FL; + ch_map[1] = PCM_CHANNEL_FR; + break; + case 3: + ch_map[0] = PCM_CHANNEL_FL; + ch_map[1] = PCM_CHANNEL_FR; + ch_map[2] = PCM_CHANNEL_FC; + break; + case 4: + ch_map[0] = PCM_CHANNEL_FL; + ch_map[1] = PCM_CHANNEL_FR; + ch_map[2] = PCM_CHANNEL_LS; + ch_map[3] = PCM_CHANNEL_RS; + break; + case 5: + ch_map[0] = PCM_CHANNEL_FL; + ch_map[1] = PCM_CHANNEL_FR; + ch_map[2] = PCM_CHANNEL_FC; + ch_map[3] = PCM_CHANNEL_LS; + ch_map[4] = PCM_CHANNEL_RS; + break; + case 6: + ch_map[0] = PCM_CHANNEL_FL; + ch_map[1] = PCM_CHANNEL_FR; + ch_map[2] = PCM_CHANNEL_LFE; + ch_map[3] = PCM_CHANNEL_FC; + ch_map[4] = PCM_CHANNEL_LS; + ch_map[5] = PCM_CHANNEL_RS; + break; + case 8: + ch_map[0] = PCM_CHANNEL_FL; + ch_map[1] = PCM_CHANNEL_FR; + ch_map[2] = PCM_CHANNEL_LFE; + ch_map[3] = PCM_CHANNEL_FC; + ch_map[4] = PCM_CHANNEL_LS; + ch_map[5] = PCM_CHANNEL_RS; + ch_map[6] = PCM_CHANNEL_LB; + ch_map[7] = PCM_CHANNEL_RB; + break; + default: + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL_GPL(q6dsp_map_channels); +MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/qcom/qdsp6/q6dsp-common.h b/sound/soc/qcom/qdsp6/q6dsp-common.h new file mode 100644 index 000000000000..32386f4a6432 --- /dev/null +++ b/sound/soc/qcom/qdsp6/q6dsp-common.h @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0 + +#ifndef __Q6DSP_COMMON_H__ +#define __Q6DSP_COMMON_H__ + +#include + +#define PCM_FORMAT_MAX_NUM_CHANNEL 8 +#define PCM_CHANNEL_NULL 0 + +#define PCM_CHANNEL_FL 1 /* Front left channel. */ +#define PCM_CHANNEL_FR 2 /* Front right channel. */ +#define PCM_CHANNEL_FC 3 /* Front center channel. */ +#define PCM_CHANNEL_LS 4 /* Left surround channel. */ +#define PCM_CHANNEL_RS 5 /* Right surround channel. */ +#define PCM_CHANNEL_LFE 6 /* Low frequency effect channel. */ +#define PCM_CHANNEL_CS 7 /* Center surround channel; Rear center ch */ +#define PCM_CHANNEL_LB 8 /* Left back channel; Rear left channel. */ +#define PCM_CHANNEL_RB 9 /* Right back channel; Rear right channel. */ +#define PCM_CHANNELS 10 /* Top surround channel. */ + +int q6dsp_map_channels(u8 ch_map[PCM_FORMAT_MAX_NUM_CHANNEL], int ch); + +#endif /* __Q6DSP_COMMON_H__ */ diff --git a/sound/soc/qcom/qdsp6/q6dsp-errno.h b/sound/soc/qcom/qdsp6/q6dsp-errno.h new file mode 100644 index 000000000000..763c19bb4a13 --- /dev/null +++ b/sound/soc/qcom/qdsp6/q6dsp-errno.h @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0 + +#ifndef __Q6DSP_ERR_NO_H__ +#define __Q6DSP_ERR_NO_H__ +#include + +/* Success. The operation completed with no errors. */ +#define ADSP_EOK 0x00000000 +/* General failure. */ +#define ADSP_EFAILED 0x00000001 +/* Bad operation parameter. */ +#define ADSP_EBADPARAM 0x00000002 +/* Unsupported routine or operation. */ +#define ADSP_EUNSUPPORTED 0x00000003 +/* Unsupported version. */ +#define ADSP_EVERSION 0x00000004 +/* Unexpected problem encountered. */ +#define ADSP_EUNEXPECTED 0x00000005 +/* Unhandled problem occurred. */ +#define ADSP_EPANIC 0x00000006 +/* Unable to allocate resource. */ +#define ADSP_ENORESOURCE 0x00000007 +/* Invalid handle. */ +#define ADSP_EHANDLE 0x00000008 +/* Operation is already processed. */ +#define ADSP_EALREADY 0x00000009 +/* Operation is not ready to be processed. */ +#define ADSP_ENOTREADY 0x0000000A +/* Operation is pending completion. */ +#define ADSP_EPENDING 0x0000000B +/* Operation could not be accepted or processed. */ +#define ADSP_EBUSY 0x0000000C +/* Operation aborted due to an error. */ +#define ADSP_EABORTED 0x0000000D +/* Operation preempted by a higher priority. */ +#define ADSP_EPREEMPTED 0x0000000E +/* Operation requests intervention to complete. */ +#define ADSP_ECONTINUE 0x0000000F +/* Operation requests immediate intervention to complete. */ +#define ADSP_EIMMEDIATE 0x00000010 +/* Operation is not implemented. */ +#define ADSP_ENOTIMPL 0x00000011 +/* Operation needs more data or resources. */ +#define ADSP_ENEEDMORE 0x00000012 +/* Operation does not have memory. */ +#define ADSP_ENOMEMORY 0x00000014 +/* Item does not exist. */ +#define ADSP_ENOTEXIST 0x00000015 +/* Max count for adsp error code sent to HLOS*/ + +struct q6dsp_err_code { + int lnx_err_code; + char *adsp_err_str; +}; + +static struct q6dsp_err_code q6dsp_err_codes[] = { + [ADSP_EFAILED] = { -ENOTRECOVERABLE, "ADSP_EFAILED"}, + [ADSP_EBADPARAM] = { -EINVAL, "ADSP_EBADPARAM"}, + [ADSP_EUNSUPPORTED] = { -ENOSYS, "ADSP_EUNSUPPORTED"}, + [ADSP_EVERSION] = { -ENOPROTOOPT, "ADSP_EVERSION"}, + [ADSP_EUNEXPECTED] = { -ENOTRECOVERABLE, "ADSP_EUNEXPECTED"}, + [ADSP_EPANIC] = { -ENOTRECOVERABLE, "ADSP_EPANIC"}, + [ADSP_ENORESOURCE] = { -ENOSPC, "ADSP_ENORESOURCE"}, + [ADSP_EHANDLE] = { -EBADR, "ADSP_EHANDLE"}, + [ADSP_EALREADY] = { -EALREADY, "ADSP_EALREADY"}, + [ADSP_ENOTREADY] = { -EPERM, "ADSP_ENOTREADY"}, + [ADSP_EPENDING] = { -EINPROGRESS, "ADSP_EPENDING"}, + [ADSP_EBUSY] = { -EBUSY, "ADSP_EBUSY"}, + [ADSP_EABORTED] = { -ECANCELED, "ADSP_EABORTED"}, + [ADSP_EPREEMPTED] = { -EAGAIN, "ADSP_EPREEMPTED"}, + [ADSP_ECONTINUE] = { -EAGAIN, "ADSP_ECONTINUE"}, + [ADSP_EIMMEDIATE] = { -EAGAIN, "ADSP_EIMMEDIATE"}, + [ADSP_ENOTIMPL] = { -EAGAIN, "ADSP_ENOTIMPL"}, + [ADSP_ENEEDMORE] = { -ENODATA, "ADSP_ENEEDMORE"}, + [ADSP_ENOMEMORY] = { -EINVAL, "ADSP_ENOMEMORY"}, + [ADSP_ENOTEXIST] = { -ENOENT, "ADSP_ENOTEXIST"}, +}; + +static inline int q6dsp_errno(u32 error) +{ + int ret = -EINVAL; + + if (error <= ARRAY_SIZE(q6dsp_err_codes)) + ret = q6dsp_err_codes[error].lnx_err_code; + + return ret; +} + +static inline char *q6dsp_strerror(u32 error) +{ + if (error <= ARRAY_SIZE(q6dsp_err_codes)) + return q6dsp_err_codes[error].adsp_err_str; + + return "ADSP_ERR_MAX"; +} + +#endif /*__Q6DSP_ERR_NO_H__ */ From patchwork Tue Feb 13 16:58:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 128280 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4461650ljc; Tue, 13 Feb 2018 09:05:15 -0800 (PST) X-Google-Smtp-Source: AH8x2267eeOxe8iunHKSCUUFj82n1xXSB56CwqSvaXs5Jj/Ztjp2kIF+wf63g4+LCIAPj686QaA4 X-Received: by 10.101.74.132 with SMTP id b4mr1535450pgu.355.1518541514901; Tue, 13 Feb 2018 09:05:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518541514; cv=none; d=google.com; s=arc-20160816; b=g/LoO/ezBaT82RLPY5PpoPJq0jhJywbifNTSSioP4RkWKxEyeRGAhTHeRVITnhIUa1 NhTuXZMbQgSwrtrhlCBFJRqgt4mrgN80R2W+z0j+EVpIl6U9Bmp5LVDwwQ6Ub234rVxS hrXAmt4kZou4+5UWH55NyUcTesBJxa5trckEkALs653Cydx30NYEKpeS9eV3Ngwsnf83 iIJaDteTgEmBCb3o0HAV7KL/4cu+Dk/LHXk+G7FPvPuM2bVv19zWSHUW4M+Pm+Hz/Yta fCQxS7bXnKaODTZ+9KwN737lGcRSY8l+sFcLjRpg4I+N6s9swVIAR0Wjiycvj5Qc+o6m l4zw== 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=sSDdcKpVigHgLjM03fIMLvcI4aSt0Ly6R+JlTrqU6CM=; b=x+zG1CfU6U8h0P3CBbsPDefb1/ZnDe71BzHm6FB9ttFq4LH1yBTuOj+oPGkbhqdpNa 37g6eZ7u6zRUtwgTJ39ebxYZXyXHaZ82+9xSeyKRpZbXCr/ywGrAZvbk1G87IiYWF35C z5bFIneRXJ2SJruphSNh2pianLV63hib/1rDP+uoKsJw5ZoxJ4rkqHjDFTkPS6OWor/3 YLHmj1NQ1GuIHB7Pk/I8E63XxWmRoNNwQpNMsahZvlnW3NGksJKdsrk5WQysHxN6cgGS azmOZ8L940WhP9QQmr8iigio3CP5M/Gq+EbW2jWtLcirFpRpW/MtDGMq9bx3EZ61eMtf pvHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IMguwWUi; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (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 m73si1847554pfj.131.2018.02.13.09.05.14; Tue, 13 Feb 2018 09:05:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=IMguwWUi; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965484AbeBMREp (ORCPT + 6 others); Tue, 13 Feb 2018 12:04:45 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42100 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965477AbeBMRBh (ORCPT ); Tue, 13 Feb 2018 12:01:37 -0500 Received: by mail-wr0-f195.google.com with SMTP id k9so5515808wre.9 for ; Tue, 13 Feb 2018 09:01:37 -0800 (PST) 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=0zaxe7rGXKtigYGGEeEfPOfxXVn2gbAL2Pb4k/x+U2w=; b=IMguwWUiLzYb936/JQiue7vKbURErXSH81Sar/qq+A7IlQW4EI9X8lA0jQYptd0NaN egF3qeKt5aBEo3MfewPTHXLL2VtGbvdUBnSronrJqUR0NQwBfw/ZJup7MliJFGmkz3pI CHbvS/HUozpdpw3mYZyHUemUO0lMlMqYE7TGo= 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=0zaxe7rGXKtigYGGEeEfPOfxXVn2gbAL2Pb4k/x+U2w=; b=j7GdHqaMTjMykAEWoMXh4GuHr49KQTFUL1+/eKayP8k2lanb+UvukSJmMqit3WYZUN bAJAeXaCmMJR5zevlb3Li16rVl+Ko90wZk5WQ7hteTANpDDgJv0WDjIAmldYUc6x84zx dRDOgVNnd/TkCCPGN7BEa48i54/hDXj224oIcyl/bzzpiqltBs/9TosH+7bMfG7IR9oQ ZfWMb0DsIx1fFwxQ5oDp30EYxYZl2pW0QoJB2l+wJ5NdkGVec/eHuBUw3l8QkOgaNYDN 1G3Msq/mCX64pHSjulEPQU2agG1N/ZM5AQhoji6mZ+TWTmyjB8fqSZzgN0b1xIBNQBFB 2CEg== X-Gm-Message-State: APf1xPDwslHg7MiCMO19j6hZ9jwKMZB2sIJBF+Bo8BNE76DKSg4u67uY nzHujkR3SvfYim8kzGipLTIZJg== X-Received: by 10.223.182.65 with SMTP id i1mr1806594wre.24.1518541295934; Tue, 13 Feb 2018 09:01:35 -0800 (PST) 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 y145sm7432723wmd.43.2018.02.13.09.01.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Feb 2018 09:01:35 -0800 (PST) From: srinivas.kandagatla@linaro.org To: andy.gross@linaro.org, broonie@kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org Cc: david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, lgirdwood@gmail.com, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rohkumar@qti.qualcomm.com, spatakok@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH v3 16/25] ASoC: qcom: q6afe: add SLIMBus port Support Date: Tue, 13 Feb 2018 16:58:28 +0000 Message-Id: <20180213165837.1620-17-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180213165837.1620-1-srinivas.kandagatla@linaro.org> References: <20180213165837.1620-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla This patch adds support to 6 SLIMBus AFE ports, which are used as backend dais. Signed-off-by: Srinivas Kandagatla --- include/dt-bindings/sound/qcom,q6afe.h | 14 ++++ sound/soc/qcom/qdsp6/q6afe.c | 129 +++++++++++++++++++++++++++++++++ sound/soc/qcom/qdsp6/q6afe.h | 16 +++- 3 files changed, 158 insertions(+), 1 deletion(-) -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/dt-bindings/sound/qcom,q6afe.h b/include/dt-bindings/sound/qcom,q6afe.h index b4d82cccdc86..e9004ee39f72 100644 --- a/include/dt-bindings/sound/qcom,q6afe.h +++ b/include/dt-bindings/sound/qcom,q6afe.h @@ -4,6 +4,20 @@ /* Audio Front End (AFE) Ports */ #define AFE_PORT_HDMI_RX 8 +#define SLIMBUS_0_RX 15 +#define SLIMBUS_0_TX 16 +#define SLIMBUS_1_RX 17 +#define SLIMBUS_1_TX 18 +#define SLIMBUS_2_RX 19 +#define SLIMBUS_2_TX 20 +#define SLIMBUS_3_RX 21 +#define SLIMBUS_3_TX 22 +#define SLIMBUS_4_RX 23 +#define SLIMBUS_4_TX 24 +#define SLIMBUS_5_RX 25 +#define SLIMBUS_5_TX 26 +#define SLIMBUS_6_RX 45 +#define SLIMBUS_6_TX 46 #endif /* __DT_BINDINGS_Q6_AFE_H__ */ diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c index 0a5af06bb50e..637390f5421e 100644 --- a/sound/soc/qcom/qdsp6/q6afe.c +++ b/sound/soc/qcom/qdsp6/q6afe.c @@ -25,9 +25,45 @@ #define AFE_PARAM_ID_HDMI_CONFIG 0x00010210 #define AFE_MODULE_AUDIO_DEV_INTERFACE 0x0001020C +#define AFE_PARAM_ID_CDC_SLIMBUS_SLAVE_CFG 0x00010235 + +#define AFE_PARAM_ID_SLIMBUS_CONFIG 0x00010212 + /* Port IDs */ #define AFE_API_VERSION_HDMI_CONFIG 0x1 #define AFE_PORT_ID_MULTICHAN_HDMI_RX 0x100E + +#define AFE_API_VERSION_SLIMBUS_CONFIG 0x1 + +/* SLIMbus Rx port on channel 0. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX 0x4000 +/* SLIMbus Tx port on channel 0. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX 0x4001 +/* SLIMbus Rx port on channel 1. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_RX 0x4002 +/* SLIMbus Tx port on channel 1. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_TX 0x4003 +/* SLIMbus Rx port on channel 2. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_RX 0x4004 +/* SLIMbus Tx port on channel 2. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_TX 0x4005 +/* SLIMbus Rx port on channel 3. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_RX 0x4006 +/* SLIMbus Tx port on channel 3. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_TX 0x4007 +/* SLIMbus Rx port on channel 4. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_RX 0x4008 +/* SLIMbus Tx port on channel 4. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_TX 0x4009 +/* SLIMbus Rx port on channel 5. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_RX 0x400a +/* SLIMbus Tx port on channel 5. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX 0x400b +/* SLIMbus Rx port on channel 6. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_RX 0x400c +/* SLIMbus Tx port on channel 6. */ +#define AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_TX 0x400d + #define TIMEOUT_MS 1000 #define AFE_CMD_RESP_AVAIL 0 #define AFE_CMD_RESP_NONE 1 @@ -82,8 +118,53 @@ struct afe_param_id_hdmi_multi_chan_audio_cfg { u16 reserved; } __packed; +struct afe_param_id_slimbus_cfg { + u32 sb_cfg_minor_version; +/* Minor version used for tracking the version of the SLIMBUS + * configuration interface. + * Supported values: #AFE_API_VERSION_SLIMBUS_CONFIG + */ + + u16 slimbus_dev_id; +/* SLIMbus hardware device ID, which is required to handle + * multiple SLIMbus hardware blocks. + * Supported values: - #AFE_SLIMBUS_DEVICE_1 - #AFE_SLIMBUS_DEVICE_2 + */ + u16 bit_width; +/* Bit width of the sample. + * Supported values: 16, 24 + */ + u16 data_format; +/* Data format supported by the SLIMbus hardware. The default is + * 0 (#AFE_SB_DATA_FORMAT_NOT_INDICATED), which indicates the + * hardware does not perform any format conversions before the data + * transfer. + */ + u16 num_channels; +/* Number of channels. + * Supported values: 1 to #AFE_PORT_MAX_AUDIO_CHAN_CNT + */ + u8 shared_ch_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT]; +/* Mapping of shared channel IDs (128 to 255) to which the + * master port is to be connected. + * Shared_channel_mapping[i] represents the shared channel assigned + * for audio channel i in multichannel audio data. + */ + u32 sample_rate; +/* Sampling rate of the port. + * Supported values: + * - #AFE_PORT_SAMPLE_RATE_8K + * - #AFE_PORT_SAMPLE_RATE_16K + * - #AFE_PORT_SAMPLE_RATE_48K + * - #AFE_PORT_SAMPLE_RATE_96K + * - #AFE_PORT_SAMPLE_RATE_192K + */ +} __packed; + + union afe_port_config { struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch; + struct afe_param_id_slimbus_cfg slim_cfg; } __packed; struct q6afe_port { @@ -114,6 +195,20 @@ struct afe_port_map { static struct afe_port_map port_maps[AFE_PORT_MAX] = { [AFE_PORT_HDMI_RX] = { AFE_PORT_ID_MULTICHAN_HDMI_RX, AFE_PORT_HDMI_RX, 1, 1}, + [SLIMBUS_0_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX, + SLIMBUS_0_RX, 1, 1}, + [SLIMBUS_1_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_RX, + SLIMBUS_1_RX, 1, 1}, + [SLIMBUS_2_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_RX, + SLIMBUS_2_RX, 1, 1}, + [SLIMBUS_3_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_RX, + SLIMBUS_3_RX, 1, 1}, + [SLIMBUS_4_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_RX, + SLIMBUS_4_RX, 1, 1}, + [SLIMBUS_5_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_RX, + SLIMBUS_5_RX, 1, 1}, + [SLIMBUS_6_RX] = { AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_RX, + SLIMBUS_6_RX, 1, 1}, }; static struct q6afe_port *afe_find_port(struct q6afe *afe, int token) @@ -372,6 +467,31 @@ void *q6afe_get_dai_data(struct device *dev) } EXPORT_SYMBOL_GPL(q6afe_get_dai_data); +/** + * q6afe_slim_port_prepare() - Prepare slim afe port. + * + * @port: Instance of afe port + * @cfg: SLIM configuration for the afe port + * + */ +void q6afe_slim_port_prepare(struct q6afe_port *port, + struct q6afe_slim_cfg *cfg) +{ + union afe_port_config *pcfg = &port->port_cfg; + + pcfg->slim_cfg.sb_cfg_minor_version = AFE_API_VERSION_SLIMBUS_CONFIG; + pcfg->slim_cfg.sample_rate = cfg->sample_rate; + pcfg->slim_cfg.bit_width = cfg->bit_width; + pcfg->slim_cfg.num_channels = cfg->num_channels; + pcfg->slim_cfg.data_format = cfg->data_format; + pcfg->slim_cfg.shared_ch_mapping[0] = cfg->ch_mapping[0]; + pcfg->slim_cfg.shared_ch_mapping[1] = cfg->ch_mapping[1]; + pcfg->slim_cfg.shared_ch_mapping[2] = cfg->ch_mapping[2]; + pcfg->slim_cfg.shared_ch_mapping[3] = cfg->ch_mapping[3]; + +} +EXPORT_SYMBOL_GPL(q6afe_slim_port_prepare); + /** * q6afe_hdmi_port_prepare() - Prepare hdmi afe port. * @@ -433,6 +553,15 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id) case AFE_PORT_ID_MULTICHAN_HDMI_RX: cfg_type = AFE_PARAM_ID_HDMI_CONFIG; break; + case AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX: + case AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_RX: + case AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_RX: + case AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_RX: + case AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_RX: + case AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_RX: + case AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_RX: + cfg_type = AFE_PARAM_ID_SLIMBUS_CONFIG; + break; default: dev_err(dev, "Invalid port id 0x%x\n", port_id); return ERR_PTR(-EINVAL); diff --git a/sound/soc/qcom/qdsp6/q6afe.h b/sound/soc/qcom/qdsp6/q6afe.h index 647ed2d15545..aeacf1f2c9a9 100644 --- a/sound/soc/qcom/qdsp6/q6afe.h +++ b/sound/soc/qcom/qdsp6/q6afe.h @@ -5,12 +5,15 @@ #include -#define AFE_PORT_MAX 9 +#define AFE_PORT_MAX 48 #define MSM_AFE_PORT_TYPE_RX 0 #define MSM_AFE_PORT_TYPE_TX 1 #define AFE_MAX_PORTS AFE_PORT_MAX +#define AFE_MAX_CHAN_COUNT 8 +#define AFE_PORT_MAX_AUDIO_CHAN_CNT 0x8 + struct q6afe_hdmi_cfg { u16 datatype; u16 channel_allocation; @@ -18,8 +21,17 @@ struct q6afe_hdmi_cfg { u16 bit_width; }; +struct q6afe_slim_cfg { + u32 sample_rate; + u16 bit_width; + u16 data_format; + u16 num_channels; + u8 ch_mapping[AFE_MAX_CHAN_COUNT]; +}; + struct q6afe_port_config { struct q6afe_hdmi_cfg hdmi; + struct q6afe_slim_cfg slim; }; struct q6afe_port; @@ -36,5 +48,7 @@ void q6afe_port_put(struct q6afe_port *port); int q6afe_get_port_id(int index); void q6afe_hdmi_port_prepare(struct q6afe_port *port, struct q6afe_hdmi_cfg *cfg); +void q6afe_slim_port_prepare(struct q6afe_port *port, + struct q6afe_slim_cfg *cfg); #endif /* __Q6AFE_H__ */ From patchwork Tue Feb 13 16:58:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 128270 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp4459437ljc; Tue, 13 Feb 2018 09:03:14 -0800 (PST) X-Google-Smtp-Source: AH8x226JdMsMnm2QLIKZzt0flhA9jck7BONZUx7kR36O8qG+m1z+QHXHdIEXz4qlvt43mrIawdfe X-Received: by 2002:a17:902:9895:: with SMTP id s21-v6mr1684444plp.297.1518541394780; Tue, 13 Feb 2018 09:03:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518541394; cv=none; d=google.com; s=arc-20160816; b=IftL+BgRfyksXxkBJR/rDryRx4lplwgJDUoXDLhAZAsuHe7/FojGhsHvqj+DUvazt7 leQeiLt7p5V/p0fW3VPNOfxCivJAkaYVY5BQQBN1e5EZqCOLUYWjL6i+FOAz8CXsmVN5 Li5mjWinVMBNSfFxniAdGnKEJGoVpmMCNHP2XBFJsMb1sqjaWwJNUbfjGSXDSmPenFE0 KU12knmEsPEcdsuVj7WkTzVnII9W36cjG5TgIwJfoGgXqsCCqLsIdjrCFGuPP+n9Ggi7 p0sEUVtBKnNP0BUFR0Yx7t44mDw+tL9dCfU9xIKGc6Uphmhz7QWTTiw4RafPsgxhnyWJ RNqA== 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=jo7fC82gVeu3qDZ//KVJmevl6TV3RXnQ2eKnRsspoxg=; b=uZfwC07PBz1xjsTRmOMVXTK2ZUzDECg7HXSYN/ExyPzp42aOQ4/wm99G1rCzoFFykW DfAlWh0w6fh/Zy/qhyWFLFL8GfYrYS9hiOH6J5RAXL0OGBN5qUSM6DldBkZYMNy+iCnA vMtOjoLORlEZyktw0c1ATpAvsLqkStlAqo77KISPf9qv5Tybz2jN8w/ROK480IFEZCzc /MozM23wt6M0nZJwx5yDUGOjpbC2eQ/rvVN6830H6JrVJrS7HngvCnUa9i5VJEL6Gi27 sWRYc64NoC2ooRTL5uo0ktyXH48VSmOz/133TcWHi/RFdoITsoxnBg3DXlR/9MRWWClc 4+tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Tsetrpns; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (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 c1-v6si1774672plk.813.2018.02.13.09.03.14; Tue, 13 Feb 2018 09:03:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Tsetrpns; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965390AbeBMRDN (ORCPT + 6 others); Tue, 13 Feb 2018 12:03:13 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34441 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965512AbeBMRBp (ORCPT ); Tue, 13 Feb 2018 12:01:45 -0500 Received: by mail-wm0-f65.google.com with SMTP id j21so14098777wmh.1 for ; Tue, 13 Feb 2018 09:01:45 -0800 (PST) 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=w1zSG7XI0TYmd7bRPlH4ujzhrvUsganqcSIeZtYB09s=; b=TsetrpnsmSEhXS7cjMnhlbAiUqZf9cQSVXe/jv9M8KgUamUJwox9jChpwFayKxp9U7 D8iqrIxLuCtVgo/iPTXH3upTfvDuGa8QKBrocZT0KovH9dbn+uJIXz1w18DpDd+f2rQ2 B03gQd4UkCO8tV2O8SqXHJHBf6HuyUp8jrm1k= 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=w1zSG7XI0TYmd7bRPlH4ujzhrvUsganqcSIeZtYB09s=; b=E1hW2JaORzliQSVixrR4r+WAtu0r9cXwGBy1QZ1oN41f57emYeiVOiuj/KuvqRK2W6 SwPayEaJ5ZUj9QJSloRhzh0Nu1Wwx+lwPnpyX5nc3m9xl/G+MNGdRW2P4lFtTNnqRNx0 uU1Q9Mr1KtkSOrdzMSsjaFdhEetjX31343iVQI7aNxaP3r8fwCCtXWpNYHk03nA/+PDt 8W2Ul/smxQdHyKFTJ8EVfaMDagW9sYBUzyAZaD6X2nsYUOzgb7R727ZN/wkkKcL3qmAD FQlqXNW9pL7hmN9geQ+uphHiFuTpUA3sWSlDrX3adbEgb5wn8xwrhAdv0XzSe+4w8w2r aI4A== X-Gm-Message-State: APf1xPDs3k730E509f7c0pkYs53m3qwwwZ2dF9iNIUhj71yOln/E+RtO 0Hcc9fPQjeeg2Yo31HK64z/ZFw== X-Received: by 10.28.173.20 with SMTP id w20mr1771403wme.15.1518541304445; Tue, 13 Feb 2018 09:01:44 -0800 (PST) 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 y145sm7432723wmd.43.2018.02.13.09.01.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Feb 2018 09:01:43 -0800 (PST) From: srinivas.kandagatla@linaro.org To: andy.gross@linaro.org, broonie@kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org Cc: david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, lgirdwood@gmail.com, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rohkumar@qti.qualcomm.com, spatakok@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH v3 22/25] ASoC: qcom: q6routing: add support to MI2S Mixers Date: Tue, 13 Feb 2018 16:58:34 +0000 Message-Id: <20180213165837.1620-23-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180213165837.1620-1-srinivas.kandagatla@linaro.org> References: <20180213165837.1620-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla This patch add support to MI2S mixers required to select path between ASM stream and AFE ports. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6routing.c | 142 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c index 8c9b5d899ba7..8ffcc49a79a1 100644 --- a/sound/soc/qcom/qdsp6/q6routing.c +++ b/sound/soc/qcom/qdsp6/q6routing.c @@ -232,6 +232,102 @@ static const struct snd_kcontrol_new hdmi_mixer_controls[] = { msm_routing_put_audio_mixer), }; +static const struct snd_kcontrol_new primary_mi2s_rx_mixer_controls[] = { + SOC_SINGLE_EXT("MultiMedia1", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia2", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia3", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia4", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia5", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia6", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia7", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia8", PRIMARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), +}; + +static const struct snd_kcontrol_new secondary_mi2s_rx_mixer_controls[] = { + SOC_SINGLE_EXT("MultiMedia1", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia2", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia3", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia4", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia5", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia6", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia7", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia8", SECONDARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), +}; + +static const struct snd_kcontrol_new quaternary_mi2s_rx_mixer_controls[] = { + SOC_SINGLE_EXT("MultiMedia1", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia2", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia3", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia4", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia5", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA5, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia6", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA6, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia7", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA7, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia8", QUATERNARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), +}; + +static const struct snd_kcontrol_new tertiary_mi2s_rx_mixer_controls[] = { + SOC_SINGLE_EXT("MultiMedia1", TERTIARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia2", TERTIARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA2, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia3", TERTIARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA3, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), + SOC_SINGLE_EXT("MultiMedia4", TERTIARY_MI2S_RX, + MSM_FRONTEND_DAI_MULTIMEDIA4, 1, 0, msm_routing_get_audio_mixer, + msm_routing_put_audio_mixer), +}; + static const struct snd_kcontrol_new slimbus_rx_mixer_controls[] = { SOC_SINGLE_EXT("MultiMedia1", SLIMBUS_0_RX, MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer, @@ -443,6 +539,18 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = { SND_SOC_DAPM_MIXER("SLIMBUS_6_RX Audio Mixer", SND_SOC_NOPM, 0, 0, slimbus_6_rx_mixer_controls, ARRAY_SIZE(slimbus_6_rx_mixer_controls)), + SND_SOC_DAPM_MIXER("PRI_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, + primary_mi2s_rx_mixer_controls, + ARRAY_SIZE(primary_mi2s_rx_mixer_controls)), + SND_SOC_DAPM_MIXER("SEC_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, + secondary_mi2s_rx_mixer_controls, + ARRAY_SIZE(secondary_mi2s_rx_mixer_controls)), + SND_SOC_DAPM_MIXER("QUAT_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, + quaternary_mi2s_rx_mixer_controls, + ARRAY_SIZE(quaternary_mi2s_rx_mixer_controls)), + SND_SOC_DAPM_MIXER("TERT_MI2S_RX Audio Mixer", SND_SOC_NOPM, 0, 0, + tertiary_mi2s_rx_mixer_controls, + ARRAY_SIZE(tertiary_mi2s_rx_mixer_controls)), }; static const struct snd_soc_dapm_route intercon[] = { @@ -520,6 +628,40 @@ static const struct snd_soc_dapm_route intercon[] = { {"SLIMBUS_6_RX Audio Mixer", "MultiMedia7", "MM_DL7"}, {"SLIMBUS_6_RX Audio Mixer", "MultiMedia8", "MM_DL8"}, {"SLIMBUS_6_RX", NULL, "SLIMBUS_6_RX Audio Mixer"}, + + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia1", "MM_DL1"}, + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia2", "MM_DL2"}, + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia3", "MM_DL3"}, + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia4", "MM_DL4"}, + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia5", "MM_DL5"}, + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia6", "MM_DL6"}, + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia7", "MM_DL7"}, + {"QUAT_MI2S_RX Audio Mixer", "MultiMedia8", "MM_DL8"}, + {"QUAT_MI2S_RX", NULL, "QUAT_MI2S_RX Audio Mixer"}, + + {"TERT_MI2S_RX Audio Mixer", "MultiMedia1", "MM_DL1"}, + {"TERT_MI2S_RX Audio Mixer", "MultiMedia2", "MM_DL2"}, + {"TERT_MI2S_RX Audio Mixer", "MultiMedia3", "MM_DL3"}, + {"TERT_MI2S_RX Audio Mixer", "MultiMedia4", "MM_DL4"}, + {"TERT_MI2S_RX", NULL, "TERT_MI2S_RX Audio Mixer"}, + + {"SEC_MI2S_RX Audio Mixer", "MultiMedia1", "MM_DL1"}, + {"SEC_MI2S_RX Audio Mixer", "MultiMedia2", "MM_DL2"}, + {"SEC_MI2S_RX Audio Mixer", "MultiMedia3", "MM_DL3"}, + {"SEC_MI2S_RX Audio Mixer", "MultiMedia4", "MM_DL4"}, + {"SEC_MI2S_RX Audio Mixer", "MultiMedia5", "MM_DL5"}, + {"SEC_MI2S_RX Audio Mixer", "MultiMedia6", "MM_DL5"}, + {"SEC_MI2S_RX Audio Mixer", "MultiMedia7", "MM_DL7"}, + {"SEC_MI2S_RX Audio Mixer", "MultiMedia8", "MM_DL7"}, + {"SEC_MI2S_RX", NULL, "SEC_MI2S_RX Audio Mixer"}, + + {"PRI_MI2S_RX Audio Mixer", "MultiMedia1", "MM_DL1"}, + {"PRI_MI2S_RX Audio Mixer", "MultiMedia2", "MM_DL2"}, + {"PRI_MI2S_RX Audio Mixer", "MultiMedia3", "MM_DL3"}, + {"PRI_MI2S_RX Audio Mixer", "MultiMedia4", "MM_DL4"}, + {"PRI_MI2S_RX Audio Mixer", "MultiMedia5", "MM_DL5"}, + {"PRI_MI2S_RX Audio Mixer", "MultiMedia7", "MM_DL7"}, + {"PRI_MI2S_RX", NULL, "PRI_MI2S_RX Audio Mixer"}, }; static int routing_hw_params(struct snd_pcm_substream *substream,