Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2197173rwd; Fri, 9 Jun 2023 07:59:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7eq/T2WjmxJOaznVoV0DI4ivZajdHC/KhOBe6amRqHkGeDRGYVlfAb4j2rCt4V4nApwfrm X-Received: by 2002:a17:902:9897:b0:1b2:1a79:9a67 with SMTP id s23-20020a170902989700b001b21a799a67mr1402791plp.50.1686322757166; Fri, 09 Jun 2023 07:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686322757; cv=none; d=google.com; s=arc-20160816; b=mEejUi9HgSMVcZE+L2fZ1BiHpGWbx5ijwy9k42mJkfqlG5Nohbqsl9Jeb0dpbMEvqi 79l0bv7F/MQ0IZkPtjise0K3sAq8XIHLvB9cMxqa+uhwVL3Gu2XmeJwqls0rYshYfeFJ aNbK7b3FmPYZl/aDVPVONbU63Uc1qsIeSMotIBF2BhadYR8v1QideQuMAfPC5rW9wxSc 04uns5M8y7Iw6/4VqBow1BC2xfGtYkOWLgJC3en4LMMKtDRYAsnP0GoA1LDZtSgwKJdU jOJI8XcMpYWaqHouHOPGs7blmfBeMFkImyJgcZOSydwGLX+92UfLjyd+xmsS6+SmHstB VZoA== 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=xT6jIsaE6umxJp6LYKmlwleIfCNa53LIehUuB1/ryv8=; b=gX5yHYJELsv2ebSrF2wegXmtB+saZCiI+2e8aP4IsrreQZ1HicxUrQjJpnobdH6nnL f80VweT9WBEiX1ZJtTj5YLYOrX4qFN9Anv8M0PC0zbTeRDwpcHvjhly88Pk0e+Lhknc0 OiYfQbz5zGNBgg8JCa+6lY004o+RBxlvjI5GvePpsbRnSHeenH/v2n3GnnZOlfZVh2cB UouwDJL2hswF8azgllwP3Yo3XHOOAYRBksBWjsTvtWuKT2XJwcuIC/HOfKH5Hhi7xG1q HLgUbMNW3noEFAIJWs7tgnoPqg4zTdWawV+FXMPcw2gOhpC4eDdxolV1OFRAJ28XkRbl RvAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Vd0Vf8OB; 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 le7-20020a170902fb0700b001ac61add6c0si142369plb.401.2023.06.09.07.59.03; Fri, 09 Jun 2023 07:59:17 -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=Vd0Vf8OB; 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 S241664AbjFIOyn (ORCPT + 99 others); Fri, 9 Jun 2023 10:54:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241614AbjFIOyg (ORCPT ); Fri, 9 Jun 2023 10:54:36 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2080E3A91 for ; Fri, 9 Jun 2023 07:54:27 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f7f4819256so14388095e9.1 for ; Fri, 09 Jun 2023 07:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686322465; x=1688914465; 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=xT6jIsaE6umxJp6LYKmlwleIfCNa53LIehUuB1/ryv8=; b=Vd0Vf8OBk3PGtxmzsgVG4KAb8TUnZ4cZkGdqyFQPd2LRpjIA1MektKV2tRCWG32Wpn ic7pvZymZ/UHYoGO6M1V2I7d3Grr2X8GSdTmwESak18rlmeaVKw2CuJXpW9nDQEEqFjN RuvQRXbG6FVfBxsJfrFVKniPlzeAnVkxHpX8t3lRyyuaixfVaLC2bojtgpuRrHiF2FU9 /AfQPO3ko7eQOLu7XYpwjzBjlDVOC/gjC4fqAhWEgpWaCVkXBm44IUO8nURx2TxI6Wvk AH7tqyelW+2h1zk7Kvnsd9fg5RduXVDPiEKVxNAacgYgSsGaYovXDo6BdvG9azXxMb+D JajA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686322465; x=1688914465; 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=xT6jIsaE6umxJp6LYKmlwleIfCNa53LIehUuB1/ryv8=; b=AsasI/qoEZgLXgt6oRHsZ6+U2Aoy4y0+41jcW12M+tABZQimbuRev7SIvHb5N7zPPQ i6NYjgkeh1j1o1viNG7sIUGrhq6+zpJsOaaB3q3WbMs4WG/I846VCyXNPsYP9Pfi9cx+ G/aCEfxXSQY4yTvGm/1d11nUKCto+NrF03FGAR/3j9r4hLFnv82CIZQIbNF4DJ0qhe5Y Ocvyw3NqRmM/b+nY3eEgazljxlp9pBjrEsUDl3gzm6nmn4mt4QuYZOu7D/Ln0rEAVLUw 9Qcb34VGLizaisNndrbVvUmiaKqDUjEsbZiJXDZx89BBKhx4/KTgOUSZejakJT/DEERi ImtQ== X-Gm-Message-State: AC+VfDx7UkdW8RSpgfT+8/Xt+SHsQOe0SLQmnW2jX1t1twLZoJOQGc5q i/y/nYAP12VJ/2MxgtSL1elIIg== X-Received: by 2002:a1c:ed15:0:b0:3f7:f584:579d with SMTP id l21-20020a1ced15000000b003f7f584579dmr1058428wmh.0.1686322465617; Fri, 09 Jun 2023 07:54:25 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id c21-20020a05600c0ad500b003f7310a3ffasm2946632wmr.2.2023.06.09.07.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 07:54:24 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com, ckeepax@opensource.cirrus.com, kuninori.morimoto.gx@renesas.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, Srinivas Kandagatla , Mohammad Rafi Shaik Subject: [PATCH v2 04/11] ASoC: q6dsp: audioreach: Add placeholder decoder for compress playback Date: Fri, 9 Jun 2023 15:54:00 +0100 Message-Id: <20230609145407.18774-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230609145407.18774-1-srinivas.kandagatla@linaro.org> References: <20230609145407.18774-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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 placeholder decoder graph module for compressed playback feature. Co-developed-by: Mohammad Rafi Shaik Signed-off-by: Mohammad Rafi Shaik Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/audioreach.h | 14 +++++++ sound/soc/qcom/qdsp6/q6apm.c | 65 +++++++++++++++++++++++++++++++ sound/soc/qcom/qdsp6/q6apm.h | 4 ++ 3 files changed, 83 insertions(+) diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h index 18d8d243b06b..c4e03a49ac82 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -15,6 +15,8 @@ struct q6apm_graph; #define MODULE_ID_PCM_CNV 0x07001003 #define MODULE_ID_PCM_ENC 0x07001004 #define MODULE_ID_PCM_DEC 0x07001005 +#define MODULE_ID_PLACEHOLDER_ENCODER 0x07001008 +#define MODULE_ID_PLACEHOLDER_DECODER 0x07001009 #define MODULE_ID_SAL 0x07001010 #define MODULE_ID_MFC 0x07001015 #define MODULE_ID_CODEC_DMA_SINK 0x07001023 @@ -22,6 +24,9 @@ struct q6apm_graph; #define MODULE_ID_I2S_SINK 0x0700100A #define MODULE_ID_I2S_SOURCE 0x0700100B #define MODULE_ID_DATA_LOGGING 0x0700101A +#define MODULE_ID_AAC_DEC 0x0700101F +#define MODULE_ID_FLAC_DEC 0x0700102F +#define MODULE_ID_MP3_DECODE 0x0700103B #define MODULE_ID_DISPLAY_PORT_SINK 0x07001069 #define APM_CMD_GET_SPF_STATE 0x01001021 @@ -608,6 +613,15 @@ struct param_id_vol_ctrl_master_gain { } __packed; +#define PARAM_ID_REMOVE_INITIAL_SILENCE 0x0800114B +#define PARAM_ID_REMOVE_TRAILING_SILENCE 0x0800115D + +#define PARAM_ID_REAL_MODULE_ID 0x0800100B + +struct param_id_placeholder_real_module_id { + uint32_t real_module_id; +} __packed; + /* Graph */ struct audioreach_connection { /* Connections */ diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index b07fee8ccac1..7bfac9492ab5 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -298,6 +298,71 @@ int q6apm_unmap_memory_regions(struct q6apm_graph *graph, unsigned int dir) } EXPORT_SYMBOL_GPL(q6apm_unmap_memory_regions); +int q6apm_remove_initial_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples) +{ + struct audioreach_module *module; + + module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER); + if (!module) + return -ENODEV; + + return audioreach_send_u32_param(graph, module, PARAM_ID_REMOVE_INITIAL_SILENCE, samples); +} +EXPORT_SYMBOL_GPL(q6apm_remove_initial_silence); + +int q6apm_remove_trailing_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples) +{ + struct audioreach_module *module; + + module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER); + if (!module) + return -ENODEV; + + return audioreach_send_u32_param(graph, module, PARAM_ID_REMOVE_TRAILING_SILENCE, samples); +} +EXPORT_SYMBOL_GPL(q6apm_remove_trailing_silence); + +int q6apm_enable_compress_module(struct device *dev, struct q6apm_graph *graph, bool en) +{ + struct audioreach_module *module; + + module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER); + if (!module) + return -ENODEV; + + return audioreach_send_u32_param(graph, module, PARAM_ID_MODULE_ENABLE, en); +} +EXPORT_SYMBOL_GPL(q6apm_enable_compress_module); + +int q6apm_set_real_module_id(struct device *dev, struct q6apm_graph *graph, + uint32_t codec_id) +{ + struct audioreach_module *module; + uint32_t module_id; + + module = q6apm_find_module_by_mid(graph, MODULE_ID_PLACEHOLDER_DECODER); + if (!module) + return -ENODEV; + + switch (codec_id) { + case SND_AUDIOCODEC_MP3: + module_id = MODULE_ID_MP3_DECODE; + break; + case SND_AUDIOCODEC_AAC: + module_id = MODULE_ID_AAC_DEC; + break; + case SND_AUDIOCODEC_FLAC: + module_id = MODULE_ID_FLAC_DEC; + break; + default: + return -EINVAL; + } + + return audioreach_send_u32_param(graph, module, PARAM_ID_REAL_MODULE_ID, + module_id); +} +EXPORT_SYMBOL_GPL(q6apm_set_real_module_id); + int q6apm_graph_media_format_pcm(struct q6apm_graph *graph, struct audioreach_module_config *cfg) { struct audioreach_graph_info *info = graph->info; diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index 7005be9b63e3..87d67faf5f1a 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -147,4 +147,8 @@ int q6apm_graph_get_rx_shmem_module_iid(struct q6apm_graph *graph); bool q6apm_is_adsp_ready(void); +int q6apm_enable_compress_module(struct device *dev, struct q6apm_graph *graph, bool en); +int q6apm_remove_initial_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples); +int q6apm_remove_trailing_silence(struct device *dev, struct q6apm_graph *graph, uint32_t samples); +int q6apm_set_real_module_id(struct device *dev, struct q6apm_graph *graph, uint32_t codec_id); #endif /* __APM_GRAPH_ */ -- 2.21.0