From patchwork Thu Dec 11 04:15:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Zhang X-Patchwork-Id: 5474161 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 B4A189F1D4 for ; Thu, 11 Dec 2014 04:17:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C61AA2018E for ; Thu, 11 Dec 2014 04:17:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 834BA20160 for ; Thu, 11 Dec 2014 04:17:20 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8A50E265066; Thu, 11 Dec 2014 05:17:19 +0100 (CET) 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,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 9A0CA26155E; Thu, 11 Dec 2014 05:16:05 +0100 (CET) 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 1975A26155E; Thu, 11 Dec 2014 05:16:05 +0100 (CET) Received: from mail-qc0-f202.google.com (mail-qc0-f202.google.com [209.85.216.202]) by alsa0.perex.cz (Postfix) with ESMTP id 17560260719 for ; Thu, 11 Dec 2014 05:15:54 +0100 (CET) Received: by mail-qc0-f202.google.com with SMTP id i17so262184qcy.1 for ; Wed, 10 Dec 2014 20:15:53 -0800 (PST) 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=ImLnr99V1JsceKvvF8sCnf32s4musata+kGHOaph5w4=; b=QjAJwhlg/jt+2/YxrLBoDCvMNhnGAfw78wCKvUC1YOYBcjVMnC2RvOLEHp5jSf1aUb JV/XAJxF2ly+tVvaJksY5GCVAgF0byYWZCePv/q3cEJo9zWTNVl9rH82pooaGwur12bb VZD6UjqIDTVkCnwi0QNyeYtNwB3dn1aLZyZFae7PVbsYq9BlA+G9Yo0dSxEkZB7CsMBE gMPtDjI5hPBBYEdw9LnJoWHKYn1ICSYoT5QYORHWExbyg0OfApWmd0ycep9VNyCjtBs9 /jCvbmqSs2YeJ/hWMusmzq6zRd8tWCUIS/MenacweE4c5druPJevbdGOYMk+dy+79tI8 pSYg== X-Gm-Message-State: ALoCoQmWOZo2Qf7sAWAwU+YhWaLHVgcTQqb7A1Nej9NLuhJ7MIgMPi8RL4X14WIgHyAKZUxqCJFlye2HGksNlbtCWKmj5XTwbyyyW161TGvkU9YKTU0lF9yhyvzm7PPAYQUQHcLrNYLJ6IPlEiMfsiMKOfCsijk0T34vjBr4MDOYm4Yr7LruoXw= X-Received: by 10.236.207.136 with SMTP id n8mr7680077yho.5.1418271353263; Wed, 10 Dec 2014 20:15:53 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id t24si216132yht.2.2014.12.10.20.15.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Dec 2014 20:15:53 -0800 (PST) Received: from benzh.mtv.corp.google.com ([172.22.65.67]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id ngaWaDiJ.1; Wed, 10 Dec 2014 20:15:53 -0800 Received: by benzh.mtv.corp.google.com (Postfix, from userid 215530) id 11805E0495; Wed, 10 Dec 2014 20:15:52 -0800 (PST) From: Ben Zhang To: Mark Brown Date: Wed, 10 Dec 2014 20:15:27 -0800 Message-Id: <1418271327-14710-3-git-send-email-benzh@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1418271327-14710-1-git-send-email-benzh@chromium.org> References: <1418271327-14710-1-git-send-email-benzh@chromium.org> Cc: Oder Chiou , alsa-devel@alsa-project.org, Ben Zhang , Liam Girdwood , linux-kernel@vger.kernel.org, Albert Chen , Anatol Pomozov , Bard Liao , Dylan Reid Subject: [alsa-devel] [PATCH 3/3] ASoC: rt5677: add a platform config option for DACREF source 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 DACREF power source can come from external 1.8V or codec internal 1.8V. This patch adds the option to enable the internal DACREF power source. Signed-off-by: Ben Zhang --- Documentation/devicetree/bindings/sound/rt5677.txt | 3 +++ include/sound/rt5677.h | 2 ++ sound/soc/codecs/rt5677.c | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/rt5677.txt b/Documentation/devicetree/bindings/sound/rt5677.txt index f54d0dd..f06d52a 100644 --- a/Documentation/devicetree/bindings/sound/rt5677.txt +++ b/Documentation/devicetree/bindings/sound/rt5677.txt @@ -22,6 +22,9 @@ Optional properties: - realtek,micbias1 Select 0/1/2/3 to set MICBIAS1 voltage to 1.476V/2.970V/1.242V/2.475V +- realtek,internal-dacref-en + Select codec internal 1.8V as DACREF source optionally. + - realtek,in1-differential - realtek,in2-differential - realtek,lout1-differential diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h index efa74bb..42866f3 100644 --- a/include/sound/rt5677.h +++ b/include/sound/rt5677.h @@ -28,6 +28,8 @@ enum rt5677_dmic2_clk { struct rt5677_platform_data { /* MICBIAS output voltage control */ enum rt5677_micbias micbias1; + /* Select codec internal 1.8V as DACREF source optionally */ + bool internal_dacref_en; /* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */ bool in1_diff; bool in2_diff; diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index ac4bee8..e6d7bb4 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4552,6 +4552,8 @@ MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id); static int rt5677_parse_dt(struct rt5677_priv *rt5677, struct device_node *np) { of_property_read_u32(np, "realtek,micbias1", &rt5677->pdata.micbias1); + rt5677->pdata.internal_dacref_en = of_property_read_bool(np, + "realtek,internal-dacref-en"); rt5677->pdata.in1_diff = of_property_read_bool(np, "realtek,in1-differential"); rt5677->pdata.in2_diff = of_property_read_bool(np, @@ -4728,6 +4730,13 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, RT5677_MICBIAS1_CTRL_VDD_MASK, rt5677->pdata.micbias1 << RT5677_MICBIAS1_CTRL_VDD_SFT); + if (rt5677->pdata.internal_dacref_en) { + regmap_update_bits(rt5677->regmap, RT5677_PR_BASE + + RT5677_TEST_CTRL1, 1 << 9, 1 << 9); + regmap_update_bits(rt5677->regmap, RT5677_PR_BASE + + RT5677_SOFT_DEPOP_DAC_CLK_CTRL, 1 << 5, 1 << 5); + } + if (rt5677->pdata.in1_diff) regmap_update_bits(rt5677->regmap, RT5677_IN1, RT5677_IN_DF1, RT5677_IN_DF1);