Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp322445pxp; Wed, 9 Mar 2022 03:48:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAyIy0AS7F1sWFGgT9to5D2Z14JHKJX9nW/NTCIw4rH1NCSdf7QQb0rci7dtHseRyYf+6P X-Received: by 2002:a17:902:7d81:b0:14f:e18b:2b9e with SMTP id a1-20020a1709027d8100b0014fe18b2b9emr22154589plm.160.1646826482963; Wed, 09 Mar 2022 03:48:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646826482; cv=none; d=google.com; s=arc-20160816; b=xqhuU33sYdUhn+XITq1EVRO0t0j+N8p0mG1WSkfTU/81ZJ/N1ExaOP6ulpf8qrUXxx oKa/H7zbphGo0RZfhvXXTP3M5/vfAP3+UZI92BVdykQpkfQs5pWnx98sMNHtdEQPL7S7 haor/TVyKYIpAkoRmIr7Dvr9XZgWUa5RQEhMd0pxoOaHsf+H2NXJpA+pXUP0dGaL84Br 0V+a0o1nobA3zdsHZwTy4acLZ47zSheWITFI2X9U0r6D1tPXh31HPWwkFDg/DzcuLQcF z4FQtV7pUBhksHDRNqigfRCpaSF1WFmSmoRqEkhKF2WHa+yxJq4t3+hITRu5oHPIkLnl Cj5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z4mmaxHNrXBGVaJHxv43kF3l/Y+f4qiTwxrkpu78Hyo=; b=yNY0hsvp9aN3WkWUyA9aW0NvVWcYtV8fPfLUnws3PcBPcryBeEX/h6+dGplTt/NGFC CRdz+XMRsdg+8pl8lADZZiNx/2AQsrLYkwiqxKhg5ZOUSztlwXU9Lk8c/a0uAo2Gl/oN FZq7eMgm5iPc2lz21oJZ2pjfFYjuJxvk9Ja5ac5YoWGyQx9FpZYSibZ3kSO6QzyIbHh9 Kwl+Y3ve+dGqTl0R6Uag3QQ4AO96SenjUNEuwuKnvfilbLwiS0ub9AgXjMpPs2DqHKMB tDLtL9Rt9z6c5mSsc9uxPhTQtx36xLkgUYtDCKd3iYkYqr6QaRMwwkeYj8n3zS2MO73s 8wVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=BNGp83Ig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i1-20020a17090a65c100b001bf70e727easi4731238pjs.101.2022.03.09.03.47.48; Wed, 09 Mar 2022 03:48:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=BNGp83Ig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231251AbiCIKm3 (ORCPT + 99 others); Wed, 9 Mar 2022 05:42:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbiCIKm3 (ORCPT ); Wed, 9 Mar 2022 05:42:29 -0500 Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA6B4F45A for ; Wed, 9 Mar 2022 02:41:30 -0800 (PST) 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 Cc: John Keeping , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Daniel Beer , linux-kernel@vger.kernel.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 Content-Transfer-Encoding: 8bit X-Authenticated: YES X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.35.1