Received: by 10.192.165.148 with SMTP id m20csp64489imm; Fri, 20 Apr 2018 03:06:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx49MqmgFHVeGoW5yvzJE9UzCwAkuTNgD48Khq/bdQiw5yG0Ga+Og3OijY6NdNT9Q0vniOalZ X-Received: by 10.99.115.81 with SMTP id d17mr7809530pgn.297.1524218786639; Fri, 20 Apr 2018 03:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524218786; cv=none; d=google.com; s=arc-20160816; b=gnaISx3QRkgR+/k8c6A9S2lCVTcqY+/z4MgQPdzBtob45gJuqjzRtb5lDbbM2FjLA3 0I5MjPonNLrFLqj/Hns34p+GYqflBWGpMM41ZWhZIBkcJ9afnHm7OhKJpgUeNNU9+SL2 1ktCJNBZhjcxU1Kbg/J73ulklOs8cBycdMFRcEVd0AhGpTf7c9fnkkmr0HcmNesRcw/F ZuiXAhL7oarqYKciAOyXfxG6LpqExlGzmB3moI+Kzyv/ZdIOxjoSdpCWzNwoipKWDr5v LA03YpxNfIRskLfWwtKn5J53Nqg87lHumcc5WLSwmv6Iz6J4t/ULn1+PKZXQXSJ7Xl2r xqkA== 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=Grdcw4xvkeuiYAxDK9Aa6/tZZyCUY1DSOM5Xselc1C8=; b=qx4qyOP9BWqC75TbM7eV2oK2riE9JOPDlxLZHseB29F9xXy810b83avynI127PWryh 11SromRa+G7EmrikdGCftbY8KmjbWiEQpIO9IECZIGhJVqhijhys7qjXGzaNG7bfNccM 9p4AWVkEGvL+HBxCjajxdPVFa9TJeoGc9MoyqsqpVECeNsBviyDy9dlLgmFVjDc+KBGM btV/+ZxcsYMpny98hphinVUlT2YRybTT2ROWpPyaatrnB4AXwD+SSR1H2YspliR6QCl0 Rv4dYmf3wQdif9Nk7ELjCVTfFImZj21FC+9i2msC9/dJe5kaUpKWJ0wAHFayhTC1WbDZ IHgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DH0uVIm6; 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 m39-v6si5501033plg.570.2018.04.20.03.06.12; Fri, 20 Apr 2018 03:06:26 -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=DH0uVIm6; 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 S1754478AbeDTKFJ (ORCPT + 99 others); Fri, 20 Apr 2018 06:05:09 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:60371 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754290AbeDTKFG (ORCPT ); Fri, 20 Apr 2018 06:05:06 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3KA4olQ032586; Fri, 20 Apr 2018 05:04:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524218690; bh=0IN6K05v+teynA2a50u96iB+dcyRb8DJwNUrFkJhseQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=DH0uVIm6H9c6vuY8bcUsSlMy1jSB7kt+c9LAki4fFdGb+NvX1n/gIrUzUVhpTdcTV UHem7BGTvgWtsAvKSYswik0klnszjAkvCjf+2VQ+AebZdH2NYP5YxoWIKVxEStIlin pdamLn5495KTDbwkMX2Mh5LxEB/9hRT4CyIxddCg= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3KA4oHD007931; Fri, 20 Apr 2018 05:04:50 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 20 Apr 2018 05:04:50 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 20 Apr 2018 05:04:50 -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 w3KA4ni0031467; Fri, 20 Apr 2018 05:04:49 -0500 From: Jean-Jacques Hiblot To: , , , , CC: , , , , , Jean-Jacques Hiblot Subject: [PATCH 2/3] ASoC: tas6424: Add support for the standby pin Date: Fri, 20 Apr 2018 12:04:43 +0200 Message-ID: <1524218684-19752-3-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524218684-19752-1-git-send-email-jjhiblot@ti.com> References: <1524218684-19752-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 bf2ff98..82c6d48 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas6424.txt +++ b/Documentation/devicetree/bindings/sound/ti,tas6424.txt @@ -8,6 +8,7 @@ Required properties: - sound-dai-cells: must be equal to 0 - disable-auto-diagnostics: disable DC auto diagnostics (faster power on, but less safe as shortage won't be detected) + - standby-gpio: GPIO used to shut the TAS6424 down. Example: diff --git a/sound/soc/codecs/tas6424.c b/sound/soc/codecs/tas6424.c index 5cee400..926259a 100644 --- a/sound/soc/codecs/tas6424.c +++ b/sound/soc/codecs/tas6424.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -44,6 +45,7 @@ struct tas6424_data { unsigned int last_fault2; unsigned int last_warn; bool no_auto_diags; + struct gpio_desc *standby_gpio; }; /* @@ -632,6 +634,22 @@ static int tas6424_i2c_probe(struct i2c_client *client, tas6424->no_auto_diags = of_property_read_bool(dev->of_node, "disable-auto-diagnostics"); + /* + * 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 standvby 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), @@ -691,6 +709,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