Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp722862rwn; Thu, 15 Sep 2022 05:41:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ZAv8ydxBT65l68tvGwJnTDLf3GmvuUEoAEG/eFoiu35ZPOY3zbBMKJIrnzp+R/R1ty7QI X-Received: by 2002:a17:907:9605:b0:6f5:c66:7c13 with SMTP id gb5-20020a170907960500b006f50c667c13mr29950393ejc.66.1663245674543; Thu, 15 Sep 2022 05:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663245674; cv=none; d=google.com; s=arc-20160816; b=ihLvzNAXks2Sy3JdMXntpJRHEf4fUcIXSLOT2wLc28GrpmTm+JV5mOA1RdiUJDv7ju XD13zXXDwTEV68HFIwlMHEuaf3CIuP8Iutxu5bCK0tuX0Y+SKBEmQudQX0IyV/6DTtoS 3A3w0VOQH1r/Kq2d/SidhY22PzknjJvrepbaQ3A1+UrDuR+nN9QKFeEB2kT9KrJP7OJA enadQa7T4WCAavMo3MVw3s1tmqAOTtAXndWkSS32TrpYYM7pnkeBuAhaYeE9zBLTt7ij R2gLzSxKHvAQH1EZsAPfftfb8IjRgFDwOuRAfV3dnN7kRdYfPHpbLz3/hvRMzuJiV5sr n68Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kAZv18kXUCWvtykG7jA+P3fmOwgdcns1b4nN2opdgaY=; b=Zm2SepHji6ub8NZr9j4EBZjkImlf75UwR1nXYKamLVH/E3Gy1YiQEP8Dz7jjzhjAfY FgFiqA/nyuaenHJdecdpDLx+Dacmcc2ovPix4u7/KfkyDuHr44WBgeg6N7bwVZoaTV+3 0cFXkKIaqQx8csrLtwKgQxTQHJerfnUO4VIDmwgvcKpmYF3Bi4qo17xkp7l/EOvq7OtX VTdS5/3FZVnOMUpgcRVksthWENGjjd3jQuQJqnP6eBRt9OANKOAPgzYqz/5Kh4IIthoN dqt+Z6ZRHG6K2OuoNbj2Sl8FRcGg8MTNdk/Ukw7097H/CSmsVpXZqGaUHDQPoOp4/96C elMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YMFknw/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q34-20020a05640224a200b0044e8fc8221bsi14519509eda.257.2022.09.15.05.40.47; Thu, 15 Sep 2022 05:41:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YMFknw/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229952AbiIOMjY (ORCPT + 99 others); Thu, 15 Sep 2022 08:39:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbiIOMjB (ORCPT ); Thu, 15 Sep 2022 08:39:01 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF0B87E81B for ; Thu, 15 Sep 2022 05:38:59 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id n17-20020a05600c501100b003a84bf9b68bso13700941wmr.3 for ; Thu, 15 Sep 2022 05:38:59 -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; bh=kAZv18kXUCWvtykG7jA+P3fmOwgdcns1b4nN2opdgaY=; b=YMFknw/gQEtWbcY+cioCGHrSwKgqjFxxHJwyAqoumz4tOkxkqnUddkpsA7CAIzwlrN 4/awiX3hVFI7KsTyhb1dFB0ePEqgPiE6Z5mavLAfOrnu8QqUkoceZVVOUIyvqplAfkcZ Y4DjTbc246HdSWob43dnvAF/83xlSK0/zdlxLRGOb2LE+nbVH95Pj/IILTtsYj2849+N eCtmMpSAROPRhmqlfZtcAxFjv2/WstYnhUW6U60ZMKitRT3sAJb7vgPaGv0wF3+kPaV6 yJp4oAhOwtwvPjypl+OnbRhau0lasiDEReesQTxqufJz0lFYrlZ3MRog/qaswFlzDhpl RMog== 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; bh=kAZv18kXUCWvtykG7jA+P3fmOwgdcns1b4nN2opdgaY=; b=qWU6du4kw06TLIq4DK8eKl5eyQVMxuwxIecu2xoA6HZEz5KzQ9/V2ziWPfDrPUd2rc mdsbU3JqC8E1hFDHHDd4Cli3etDySQo/s392M+egxwqFc0WhYm7FoT8OLBNTxHWtcUT3 KoCowfap3POHkcwT/Hx7jc7JygjsRIFa3N0JK5YLeTNgj5q5z3BCC4Eiez9T+rmZbkUI gcTw4ohFceUVt5zpsDdJoxmRbinFevzlROkHPT7T3i3CrmCgWcYpb0gZTvkdv/Z9v6AS hiW/8ICxYMYq2tFwhj6bc/C5U/NkUyzGnkraXF+Ne8vl1n6BvcrxWFTAfzMa8HjH9uM/ esyQ== X-Gm-Message-State: ACgBeo1xgtxusjbUsL2YyvdNMe56kmyA71nY6TUHwN/c+1+LMLieDTx/ R7jWA4aWXZNyfZc+GQA7xtQ5Ig== X-Received: by 2002:a1c:f217:0:b0:3a6:61f2:a9c2 with SMTP id s23-20020a1cf217000000b003a661f2a9c2mr6600625wmc.88.1663245538291; Thu, 15 Sep 2022 05:38:58 -0700 (PDT) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id bg13-20020a05600c3c8d00b003a5f4fccd4asm3112559wmb.35.2022.09.15.05.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 05:38:57 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, bgoswami@quicinc.com, perex@perex.cz, tiwai@suse.com, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 7/9] ASoC: qdsp6: audioreach: add support to enable SAL Module Date: Thu, 15 Sep 2022 13:38:35 +0100 Message-Id: <20220915123837.11591-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220915123837.11591-1-srinivas.kandagatla@linaro.org> References: <20220915123837.11591-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to Simple Accumulator-Limiter module. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.c | 76 +++++++++++++++++++++++++++++++ sound/soc/qcom/qdsp6/audioreach.h | 11 +++++ 2 files changed, 87 insertions(+) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c index 37f1408f6f6f..168bc3020b74 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -656,6 +656,77 @@ static int audioreach_codec_dma_set_media_format(struct q6apm_graph *graph, return rc; } +static int audioreach_sal_limiter_enable(struct q6apm_graph *graph, + struct audioreach_module *module, bool enable) +{ + struct apm_module_param_data *param_data; + struct param_id_sal_limiter_enable *limiter_enable; + int payload_size; + struct gpr_pkt *pkt; + int rc; + void *p; + + payload_size = sizeof(*limiter_enable) + 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_SAL_LIMITER_ENABLE; + param_data->param_size = sizeof (*limiter_enable); + p = p + APM_MODULE_PARAM_DATA_SIZE; + limiter_enable = p; + + limiter_enable->enable_lim = enable; + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + +static int audioreach_sal_set_media_format(struct q6apm_graph *graph, + struct audioreach_module *module, + struct audioreach_module_config *cfg) +{ + struct apm_module_param_data *param_data; + struct param_id_sal_output_config *media_format; + int payload_size; + struct gpr_pkt *pkt; + int rc; + void *p; + + payload_size = sizeof(*media_format) + 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_SAL_OUTPUT_CFG; + param_data->param_size = sizeof (*media_format); + p = p + APM_MODULE_PARAM_DATA_SIZE; + media_format = p; + + media_format->bits_per_sample = cfg->bit_width; + + rc = q6apm_send_cmd_sync(graph->apm, pkt, 0); + + kfree(pkt); + + return rc; +} + static int audioreach_i2s_set_media_format(struct q6apm_graph *graph, struct audioreach_module *module, struct audioreach_module_config *cfg) @@ -976,6 +1047,11 @@ int audioreach_set_media_format(struct q6apm_graph *graph, struct audioreach_mod case MODULE_ID_CODEC_DMA_SOURCE: rc = audioreach_codec_dma_set_media_format(graph, module, cfg); break; + case MODULE_ID_SAL: + audioreach_sal_set_media_format(graph, module, cfg); + audioreach_sal_limiter_enable(graph, module, true); + break; + default: rc = 0; } diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index df5026b646c1..f2b51d8fc718 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -15,6 +15,7 @@ struct q6apm_graph; #define MODULE_ID_PCM_CNV 0x07001003 #define MODULE_ID_PCM_ENC 0x07001004 #define MODULE_ID_PCM_DEC 0x07001005 +#define MODULE_ID_SAL 0x07001010 #define MODULE_ID_CODEC_DMA_SINK 0x07001023 #define MODULE_ID_CODEC_DMA_SOURCE 0x07001024 #define MODULE_ID_I2S_SINK 0x0700100A @@ -499,6 +500,16 @@ struct data_logging_config { uint32_t mode; } __packed; +#define PARAM_ID_SAL_OUTPUT_CFG 0x08001016 +struct param_id_sal_output_config { + uint32_t bits_per_sample; +} __packed; + +#define PARAM_ID_SAL_LIMITER_ENABLE 0x0800101E +struct param_id_sal_limiter_enable { + uint32_t enable_lim; +} __packed; + #define PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT 0x08001024 struct param_id_mfc_media_format { -- 2.21.0