Received: by 10.192.165.148 with SMTP id m20csp747683imm; Fri, 27 Apr 2018 06:58:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqFjLgJ/R3VDJpUZk2qQssV+KHzaozLqwOP8yD7hFMdnaw7sOs5PnKdC7WZH7syZ8Z4Nq1a X-Received: by 2002:a63:9711:: with SMTP id n17-v6mr2191263pge.171.1524837494449; Fri, 27 Apr 2018 06:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524837494; cv=none; d=google.com; s=arc-20160816; b=SQZvrILMEHY8kyIkSGhDdUM5ehofFLH1KQ2bQvHPWfhRbsoaR2wwwdQVcwz5VFLeVy KLkzVq+4cK05XI+RrzfY9ibWNppGvj2Y3DR0UwF2VJnGaoAdOQ01AI5Hsd//e70NUctb si3wWe5hm2YiieSlxMPjpgGv+BA67RGazKokkUegPK5CawEDg4yjtH+7FMw045LVst6A 4AouxKDB+KOYNyo10PMjp8l+YyhnQtZqxdzl/IHSbdrgDb1f5NYc3YpmkTh8DkVXEiWA bmvRK1g/9vkteBeN4T9nR/mH1YPbm4vv7bJN1nM7xcGzwIerXc4ePSQ6NAP9EX3TVTCY ZGIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=mugiIJyB2QkRMoSD/Oc9kEmKrdcauea5JCFKB0peLMM=; b=z/jMa2xEl55OGk0I+xBiwwHY3d2zevw/e+ZOTjwjVeLS/j3XDgUHaS8T1KfusyL24O oG1Z8JFUKTNqaHLC9n4+9Ph0h64yeojhAc19yJssAT2kFnxW3amTsdRtoh50PafwxoMd kA3EfoxQnfvw3Dits5d/2joYk8UGvotNG02CiNOUbopXWWAimWUMwSg3imH2nzCBIzA8 G+cPOJVyZ7xJIkzSyMi+oeriRyzDo8FVDIeCkyEVRSatGS67Qp2bWkjwlICqSSPoBqoI xcOxQ6vrYC2cmR+U8ukzgRY+oYXn90vqzgaMiPkMB8wUghPZNU+2Dk0PLOp4NACMmUH6 tXdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TelKObWP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h62si1309168pfg.308.2018.04.27.06.57.59; Fri, 27 Apr 2018 06:58:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TelKObWP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932497AbeD0N4q (ORCPT + 99 others); Fri, 27 Apr 2018 09:56:46 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:20612 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758529AbeD0N4o (ORCPT ); Fri, 27 Apr 2018 09:56:44 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3RDttd6031999; Fri, 27 Apr 2018 08:55:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524837355; bh=0l/wYa3iQ52I2JzANNHKVVd8t2hiFHUka6eJbPMGxl8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TelKObWPpklv3VDr8OlGhb74EhcgDtSt04JayhVgXw2+hCHjOeQFjXsc0Cpsxoa3m OJuY+rEzJ6R5KrQmfnUcMIfW8x4RaNSLUAibLkFkBT8RqhMr//pQfEgBLrb3D8uVLY KNLVGXCcnYl2eT0Mpco+FUSSV7nIzND68AZB355E= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3RDtt0r000597; Fri, 27 Apr 2018 08:55:55 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 27 Apr 2018 08:55:55 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 27 Apr 2018 08:55:55 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3RDtskW012651; Fri, 27 Apr 2018 08:55:55 -0500 From: Jean-Jacques Hiblot To: , , , , CC: , , , , , Jean-Jacques Hiblot Subject: [PATCH v2 1/3] ASoC: tas6424: Add support for the standby pin Date: Fri, 27 Apr 2018 15:55:47 +0200 Message-ID: <1524837349-16350-2-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524837349-16350-1-git-send-email-jjhiblot@ti.com> References: <1524837349-16350-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The standby pin can be connected to a GPIO. In that case we have to drive it to the correct values for the TAS6424 to operate properly. Signed-off-by: Jean-Jacques Hiblot --- .../devicetree/bindings/sound/ti,tas6424.txt | 1 + sound/soc/codecs/tas6424.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/ti,tas6424.txt b/Documentation/devicetree/bindings/sound/ti,tas6424.txt index 1c4ada0..df71e41 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas6424.txt +++ b/Documentation/devicetree/bindings/sound/ti,tas6424.txt @@ -6,6 +6,7 @@ Required properties: - compatible: "ti,tas6424" - TAS6424 - reg: I2C slave address - sound-dai-cells: must be equal to 0 + - standby-gpios: GPIO used to shut the TAS6424 down. Example: diff --git a/sound/soc/codecs/tas6424.c b/sound/soc/codecs/tas6424.c index 4f3a16c..5abb17f 100644 --- a/sound/soc/codecs/tas6424.c +++ b/sound/soc/codecs/tas6424.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -43,6 +44,7 @@ struct tas6424_data { unsigned int last_fault1; unsigned int last_fault2; unsigned int last_warn; + struct gpio_desc *standby_gpio; }; /* @@ -627,6 +629,22 @@ static int tas6424_i2c_probe(struct i2c_client *client, return ret; } + /* + * Get control of the standby pin and set it LOW to take the codec + * out of the stand-by mode. + * Note: The actual pin polarity is taken care of in the GPIO lib + * according the polarity specified in the DTS. + */ + tas6424->standby_gpio = devm_gpiod_get_optional(dev, "standby", + GPIOD_OUT_LOW); + if (IS_ERR(tas6424->standby_gpio)) { + if (PTR_ERR(tas6424->standby_gpio) == -EPROBE_DEFER) + return -EPROBE_DEFER; + dev_info(dev, "failed to get standby GPIO: %ld\n", + PTR_ERR(tas6424->standby_gpio)); + tas6424->standby_gpio = NULL; + } + for (i = 0; i < ARRAY_SIZE(tas6424->supplies); i++) tas6424->supplies[i].supply = tas6424_supply_names[i]; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(tas6424->supplies), @@ -671,6 +689,10 @@ static int tas6424_i2c_remove(struct i2c_client *client) cancel_delayed_work_sync(&tas6424->fault_check_work); + /* put the codec in stand-by */ + if (tas6424->standby_gpio) + gpiod_set_value_cansleep(tas6424->standby_gpio, 1); + ret = regulator_bulk_disable(ARRAY_SIZE(tas6424->supplies), tas6424->supplies); if (ret < 0) { -- 2.7.4