From patchwork Fri Jul 17 17:38:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatol Pomozov X-Patchwork-Id: 6818401 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D434FC05AC for ; Fri, 17 Jul 2015 17:39:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E2CF7207A4 for ; Fri, 17 Jul 2015 17:39:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8BA0B207A0 for ; Fri, 17 Jul 2015 17:39:55 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 48EB026065A; Fri, 17 Jul 2015 19:39:53 +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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A3FD9260699; Fri, 17 Jul 2015 19:39: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 E79302606A8; Fri, 17 Jul 2015 19:39:49 +0200 (CEST) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by alsa0.perex.cz (Postfix) with ESMTP id DA59026062C for ; Fri, 17 Jul 2015 19:39:42 +0200 (CEST) Received: by pdjr16 with SMTP id r16so65848253pdj.3 for ; Fri, 17 Jul 2015 10:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=zD5leXZ4aFpfNSxtIbiYmS9KdXbZRBGnJYEuxtSJYwg=; b=JMdwdwxC/6CAE47D6EBlnqqTHm0+055VWS/a0rzTASiD+5C+qdq8FLVzHDAis2RUgW wztCV1Qn8AVJIKPeGfA7uOmN7c0ues4Ofs2r4zM7LpSoUFJ0e9Fu0v3dq6Evkg1Hz9Rb IOhBfFA1RDzefcS/0ccUpEmZbxi/MZwLjW6/HIMbDgTu8ntl8pIrOk93T3Tyb35ENPGT QZqnmuwrk2unobL/Ft02tQiIVYVd/24c28sf/MIXOfTrdlEmoYu1ylnuQqdc34gO7KpD 0pg/JHjHaPFcqDoBwb+HWSskb7Yfhbwas/uBozeBA50q3djL5Vij4USRHLxyEEM2TDX2 8BaQ== X-Received: by 10.68.238.39 with SMTP id vh7mr32293411pbc.12.1437154781419; Fri, 17 Jul 2015 10:39:41 -0700 (PDT) Received: from anatol.mtv.corp.google.com ([172.22.64.197]) by smtp.gmail.com with ESMTPSA id kw5sm11915489pab.29.2015.07.17.10.39.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jul 2015 10:39:40 -0700 (PDT) From: Anatol Pomozov To: alsa-devel@alsa-project.org Date: Fri, 17 Jul 2015 10:38:56 -0700 Message-Id: <1437154736-15320-1-git-send-email-anatol.pomozov@gmail.com> X-Mailer: git-send-email 2.4.3.573.g4eafbef Cc: oder_chiou@realtek.com, broonie@kernel.org, Anatol Pomozov Subject: [alsa-devel] [PATCH] ASoC: rt5677: handle reset_pin logical state correctly 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 According to the datasheet RESET is active low pin, i.e. system goes to reset state when pin is low. Handle logic state correctly - set reset_pin to logical 0 at boot time, and set it to logical 1 when we need to reset the chip. Signed-off-by: Anatol Pomozov --- Documentation/devicetree/bindings/sound/rt5677.txt | 2 +- sound/soc/codecs/rt5677.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/rt5677.txt b/Documentation/devicetree/bindings/sound/rt5677.txt index f070789..1b3c13d 100644 --- a/Documentation/devicetree/bindings/sound/rt5677.txt +++ b/Documentation/devicetree/bindings/sound/rt5677.txt @@ -18,7 +18,7 @@ Required properties: Optional properties: - realtek,pow-ldo2-gpio : The GPIO that controls the CODEC's POW_LDO2 pin. -- realtek,reset-gpio : The GPIO that controls the CODEC's RESET pin. +- realtek,reset-gpio : The GPIO that controls the CODEC's RESET pin. Active low. - realtek,in1-differential - realtek,in2-differential diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 3b46b35..433652f 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -4766,7 +4766,7 @@ static int rt5677_remove(struct snd_soc_codec *codec) if (rt5677->pow_ldo2) gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); if (rt5677->reset_pin) - gpiod_set_value_cansleep(rt5677->reset_pin, 0); + gpiod_set_value_cansleep(rt5677->reset_pin, 1); return 0; } @@ -4783,7 +4783,7 @@ static int rt5677_suspend(struct snd_soc_codec *codec) if (rt5677->pow_ldo2) gpiod_set_value_cansleep(rt5677->pow_ldo2, 0); if (rt5677->reset_pin) - gpiod_set_value_cansleep(rt5677->reset_pin, 0); + gpiod_set_value_cansleep(rt5677->reset_pin, 1); } return 0; @@ -4797,7 +4797,7 @@ static int rt5677_resume(struct snd_soc_codec *codec) if (rt5677->pow_ldo2) gpiod_set_value_cansleep(rt5677->pow_ldo2, 1); if (rt5677->reset_pin) - gpiod_set_value_cansleep(rt5677->reset_pin, 1); + gpiod_set_value_cansleep(rt5677->reset_pin, 0); if (rt5677->pow_ldo2 || rt5677->reset_pin) msleep(10); @@ -5142,7 +5142,7 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, rt5677->pow_ldo2 = 0; } rt5677->reset_pin = devm_gpiod_get_optional(&i2c->dev, - "realtek,reset", GPIOD_OUT_HIGH); + "realtek,reset", GPIOD_OUT_LOW); if (IS_ERR(rt5677->reset_pin)) { ret = PTR_ERR(rt5677->reset_pin); dev_err(&i2c->dev, "Failed to request RESET: %d\n", ret);