From patchwork Fri May 28 10:50:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Knecht X-Patchwork-Id: 449596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FFE7C47087 for ; Fri, 28 May 2021 11:12:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02504613C9 for ; Fri, 28 May 2021 11:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbhE1LOM (ORCPT ); Fri, 28 May 2021 07:14:12 -0400 Received: from msg-1.mailo.com ([213.182.54.11]:38268 "EHLO msg-1.mailo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbhE1LOL (ORCPT ); Fri, 28 May 2021 07:14:11 -0400 X-Greylist: delayed 1271 seconds by postgrey-1.27 at vger.kernel.org; Fri, 28 May 2021 07:14:11 EDT DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailoo.org; s=mailo; t=1622199078; bh=xiYAYJ4ReoERjHj/7lnXJ2gG8qm27EGp9h0Zicsjm2A=; h=X-EA-Auth:From:To:Cc:Subject:Date:Message-Id:X-Mailer: MIME-Version:Content-Transfer-Encoding; b=PxlCSR5w+TtcWNQHVtNEN71h0mP8zqj3o/bahrQk9tNcUrkjvVKOvUPT2RWtrqbpG NM4LtC/9dDoWqWaaYOd+eOCgzAL7Eoe8eBZN7fIO1BvBcB4vik48jKIJwhJX9WKDzR bT3X4eLMuBe9fSq+C4TxGo8EcRZuI5c2FdD/dU5w= Received: by 192.168.90.15 [192.168.90.15] with ESMTP via proxy.mailoo.org [213.182.55.207] Fri, 28 May 2021 12:51:18 +0200 (CEST) X-EA-Auth: SD0V86Q8ap8CtVY4uhieJZ54T3WTDESiy4Rm1MXlEiRfL4uMado0R8JV+UTvoTYVF21OAyIoqgWrrDhofMvhjYe2atea8x1ShV+x+68wU5E= From: Vincent Knecht To: Mark Brown Cc: phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Vincent Knecht , Stephan Gerhold , Liam Girdwood , Rob Herring , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/4] ASoC: dt-bindings: nxp,tfa989x: Add tfa9897 support Date: Fri, 28 May 2021 12:50:58 +0200 Message-Id: <20210528105101.508254-1-vincent.knecht@mailoo.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Document TFA9897 bindings. Signed-off-by: Vincent Knecht Reviewed-by: Stephan Gerhold Reviewed-by: Stephan Gerhold --- Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml index 45db5776550c..46ddc1f3fc0c 100644 --- a/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml +++ b/Documentation/devicetree/bindings/sound/nxp,tfa989x.yaml @@ -13,6 +13,7 @@ properties: compatible: enum: - nxp,tfa9895 + - nxp,tfa9897 reg: maxItems: 1 From patchwork Fri May 28 10:51:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Knecht X-Patchwork-Id: 449595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71940C47087 for ; Fri, 28 May 2021 11:12:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 497C4613E3 for ; Fri, 28 May 2021 11:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229653AbhE1LOT (ORCPT ); Fri, 28 May 2021 07:14:19 -0400 Received: from msg-1.mailo.com ([213.182.54.11]:38272 "EHLO msg-1.mailo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229740AbhE1LOR (ORCPT ); Fri, 28 May 2021 07:14:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailoo.org; s=mailo; t=1622199081; bh=etQv4148XiNjFlFCkrHITfinHD/7B2v2acgKy9+MWrU=; h=X-EA-Auth:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=lpZkfxeyJ8p+JHJHogUWEhQVPFdv4A7yOmPfBLK/AXpjbGGBVin+qXJ1gtj+VkbP+ Nmyme5Y+qXca/cmmmN8LyGg2IBZYXexfP/vj9x+VA4YP0V3t5W4nGAh1fFH+nT009j zBFLJu/VzJyil3zWNowUkgYZE4u3mcqf5JZy+Ym8= Received: by 192.168.90.15 [192.168.90.15] with ESMTP via proxy.mailoo.org [213.182.55.207] Fri, 28 May 2021 12:51:21 +0200 (CEST) X-EA-Auth: bZWbzNMKnaVnjmJ2JWIbsTfsgap0MJP1+XsFBIJF2qthYKxGEPDAuxPbQeIE6hwUSnRHZx8rrrqqnnMDVkcimd5rcYdH9yuYln+A7KOuCX0= From: Vincent Knecht To: Mark Brown Cc: phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Vincent Knecht , Stephan Gerhold , Liam Girdwood , Rob Herring , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/4] ASoC: codecs: tfa989x: Add support for optional vddd-supply Date: Fri, 28 May 2021 12:51:01 +0200 Message-Id: <20210528105101.508254-4-vincent.knecht@mailoo.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210528105101.508254-1-vincent.knecht@mailoo.org> References: <20210528105101.508254-1-vincent.knecht@mailoo.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Allow specifying Vddd regulator/supply to be enabled on I2C probing. Signed-off-by: Vincent Knecht --- sound/soc/codecs/tfa989x.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/sound/soc/codecs/tfa989x.c b/sound/soc/codecs/tfa989x.c index 6d94865c534b..643b45188b6f 100644 --- a/sound/soc/codecs/tfa989x.c +++ b/sound/soc/codecs/tfa989x.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #define TFA989X_STATUSREG 0x00 @@ -51,6 +52,10 @@ struct tfa989x_rev { int (*init)(struct regmap *regmap); }; +struct tfa989x { + struct regulator *vddd_supply; +}; + static bool tfa989x_writeable_reg(struct device *dev, unsigned int reg) { return reg > TFA989X_REVISIONNUMBER; @@ -242,10 +247,18 @@ static int tfa989x_dsp_bypass(struct regmap *regmap) BIT(TFA989X_SYS_CTRL_AMPC)); } +static void tfa989x_regulator_disable(void *data) +{ + struct tfa989x *tfa989x = data; + + regulator_disable(tfa989x->vddd_supply); +} + static int tfa989x_i2c_probe(struct i2c_client *i2c) { struct device *dev = &i2c->dev; const struct tfa989x_rev *rev; + struct tfa989x *tfa989x; struct regmap *regmap; unsigned int val; int ret; @@ -256,10 +269,31 @@ static int tfa989x_i2c_probe(struct i2c_client *i2c) return -ENODEV; } + tfa989x = devm_kzalloc(dev, sizeof(*tfa989x), GFP_KERNEL); + if (!tfa989x) + return -ENOMEM; + + i2c_set_clientdata(i2c, tfa989x); + + tfa989x->vddd_supply = devm_regulator_get(dev, "vddd"); + if (IS_ERR(tfa989x->vddd_supply)) + return dev_err_probe(dev, PTR_ERR(tfa989x->vddd_supply), + "Failed to get vddd regulator\n"); + regmap = devm_regmap_init_i2c(i2c, &tfa989x_regmap); if (IS_ERR(regmap)) return PTR_ERR(regmap); + ret = regulator_enable(tfa989x->vddd_supply); + if (ret) { + dev_err(dev, "Failed to enable vddd regulator: %d\n", ret); + return ret; + } + + ret = devm_add_action_or_reset(dev, tfa989x_regulator_disable, tfa989x); + if (ret) + return ret; + /* Bypass regcache for reset and init sequence */ regcache_cache_bypass(regmap, true);