From patchwork Tue Oct 14 06:32:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 5078221 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 08CCE9F30B for ; Tue, 14 Oct 2014 06:33:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35D9220142 for ; Tue, 14 Oct 2014 06:33:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 09FC82012E for ; Tue, 14 Oct 2014 06:33:45 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2E7202606BB; Tue, 14 Oct 2014 08:33:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1A72A26051B; Tue, 14 Oct 2014 08:32:44 +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 8F87026051F; Tue, 14 Oct 2014 08:32:43 +0200 (CEST) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by alsa0.perex.cz (Postfix) with ESMTP id B374E2604BB for ; Tue, 14 Oct 2014 08:32:37 +0200 (CEST) Received: by mail-wi0-f182.google.com with SMTP id n3so9203857wiv.9 for ; Mon, 13 Oct 2014 23:32:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O/SD84LZyznGyIDShNnZ6PB4rJ5ga+G8lCc8gd+UX5o=; b=Oo4gCQf798hOWjQNxT7+ri18V6BzPvlMvWD6JhIoQ4a9o9xEV2CW67J0oPLj+yV/8r AuazxgOisOZtN1bSP4GvXBLJxxVr9w9Co+qt/MNboPPV+jPvKq7pU14mjk3n6BvxYHVF 4HdHbyYBFBXP/oW9sw72qIn4vE+exzRUb/6alBDpHXxtBP2TBO1zNCwWD/xsT+4ApU1H j5/6x/jW/Do3RjeeG3XszrY9+NK6LXLZA6sMzbkysCGfZ7Na6ZRkAmMvtVsQZaq22W+u 5Dt2ETjz11VCSlbzrbFyiG83lfzm8og8Ndk0K6GBAhfGCgmsfZT0C7/P1xDArctkdoDR 3r6Q== X-Gm-Message-State: ALoCoQnKTAkzJeXPr3ZYb/Fww8vtxP7Wci/52jOcCK0bvwJmfgtm1mPL1lhgDLHPwfEfKBgnR35A X-Received: by 10.194.246.39 with SMTP id xt7mr3176355wjc.4.1413268356425; Mon, 13 Oct 2014 23:32:36 -0700 (PDT) Received: from localhost.localdomain (port-195-158-157-135.static.isionline-dialin.de. [195.158.157.135]) by mx.google.com with ESMTPSA id i1sm14499575wix.23.2014.10.13.23.32.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Oct 2014 23:32:35 -0700 (PDT) From: Jean-Michel Hautbois To: broonie@kernel.org, fabio.estevam@freescale.com, alsa-devel@alsa-project.org Date: Tue, 14 Oct 2014 08:32:21 +0200 Message-Id: <1413268341-3743-3-git-send-email-jean-michel.hautbois@vodalys.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1413268341-3743-1-git-send-email-jean-michel.hautbois@vodalys.com> References: <1413268341-3743-1-git-send-email-jean-michel.hautbois@vodalys.com> Cc: nicoleotsuka@gmail.com, devicetree@vger.kernel.org, Jean-Michel Hautbois Subject: [alsa-devel] [PATCH 2/2] audio: sgtl5000: Add MicBias voltage support 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 Some systems may require to specify a bias different than default (1.25V). This adds a property in sgtl5000 codec. The property is specified in milli-volts so that it is coherent with datasheet. Signed-off-by: Jean-Michel Hautbois --- Documentation/devicetree/bindings/sound/sgtl5000.txt | 7 ++++++- sound/soc/codecs/sgtl5000.c | 13 +++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/sgtl5000.txt b/Documentation/devicetree/bindings/sound/sgtl5000.txt index d6ec927..1aab403 100644 --- a/Documentation/devicetree/bindings/sound/sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/sgtl5000.txt @@ -13,6 +13,10 @@ Required properties: If this node is not mentioned or if the value is unknown, then micbias resistor is set to 4K. +- micbias-voltage-m-volts : the bias voltage to be used in mVolts + The voltage can take values from 1.25V to 3V by 250mV steps + If this node is not mentionned or the value is unknown, then + the value is set to 1.25V. Example: @@ -20,5 +24,6 @@ codec: sgtl5000@0a { compatible = "fsl,sgtl5000"; reg = <0x0a>; clocks = <&clks 150>; - sgtl5000-micbias-resistor = <1>; + micbias-resistor-k-ohms = <2>; + micbias-voltage-m-volts = <2250>; }; diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index f0b40a6..cb77231 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -140,6 +140,7 @@ struct sgtl5000_priv { struct clk *mclk; int revision; u8 micbias_resistor; + u8 micbias_voltage; }; /* @@ -1341,6 +1342,9 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) SGTL5000_BIAS_R_MASK, sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT); + snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, + SGTL5000_BIAS_R_MASK, + sgtl5000->micbias_voltage << SGTL5000_BIAS_R_SHIFT); /* * disable DAP * TODO: @@ -1510,10 +1514,19 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, /* default is 4Kohms */ sgtl5000->micbias_resistor = 2; } + if (!of_property_read_u32(np, + "micbias-voltage-m-volts", &value)) { + /* 1250mV => 0 */ + /* steps of 250mV */ + if ((value >= 1250) && (value <= 3000)) + sgtl5000->micbias_voltage = (value / 250) - 5; + else { + sgtl5000->micbias_voltage = 0; dev_err(&client->dev, "Unsuitable MicBias resistor\n"); } } else { + sgtl5000->micbias_voltage = 0; } }