From patchwork Tue Oct 14 06:43:12 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: 5078251 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 5FAFB9F349 for ; Tue, 14 Oct 2014 06:44:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7841220148 for ; Tue, 14 Oct 2014 06:44:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 45F4C20131 for ; Tue, 14 Oct 2014 06:44:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5777C2606C9; Tue, 14 Oct 2014 08:44:32 +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 48E4426051B; Tue, 14 Oct 2014 08:43:33 +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 84B43260506; Tue, 14 Oct 2014 08:43:30 +0200 (CEST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by alsa0.perex.cz (Postfix) with ESMTP id 82DB72604BB for ; Tue, 14 Oct 2014 08:43:23 +0200 (CEST) Received: by mail-wi0-f181.google.com with SMTP id hi2so9221664wib.14 for ; Mon, 13 Oct 2014 23:43:23 -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=zcLvc1Yyn63y1MMR0o8++iwVVpCYugwLTTTUgDvehxM=; b=YtVhJLl6lR/679+S/sFsrHipi9tPM+8OHi3wJowgYTtVGvQRGOrzuoHtfg1B3RtunC zOnoy53zJfh25OQhqY7JhhJbAj5qdsoy62LnfHxo20U7qyvqjd2fuY043bxGuSb4iKGS rpMKWZ2IKUbWAV6NkOj0rk7hqGqL0TTC0CNibS0Nfq1mG2Iq7Rm/J8YoSgqnfIlffsdc /oFaGXPP+Yc4Ra6JdgAdwOOWlpXRsy+en20roLm4GrHwsN9vVowMJOb2YqlxYJyBMRf8 ySnW8XUF/dvfJezOOkVyzTn5qYMxequ2gNablVy91Ug0MRenac+vXOHlYXr33M3/NMgL eiog== X-Gm-Message-State: ALoCoQkWBKVwGZsAS4YMyeWLeCOPeWiGKF65l0LpfmYFwPJoKHehU7EYag4Xct46b8yW2QKDOVt6 X-Received: by 10.180.96.10 with SMTP id do10mr3592532wib.16.1413269002244; Mon, 13 Oct 2014 23:43:22 -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 bq8sm8737118wjb.6.2014.10.13.23.43.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Oct 2014 23:43:21 -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:43:12 +0200 Message-Id: <1413268992-15248-3-git-send-email-jean-michel.hautbois@vodalys.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1413268992-15248-1-git-send-email-jean-michel.hautbois@vodalys.com> References: <1413268992-15248-1-git-send-email-jean-michel.hautbois@vodalys.com> Cc: nicoleotsuka@gmail.com, devicetree@vger.kernel.org, Jean-Michel Hautbois Subject: [alsa-devel] [PATCH v2 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 b2c2ed7..8611cfb 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; } }