From patchwork Tue Sep 19 13:46:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9959061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5635601E9 for ; Tue, 19 Sep 2017 13:47:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CA4F28878 for ; Tue, 19 Sep 2017 13:47:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8147128897; Tue, 19 Sep 2017 13:47:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA2E728878 for ; Tue, 19 Sep 2017 13:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id: In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: References:List-Owner; bh=L3/y6/Unt7iQBARtu3+vHpUrl0I8iMKV2/mMITgMLaU=; b=SgC tOX+BzrIVwaYIu0eOFnrq38jTsFlw0yQCtw/LbQOIVOSM56w8KqjP1K4AOUwPNOrM578ZPGcZ9v9d rWuaf68R0fL8e7hDqe4/OvNCkmtmEhhWuidVpB3M3FNKXSJQpu0KHb2mb1WhC4FmFMuPOx6pyYCgw 78nF+edL6G5SzGbMymm+gpmM5+INGjGsfOmznCrlqikOXiaqXdn7botbiX5RNQtx2hdp2fC92Gopx EbYPqeiPwxG6dVrXFL24t/abF1Hdku7RhvB1Efv1wd3d68o5ZWVzgkCChGNC7Q2yIxTh91hwyX2Kg /BfxNIJxVIW02T6ZIUuWX+QD9ADJySQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1duIsJ-0006Ah-C9; Tue, 19 Sep 2017 13:47:43 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1duIsI-00069s-8Z; Tue, 19 Sep 2017 13:47:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Date:Message-Id:In-Reply-To:Subject:Cc: To:From:Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:References:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=JhJmYYKBolJJcdkUTIlv8IjpIrlAhONpMBASKg34YfU=; b=A0OajN+ybpoT0qt/0D2SIlf6wx N3OyKj7wwooqo2hdWCoTaId4RySMfInxA5on5Yn5ol2/+FQmffBx06U35lRbk1QK4KahqKKgr8eEx cdy9HfcfJybKzjBWCFSP8ORJNtASwFt2Xl97QAcR3lycw/GKQ75JvzCXwTG2PoG7ijD9LHWO6AThb jW92BQBoXmQIN6+zZA4DrmKHUhlP7UOVjCphmszXOzAeMtvl004ewTHUy79NL+7fkMaHCLrGrfZUy uEYzN6NzWn0NrkRi6/q2q+LjXjYQ66h0T9lIKCByiNJEDwwJznq/hjoUyb3ChpQ8Hz4swsgDRDgy9 +Ox/CiQA==; Received: from heliosphere.sirena.org.uk ([2a01:7e01::f03c:91ff:fed4:a3b6]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1duIsF-0006DH-Ci; Tue, 19 Sep 2017 13:47:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=JhJmYYKBolJJcdkUTIlv8IjpIrlAhONpMBASKg34YfU=; b=VKTO4syTo/7z 12GBBNCmcbQRJ+wuKsKXPJql3spvcmTxwy0aIFWAhG2Tavyf985xGN1+YwODrZq+DrmhQonREaU84 +ASXebdlOUuR741ioF3T6uwILOYWRF35SfR52wT3Zf05fPqTmiJpoNlLeEFlfXPcWU4MiFXAJkaB1 Tde7Y=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1duIqw-0001Nz-2m; Tue, 19 Sep 2017 13:46:18 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1duIqv-0008CA-M5; Tue, 19 Sep 2017 14:46:17 +0100 From: Mark Brown To: Jeffy Chen Subject: Applied "ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec" to the asoc tree In-Reply-To: <20170919125800.336-5-jeffy.chen@rock-chips.com> Message-Id: Date: Tue, 19 Sep 2017 14:46:17 +0100 X-Bad-Reply: In-Reply-To but no 'Re:' in Subject. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170919_144739_453354_84F77DEA X-CRM114-Status: GOOD ( 22.47 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, dianders@chromium.org, Heiko Stuebner , briannorris@chromium.org, linux-kernel@vger.kernel.org, Liam Girdwood , linux-rockchip@lists.infradead.org, Mark Brown , Takashi Iwai , mka@chromium.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 7e0dc9aeaea3ed130e090e20e9be0fc4877ddc37 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Tue, 19 Sep 2017 20:57:59 +0800 Subject: [PATCH] ASoC: rockchip: Use bus_type to distinguish rt5514 dsp from rt5514 codec Currently rt5514 dsp and rt5514 codec are sharing the same compatible. Use bus_type to distinguish rt5514 dsp from rt5514 codec. Signed-off-by: Jeffy Chen Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke Signed-off-by: Mark Brown --- sound/soc/rockchip/rk3399_gru_sound.c | 61 ++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index fab868850d3a..30eed83e8a13 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -317,15 +318,6 @@ enum { DAILINK_RT5514_DSP, }; -static const char * const dailink_compat[] = { - [DAILINK_CDNDP] = "rockchip,rk3399-cdn-dp", - [DAILINK_DA7219] = "dlg,da7219", - [DAILINK_DMIC] = "dmic-codec", - [DAILINK_MAX98357A] = "maxim,max98357a", - [DAILINK_RT5514] = "realtek,rt5514-i2c", - [DAILINK_RT5514_DSP] = "realtek,rt5514-spi", -}; - static const struct snd_soc_dai_link rockchip_dais[] = { [DAILINK_CDNDP] = { .name = "DP", @@ -438,13 +430,58 @@ static const struct rockchip_sound_route rockchip_routes[] = { [DAILINK_RT5514_DSP] = {}, }; +struct dailink_match_data { + const char *compatible; + struct bus_type *bus_type; +}; + +static const struct dailink_match_data dailink_match[] = { + [DAILINK_CDNDP] = { + .compatible = "rockchip,rk3399-cdn-dp", + }, + [DAILINK_DA7219] = { + .compatible = "dlg,da7219", + }, + [DAILINK_DMIC] = { + .compatible = "dmic-codec", + }, + [DAILINK_MAX98357A] = { + .compatible = "maxim,max98357a", + }, + [DAILINK_RT5514] = { + .compatible = "realtek,rt5514", + .bus_type = &i2c_bus_type, + }, + [DAILINK_RT5514_DSP] = { + .compatible = "realtek,rt5514", + .bus_type = &spi_bus_type, + }, +}; + +static int of_dev_node_match(struct device *dev, void *data) +{ + return dev->of_node == data; +} + static int rockchip_sound_codec_node_match(struct device_node *np_codec) { + struct device *dev; int i; - for (i = 0; i < ARRAY_SIZE(dailink_compat); i++) { - if (of_device_is_compatible(np_codec, dailink_compat[i])) - return i; + for (i = 0; i < ARRAY_SIZE(dailink_match); i++) { + if (!of_device_is_compatible(np_codec, + dailink_match[i].compatible)) + continue; + + if (dailink_match[i].bus_type) { + dev = bus_find_device(dailink_match[i].bus_type, NULL, + np_codec, of_dev_node_match); + if (!dev) + continue; + put_device(dev); + } + + return i; } return -1; }