From patchwork Wed Mar 9 10:41:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 12774915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B148C433F5 for ; Wed, 9 Mar 2022 10:42:13 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4195516EE; Wed, 9 Mar 2022 11:41:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4195516EE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646822531; bh=yt9A+qflCHdq+C7ixRX/Y8Y1rKlJ83WEB+GReFfuRus=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=CcaQ6nOLLOCyNs0j2at2ALCXqUtXENxRH4AFydICZclPfMV8ARFDu4w0xcBdUvEwx G7vQE2R8d27yNosGWxKvsA30Vab99CL5RxQP/7Mdt9Ct8KFS6Imkl4P+f2oBlUcZs2 JuWfyir+x3MeWo/6GVM2IC+2DN0IzqzI2t3e7LO8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CBD47F80158; Wed, 9 Mar 2022 11:41:20 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C25ABF8016C; Wed, 9 Mar 2022 11:41:19 +0100 (CET) Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 64925F80155 for ; Wed, 9 Mar 2022 11:41:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 64925F80155 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=metanate.com header.i=@metanate.com header.b="BNGp83Ig" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Content-Type:Reply-To:Content-ID:Content-Description: In-Reply-To:References; bh=z4mmaxHNrXBGVaJHxv43kF3l/Y+f4qiTwxrkpu78Hyo=; b=BN Gp83IgqHQfM8bfylB5NIE2XSsbWdoAc2n18JGuvGO6ihMcyoLssgBoHx/cpHPocq8NgpNGkOQm9hZ 7ZpJtcRAzNewRg5d8fLVFtp8o81hkdrnXc4CDui0dBeO7S7hufgkSCDYkryRCM3rSDom/IsjLwRBY cyhRL/B8Xbkrv6h6e1HjQcZ3C6fgN+NpC0lrpvfJLhQ+X/CVo5FSZM+H8tQq6Re87GPZmkqcZPKBI 8yP7GnFqOmK2PvdfWQsVt1gVIWBIDyA3f9OhcHx6/l4ASgHEJe3ZjPKD3UmEtXkOjoXcUyOxJwqBx lsTqxIzh5l7d6n/rHZiceo2a+vf4mRFw==; Received: from [81.174.171.191] (helo=donbot.metanate.com) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nRtkj-0008Ez-Sx; Wed, 09 Mar 2022 10:41:09 +0000 From: John Keeping To: alsa-devel@alsa-project.org Subject: [PATCH] ASoC: tas5805m: fix pdn polarity Date: Wed, 9 Mar 2022 10:41:04 +0000 Message-Id: <20220309104104.3605112-1-john@metanate.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Authenticated: YES Cc: linux-kernel@vger.kernel.org, Daniel Beer , Takashi Iwai , Liam Girdwood , Mark Brown , John Keeping X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The binding defines the GPIO as "pdn-gpios" so when the GPIO is active the expectation is that the power down signal is asserted, but the driver swaps this to represent the inverted logic of the electrical signal. The GPIO_ACTIVE_HIGH/LOW flags should be used to identify the inverted logic here with the driver treating power down as active when the mapped GPIO value is 1. Fixes: ec45268467f4 ("ASoC: add support for TAS5805M digital amplifier") Signed-off-by: John Keeping --- sound/soc/codecs/tas5805m.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/tas5805m.c b/sound/soc/codecs/tas5805m.c index fa0e81ec875a..12146a860ef8 100644 --- a/sound/soc/codecs/tas5805m.c +++ b/sound/soc/codecs/tas5805m.c @@ -155,7 +155,7 @@ static const uint32_t tas5805m_volume[] = { struct tas5805m_priv { struct regulator *pvdd; - struct gpio_desc *gpio_pdn_n; + struct gpio_desc *gpio_pdn; uint8_t *dsp_cfg_data; int dsp_cfg_len; @@ -444,11 +444,11 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c) dev_set_drvdata(dev, tas5805m); tas5805m->regmap = regmap; - tas5805m->gpio_pdn_n = devm_gpiod_get(dev, "pdn", GPIOD_OUT_LOW); - if (IS_ERR(tas5805m->gpio_pdn_n)) { + tas5805m->gpio_pdn = devm_gpiod_get(dev, "pdn", GPIOD_OUT_HIGH); + if (IS_ERR(tas5805m->gpio_pdn)) { dev_err(dev, "error requesting PDN gpio: %ld\n", - PTR_ERR(tas5805m->gpio_pdn_n)); - return PTR_ERR(tas5805m->gpio_pdn_n); + PTR_ERR(tas5805m->gpio_pdn)); + return PTR_ERR(tas5805m->gpio_pdn); } /* This configuration must be generated by PPC3. The file loaded @@ -505,7 +505,7 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c) } usleep_range(100000, 150000); - gpiod_set_value(tas5805m->gpio_pdn_n, 1); + gpiod_set_value(tas5805m->gpio_pdn, 0); usleep_range(10000, 15000); /* Don't register through devm. We need to be able to unregister @@ -515,7 +515,7 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c) &tas5805m_dai, 1); if (ret < 0) { dev_err(dev, "unable to register codec: %d\n", ret); - gpiod_set_value(tas5805m->gpio_pdn_n, 0); + gpiod_set_value(tas5805m->gpio_pdn, 1); regulator_disable(tas5805m->pvdd); return ret; } @@ -529,7 +529,7 @@ static int tas5805m_i2c_remove(struct i2c_client *i2c) struct tas5805m_priv *tas5805m = dev_get_drvdata(dev); snd_soc_unregister_component(dev); - gpiod_set_value(tas5805m->gpio_pdn_n, 0); + gpiod_set_value(tas5805m->gpio_pdn, 1); usleep_range(10000, 15000); regulator_disable(tas5805m->pvdd); return 0;