From nobody Sat Oct 4 03:17:16 2025 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D78E326E71E for ; Wed, 20 Aug 2025 21:16:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755724575; cv=none; b=LvLDk1vGCBFjB4NYJipa1m7y0z47rb27xBo2j1G8ImDlqvM0zdVVJZNzRwGypd9niXL5RUVqdc/gUiS3LVIK6v5+dOGOJrFhyviCqcVRFoc1bcSTMQ/dzVh4HKWrss/xSvzaFcj4NxzCvAhpQP21+iKKhGOQbVD1jzyAG4l1VVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755724575; c=relaxed/simple; bh=x/i6YSno0uZn+m73vZYG7p5SK1WjGPZPgx8s0L4S1+0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C1/nJKAl+v7mAbgv1gn5FXZXECxmF5TUAAnkO19dxxdDE3GSYuANWBPnpQ0hqdW5h5+uEm5zLqnel54C16Lx7i2EPwXOWik0GPgc+vCLtPIQE6q13IKy34alOKYK8EDIuBp6auC2XF8uVTV2J9kD/nfqIK/LDRkjmyCIK3407/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Qp3FEFXK; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qp3FEFXK" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-45a1b05a59fso2164895e9.1 for ; Wed, 20 Aug 2025 14:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755724572; x=1756329372; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iHnq1zNUNjsCGwo2uZ1IBjHQWm9iZco+f3TAzh7Rxzk=; b=Qp3FEFXKJmIMI3bIWzyH2YRNxjTxneBBGW90yvIWRB95N7ovaa3FEdbAKQ/P12uuF9 pNkBpXHoFcQPvpunJTGREWlSyFMBrmdZJ37WsfDsMd9WkFMCvT8yPu1v34L3BJxiD3oT 5VXUFH53N5JmJ1F3lo2mSiHHW9cL59Hfu/DAu98zG+OaeH8WCPgfqPTChAQyyCIKB5ir 7JmUOaiM/lOCQDrhH0J6N2eQ9OFPX2G7X0cG24eFw4gIIRVV85wJaZu5M31MSjiJaMwK 3zv8AT6lUb8C/aMRTo/MZ8YP9VNlx+PKL7CgVepJAe3zGssEgzx+AdPh1fP+iilBI5z8 zdew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755724572; x=1756329372; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iHnq1zNUNjsCGwo2uZ1IBjHQWm9iZco+f3TAzh7Rxzk=; b=UiGqLy64a+0vXOR25K5pObPVFEmADsNPmirEI9Q17pambb+UOHpsdNFbN4PCkHQ14m hBhZ4sIwLC3qhiWxGO8cYcKAYwqDIdNQJXNIsFAhaNGHcY3xK/7ctdXMq5fHNnRZIRik U2qHivLjfg283V3aaKSamgxgncUb4VyMAobbSb+UO2LgH4y3y6D7tpD7Hd5RLsidMUyV kAHUFHvYrJPhGSYhSzLN5U2gS6VE8sg4DBEvaju8dkIiydxse/FnBD9DvOiRytmgDLjM 1l/mr+D+PrhmRDLZ33B2Izdcq2VakzhPdtDd9EzkvKVRlek321XNUZqKWaJdah9s0tKH rqKw== X-Forwarded-Encrypted: i=1; AJvYcCVjpNkOzVLWYLL09srk0BMcrE2pb7rZCNg8C6xnHjx0S2ovlu//iVMuwx4n5MHLQIv1+la8RyDfKylL/Kg=@vger.kernel.org X-Gm-Message-State: AOJu0YwRknA6//ZDyKoOC+hFNRL2r5r6hZC5EiB+KPYGsfRZjpJHuwx4 3cVwcLS8EvzFFQabUVkAkTzESU3ruX0InhlD1LWyP5uRnOYt7ecG8I9S8udiMEsCaQ8= X-Gm-Gg: ASbGncufbvKrX6jvcPR8QAErkXiZ1gK7vzoMYZ8MKLrKuatBmseoWmsDHIsH61Sh3tq AjiuJRaz8vSSuCVD2Dxiopu2P21BCM9e7s//kGk6Fq3402hMywIeQ+MIFoIi2noZuKKwSWscvdc nkgQRENvmNHg2Gpdp1ROxN0yFtN4RFXHXDmahCgYMX4JOiJMYjyKp/4GEwh/rIYvJ3WI0cv8I/2 tcWXEZcIQ3wB2Y0eylvnZZeMqXUNwV8wkzWKzSpy47wiW2J6M+eQszkRyiD9AojOIJztl8QmL/O K0VR5KCpcydbm28URE6qGqlFi6bH0/TWsi8TGG+0bm4IhaqDQa46NK1HvJjGFz/sOOV+FDLVM9p SuV1+pKbN6vCPhmQ83CgvZyoysJGhFK/TjqND030= X-Google-Smtp-Source: AGHT+IF6mc6i3GB80pU+NXSZj3BrVHUS/irruglP4BirKVhRoCkCZCYy4zY2P7/VCJuci1L8rEovxg== X-Received: by 2002:a05:600c:630d:b0:459:e3a1:a0c4 with SMTP id 5b1f17b1804b1-45b4d865e87mr42375e9.30.1755724572081; Wed, 20 Aug 2025 14:16:12 -0700 (PDT) Received: from orion.home ([2a02:c7c:7259:a00:41e2:cc8d:197b:62f6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b4d7b2948sm162105e9.0.2025.08.20.14.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Aug 2025 14:16:11 -0700 (PDT) From: Alexey Klimov Date: Wed, 20 Aug 2025 22:15:59 +0100 Subject: [PATCH 1/2] ALSA: compress: add raw opus codec define and opus decoder structs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250820-opus_codec_rfc_v1-v1-1-54d5c7560856@linaro.org> References: <20250820-opus_codec_rfc_v1-v1-0-54d5c7560856@linaro.org> In-Reply-To: <20250820-opus_codec_rfc_v1-v1-0-54d5c7560856@linaro.org> To: Vinod Koul , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Liam Girdwood , Mark Brown Cc: Patrick Lai , Annemarie Porter , srinivas.kandagatla@oss.qualcomm.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski , kernel@oss.qualcomm.com, Ekansh Gupta , Alexey Klimov , Pierre-Louis Bossart X-Mailer: b4 0.14.2 Adds a raw opus codec define and raw opus decoder structs. This is for raw OPUS packets not packed in any type of container (for instance OGG container). The decoder struct fields are taken from corresponding RFC document: RFC 7845 Section 5. Cc: Srinivas Kandagatla Cc: Vinod Koul Co-developed-by: Annemarie Porter Signed-off-by: Annemarie Porter Signed-off-by: Alexey Klimov --- include/uapi/sound/compress_params.h | 43 ++++++++++++++++++++++++++++++++= +++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/comp= ress_params.h index bc7648a30746f4632ecf6695868e79550a431dfa..faf4fa911f7fc2830c3ae42b936= 50fe40d8a776b 100644 --- a/include/uapi/sound/compress_params.h +++ b/include/uapi/sound/compress_params.h @@ -43,7 +43,8 @@ #define SND_AUDIOCODEC_BESPOKE ((__u32) 0x0000000E) #define SND_AUDIOCODEC_ALAC ((__u32) 0x0000000F) #define SND_AUDIOCODEC_APE ((__u32) 0x00000010) -#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_APE +#define SND_AUDIOCODEC_OPUS_RAW ((__u32) 0x00000011) +#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_OPUS_RAW =20 /* * Profile and modes are listed with bit masks. This allows for a @@ -324,6 +325,45 @@ struct snd_dec_ape { __u32 seek_table_present; } __attribute__((packed, aligned(4))); =20 +/** + * struct snd_dec_opus - Opus decoder parameters (raw opus packets) + * @version: Usually should be '1' but can be split into major (4 upper bi= ts) + * and minor (4 lower bits) sub-fields. + * @num_channels: Number of output channels. + * @pre_skip: Number of samples to discard at 48 kHz. + * @sample_rate: Sample rate of original input. + * @output_gain: Gain to apply when decoding (in Q7.8 format). + * @mapping_family: Order and meaning of output channels. Only values 0 an= d 1 + * are expected; values 2..255 are not recommended for playback. + * + * Optional channel mapping table. Describes mapping of opus streams to de= coded + * channels. + * @struct snd_dec_opus_ch_map + * @stream_count: Number of streams encoded in each Ogg packet. + * @coupled_count: Number of streams whose decoders are used for two + * channels. + * @channel_map: describes which decoded channel to be used for each one. + * See RFC doc for details. + * This supports only mapping families 0 and 1, therefore max + * number of channels is 8. + * + * These options were extracted from RFC7845 Section 5. + */ + +struct snd_dec_opus { + __u8 version; + __u8 num_channels; + __u16 pre_skip; + __u32 sample_rate; + __u16 output_gain; + __u8 mapping_family; + struct snd_dec_opus_ch_map { + __u8 stream_count; + __u8 coupled_count; + __u8 channel_map[8]; + } chan_map; +} __attribute__((packed, aligned(4))); + union snd_codec_options { struct snd_enc_wma wma; struct snd_enc_vorbis vorbis; @@ -334,6 +374,7 @@ union snd_codec_options { struct snd_dec_wma wma_d; struct snd_dec_alac alac_d; struct snd_dec_ape ape_d; + struct snd_dec_opus opus_d; struct { __u32 out_sample_rate; } src_d; --=20 2.47.2 From nobody Sat Oct 4 03:17:16 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EF4828B7EA for ; Wed, 20 Aug 2025 21:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755724577; cv=none; b=LVjpWozepImJLGylwehXieAuBuVtBUN3NzK82VZLCDoPyvfhyEaP+aMY+xLvNpejTofd+efAJOw1fBB4cpIOZu1u5B07uDJDsl4qpaGUl0JKBGqysHD6M6iOzEu2IJZ3ryFx6+ud3CdDM2TEVIYcsRyxvHaxagl+I571RSEQEJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755724577; c=relaxed/simple; bh=hmWbs8FGLzvsazw5RVUy4v3GvgVeg7eQjs7ei15fWrA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j69PTuova0ETPXrbgjspHGbkMo8H0wqVnP8jC6yAxqFUWJ5xm2beC9QRO7La0iLyunER6jqCy+99Dpi1DhnRaLXxCZdgLCAvm+/T2e0+G16Zs1F2rhjnnkZT6FStje3KV2WKWimS6eUB2Nk5Y1IR4xeSje+v9gz3Lk7/LpIKTEQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=xNwSRYF7; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xNwSRYF7" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-45a1b0c52f3so1829395e9.3 for ; Wed, 20 Aug 2025 14:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755724573; x=1756329373; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ytmwRW2y3GFxQiML3XJrlQdf+rqHBq2ABtfrv5RXEuM=; b=xNwSRYF7ZCH+FwN4MnFkDwbJOq0X31Y5cW+i+kA3eurFUsMnIAySZCRvVwvl9Mefsm rjcKbbhHC7/kuwQOdM+J7cSn2eU1D0qrobzjRFiWwuWp8laM1LQ+n7QwjxlgacFOFGfK HrK9esV2KucyC+5BCfQIRH2swS19PvCkeddm7MTP2H5M5H7SCjWTWoi0dmLfCEmjJ8ho IefWkNzQvFUGOFZ0DCakhOumagAJGjEcgWPwb+pr6sQ6IW8YmTW/o1N8DwOIlxhPCG0o EEDsZjwmVWnS+3MAOeMyxYNVUaxPXkqsV4/X20bYTjXbfNBRfqg/BlvqyDxyOVOpINFc 4Ifg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755724573; x=1756329373; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ytmwRW2y3GFxQiML3XJrlQdf+rqHBq2ABtfrv5RXEuM=; b=oGIedT1ziWJTSUVS9gyKT7LECX5Onx0rHpqNJfMBXBoGB6wr5IZOkG7Ac17TV8gRKR p0B4zQ+sx2jRRiRBwyJcNnEtUDrWjd1ZlcW/nT6qu4muxeDXT4mGq/Pk4s1DUE8q9PYP Dj7S8mFCtpaG/uAXQjHGElogH0IHdlXQC5f6/TDnSwm65D2DkF9AeYiglOukrq32p7Fr zQDtlVDARMSi+g+2dRCCkkHfGz9HoGJq36OSsbLrT/4P7M3rdA5K44E1UvAIWsAUm/Pl R8cSjdQMCbc+14dXTOfrRQjDXhis6jrk6Upx9lQ7KnUsb8FX4mTFmTLjAiaknxcSfawC CvLg== X-Forwarded-Encrypted: i=1; AJvYcCUZ/WX+dS6aphWtI6m9MUICDO7Tt4QJZC7cQR0acOZp89gGi72gjGD1eUYftS+Sso5TnaYZGzovsjAMRJQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwrbmKzsJFZAkcS7i0tnfl/eDlzXRnI6tAmb8ia5fv7fZnfBws2 5MF2ft193F7FFjLHIeMK4bi5IQULR1vw5CfC6uslFPq25D2i8aw7sk1VZsHIojkFoVE= X-Gm-Gg: ASbGnctjaFaRfNVNu/lIk3LBDJE1vdTgFcZiGHIeqMlH5rT2TTcFztFYgeFFLlsBNXd t8yDvNd21t3Jhcd3LCUVwnTiAch4Q85kcC1PWlfC7Gdrkbh/d/C6uR7cXCTsCHjC2wbMdWW3zoM 79ErUFE9n3mkx4K6ekPNR3tgHAdKBhh5MdBMenSlvJFrzJA/HkTD6d8m/SZHSJZhtggtvpJFouX NGzRPpOwVpDWvV7r3CZQl1r/kKG4RiejhVvSMbWzgQ0sdk0MIiviBSfbCp5PnG2NXQBFNY2FBpp pnsT7h3VUSSFcp4eakTWP6nvdTWp6Y5jqcqNq/nxExh9OSG/TwRbpda7gIZYTFR2/aS2NaRqhbs 1Hl1v1eLnn/lbCB7RVtCKHWhN9ZwBmAPWBnPsnZE= X-Google-Smtp-Source: AGHT+IEe4M3NBOiWSKUa+0NGhdxb6Od8NyNMdp0SOCvaPO9HpLzj2LwXaeh30jMJMNJA9JOQbegDxg== X-Received: by 2002:a05:600c:190a:b0:458:c059:7db1 with SMTP id 5b1f17b1804b1-45b4d859a4dmr66575e9.30.1755724573278; Wed, 20 Aug 2025 14:16:13 -0700 (PDT) Received: from orion.home ([2a02:c7c:7259:a00:41e2:cc8d:197b:62f6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b4d7b2948sm162105e9.0.2025.08.20.14.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Aug 2025 14:16:12 -0700 (PDT) From: Alexey Klimov Date: Wed, 20 Aug 2025 22:16:00 +0100 Subject: [PATCH 2/2] ASoC: qcom: qdsp6/audioreach: add support for offloading raw opus playback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250820-opus_codec_rfc_v1-v1-2-54d5c7560856@linaro.org> References: <20250820-opus_codec_rfc_v1-v1-0-54d5c7560856@linaro.org> In-Reply-To: <20250820-opus_codec_rfc_v1-v1-0-54d5c7560856@linaro.org> To: Vinod Koul , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Liam Girdwood , Mark Brown Cc: Patrick Lai , Annemarie Porter , srinivas.kandagatla@oss.qualcomm.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Krzysztof Kozlowski , kernel@oss.qualcomm.com, Ekansh Gupta , Alexey Klimov , Pierre-Louis Bossart X-Mailer: b4 0.14.2 Add support for OPUS module, OPUS format ID, media format payload struct and make it all recognizable by audioreach compress playback path. At this moment this only supports raw or plain OPUS packets not encapsulated in container (for instance OGG container). For this usecase each OPUS packet needs to be prepended with 4-bytes long length field which is expected to be done by userspace applications. This is Qualcomm DSP specific requirement. Cc: Annemarie Porter Cc: Vinod Koul Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Alexey Klimov --- sound/soc/qcom/qdsp6/audioreach.c | 27 +++++++++++++++++++++++++++ sound/soc/qcom/qdsp6/audioreach.h | 17 +++++++++++++++++ sound/soc/qcom/qdsp6/q6apm-dai.c | 3 ++- sound/soc/qcom/qdsp6/q6apm.c | 3 +++ 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audio= reach.c index 4ebaaf736fb98a5a8a58d06416b3ace2504856e1..2d27e33c545357896c35bcf1314= dd6753ad8b861 100644 --- a/sound/soc/qcom/qdsp6/audioreach.c +++ b/sound/soc/qcom/qdsp6/audioreach.c @@ -859,6 +859,7 @@ static int audioreach_set_compr_media_format(struct med= ia_format *media_fmt_hdr, struct payload_media_fmt_aac_t *aac_cfg; struct payload_media_fmt_pcm *mp3_cfg; struct payload_media_fmt_flac_t *flac_cfg; + struct payload_media_fmt_opus_t *opus_cfg; =20 switch (mcfg->fmt) { case SND_AUDIOCODEC_MP3: @@ -901,6 +902,32 @@ static int audioreach_set_compr_media_format(struct me= dia_format *media_fmt_hdr, flac_cfg->min_frame_size =3D mcfg->codec.options.flac_d.min_frame_size; flac_cfg->max_frame_size =3D mcfg->codec.options.flac_d.max_frame_size; break; + case SND_AUDIOCODEC_OPUS_RAW: + media_fmt_hdr->data_format =3D DATA_FORMAT_RAW_COMPRESSED; + media_fmt_hdr->fmt_id =3D MEDIA_FMT_ID_OPUS; + media_fmt_hdr->payload_size =3D sizeof(*opus_cfg); + p =3D p + sizeof(*media_fmt_hdr); + opus_cfg =3D p; + /* raw opus packets prepended with 4 bytes of length */ + opus_cfg->bitstream_format =3D 1; + /* + * payload_type: + * 0 -- read metadata from opus stream; + * 1 -- metadata is provided by filling in the struct here. + */ + opus_cfg->payload_type =3D 1; + opus_cfg->version =3D mcfg->codec.options.opus_d.version; + opus_cfg->num_channels =3D mcfg->codec.options.opus_d.num_channels; + opus_cfg->pre_skip =3D mcfg->codec.options.opus_d.pre_skip; + opus_cfg->sample_rate =3D mcfg->codec.options.opus_d.sample_rate; + opus_cfg->output_gain =3D mcfg->codec.options.opus_d.output_gain; + opus_cfg->mapping_family =3D mcfg->codec.options.opus_d.mapping_family; + opus_cfg->stream_count =3D mcfg->codec.options.opus_d.chan_map.stream_co= unt; + opus_cfg->coupled_count =3D mcfg->codec.options.opus_d.chan_map.coupled_= count; + memcpy(opus_cfg->channel_mapping, mcfg->codec.options.opus_d.chan_map.ch= annel_map, + sizeof(opus_cfg->channel_mapping)); + opus_cfg->reserved[0] =3D opus_cfg->reserved[1] =3D opus_cfg->reserved[2= ] =3D 0; + break; default: return -EINVAL; } diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audio= reach.h index 61a69df4f50f6cc90b56697c272ade6f1411bbf2..512ea24fd402c95f98db790313b= 756a5ba3dcca1 100644 --- a/sound/soc/qcom/qdsp6/audioreach.h +++ b/sound/soc/qcom/qdsp6/audioreach.h @@ -29,6 +29,7 @@ struct q6apm_graph; #define MODULE_ID_MP3_DECODE 0x0700103B #define MODULE_ID_GAPLESS 0x0700104D #define MODULE_ID_DISPLAY_PORT_SINK 0x07001069 +#define MODULE_ID_OPUS_DEC 0x07001174 =20 #define APM_CMD_GET_SPF_STATE 0x01001021 #define APM_CMD_RSP_GET_SPF_STATE 0x02001007 @@ -255,6 +256,22 @@ struct payload_media_fmt_aac_t { uint32_t sample_rate; } __packed; =20 +#define MEDIA_FMT_ID_OPUS 0x09001039 +struct payload_media_fmt_opus_t { + uint16_t bitstream_format; + uint16_t payload_type; + uint8_t version; + uint8_t num_channels; + uint16_t pre_skip; + uint32_t sample_rate; + uint16_t output_gain; + uint8_t mapping_family; + uint8_t stream_count; + uint8_t coupled_count; + uint8_t channel_mapping[8]; + uint8_t reserved[3]; +} __packed; + #define DATA_CMD_WR_SH_MEM_EP_EOS 0x04001002 #define WR_SH_MEM_EP_EOS_POLICY_LAST 1 #define WR_SH_MEM_EP_EOS_POLICY_EACH 2 diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index 2cd522108221a2ec5c7bbbb63f7d4ae4f8001cf6..7da91ed297f4a5ed39ca0747804= cabd579634b50 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -550,10 +550,11 @@ static int q6apm_dai_compr_get_caps(struct snd_soc_co= mponent *component, caps->max_fragment_size =3D COMPR_PLAYBACK_MAX_FRAGMENT_SIZE; caps->min_fragments =3D COMPR_PLAYBACK_MIN_NUM_FRAGMENTS; caps->max_fragments =3D COMPR_PLAYBACK_MAX_NUM_FRAGMENTS; - caps->num_codecs =3D 3; + caps->num_codecs =3D 4; caps->codecs[0] =3D SND_AUDIOCODEC_MP3; caps->codecs[1] =3D SND_AUDIOCODEC_AAC; caps->codecs[2] =3D SND_AUDIOCODEC_FLAC; + caps->codecs[3] =3D SND_AUDIOCODEC_OPUS_RAW; =20 return 0; } diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index b4ffa0f0b188e2c32fdfb863b9130d1d11e578dd..0e667a7eb5467bdd65326099132= e8ba9dfefa21e 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -354,6 +354,9 @@ int q6apm_set_real_module_id(struct device *dev, struct= q6apm_graph *graph, case SND_AUDIOCODEC_FLAC: module_id =3D MODULE_ID_FLAC_DEC; break; + case SND_AUDIOCODEC_OPUS_RAW: + module_id =3D MODULE_ID_OPUS_DEC; + break; default: return -EINVAL; } --=20 2.47.2