From patchwork Fri Sep 26 16:57:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatol Pomozov X-Patchwork-Id: 4986521 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 5E1D99FAAF for ; Fri, 26 Sep 2014 16:58:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 829AD2022D for ; Fri, 26 Sep 2014 16:58:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D3EC2201ED for ; Fri, 26 Sep 2014 16:58:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BC31A2604D6; Fri, 26 Sep 2014 18:58:11 +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, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 4C90C2604CB; Fri, 26 Sep 2014 18:58:04 +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 E07C72604CB; Fri, 26 Sep 2014 18:58:00 +0200 (CEST) Received: from mail-pd0-f202.google.com (mail-pd0-f202.google.com [209.85.192.202]) by alsa0.perex.cz (Postfix) with ESMTP id 5A07B2604CC for ; Fri, 26 Sep 2014 18:57:52 +0200 (CEST) Received: by mail-pd0-f202.google.com with SMTP id r10so2173851pdi.1 for ; Fri, 26 Sep 2014 09:57:50 -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; bh=SX6cHb92BWcW+wEDI4HHxVXSV5v0V7SXzLvO7gge6gM=; b=PY7qUO6mjtDAJ1M4ToZDC/0+xLMBjwlT7zbhzkqpxxUO+LKyQz/ao9OV+ti5QTjUdP eJVve5+YP5ZElD9SHe9bmK/BMioKR7DPGlgR51bI1e7QOrIN8SRcYqSMS6qAb/4NdgYk xZPLbsojDE1wipFcXP/G47DGeSg2LALBCkltLj1s1qMLHw8aK8e6MAJY6cnGL00dESID WemgWbOX5hHM8BqKyRkcTMYpEUFpRp4xHJk6XvhGPIG0fO2QzsTQ5EdE/KZAvKdI+oqc XRSMoNDbJr6aE9hQy7Nr93EBbPVUQJwbpICieT2Pl3F+E620v+Npq0mtqkLmtKFB16eF 9xZQ== X-Gm-Message-State: ALoCoQnRJn6kkSnMjGuR9TOAJomrFBJ+rWUfk+aAuxHzrxXwK8LZkSpqgXxMVTVPmf/QEmvc4ETyEw5aCUVwVmrqV37yFvJ6gpxdFZ5LZde0XZEKncsPDN0f9WIFb3dsQhXnnlssLMHTrDkZPFj/abXYLXzJJn2NGH+pbWMQGHYHSkYuCzPkhl0= X-Received: by 10.70.96.239 with SMTP id dv15mr17830605pdb.3.1411750669331; Fri, 26 Sep 2014 09:57:49 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id f102si325574yhp.7.2014.09.26.09.57.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Sep 2014 09:57:49 -0700 (PDT) Received: from anatol.mtv.corp.google.com ([172.22.64.197]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id hWj3uSjb.1; Fri, 26 Sep 2014 09:57:49 -0700 Received: by anatol.mtv.corp.google.com (Postfix, from userid 67983) id 73E791003BC; Fri, 26 Sep 2014 09:57:48 -0700 (PDT) From: Anatol Pomozov To: broonie@kernel.org, bardliao@realtek.com, oder_chiou@realtek.com Date: Fri, 26 Sep 2014 09:57:27 -0700 Message-Id: <1411750647-10134-1-git-send-email-anatol.pomozov@gmail.com> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 Cc: alsa-devel@alsa-project.org, Anatol Pomozov Subject: [alsa-devel] [PATCH] ASoC: rt5677: Add dts properties for input/output differential configuration 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 Signed-off-by: Anatol Pomozov --- Documentation/devicetree/bindings/sound/rt5677.txt | 9 +++++++++ include/sound/rt5677.h | 5 ++++- sound/soc/codecs/rt5677.c | 23 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/rt5677.txt b/Documentation/devicetree/bindings/sound/rt5677.txt index bd28df6..0701b83 100644 --- a/Documentation/devicetree/bindings/sound/rt5677.txt +++ b/Documentation/devicetree/bindings/sound/rt5677.txt @@ -19,6 +19,14 @@ Optional properties: - realtek,pow-ldo2-gpio : The GPIO that controls the CODEC's POW_LDO2 pin. +- realtek,in1-differential +- realtek,in2-differential +- realtek,lout1-differential +- realtek,lout2-differential +- realtek,lout3-differential + Boolean. Indicate MIC1/2 input and LOUT1/2/3 outputs are differential, + rather than single-ended. + Pins on the device (for linking into audio routes): * IN1P @@ -47,4 +55,5 @@ rt5677 { realtek,pow-ldo2-gpio = <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>; + realtek,in1-differential = "true"; }; diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h index a676717..082670e 100644 --- a/include/sound/rt5677.h +++ b/include/sound/rt5677.h @@ -19,9 +19,12 @@ enum rt5677_dmic2_clk { struct rt5677_platform_data { - /* IN1 IN2 can optionally be differential */ + /* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */ bool in1_diff; bool in2_diff; + bool lout1_diff; + bool lout2_diff; + bool lout3_diff; /* DMIC2 clock source selection */ enum rt5677_dmic2_clk dmic2_clk_pin; }; diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index cecbdb1..16aa4d9 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -3566,6 +3566,17 @@ MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id); static int rt5677_parse_dt(struct rt5677_priv *rt5677, struct device_node *np) { + rt5677->pdata.in1_diff = of_property_read_bool(np, + "realtek,in1-differential"); + rt5677->pdata.in2_diff = of_property_read_bool(np, + "realtek,in2-differential"); + rt5677->pdata.lout1_diff = of_property_read_bool(np, + "realtek,lout1-differential"); + rt5677->pdata.lout2_diff = of_property_read_bool(np, + "realtek,lout2-differential"); + rt5677->pdata.lout3_diff = of_property_read_bool(np, + "realtek,lout3-differential"); + rt5677->pow_ldo2 = of_get_named_gpio(np, "realtek,pow-ldo2-gpio", 0); @@ -3657,6 +3668,18 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, regmap_update_bits(rt5677->regmap, RT5677_IN1, RT5677_IN_DF2, RT5677_IN_DF2); + if (rt5677->pdata.lout1_diff) + regmap_update_bits(rt5677->regmap, RT5677_LOUT1, + RT5677_LOUT1_L_DF, RT5677_LOUT1_L_DF); + + if (rt5677->pdata.lout2_diff) + regmap_update_bits(rt5677->regmap, RT5677_LOUT1, + RT5677_LOUT2_L_DF, RT5677_LOUT2_L_DF); + + if (rt5677->pdata.lout3_diff) + regmap_update_bits(rt5677->regmap, RT5677_LOUT1, + RT5677_LOUT3_L_DF, RT5677_LOUT3_L_DF); + if (rt5677->pdata.dmic2_clk_pin == RT5677_DMIC_CLK2) { regmap_update_bits(rt5677->regmap, RT5677_GEN_CTRL2, RT5677_GPIO5_FUNC_MASK,