From patchwork Fri May 19 17:04:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9737777 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 7259F601C2 for ; Fri, 19 May 2017 17:06:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 595772852B for ; Fri, 19 May 2017 17:06:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D76B2852D; Fri, 19 May 2017 17:06:50 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 600BE2852B for ; Fri, 19 May 2017 17:06:49 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E9641267628; Fri, 19 May 2017 19:05:45 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2A63F26762A; Fri, 19 May 2017 19:05:43 +0200 (CEST) Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id 18BF1267262 for ; Fri, 19 May 2017 19:04:53 +0200 (CEST) Received: from [2001:470:1f1d:6b5::3] (helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dBlKK-0000Uz-0Z; Fri, 19 May 2017 17:04:34 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1dBlKF-0003lI-WE; Fri, 19 May 2017 18:04:28 +0100 From: Mark Brown To: Adam Thomson In-Reply-To: <20170519143225.089823FBCD@swsrvapps-01.diasemi.com> Message-Id: Date: Fri, 19 May 2017 18:04:27 +0100 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: alsa-devel@alsa-project.org, Support Opensource , linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , Mark Brown Subject: [alsa-devel] Applied "ASoC: da7213: Update driver to use device_property* FW functions" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: da7213: Update driver to use device_property* FW functions 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 0e54153b6685712c1e0eaa31c0c199fdce121b28 Mon Sep 17 00:00:00 2001 From: Adam Thomson Date: Fri, 19 May 2017 15:32:25 +0100 Subject: [PATCH] ASoC: da7213: Update driver to use device_property* FW functions The driver now supports ACPI based initialisation as well as DT and old pdata methods. However the FW data handling still uses DT specific calls to read firmware data (of_property*) so for ACPI based initialisation the FW data will only be set to default values. This patch updates the FW handling to use device_property* calls instead so that both ACPI and DT are handled as expected. Signed-off-by: Adam Thomson Signed-off-by: Mark Brown --- sound/soc/codecs/da7213.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 024d83fa6a7f..c3e11897f8ae 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c @@ -13,6 +13,8 @@ */ #include +#include +#include #include #include #include @@ -1606,12 +1608,12 @@ static enum da7213_dmic_clk_rate } static struct da7213_platform_data - *da7213_of_to_pdata(struct snd_soc_codec *codec) + *da7213_fw_to_pdata(struct snd_soc_codec *codec) { - struct device_node *np = codec->dev->of_node; + struct device *dev = codec->dev; struct da7213_platform_data *pdata; - const char *of_str; - u32 of_val32; + const char *fw_str; + u32 fw_val32; pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) { @@ -1619,29 +1621,29 @@ static struct da7213_platform_data return NULL; } - if (of_property_read_u32(np, "dlg,micbias1-lvl", &of_val32) >= 0) - pdata->micbias1_lvl = da7213_of_micbias_lvl(codec, of_val32); + if (device_property_read_u32(dev, "dlg,micbias1-lvl", &fw_val32) >= 0) + pdata->micbias1_lvl = da7213_of_micbias_lvl(codec, fw_val32); else pdata->micbias1_lvl = DA7213_MICBIAS_2_2V; - if (of_property_read_u32(np, "dlg,micbias2-lvl", &of_val32) >= 0) - pdata->micbias2_lvl = da7213_of_micbias_lvl(codec, of_val32); + if (device_property_read_u32(dev, "dlg,micbias2-lvl", &fw_val32) >= 0) + pdata->micbias2_lvl = da7213_of_micbias_lvl(codec, fw_val32); else pdata->micbias2_lvl = DA7213_MICBIAS_2_2V; - if (!of_property_read_string(np, "dlg,dmic-data-sel", &of_str)) - pdata->dmic_data_sel = da7213_of_dmic_data_sel(codec, of_str); + if (!device_property_read_string(dev, "dlg,dmic-data-sel", &fw_str)) + pdata->dmic_data_sel = da7213_of_dmic_data_sel(codec, fw_str); else pdata->dmic_data_sel = DA7213_DMIC_DATA_LRISE_RFALL; - if (!of_property_read_string(np, "dlg,dmic-samplephase", &of_str)) + if (!device_property_read_string(dev, "dlg,dmic-samplephase", &fw_str)) pdata->dmic_samplephase = - da7213_of_dmic_samplephase(codec, of_str); + da7213_of_dmic_samplephase(codec, fw_str); else pdata->dmic_samplephase = DA7213_DMIC_SAMPLE_ON_CLKEDGE; - if (of_property_read_u32(np, "dlg,dmic-clkrate", &of_val32) >= 0) - pdata->dmic_clk_rate = da7213_of_dmic_clkrate(codec, of_val32); + if (device_property_read_u32(dev, "dlg,dmic-clkrate", &fw_val32) >= 0) + pdata->dmic_clk_rate = da7213_of_dmic_clkrate(codec, fw_val32); else pdata->dmic_clk_rate = DA7213_DMIC_CLK_3_0MHZ; @@ -1713,10 +1715,9 @@ static int da7213_probe(struct snd_soc_codec *codec) DA7213_LINE_AMP_OE, DA7213_LINE_AMP_OE); /* Handle DT/Platform data */ - if (codec->dev->of_node) - da7213->pdata = da7213_of_to_pdata(codec); - else - da7213->pdata = dev_get_platdata(codec->dev); + da7213->pdata = dev_get_platdata(codec->dev); + if (!da7213->pdata) + da7213->pdata = da7213_fw_to_pdata(codec); /* Set platform data values */ if (da7213->pdata) {