From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB007C433F5 for ; Tue, 1 Mar 2022 09:05:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w4M1tcQ/3OLQKWeIGWdybP/mgfUOEWWREaNdhm6elTo=; b=mOF3U0NxQRICCZ eGbMxiXHaerrqNBJivUGVEzpbjE1KtG50lXnczT4bwECPYzXk8oF7Dwll4Sm6BfjIacpqDxGR/22s 57VhZfvkHdVzILQJ4I2pxMCQb1w512hE5vP9OU36m2CLXNIY167rPFcWpRBWrlGjE5RAQr8TUcnCg Eg9oLZ90FI9SuYLPuWH3JMEMOzzypP8zydBBQ08jwjjezGHcLvVij+zzA8mL5VAxpMYyf8Nn7XKef 7CN54vXgBx+PeYiUMj3YnsngPlzt9y7Zo6tfjC1X31ZWSx5IcBNgtupDOpMf17wxVyKnsXsCUDOJV hlNbTQKN3yX0lHLeRc+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOyQI-00FktX-6o; Tue, 01 Mar 2022 09:03:58 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nOyQD-00Fkrg-1w; Tue, 01 Mar 2022 09:03:55 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1AAD1B817F9; Tue, 1 Mar 2022 09:03:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1186C340EE; Tue, 1 Mar 2022 09:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646125429; bh=1c14S9dVNVF1VyP3FFe0N65e9c5Jwxgr+ehoV6e9Nh4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gD5dXXhUeEpUdK7hh/LestsugNYQB0olqAMDGA85MmxmdxSbaa8ZXOIKWM/2ZswUK xLf/XlReSOYTALDhEGkCR0pV6xgf7JEhKLhbjM7EKbXIALSoDeXUPTnV6Kp5bcUCAj Pz9UtyP8vv8NGM+AM6IM0VTUdqn2iSoDw9OYSpBi+B52N4oDlTHdYAzBvDS0b+mjKp Xd+5CA9Tugg4uwvHbkVQGI4iS4yFkYZb2cRkbPGwSZ1HOdjxyr/WRRvMuKUwgWri48 TVoO6bSS5lESM/u0uNGB/qSpd/iWw67aaIm9iqO04J6Quh83P17qIcnpFKP9V2Z4I6 dzEq5egneiLXQ== Date: Tue, 1 Mar 2022 17:03:45 +0800 From: Tzung-Bi Shih To: Jiaxin Yu Cc: broonie@kernel.org, robh+dt@kernel.org, matthias.bgg@gmail.com, trevor.wu@mediatek.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Project_Global_Chrome_Upstream_Group@mediatek.com, Jiaxin Yu Subject: Re: [PATCH 2/2] ASoC: mediatek: mt8192: support rt1015p_rt5682s Message-ID: References: <20220301072924.24814-1-jiaxin.yu@mediatek.com> <20220301072924.24814-3-jiaxin.yu@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220301072924.24814-3-jiaxin.yu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220301_010353_451950_1D5D9051 X-CRM114-Status: GOOD ( 15.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 01, 2022 at 03:29:24PM +0800, Jiaxin Yu wrote: > From: Jiaxin Yu The environment didn't configure properly so that the header showed up. See [1]. [1]: https://git-scm.com/docs/git-send-email#Documentation/git-send-email.txt---fromltaddressgt > diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c [...] > +static struct snd_soc_card mt8192_mt6359_rt1015p_rt5682s_card = { > + .name = "mt8192_mt6359_rt1015p_rt5682s", > + .owner = THIS_MODULE, > + .dai_link = mt8192_mt6359_dai_links, > + .num_links = ARRAY_SIZE(mt8192_mt6359_dai_links), > + .controls = mt8192_mt6359_rt1015p_rt5682_controls, > + .num_controls = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_controls), > + .dapm_widgets = mt8192_mt6359_rt1015p_rt5682_widgets, > + .num_dapm_widgets = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_widgets), > + .dapm_routes = mt8192_mt6359_rt1015p_rt5682_routes, > + .num_dapm_routes = ARRAY_SIZE(mt8192_mt6359_rt1015p_rt5682_routes), > +}; Are the two cards only different from names (mt8192_mt6359_rt1015p_rt5682_card vs. mt8192_mt6359_rt1015p_rt5682s_card)? > @@ -1150,6 +1177,52 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) > dai_link->num_platforms = > ARRAY_SIZE(i2s3_rt1015p_platforms); > } > + } else if (strcmp(dai_link->name, "I2S8") == 0) { > + if (card == &mt8192_mt6359_rt1015_rt5682_card || > + card == &mt8192_mt6359_rt1015p_rt5682_card) { > + dai_link->cpus = i2s8_rt5682_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s8_rt5682_cpus); > + dai_link->codecs = i2s8_rt5682_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s8_rt5682_codecs); > + dai_link->platforms = i2s8_rt5682_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s8_rt5682_platforms); > + } else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { > + dai_link->cpus = i2s8_rt5682s_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s8_rt5682s_cpus); > + dai_link->codecs = i2s8_rt5682s_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s8_rt5682s_codecs); > + dai_link->platforms = i2s8_rt5682s_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s8_rt5682s_platforms); > + } > + } else if (strcmp(dai_link->name, "I2S9") == 0) { > + if (card == &mt8192_mt6359_rt1015_rt5682_card || > + card == &mt8192_mt6359_rt1015p_rt5682_card) { > + dai_link->cpus = i2s9_rt5682_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s9_rt5682_cpus); > + dai_link->codecs = i2s9_rt5682_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s9_rt5682_codecs); > + dai_link->platforms = i2s9_rt5682_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s9_rt5682_platforms); > + } else if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { > + dai_link->cpus = i2s9_rt5682s_cpus; > + dai_link->num_cpus = > + ARRAY_SIZE(i2s9_rt5682s_cpus); > + dai_link->codecs = i2s9_rt5682s_codecs; > + dai_link->num_codecs = > + ARRAY_SIZE(i2s9_rt5682s_codecs); > + dai_link->platforms = i2s9_rt5682s_platforms; > + dai_link->num_platforms = > + ARRAY_SIZE(i2s9_rt5682s_platforms); > + } After seeing the code, I am starting to wonder if the reuse is overkill. If they (RT5682 vs. RT5682S) only have some minor differences, probably it could reuse more by: SND_SOC_DAILINK_DEFS(i2s8, ... SND_SOC_DAILINK_DEFS(i2s9, ... ... if (card == &mt8192_mt6359_rt1015p_rt5682s_card) { i2s8_codecs.name = RT5682S_DEV0_NAME; i2s8_codecs.dai_name = RT5682S_CODEC_DAI; ... } Or even uses of_device_is_compatible() if it would like to reuse the struct snd_soc_card. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel