From patchwork Fri Oct 21 16:52:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 617194 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC1FEFA373D for ; Fri, 21 Oct 2022 16:56:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1D385A8D0; Fri, 21 Oct 2022 18:55:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1D385A8D0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666371392; bh=WDnvCGrsQcHcOrV/3P19BKBZb29SaRlO5Q7Mm3y3CMU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AMktv/OjxAj081TidGN+BH3wubb6UxLdXPJd0JW1RbGYFbUQ0PzFH5uS2C3OXeQts YgxNc5z++0JxbV2raKESOw14pfLUTQllL0cZ5tU49AMTB6YryzhN0hw+Wt4n74XvK6 4IqUTUAPk41QzLmCFo3kjz7Bm4z4gSTaTGFSqU6k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 15D91F805AA; Fri, 21 Oct 2022 18:53:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CFA06F80588; Fri, 21 Oct 2022 18:53:25 +0200 (CEST) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 51561F80587 for ; Fri, 21 Oct 2022 18:53:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 51561F80587 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="v2L7/MLQ" Received: by mail-wr1-x429.google.com with SMTP id w18so5880251wro.7 for ; Fri, 21 Oct 2022 09:53:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P38kTBSJr/DRXyh4Je0XkAOEtRTZS4roS95ylRUlbWA=; b=v2L7/MLQEM62vRMDJl2OvRagyQDMvI9Nymr91iGl6SCFtRwreusq9eArbalmCitKmw +hhaFtS/OnHIn+5Xf6nwDNqdfoUMc7HgHUiF2pUGEE3DwN7QEYkAcxb4cK4TRHIDHee5 qtcn/Zh7JexBtSjqDnAv3pzmWv3BQM8oepnsMsqkgFsgD7GAXqIIdx6gyUhxyW1yZf0a jJ9asdZ03lPN3bVlMf+Jf6yZGUdf3sE3aPcWLKN0O7T8ZGPUQl3+gJSbTImklJ8iGhlu wGxVv2oHVoc11MJe/Ebl0h3dBwVu89Zv+HwtG2xPUafiph0CvZLyUJXmP5rEAerNZreA 6mJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P38kTBSJr/DRXyh4Je0XkAOEtRTZS4roS95ylRUlbWA=; b=YTN5wdjVclL4ZdpbKiF7V0Ocu0kbeaff0p5LMZoNO4dO21wWzoXgHfP4COuSRdrjXe /f8znvVGJ+tuWaBGGqWuutVUXvuiq4ka/l9gVbEYycclQSXUHUtGpQHc2agKKt/Be3QV MEBWrdmbYo6cBR/jck/ZSuRIZGwv385m6spILbgpzwGmzJmcocD4HzAEmb4/uoZIX3w0 ZQO1MinpG389YPh6aeZ5dO31Mgyh8C+4XYk2u8bceCOcWjdt7+KaQg5TYKi7mB7BKoM1 95YsVncIbs7hgthkuWH9VpbFmHuCAmVAgqdv8G7pZtjazUZiQAH/q79w2TGdUFFUb4LO IRig== X-Gm-Message-State: ACrzQf1Dw2v3YDy3EboEFUIEQeuHZysE9hKW0F2S3KCpOrBxnZfr+dNI 1qqO1MJzCr26dP9sgNSZg4QXsg== X-Google-Smtp-Source: AMsMyM6zQoWParlSxvfB2HUAFHKdeQhoLVug903b1NjXtgJhHefeJargZB0bYfSyjxfnLy/MCiC+Eg== X-Received: by 2002:a5d:598d:0:b0:230:f238:a485 with SMTP id n13-20020a5d598d000000b00230f238a485mr13533983wri.71.1666371196492; Fri, 21 Oct 2022 09:53:16 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id n14-20020a5d400e000000b0022ae401e9e0sm19541773wrp.78.2022.10.21.09.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 09:53:15 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH v2 9/9] ASoC: qdsp6: audioreach: add support to enable module command Date: Fri, 21 Oct 2022 17:52:07 +0100 Message-Id: <20221021165207.13220-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> References: <20221021165207.13220-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, tiwai@suse.com, lgirdwood@gmail.com, Srinivas Kandagatla , bgoswami@quicinc.com, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add support to enable Module command which is required for logging module to be able to debug. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 40 ++++++++++++++++++++++++++++++- sound/soc/qcom/qdsp6/audioreach.h | 5 ++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 1338b99f37e1..1e0c918eb576 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -731,6 +731,42 @@ static int audioreach_sal_set_media_format(struct q6apm_graph *graph, return rc; } +static int audioreach_module_enable(struct q6apm_graph *graph, + struct audioreach_module *module, + bool enable) +{ + struct apm_module_param_data *param_data; + struct param_id_module_enable *param; + int payload_size; + struct gpr_pkt *pkt; + int rc; + void *p; + + payload_size = sizeof(*param) + APM_MODULE_PARAM_DATA_SIZE; + + pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_SET_CFG, 0); + if (IS_ERR(pkt)) + return PTR_ERR(pkt); + + p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE; + + param_data = p; + param_data->module_instance_id = module->instance_id; + param_data->error_code = 0; + param_data->param_id = PARAM_ID_MODULE_ENABLE; + param_data->param_size = sizeof(*param); + p = p + APM_MODULE_PARAM_DATA_SIZE; + param = p; + + param->enable = enable; + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + static int audioreach_mfc_set_media_format(struct q6apm_graph *graph, struct audioreach_module *module, struct audioreach_module_config *cfg) @@ -1077,7 +1113,9 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod switch (module->module_id) { case MODULE_ID_DATA_LOGGING: - rc = audioreach_logging_set_media_format(graph, module); + rc = audioreach_module_enable(graph, module, true); + if (!rc) + rc = audioreach_logging_set_media_format(graph, module); break; case MODULE_ID_PCM_DEC: case MODULE_ID_PCM_ENC: diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 707dfbdbc156..1d1d47d47d40 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -537,6 +537,11 @@ struct payload_media_fmt_pcm { uint8_t channel_mapping[]; } __packed; +#define PARAM_ID_MODULE_ENABLE 0x08001026 +struct param_id_module_enable { + uint32_t enable; +} __packed; + #define PARAM_ID_CODEC_DMA_INTF_CFG 0x08001063 struct param_id_codec_dma_intf_cfg {