Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp508259lqi; Thu, 7 Mar 2024 04:04:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1YrsQt9PPdEuzHWftRBM6kbQRSGWmWFM9V126okLLq3JD1bXfmpKtINi0OwJ2PDpsGOurHK4IipMVGU7iVdrlTuJ887ZzsHQaFNH/4g== X-Google-Smtp-Source: AGHT+IHVng4AgKGuq9+/A4Cq2E1W3Fz3LyBX0Y9gq9QE9c8vaKESgUMFTFefalrNins7Sir1vznI X-Received: by 2002:a17:902:d4cb:b0:1dc:90d6:1dd6 with SMTP id o11-20020a170902d4cb00b001dc90d61dd6mr8983040plg.28.1709813077245; Thu, 07 Mar 2024 04:04:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709813077; cv=pass; d=google.com; s=arc-20160816; b=SmxC1oUTczWturm3tZzHpwJ7yLlNvJIqMzMCfU5qtMsUGfP4lbu8hSUUE7FjBlKq6K IM3SBfRl38H+yIh7SE019eKpiTC+6FdHvhBaalp74wQ7rGwYnrmUxbTPzZ31y5tRIX9k c6tbs5OZVhNXfQJOuiZs/Dk1ZFn62cPByjDXWKsdQ7AfdfK/ZMu1G2BuGdGthLGrPU8T QeFDnNLQ9lMp3qQKspYPWQ38vFnnCBjbyVm9inzodAWiEN72/8th6O4OV2l34uG9gWGG lrXllncfDhKyJow8iJgGkuYEibtvJfuwDv4iMCQWp4NunWh6UEgJlY6+1Ij3RpzB9RzT Z9/A== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9zOXvmFuuH0jODTzR/ZE2Ew7+EIOkuE5wzgpjoneczA=; fh=9iEt4iCRn9CzCxci4w2sdEG90CBf9Xi5ef9RsAZByLs=; b=dltXuLBmDfJRXIpImNwOrmq2A1Lwv765IFle0sFrVjbGoexsRBgBgSC+XFtQeabeP6 HsE3X3YyMEKKaPImNvjnmuJfoZMRQYCHdaHW+mf5RyvMMxWqUTS4Zc+aTZFzXmsfsDQv 90NEomU1wI5p/DY+AQeYZQ4wPWO84Q/KbUb0LF143BPuNe817VHywk3D+vhtqP2bqF67 pKH3YkbqCJo4/gDRoYnJaEbTgFj+l3C+k5d9wHuBn+hBXDhOCH3+VuTyjZLSiAoPs7wD xQ209HBYljyVfAOyjCwGbWI2ylg22yubAYGvdDSGfIYyFqv3GTY2ZRE/tHvURaZcexrH feLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hMMr0Y6E; 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-95476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u1-20020a170902e80100b001dcd0d28cc0si13949707plg.108.2024.03.07.04.04.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 04:04:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hMMr0Y6E; 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-95476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95476-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1C4C9B24920 for ; Thu, 7 Mar 2024 11:49:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E284D12F369; Thu, 7 Mar 2024 11:45:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="hMMr0Y6E" 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 7E2E412E1E9; Thu, 7 Mar 2024 11:45:30 +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=1709811932; cv=none; b=VI9Aqnazjixdy5p+DuGY8rTPNQtFOY/4k1JbkIKNETXEO1sgIcBzKRF1LmaIO1q5HTlrKOXehR3DQcVrSZT4CLShacF2DN5sxp5vN7StwKufE45zTFIUwvIyLxM1Exl2W5l9LtGTRhyemRT5sMwRRy3TyWbOTYZWMZVeJCTb7R0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709811932; c=relaxed/simple; bh=ClgWR4mgcTFs9Nig5y7IuRN0DOliEM0btt6YY0gL/ck=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P51oxCk2bBjyFrIN8pG9PQJ7Ka3tFafLhrl5nMWutP5TGllvxlsm9Bdsn5dW0C1Jwi0Zy2H0Rj1vAdwcgoI69tFfx3GH+jWaO0ygdmdi416ouhJs6y4o2x6jTIaGQsSH2asKlCzcnYrtIXTaBS/w6ScDMFH5nWB4gxgJNi4sdF0= 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=hMMr0Y6E; 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=1709811928; bh=ClgWR4mgcTFs9Nig5y7IuRN0DOliEM0btt6YY0gL/ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hMMr0Y6EK0bcVd/ghZG1CcASsxXwd5r8PQIjach0ncSlh6VK/0z7WtujqlulAFrCb HMxNgiYXORt1ioTvRnqFuAGiBpkqywy/sKDWRiDZ1sjisI7vdbhPjb8UEGS52rcgEn /IbbS/m7xSVz+0FTTwXy9ttVJQ8pM0heJP+0sTpF+VvadbyLav5huHcGy9kMF9XcZ+ bMldMovNVM2Om+Z6YIGsyEzH7wULOxjAt5WM+RMuOFHPMmW5atyi1QVXVjgyhq2QP+ C+hEGQFibqtBs8IKBUF6emvMVb8DJLfKs9cR7SKG11KwfWq2lNx2jCTdCqWahyXa8d CtCCVTOZ1dUGQ== 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 9667D37820F2; Thu, 7 Mar 2024 11:45:26 +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 v2 15/22] ASoC: mediatek: Add common mtk_afe_component_probe callback Date: Thu, 7 Mar 2024 12:44:38 +0100 Message-ID: <20240307114445.196981-16-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240307114445.196981-1-angelogioacchino.delregno@collabora.com> References: <20240307114445.196981-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Multiple MediaTek AFE PCM component drivers are using their own .probe() callback, but most of those are simply duplicated functions as they are doing exactly the same thing over and over. Add a common probe callback for this component to reduce duplication. Signed-off-by: AngeloGioacchino Del Regno --- .../mediatek/common/mtk-afe-platform-driver.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c index 32edcb6d5219..9b72b2a7ae91 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c @@ -126,10 +126,28 @@ int mtk_afe_pcm_new(struct snd_soc_component *component, } EXPORT_SYMBOL_GPL(mtk_afe_pcm_new); +static int mtk_afe_component_probe(struct snd_soc_component *component) +{ + struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); + int ret; + + snd_soc_component_init_regmap(component, afe->regmap); + + /* If the list was never initialized there are no sub-DAIs */ + if (afe->sub_dais.next && afe->sub_dais.prev) { + ret = mtk_afe_add_sub_dai_control(component); + if (ret) + return ret; + } + + return 0; +} + const struct snd_soc_component_driver mtk_afe_pcm_platform = { .name = AFE_PCM_NAME, .pointer = mtk_afe_pcm_pointer, .pcm_construct = mtk_afe_pcm_new, + .probe = mtk_afe_component_probe, }; EXPORT_SYMBOL_GPL(mtk_afe_pcm_platform); -- 2.44.0