Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1890506lqp; Tue, 16 Apr 2024 00:14:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUf/HRyk+kyXsJny5X6ugZTrHwuBG+KY1fYUTyZg4FqLX0M4NvlleNU7lZG8A94cEhUABBsDgWi2/SxqiTJ4u2LtB7QHPt0wbHOMsxl4Q== X-Google-Smtp-Source: AGHT+IG8k6xeihsmv1+QNDx8qBGQPxY8lPPvxBlnPycGqNnLcs/3MI5V5OEIikLn5mD/e8sySQe5 X-Received: by 2002:a05:6808:6243:b0:3c6:fb04:70cd with SMTP id dt3-20020a056808624300b003c6fb0470cdmr10189101oib.0.1713251670210; Tue, 16 Apr 2024 00:14:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713251670; cv=pass; d=google.com; s=arc-20160816; b=ebSdMZU1DCEuse/hnrYHCUwbENrYsIMCxl6eVCybGq1fUhoILJ1gZuikX0heaSKKmG gdeS+bErZKIIU4z4kceAeETdH1RynNz5377MMPd/rvxv9PI4IBosSlPXCkBAFIplywwn KnCsmL2oH7f1kUNwTqPJJpRFb8h/mNXejuyrFNEgA350lMSZhtFWaVWTL7h7aQzeOlJN zR/cuHHUDUuAM0xBMlgGdmsCzSfm8F0swstRJzbpTS68UgOSNrG65TM+RZPLFANfi20N u8Yyeu8f+1uETV+gkhhEOPTNfOOL1Eq5289u8LJxOfOXQSzjLsKOoEXh88shOjFV6805 iINw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=oRIkCLdWrQlhnbidxcm+dGsnJ2O1z9FZNdM4iSXedfg=; fh=9iEt4iCRn9CzCxci4w2sdEG90CBf9Xi5ef9RsAZByLs=; b=QAG6m70iNj0tS07c20G6ugo23Ri4RvpiMwHsvxZDHl+j5prvdL64uvwN5OqUpkUFDl wz05hKGV+AvvE3VwPDs9fdcGR7ohZ6NQMkWGuZUicWY8/RYTdzM5nPz8p2HSn0l8sVlM 9hzQZ1Wcck0V6ES41CGQWXeqMfckcuaGVRbAWdOUbIymyb6uqumuE5ZOEHiylMATlbdh 0Fr7Su/zDZLitJbF9VnaNA18u3W1qWznHZ2VSM6Sjl/bKotQnP4No9brohBz6HQ8Sstm 8d/Kq3mMsc5EO4ppf71h2vjB/PoFOHacnxI4XHJXJMI5ORHCtobojg/vcu1XueM5O/gf dVPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=zbAcp02L; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-146384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146384-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 67-20020a630046000000b005dccf9afad5si9447628pga.305.2024.04.16.00.14.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 00:14:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=zbAcp02L; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-146384-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146384-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CF963283649 for ; Tue, 16 Apr 2024 07:14:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8580478C96; Tue, 16 Apr 2024 07:14:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="zbAcp02L" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1F7B39863; Tue, 16 Apr 2024 07:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713251662; cv=none; b=Q4NmVeyUkwHC1+NfsF7Z2Isg62Z8TuDtcusZXUyzFc+uE52XLqXdeFJNpj896e6/v1u18xWTuyMjNI7eH8IiG/AaIMNSw0UQBf9c5unkjemnQDRl2Gp1nnx9nWuwrFRpr/5t+lJkSbwJgdd/3O/M1cnh1enJ6sURikwTXwtINXM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713251662; c=relaxed/simple; bh=+zKYfmzXbGIYWT2KiYkWwX9RneJE/QPprhjzqj7y6+A=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LTtxQ42s73uAmXIbd7gnrNzbmmTaqvT3638vBBcpBDV2eJgZPUGDZmoKn6WA4/NuB396K8WwhN2nDN/wnFuDT+19e9fO+/6wd4xPNsTjDLA25BrfkouBc+wnjLI6Ir3WGiVazKvp6wV3wK1Ni+A/Pdv7CJSpw8XrENy1cTyi1OQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=zbAcp02L; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1713251658; bh=+zKYfmzXbGIYWT2KiYkWwX9RneJE/QPprhjzqj7y6+A=; h=From:To:Cc:Subject:Date:From; b=zbAcp02LmfkSzjsrxMNdT2tVPBkCWmohr7Gw7f42juNuNJyTaMv3q7Dhtd9y5GFgu ZOKLWKfnHu+gH3tPMX86k72RFSbc5hOeTIOuwX5kycDpEn5pY+5BA98OVRB8yvvuJL Fp0l1ix2jk3e8ktxpsUxLh8MIgGtSutgmAnDKpxl451NjA39rg9XLX3Xl9ecCCs0vq yt7LG45ygQ1CSbq9Yc7JvphKK5QAdy9gqX5vjaPp+kMrmlzSD40PoOAkIRECVHWLCs VHxjEIn6vLPMxI1bJVdTdgycmrOzIM3HQc+n8qtQNXPJzcdyiusKm/aBbYI0KC32Nf qK4P+D7yxQR3A== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 4233B37820F9; Tue, 16 Apr 2024 07:14:16 +0000 (UTC) From: AngeloGioacchino Del Regno To: broonie@kernel.org Cc: wenst@chromium.org, lgirdwood@gmail.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, perex@perex.cz, tiwai@suse.com, trevor.wu@mediatek.com, maso.huang@mediatek.com, xiazhengqiao@huaqin.corp-partner.google.com, arnd@arndb.de, kuninori.morimoto.gx@renesas.com, shraash@google.com, amergnat@baylibre.com, nicolas.ferre@microchip.com, u.kleine-koenig@pengutronix.de, dianders@chromium.org, frank.li@vivo.com, allen-kh.cheng@mediatek.com, eugen.hristev@collabora.com, claudiu.beznea@tuxon.dev, jarkko.nikula@bitmer.com, jiaxin.yu@mediatek.com, alpernebiyasak@gmail.com, ckeepax@opensource.cirrus.com, zhourui@huaqin.corp-partner.google.com, nfraprado@collabora.com, alsa-devel@alsa-project.org, shane.chien@mediatek.com, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, AngeloGioacchino Del Regno Subject: [PATCH v5 00/18] ASoC: Cleanup MediaTek soundcard machine drivers Date: Tue, 16 Apr 2024 09:13:52 +0200 Message-ID: <20240416071410.75620-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Changes in v5: - Cleaned up MT8186 soundcard migration commit which erroneously had leftovers from development - Changed the mtk_pcm_constraints_data structure to hold pointers to snd_pcm_hw_constraint_list, as to really reuse the const data - Tested again on all of the listed MTK platforms. Changes in v4: - Rebased over next-20240409 - Dropped the first 4 patches from v3 as were already picked by Mark - Fixed W=1 build issue Changes in v3: - Added audio-routing names in enum in all yaml files - Added mention of disallowing old and new properties together in commit message of bindings patches - Fixed validation errors with sound-card-common.yaml inclusion due to missing model property in examples - Removed `else` enforcing headset-codec/speaker-codecs requirement if xxx-dai-link not present to avoid future commit noise as the deprecated statement will disallow deprecated properties as required Changes in v2: - Bindings: Changed link-name/codec/clk-provider to remove `items` and leave just the enum - Moved .*-dai-link pattern additionalProperties after `type: object` - Added ref to sound-card-common.yaml - Fixed dai-link-xxx -> xxx-dai-link typo in example comment This series performs a cleanup of most of the MediaTek AFE drivers and soundcard machine drivers, reducing code duplication and setting a base to be consistent with their devicetree bindings, as many of those are using different properties and nodes for no good reason. Summarizing: - Commonizes functions and ops where possible - Adds a common probe mechanism, increasing maintainability of soundcard drivers for older MediaTek SoCs - Migrates all drivers to support the new bindings - Obviously retains compatibility with old device trees - Reduces machine-specific parameters hardcoding in drivers - Can now set machine-specific params in device tree - Uses the `audio-routing` and `dai-link` nodes like some other non-MediaTek SoC sound drivers - Imposes consistency between MediaTek ASoC machine soundcard drivers bindings - Reduces code size and greatly reduces the amount of code that will be required for newer drivers (retaining compatibility with the old bindings was costly in terms of code size, otherwise this series would've removed ~1000 more lines, or something along that line). This series was (manually) tested on MT8173, MT8192, MT8195 and MT8186 Chromebooks. AngeloGioacchino Del Regno (18): ASoC: mediatek: Add common machine soundcard driver probe mechanism ASoC: mediatek: common: Constify struct mtk_sof_priv ASoC: mediatek: mt8188: Migrate to mtk_soundcard_common_probe ASoC: mediatek: mt8195: Migrate to mtk_soundcard_common_probe ASoC: mediatek: mt8192: Migrate to mtk_soundcard_common_probe ASoC: mediatek: mt8186: Migrate to mtk_soundcard_common_probe ASoC: mediatek: Add common snd_soc_ops .startup() callback ASoC: mediatek: mt8195: Migrate to the common mtk_soundcard_startup ASoC: mediatek: mt8192: Migrate to the common mtk_soundcard_startup ASoC: mediatek: mt8186-rt1019: Migrate to the common mtk_soundcard_startup ASoC: mediatek: Add common mtk_afe_component_probe callback ASoC: mediatek: Use common mtk_afe_pcm_platform with common probe cb ASoC: mediatek: mt8186: Unify mt8186-mt6366 machine drivers ASoC: dt-bindings: mt8195: Document audio-routing and dai-link subnode ASoC: dt-bindings: mt8192: Document audio-routing and dai-link subnode ASoC: dt-bindings: mt8186: Document audio-routing and dai-link subnode arm64: dts: mediatek: mt8195-cherry: Specify sound DAI links and routing arm64: dts: mediatek: mt8186-corsola: Specify sound DAI links and routing .../sound/mt8186-mt6366-da7219-max98357.yaml | 131 +- .../sound/mt8186-mt6366-rt1019-rt5682s.yaml | 120 +- .../sound/mt8192-mt6359-rt1015-rt5682.yaml | 139 +- .../bindings/sound/mt8195-mt6359.yaml | 134 ++ .../boot/dts/mediatek/mt8186-corsola.dtsi | 42 +- .../boot/dts/mediatek/mt8195-cherry.dtsi | 45 + sound/soc/mediatek/Kconfig | 24 +- .../mediatek/common/mtk-afe-platform-driver.c | 18 + .../soc/mediatek/common/mtk-dsp-sof-common.c | 15 +- .../soc/mediatek/common/mtk-dsp-sof-common.h | 1 - sound/soc/mediatek/common/mtk-soc-card.h | 7 +- .../mediatek/common/mtk-soundcard-driver.c | 199 +++ .../mediatek/common/mtk-soundcard-driver.h | 42 + sound/soc/mediatek/mt6797/mt6797-afe-pcm.c | 14 +- sound/soc/mediatek/mt7986/mt7986-afe-pcm.c | 14 +- sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 14 +- sound/soc/mediatek/mt8186/Makefile | 3 +- .../mt8186/mt8186-mt6366-da7219-max98357.c | 1189 ----------------- ...t6366-rt1019-rt5682s.c => mt8186-mt6366.c} | 578 ++++---- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 21 +- sound/soc/mediatek/mt8188/mt8188-mt6359.c | 203 +-- sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 25 +- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 301 ++--- sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 21 +- sound/soc/mediatek/mt8195/mt8195-mt6359.c | 487 +++---- 25 files changed, 1597 insertions(+), 2190 deletions(-) delete mode 100644 sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c rename sound/soc/mediatek/mt8186/{mt8186-mt6366-rt1019-rt5682s.c => mt8186-mt6366.c} (72%) -- 2.44.0