From patchwork Fri Jun 23 12:04:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 106257 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp170560qgd; Fri, 23 Jun 2017 05:05:37 -0700 (PDT) X-Received: by 10.223.151.216 with SMTP id t24mr5826308wrb.40.1498219537102; Fri, 23 Jun 2017 05:05:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498219537; cv=none; d=google.com; s=arc-20160816; b=LPiJ+0z+FROX1JXl58uvv3qA16M5S0O5rISB0xJ8TeF2uBTUrFIm/vTjPDe2T8vOB0 f6QnJUb0D6XLL1G77L3xSj0Vy4jJlirHmYmNjkPFMvCQHpUvST3NPUpazKtP6CzSuyTK nJlGp1q1pPxv7NEZouT8cMVS5BTgIxFWm7GJmU1cDBN1FksETK8Wr8qTfj31WsOPCNbo LADwid3TEqgccR83BWZKrkrBRpNmis1l/nf9uC/GzUlWnFLZ6ETnVr5odYbxtbIwffJ1 2GrgtO7zFBq74TMzxRyNlMzdPuW8dqTu4oLs3+DQzelDWtXkkF2udKfCEeFFN64QOrjf /A5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :delivered-to:arc-authentication-results; bh=QoxLk2QLNoQJX5vQIf+krfSKrU96Vr97n8auJXzPln8=; b=Ve67WLwNsfY2xXAahINEvP6riiXWDgRp99GnJgidO19Ul88+DVSAyJOUOobNJwag49 +7SBoewfiN/1sJtzYzWAm7quC4ZRbzFEGRFSr6aG5bz7QnuNv0Bi1YE98/g8UGFEncGR 4HJtGD+U2E8k6xh/Lv5AtGIAKDCCkbLpf6s8QDl0vErfAWvIyg0E3zwelgVQYosLLI5k eApreLipXMQJiJY8RWZTZqZc8rBiZMdM1A96YAc6CZ2aNqLWUSoIuRg1apNjTgNYY2SD qye+B/CMVZLheP3Sa/tn7E2sOzeRf0hvsHB5VsyQvdcVTHXoHIiBvEFQjPHipfsYkvxf 3ZIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id m127si3992846wmg.165.2017.06.23.05.05.36; Fri, 23 Jun 2017 05:05:37 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0D7892674D4; Fri, 23 Jun 2017 14:04:50 +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 7E72B2674D1; Fri, 23 Jun 2017 14:04:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, SPF_PASS, T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id A89822674A8 for ; Fri, 23 Jun 2017 14:04:13 +0200 (CEST) Received: from debutante.sirena.org.uk ([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.89) (envelope-from ) id 1dONJm-0003X8-AK; Fri, 23 Jun 2017 12:04:08 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1dONJj-0006QQ-OZ; Fri, 23 Jun 2017 13:04:03 +0100 From: Mark Brown To: John Hsu In-Reply-To: <1498099311-2738-1-git-send-email-KCHSU0@nuvoton.com> Message-Id: Date: Fri, 23 Jun 2017 13:04:03 +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 Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: alsa-devel@alsa-project.org, anatol.pomozov@gmail.com, benzh@chromium.org, John Hsu , lgirdwood@gmail.com, YHCHuang@nuvoton.com, mac.chiang@intel.com, broonie@kernel.org, CTLIN0@nuvoton.com, yong.zhi@intel.com, mhkuo@nuvoton.com Subject: [alsa-devel] Applied "ASoC: nau8825: default value for property" 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 The patch ASoC: nau8825: default value for property 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 403d2fef06104275dd4909d2684c86aabe25c917 Mon Sep 17 00:00:00 2001 From: John Hsu Date: Thu, 22 Jun 2017 10:41:51 +0800 Subject: [PATCH] ASoC: nau8825: default value for property Assign default value for codec private data when property not given. If without those default value and property, the codec will work abnormally. Signed-off-by: John Hsu Signed-off-by: John Hsu Signed-off-by: Mark Brown --- sound/soc/codecs/nau8825.c | 53 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 12 deletions(-) -- 2.13.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index 97fbeba9498f..c00b86dd80dc 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -2429,6 +2429,7 @@ static void nau8825_print_device_properties(struct nau8825 *nau8825) static int nau8825_read_device_properties(struct device *dev, struct nau8825 *nau8825) { + int ret; nau8825->jkdet_enable = device_property_read_bool(dev, "nuvoton,jkdet-enable"); @@ -2436,30 +2437,58 @@ static int nau8825_read_device_properties(struct device *dev, "nuvoton,jkdet-pull-enable"); nau8825->jkdet_pull_up = device_property_read_bool(dev, "nuvoton,jkdet-pull-up"); - device_property_read_u32(dev, "nuvoton,jkdet-polarity", + ret = device_property_read_u32(dev, "nuvoton,jkdet-polarity", &nau8825->jkdet_polarity); - device_property_read_u32(dev, "nuvoton,micbias-voltage", + if (ret) + nau8825->jkdet_polarity = 1; + ret = device_property_read_u32(dev, "nuvoton,micbias-voltage", &nau8825->micbias_voltage); - device_property_read_u32(dev, "nuvoton,vref-impedance", + if (ret) + nau8825->micbias_voltage = 6; + ret = device_property_read_u32(dev, "nuvoton,vref-impedance", &nau8825->vref_impedance); - device_property_read_u32(dev, "nuvoton,sar-threshold-num", + if (ret) + nau8825->vref_impedance = 2; + ret = device_property_read_u32(dev, "nuvoton,sar-threshold-num", &nau8825->sar_threshold_num); - device_property_read_u32_array(dev, "nuvoton,sar-threshold", + if (ret) + nau8825->sar_threshold_num = 4; + ret = device_property_read_u32_array(dev, "nuvoton,sar-threshold", nau8825->sar_threshold, nau8825->sar_threshold_num); - device_property_read_u32(dev, "nuvoton,sar-hysteresis", + if (ret) { + nau8825->sar_threshold[0] = 0x08; + nau8825->sar_threshold[1] = 0x12; + nau8825->sar_threshold[2] = 0x26; + nau8825->sar_threshold[3] = 0x73; + } + ret = device_property_read_u32(dev, "nuvoton,sar-hysteresis", &nau8825->sar_hysteresis); - device_property_read_u32(dev, "nuvoton,sar-voltage", + if (ret) + nau8825->sar_hysteresis = 0; + ret = device_property_read_u32(dev, "nuvoton,sar-voltage", &nau8825->sar_voltage); - device_property_read_u32(dev, "nuvoton,sar-compare-time", + if (ret) + nau8825->sar_voltage = 6; + ret = device_property_read_u32(dev, "nuvoton,sar-compare-time", &nau8825->sar_compare_time); - device_property_read_u32(dev, "nuvoton,sar-sampling-time", + if (ret) + nau8825->sar_compare_time = 1; + ret = device_property_read_u32(dev, "nuvoton,sar-sampling-time", &nau8825->sar_sampling_time); - device_property_read_u32(dev, "nuvoton,short-key-debounce", + if (ret) + nau8825->sar_sampling_time = 1; + ret = device_property_read_u32(dev, "nuvoton,short-key-debounce", &nau8825->key_debounce); - device_property_read_u32(dev, "nuvoton,jack-insert-debounce", + if (ret) + nau8825->key_debounce = 3; + ret = device_property_read_u32(dev, "nuvoton,jack-insert-debounce", &nau8825->jack_insert_debounce); - device_property_read_u32(dev, "nuvoton,jack-eject-debounce", + if (ret) + nau8825->jack_insert_debounce = 7; + ret = device_property_read_u32(dev, "nuvoton,jack-eject-debounce", &nau8825->jack_eject_debounce); + if (ret) + nau8825->jack_eject_debounce = 0; nau8825->mclk = devm_clk_get(dev, "mclk"); if (PTR_ERR(nau8825->mclk) == -EPROBE_DEFER) {