From patchwork Wed Oct 2 10:56:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 11170755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1C2716B1 for ; Wed, 2 Oct 2019 10:57:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 852C82086A for ; Wed, 2 Oct 2019 10:57:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="pH/hcB1e" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726806AbfJBK5H (ORCPT ); Wed, 2 Oct 2019 06:57:07 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46142 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfJBK5H (ORCPT ); Wed, 2 Oct 2019 06:57:07 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191002105705euoutp01e36d1d3ee9d81e6e050a9c68e0cef623~Jz0GjaWxB1438414384euoutp01O for ; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191002105705euoutp01e36d1d3ee9d81e6e050a9c68e0cef623~Jz0GjaWxB1438414384euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1570013825; bh=TFmVNOfrv+yK5zpukqFg/VF/zWtyEJHig9qIFw+ejZU=; h=From:To:Cc:Subject:Date:References:From; b=pH/hcB1e4qA2LLqasiLhqGnj6pwvJZetAcDj9PXPC5TXagklUF7LJHroGSryDoe6c 4U9XsRHhsGchAp3zDPLwjTqFL7csSunJJlQNiLrsjOsHQUjYV/WNiT4L6VelFrBvfa NtpQoZbCkbrFi01dfKl5HdRHwh7+s/DFNqP+6Ems= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191002105705eucas1p1cc956a6b544e69b912bdd4913150bd64~Jz0GRd0OA1562815628eucas1p1R; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 86.86.04309.182849D5; Wed, 2 Oct 2019 11:57:05 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191002105705eucas1p1561d6fb9c9b7355047868e589f6a25c8~Jz0F6Fq1G1561615616eucas1p1J; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191002105705eusmtrp1ad55a810643357f673f36ea8cd3f8e49~Jz0F5PqA10038800388eusmtrp1W; Wed, 2 Oct 2019 10:57:05 +0000 (GMT) X-AuditID: cbfec7f4-ae1ff700000010d5-ba-5d9482815aa9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4B.15.04117.182849D5; Wed, 2 Oct 2019 11:57:05 +0100 (BST) Received: from AMDC3061.DIGITAL.local (unknown [106.120.51.75]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191002105704eusmtip2b813a5bb473d4ee57442ca68cef4d2ad~Jz0FT-Nxg0110001100eusmtip2B; Wed, 2 Oct 2019 10:57:04 +0000 (GMT) From: Sylwester Nawrocki To: broonie@kernel.org Cc: lgirdwood@gmail.com, ckeepax@opensource.cirrus.com, krzk@kernel.org, sbkim73@samsung.com, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, m.szyprowski@samsung.com, Sylwester Nawrocki Subject: [PATCH v4 1/3] ASoC: samsung: arndale: Simplify DAI link initialization Date: Wed, 2 Oct 2019 12:56:50 +0200 Message-Id: <20191002105652.24821-1-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIKsWRmVeSWpSXmKPExsWy7djPc7qNTVNiDY5cV7S4cvEQk8XGGetZ LaY+fMJmcaV1E6PF+fMb2C2+Xelgstj0+BqrxYzz+5gs1h65y27x+f1+VovDb9pZLS6u+MLk wOOx4XMTm8fOWXfZPTat6mTz2Lyk3mP6nP+MHn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJXx 6McT1oK/ohUv/i1ha2DcL9TFyMkhIWAi8at1K3MXIxeHkMAKRolZHzcwQjhfGCX+HZzLAuF8 ZpQ4NeUMI0zLlh0b2CASyxklVv+eygzXcrl3KQtIFZuAoUTv0T6wDhEBMYnbczqZQWxmgVNM Ek/e2HQxcnAICwRJLHltChJmEVCVaFv7FqyVV8Ba4mbPKahl8hKrNxwAmy8h0M0u0bfvARtE wkXi+uaPUEXCEq+Ob2GHsGUkTk/uYYFoaGaU6Nl9mx3CmcAocf/4AqgOa4nDxy+yglzBLKAp sX6XPkTYUWLH0l6wsIQAn8SNt4IQN/NJTNo2nRkizCvR0QYNOxWJ36umM0HYUhLdT/6zQNge Etv7W1hBbCGBWIm+6VdYJzDKzULYtYCRcRWjeGppcW56arFRXmq5XnFibnFpXrpecn7uJkZg Qjn97/iXHYy7/iQdYhTgYFTi4W0ImhwrxJpYVlyZe4hRgoNZSYTX5s+kWCHelMTKqtSi/Pii 0pzU4kOM0hwsSuK81QwPooUE0hNLUrNTUwtSi2CyTBycUg2Mi469bdf/NfnAHq/5EV49XHtd gs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eucas1p1561d6fb9c9b7355047868e589f6a25c8 X-Msg-Generator: CA X-RootMTR: 20191002105705eucas1p1561d6fb9c9b7355047868e589f6a25c8 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191002105705eucas1p1561d6fb9c9b7355047868e589f6a25c8 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org There is only one DAI link so we can drop an unnecessary loop statement. Use card->dai_link in place of direct static arndale_rt5631_dai[] array dereference as a prerequisite for adding support for other CODECs. Unnecessary assignment of dai_link->codecs->name to NULL is removed. Reviewed-by: Charles Keepax Acked-by: Krzysztof Kozlowski Signed-off-by: Sylwester Nawrocki --- Based on for-next branch from git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound Changes since v2: - none. Changes since v1: - rebased due to reordering patches in the series --- sound/soc/samsung/arndale_rt5631.c | 42 +++++++++++++----------------- 1 file changed, 18 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale_rt5631.c index fd8c6642fb0d..004c84fafad9 100644 --- a/sound/soc/samsung/arndale_rt5631.c +++ b/sound/soc/samsung/arndale_rt5631.c @@ -88,36 +88,30 @@ static void arndale_put_of_nodes(struct snd_soc_card *card) static int arndale_audio_probe(struct platform_device *pdev) { - int n, ret; struct device_node *np = pdev->dev.of_node; struct snd_soc_card *card = &arndale_rt5631; + struct snd_soc_dai_link *dai_link; + int ret; card->dev = &pdev->dev; + dai_link = card->dai_link; + + dai_link->cpus->of_node = of_parse_phandle(np, "samsung,audio-cpu", 0); + if (!dai_link->cpus->of_node) { + dev_err(&pdev->dev, + "Property 'samsung,audio-cpu' missing or invalid\n"); + return -EINVAL; + } - for (n = 0; np && n < ARRAY_SIZE(arndale_rt5631_dai); n++) { - if (!arndale_rt5631_dai[n].cpus->dai_name) { - arndale_rt5631_dai[n].cpus->of_node = of_parse_phandle(np, - "samsung,audio-cpu", n); - - if (!arndale_rt5631_dai[n].cpus->of_node) { - dev_err(&pdev->dev, - "Property 'samsung,audio-cpu' missing or invalid\n"); - return -EINVAL; - } - } - if (!arndale_rt5631_dai[n].platforms->name) - arndale_rt5631_dai[n].platforms->of_node = - arndale_rt5631_dai[n].cpus->of_node; - - arndale_rt5631_dai[n].codecs->name = NULL; - arndale_rt5631_dai[n].codecs->of_node = of_parse_phandle(np, - "samsung,audio-codec", n); - if (!arndale_rt5631_dai[0].codecs->of_node) { - dev_err(&pdev->dev, + if (!dai_link->platforms->name) + dai_link->platforms->of_node = dai_link->cpus->of_node; + + dai_link->codecs->of_node = of_parse_phandle(np, "samsung,audio-codec", 0); + if (!dai_link->codecs->of_node) { + dev_err(&pdev->dev, "Property 'samsung,audio-codec' missing or invalid\n"); - ret = -EINVAL; - goto err_put_of_nodes; - } + ret = -EINVAL; + goto err_put_of_nodes; } ret = devm_snd_soc_register_card(card->dev, card); From patchwork Wed Oct 2 10:56:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 11170757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6B7916B1 for ; Wed, 2 Oct 2019 10:57:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F8C921929 for ; Wed, 2 Oct 2019 10:57:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="RYd4qBpK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727987AbfJBK5O (ORCPT ); Wed, 2 Oct 2019 06:57:14 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:52020 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfJBK5O (ORCPT ); Wed, 2 Oct 2019 06:57:14 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191002105712euoutp02aca6da75e1b373fef7250523f8098884~Jz0MX7Crm2169821698euoutp02Z for ; Wed, 2 Oct 2019 10:57:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191002105712euoutp02aca6da75e1b373fef7250523f8098884~Jz0MX7Crm2169821698euoutp02Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1570013832; bh=JKUgJmIBdrp6LGKbDKmIjCJNaR3zlarn3qoVxpc53Xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RYd4qBpKdB69nIY57AffDfLjcT6ttvloxu0DtQAnRsv3hqTj4om22Tf03t/Mmv2DN PNsNvW1YGzlvHe5iscv62QThCji//YXVevuCiWRPBjoFiomJ7vcxw99gk6AFlqWajv cG7+b/58vMF1Z5ItmuzD93tphPwbSWdxjd7NyBGU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191002105711eucas1p1b532f453b23420a69b6070ecae32c799~Jz0MBz19g1834918349eucas1p1b; Wed, 2 Oct 2019 10:57:11 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 50.4F.04469.782849D5; Wed, 2 Oct 2019 11:57:11 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191002105711eucas1p199322dc928a0ea4724fe0e0f5e6cb156~Jz0LxfDlz1786817868eucas1p1D; Wed, 2 Oct 2019 10:57:11 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191002105711eusmtrp1ad17d5b1849c365a52fc32651664bc0a~Jz0Lw5jtN0038900389eusmtrp1b; Wed, 2 Oct 2019 10:57:11 +0000 (GMT) X-AuditID: cbfec7f2-54fff70000001175-af-5d9482871dd9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8F.15.04117.782849D5; Wed, 2 Oct 2019 11:57:11 +0100 (BST) Received: from AMDC3061.DIGITAL.local (unknown [106.120.51.75]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191002105710eusmtip2b1cc63df16db8b23a331c650adc51076~Jz0LPPKeK0236902369eusmtip23; Wed, 2 Oct 2019 10:57:10 +0000 (GMT) From: Sylwester Nawrocki To: broonie@kernel.org Cc: lgirdwood@gmail.com, ckeepax@opensource.cirrus.com, krzk@kernel.org, sbkim73@samsung.com, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, m.szyprowski@samsung.com, Sylwester Nawrocki Subject: [PATCH v4 2/3] ASoC: samsung: arndale: Add support for WM1811 CODEC Date: Wed, 2 Oct 2019 12:56:51 +0200 Message-Id: <20191002105652.24821-2-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191002105652.24821-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLKsWRmVeSWpSXmKPExsWy7djPc7rtTVNiDVa2GlhcuXiIyWLjjPWs FlMfPmGzuNK6idHi/PkN7BbfrnQwWWx6fI3VYsb5fUwWa4/cZbf4/H4/q8XhN+2sFhdXfGFy 4PHY8LmJzWPnrLvsHptWdbJ5bF5S7zF9zn9Gj74tqxg9Pm+SC2CP4rJJSc3JLEst0rdL4Mp4 tnYbW8Fi44qtk7pZGhjPa3UxcnJICJhIzNl8lrWLkYtDSGAF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cQAkpifktShA1whJ/rnVB1XxilOi/+JwdJMEm YCjRe7SPEcQWERCTuD2nkxmkiFngGpPEplmPWUASwgI+Eiv3rGcFsVkEVCUWPzoB1sArYC1x 6dZPNogN8hKrNxxgBrE5BWwkLve9AqsRAqpZ9fE66wRGvgWMDKsYRVJLi3PTc4uN9IoTc4tL 89L1kvNzNzECA3/bsZ9bdjB2vQs+xCjAwajEw9sQNDlWiDWxrLgy9xCjBAezkgivzZ9JsUK8 KYmVValF+fFFpTmpxYcYTYGOmsgsJZqcD4zKvJJ4Q1NDcwtLQ3Njc2MzCyVx3g6BgzFCAumJ JanZqakFqUUwfUwcnFINjJP3PVj6UiiH6/Icu4V/jgmd27FTnWNVaMlnVcMlfYJyTVJ6CXVZ Tt5SxtzX7qleVyrofv/sbMlbV67cvAqv9cx3Xm7fdvJtGIP3DzGWs0e6ovtbmv57Xp+85c32 ggUztxz46v5byX1B/7ffxnJ8gSc/fLeLPXiwn3lK362k8tMTM8sPfXzpeEyJpTgj0VCLuag4 EQCY5qH2kgIAAA== X-CMS-MailID: 20191002105711eucas1p199322dc928a0ea4724fe0e0f5e6cb156 X-Msg-Generator: CA X-RootMTR: 20191002105711eucas1p199322dc928a0ea4724fe0e0f5e6cb156 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191002105711eucas1p199322dc928a0ea4724fe0e0f5e6cb156 References: <20191002105652.24821-1-s.nawrocki@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The Arndale boards come with different types of the audio daughter board. In order to support the WM1811 one we add new definition of an ASoC card which will be registered when the driver matches on "samsung,arndale-wm1811" compatible. There is no runtime detection of the audio daughter board type at the moment, compatible string of the audio card needs to be adjusted in DT, e.g. by the bootloader, depending on actual audio board (CODEC) used. Reviewed-by: Charles Keepax Acked-by: Krzysztof Kozlowski Signed-off-by: Sylwester Nawrocki --- Changes since v3: - fixed the MODULE_DEVICE_TABLE entry declaration Changes since v1: - removed unneeded __maybe_used attribute --- sound/soc/samsung/Kconfig | 2 + sound/soc/samsung/arndale_rt5631.c | 85 +++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 13 deletions(-) diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 638983123d8f..6803cbfa9e46 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -199,6 +199,8 @@ config SND_SOC_ARNDALE_RT5631_ALC5631 depends on I2C select SND_SAMSUNG_I2S select SND_SOC_RT5631 + select MFD_WM8994 + select SND_SOC_WM8994 config SND_SOC_SAMSUNG_TM2_WM5110 tristate "SoC I2S Audio support for WM5110 on TM2 board" diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale_rt5631.c index 004c84fafad9..d64602950cbd 100644 --- a/sound/soc/samsung/arndale_rt5631.c +++ b/sound/soc/samsung/arndale_rt5631.c @@ -14,10 +14,11 @@ #include #include +#include "../codecs/wm8994.h" #include "i2s.h" -static int arndale_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) +static int arndale_rt5631_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; @@ -47,13 +48,45 @@ static int arndale_hw_params(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_ops arndale_ops = { - .hw_params = arndale_hw_params, +static struct snd_soc_ops arndale_rt5631_ops = { + .hw_params = arndale_rt5631_hw_params, +}; + +static int arndale_wm1811_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + unsigned int rfs, rclk; + + /* Ensure AIF1CLK is >= 3 MHz for optimal performance */ + if (params_width(params) == 24) + rfs = 384; + else if (params_rate(params) == 8000 || params_rate(params) == 11025) + rfs = 512; + else + rfs = 256; + + rclk = params_rate(params) * rfs; + + /* + * We add 1 to the frequency value to ensure proper EPLL setting + * for each audio sampling rate (see epll_24mhz_tbl in drivers/clk/ + * samsung/clk-exynos5250.c for list of available EPLL rates). + * The CODEC uses clk API and the value will be rounded hence the MCLK1 + * clock's frequency will still be exact multiple of the sample rate. + */ + return snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK1, + rclk + 1, SND_SOC_CLOCK_IN); +} + +static struct snd_soc_ops arndale_wm1811_ops = { + .hw_params = arndale_wm1811_hw_params, }; SND_SOC_DAILINK_DEFS(rt5631_hifi, DAILINK_COMP_ARRAY(COMP_EMPTY()), - DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "rt5631-hifi")), + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "rt5631-aif1")), DAILINK_COMP_ARRAY(COMP_EMPTY())); static struct snd_soc_dai_link arndale_rt5631_dai[] = { @@ -63,11 +96,28 @@ static struct snd_soc_dai_link arndale_rt5631_dai[] = { .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, - .ops = &arndale_ops, + .ops = &arndale_rt5631_ops, SND_SOC_DAILINK_REG(rt5631_hifi), }, }; +SND_SOC_DAILINK_DEFS(wm1811_hifi, + DAILINK_COMP_ARRAY(COMP_EMPTY()), + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8994-aif1")), + DAILINK_COMP_ARRAY(COMP_EMPTY())); + +static struct snd_soc_dai_link arndale_wm1811_dai[] = { + { + .name = "WM1811 HiFi", + .stream_name = "Primary", + .dai_fmt = SND_SOC_DAIFMT_I2S + | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM, + .ops = &arndale_wm1811_ops, + SND_SOC_DAILINK_REG(wm1811_hifi), + }, +}; + static struct snd_soc_card arndale_rt5631 = { .name = "Arndale RT5631", .owner = THIS_MODULE, @@ -75,6 +125,13 @@ static struct snd_soc_card arndale_rt5631 = { .num_links = ARRAY_SIZE(arndale_rt5631_dai), }; +static struct snd_soc_card arndale_wm1811 = { + .name = "Arndale WM1811", + .owner = THIS_MODULE, + .dai_link = arndale_wm1811_dai, + .num_links = ARRAY_SIZE(arndale_wm1811_dai), +}; + static void arndale_put_of_nodes(struct snd_soc_card *card) { struct snd_soc_dai_link *dai_link; @@ -89,10 +146,11 @@ static void arndale_put_of_nodes(struct snd_soc_card *card) static int arndale_audio_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - struct snd_soc_card *card = &arndale_rt5631; + struct snd_soc_card *card; struct snd_soc_dai_link *dai_link; int ret; + card = (struct snd_soc_card *)of_device_get_match_data(&pdev->dev); card->dev = &pdev->dev; dai_link = card->dai_link; @@ -134,18 +192,19 @@ static int arndale_audio_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id samsung_arndale_rt5631_of_match[] __maybe_unused = { - { .compatible = "samsung,arndale-rt5631", }, - { .compatible = "samsung,arndale-alc5631", }, +static const struct of_device_id arndale_audio_of_match[] = { + { .compatible = "samsung,arndale-rt5631", .data = &arndale_rt5631 }, + { .compatible = "samsung,arndale-alc5631", .data = &arndale_rt5631 }, + { .compatible = "samsung,arndale-wm1811", .data = &arndale_wm1811 }, {}, }; -MODULE_DEVICE_TABLE(of, samsung_arndale_rt5631_of_match); +MODULE_DEVICE_TABLE(of, arndale_audio_of_match); static struct platform_driver arndale_audio_driver = { .driver = { - .name = "arndale-audio", + .name = "arndale-audio", .pm = &snd_soc_pm_ops, - .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match), + .of_match_table = arndale_audio_of_match, }, .probe = arndale_audio_probe, .remove = arndale_audio_remove, From patchwork Wed Oct 2 10:56:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 11170759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 814D713B1 for ; Wed, 2 Oct 2019 10:57:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55E8221D7B for ; Wed, 2 Oct 2019 10:57:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="TAvwPuWs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728020AbfJBK5Q (ORCPT ); Wed, 2 Oct 2019 06:57:16 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46202 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfJBK5P (ORCPT ); Wed, 2 Oct 2019 06:57:15 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191002105714euoutp0198d80ac30ad588b3f907c2d194d30b28~Jz0OvAeBH1439214392euoutp01R for ; Wed, 2 Oct 2019 10:57:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191002105714euoutp0198d80ac30ad588b3f907c2d194d30b28~Jz0OvAeBH1439214392euoutp01R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1570013834; bh=dxZo+xJVxceHImAWqR8TT3bo9Ohx26xddfrU+mypT+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TAvwPuWsL27x/oUBkIVMiumvj7uiIL2I28A7RwmNd2+rl43UxI0yHG6w7Ao/rYCJw nX+/5wyPTQoibPc17mKWrswBAaMFg7HtoaBI4jJVO7/5o1DkCSa96kWUvaBwfquPgn EUJWLoMlnoOjgvHGpRduL6y02tl8EnWrhjxzcjUg= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20191002105714eucas1p25e68f6fd6286f7cda931687c48572283~Jz0OYLdqf0173701737eucas1p2y; Wed, 2 Oct 2019 10:57:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id CB.86.04309.A82849D5; Wed, 2 Oct 2019 11:57:14 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191002105714eucas1p1d22a05b0a2daf48fd5daf22e47693f3d~Jz0OGibDl1564115641eucas1p14; Wed, 2 Oct 2019 10:57:14 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191002105714eusmtrp15f645ed9c4eaf8ca407bf3de33e87e84~Jz0OF9bGY0038800388eusmtrp1j; Wed, 2 Oct 2019 10:57:14 +0000 (GMT) X-AuditID: cbfec7f4-ae1ff700000010d5-d5-5d94828a9a6a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 11.25.04117.982849D5; Wed, 2 Oct 2019 11:57:14 +0100 (BST) Received: from AMDC3061.DIGITAL.local (unknown [106.120.51.75]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191002105713eusmtip2b2de30345d927c47e51d280960f63093~Jz0Nk8ve30215002150eusmtip2v; Wed, 2 Oct 2019 10:57:13 +0000 (GMT) From: Sylwester Nawrocki To: broonie@kernel.org Cc: lgirdwood@gmail.com, ckeepax@opensource.cirrus.com, krzk@kernel.org, sbkim73@samsung.com, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, m.szyprowski@samsung.com, Sylwester Nawrocki Subject: [PATCH v4 3/3] ASoC: samsung: Rename Arndale card driver Date: Wed, 2 Oct 2019 12:56:52 +0200 Message-Id: <20191002105652.24821-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191002105652.24821-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSa0hTcRjG/e/s7BzNyXEzfbNoMZQoybXqwwFHKkWtL2J+6zJq6UHNK5vT TMKhlpd0eSlcIjojcEzFtdTUyMrbJKmx1PDCymhULC8fJonmJefR+vZ7nvd5eP8v/ElM0IAH k8npWYwqXZkq5vlwu4ZXbMfKCh4qjptc/vS4vZ9DP9O34/Sjr04ePX7XgmibzUzQv8dLOLTl 2yec1tv6OHTboIOg3YuvcXpgrhin7cYlTpSv3Owu4Ml76hyE3GIq5cmfP82X19ZvIrmuw4Tk bsvBWOKyjyyBSU3OZlSS09d9kqqtw1imS3jL+XiMq0VTVBnyJoE6Ba9aivAy5EMKKCOC9h+N O2IJQc/8OI8VbgRD0x/w3crbn+uIHTQjaG0exP5VKkYchCfFo6RQMaRDHg6gAmGmvhTzMEa9 44BzTuZhIRUNn20r23kuFQrLy4s8D/OpCJge0fPYbSJoMb/Z7npTMhjTubY3A2UiQO9aJdjQ WajdmMRYFoLL2rHjH4DRmnIuWyhEUP5yhmBFJYIvVgNiUxEwYLVvHUduPe8ItPdKWDsaFqp0 XI8NlB9MzvuzB/hBdVctxtp8KLknYNMh8MdUy2E5GO47N7ksy6FofXXbF1APEGgLD1UiUd3/ XQaETCiI0ajTEhn1iXQmJ1ytTFNr0hPD4zPSLGjr14xuWJe6Ue/ajX5EkUjsy9fG1SgEuDJb nZvWj4DExAF82Vq1QsBPUObeZlQZ11SaVEbdj/aTXHEQP89r9oqASlRmMSkMk8modqcc0jtY i7zChAEGV1RZoGCyr4DvuhMdGHcmXCazlyfNxeypibyanxnvsCww57XGzsbCopBug0YaOfE+ JSy5mP4oKpFc2DDPvTjHl5zsypHurTLGNkhm92mmNJOKS9/dhCgXt/esNj2pCjx8c97QaWhy qi4WxYj8Jn6VGkR9rdNtoVN5Yq46SSk9iqnUyr8dpqeEMQMAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRmVeSWpSXmKPExsVy+t/xe7pdTVNiDS76Wly5eIjJYuOM9awW Ux8+YbO40rqJ0eL8+Q3sFt+udDBZbHp8jdVixvl9TBZrj9xlt/j8fj+rxeE37awWF1d8YXLg 8djwuYnNY+esu+wem1Z1snlsXlLvMX3Of0aPvi2rGD0+b5ILYI/SsynKLy1JVcjILy6xVYo2 tDDSM7S00DMysdQzNDaPtTIyVdK3s0lJzcksSy3St0vQy5h0/BhzwSvhiiczL7M0MN4U6GLk 5JAQMJE4+OIvYxcjF4eQwFJGiZu/z7N2MXIAJaQk5rcoQdQIS/y51sUGUfOJUeLIxBNsIAk2 AUOJ3qN9jCC2iICYxO05ncwgRcwC15gkNs16zAKSEBZwlLh3/ic7iM0ioCrx/ft7sGZeAWuJ WydmsEFskJdYveEAM4jNKWAjcbnvFdhQIaCaVR+vs05g5FvAyLCKUSS1tDg3PbfYSK84Mbe4 NC9dLzk/dxMjMOy3Hfu5ZQdj17vgQ4wCHIxKPLwNQZNjhVgTy4orcw8xSnAwK4nw2vyZFCvE m5JYWZValB9fVJqTWnyI0RToqInMUqLJ+cCYzCuJNzQ1NLewNDQ3Njc2s1AS5+0QOBgjJJCe WJKanZpakFoE08fEwSnVwOhUHdPiUDD9eVrySsuHnfnH958+98UzNtOtc+l3g03VJw+c7n+3 0Z/teXpP5eOrBqlrt/2uMY5kPPBP4tB+i75fEV8VHnk/Cbp060xjxHGuqWvOG1w6sG7Ou53W 7DMXPFd713LP+/i/g0y913uLH3DnL1iqfKKSu9TJS1S98YLoRecZLY151yWUWIozEg21mIuK EwEr4IUbkQIAAA== X-CMS-MailID: 20191002105714eucas1p1d22a05b0a2daf48fd5daf22e47693f3d X-Msg-Generator: CA X-RootMTR: 20191002105714eucas1p1d22a05b0a2daf48fd5daf22e47693f3d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191002105714eucas1p1d22a05b0a2daf48fd5daf22e47693f3d References: <20191002105652.24821-1-s.nawrocki@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Rename arndale_rt5631.c to just arnddale.c as we support other CODECs than RT5631. While at it replace spaces in Kconfig with tabs. Reviewed-by: Charles Keepax Acked-by: Krzysztof Kozlowski Signed-off-by: Sylwester Nawrocki --- Changes since v2: - none. Changes since v1: - new patch. --- sound/soc/samsung/Kconfig | 10 +++++----- sound/soc/samsung/Makefile | 4 ++-- sound/soc/samsung/{arndale_rt5631.c => arndale.c} | 0 3 files changed, 7 insertions(+), 7 deletions(-) rename sound/soc/samsung/{arndale_rt5631.c => arndale.c} (100%) -- 2.17.1 diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 6803cbfa9e46..1a0b163ca47b 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -194,11 +194,11 @@ config SND_SOC_ODROID help Say Y here to enable audio support for the Odroid XU3/XU4. -config SND_SOC_ARNDALE_RT5631_ALC5631 - tristate "Audio support for RT5631(ALC5631) on Arndale Board" - depends on I2C - select SND_SAMSUNG_I2S - select SND_SOC_RT5631 +config SND_SOC_ARNDALE + tristate "Audio support for Arndale Board" + depends on I2C + select SND_SAMSUNG_I2S + select SND_SOC_RT5631 select MFD_WM8994 select SND_SOC_WM8994 diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index c3b76035f69c..8f5dfe20b9f1 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -39,7 +39,7 @@ snd-soc-lowland-objs := lowland.o snd-soc-littlemill-objs := littlemill.o snd-soc-bells-objs := bells.o snd-soc-odroid-objs := odroid.o -snd-soc-arndale-rt5631-objs := arndale_rt5631.o +snd-soc-arndale-objs := arndale.o snd-soc-tm2-wm5110-objs := tm2_wm5110.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o @@ -62,5 +62,5 @@ obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o obj-$(CONFIG_SND_SOC_BELLS) += snd-soc-bells.o obj-$(CONFIG_SND_SOC_ODROID) += snd-soc-odroid.o -obj-$(CONFIG_SND_SOC_ARNDALE_RT5631_ALC5631) += snd-soc-arndale-rt5631.o +obj-$(CONFIG_SND_SOC_ARNDALE) += snd-soc-arndale.o obj-$(CONFIG_SND_SOC_SAMSUNG_TM2_WM5110) += snd-soc-tm2-wm5110.o diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale.c similarity index 100% rename from sound/soc/samsung/arndale_rt5631.c rename to sound/soc/samsung/arndale.c