Received: by 10.192.165.148 with SMTP id m20csp3525994imm; Mon, 30 Apr 2018 01:33:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpb1x6/qXnFuK9GrWpZEKg+ZMrWmtqpYTs1hS+5dH7CkITzxotGUzMYlkBbP+1EudJDzT0R X-Received: by 2002:a17:902:7601:: with SMTP id k1-v6mr11433275pll.1.1525077235255; Mon, 30 Apr 2018 01:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525077235; cv=none; d=google.com; s=arc-20160816; b=MBLmFBmE8f8LR+nB8QTZBltyiDPjF4fDuYmILSaOHT3uyjQx/5QTDF0W1eBw45oQeH bTZKN+qJUlK02D9WUc5UZcXMq4BP2Wi8grPTJzG6e/4DOj0IGwNYVeD/WT/yhdxIrq9y x3LLcdK5pw612gk4VmhmSgJhQtFp2qLGTfpan4BZc0sHP2eSas+rjEcM7C40qRBAN1X4 w4syM+VcnJ/xD8N9FZW+4Kup8bs/NnzEUEVHIGlHfoA8W7kquv1Bf+41GaMzfSux9bVp /gYv24CsWvkOsUwiPYPp4XIm52a3cP16L4sk4wW2ogJMksCXRoUTH+1Em0zGbjLwm0FA gK0A== 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=GqrVJS2pr6wvwAO3glFpqXTpXKLFhtJ578wdcIv3mRM=; b=wHg7HkqMxziYSSxfJb81kHGdX8C5fsJG4f5TMHYmvkzAm7OA8Zh5l0Rfdvtvrkgwxj /DCcJHQsdTNsfRMYJzxQFdy1424GXotWu0Hoo/LPx7gPJNotOIA99dydzM/HxFnZW1CO 1Y9Mf1yJBfMYFlrTRyGy5tBD9NCxXjpAuQ0agbWXZtqIDlNk8FOMMXqueqfEGnn0Agcl t6FcVGzVgGCkI15LGJyfVRZIMY8O5HdPwAfZGaQk4ajkujWb7owvr+GGuTfMgYOVsw+E J/YvTOl/3Z7MP3WQyhYZEN8IrgRLeseaiIMBfi2D2LHY6A7vL98o5JjtGWtnDO2/nX60 iciw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=nUlU2CMg; 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 e188si7108659pfe.103.2018.04.30.01.33.40; Mon, 30 Apr 2018 01:33:55 -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=nUlU2CMg; 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 S1752545AbeD3IbV (ORCPT + 99 others); Mon, 30 Apr 2018 04:31:21 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:39106 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751306AbeD3IbT (ORCPT ); Mon, 30 Apr 2018 04:31:19 -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 w3U8UYwB017501; Mon, 30 Apr 2018 03:30:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1525077034; bh=pOYeOvBMlvJcwju9MVXVYMftRuF4Smncf0z7LU0rweQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nUlU2CMgf/4JrHv2VC4Li8ECd588cVFep+dh/ctKexfxnIjOBO4PIPyB0Z3Eh9HhP MFQbQKvV2f/D3VnnpUFgxTs09iPtUAeV1j2UyPTCleucTu+6nmEOo25QRELmJ2uW1c IfjGtHWDrRSuV/ZMcqhD0KLCY96aZ2KkZmN2/EGc= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3U8UYJG019319; Mon, 30 Apr 2018 03:30:34 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 30 Apr 2018 03:30:33 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 30 Apr 2018 03:30:33 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3U8UWYY019357; Mon, 30 Apr 2018 03:30:33 -0500 From: Jean-Jacques Hiblot To: , , , , CC: , , , , , Jean-Jacques Hiblot Subject: [PATCH v3 1/3] ASoC: tas6424: Add support for the standby pin Date: Mon, 30 Apr 2018 10:30:16 +0200 Message-ID: <1525077018-15863-2-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525077018-15863-1-git-send-email-jjhiblot@ti.com> References: <1525077018-15863-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 Reviewed-by: Rob Herring --- .../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