From nobody Mon Jun 8 23:58:06 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A794326945 for ; Mon, 25 May 2026 09:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779700880; cv=none; b=ohNfwmrGokNgv0e2duW27ORqZ5zOLIFDiD1F6WpgigjjgA6X83OoNqOkO+YWFBgnoV9g7pm7ewztB7WXk4hJAcOhgfL8nGVEAGWWWFrIre6HDmfxGM94xMpq1RADs+WHg2ESeW8lmStEVRlxp8oQTNLEO5w26TzBGcV39OXetCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779700880; c=relaxed/simple; bh=7lRQrxj44SXO53Ulg89F7Nql5dQ+71l+f6jdW6KyPxE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gsiAguO9s34xjyApcDAX3EEjCb9TCfsSiVgmQse73XeUZXtWyzAU4GkQm38/KQSjbJp48XjLipPCcwR+vXAy/7BIAMhzq4frR7pcnXoZpIztxbQX3gdqaPsCuQxULC2iRGc74xVYhuqELT1Uzdf1HVJnsuP1klUYq7v3F+toKk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=flipper.net; spf=pass smtp.mailfrom=flipper.net; dkim=pass (2048-bit key) header.d=flipper.net header.i=@flipper.net header.b=KEXY9Pha; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=flipper.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flipper.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flipper.net header.i=@flipper.net header.b="KEXY9Pha" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-49040362e4aso37176525e9.0 for ; Mon, 25 May 2026 02:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flipper.net; s=google; t=1779700877; x=1780305677; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sSFS8XsJ49zr+uswumEqD50SMXkceam4xnolYqy0+HM=; b=KEXY9PhaUmSqPVRQvG/Bl9zh/YQj2onLWrmF3htjanA1WecfvlOzL/B24uCi1wECwS uEhCGjt5d9OYq9me9lIz3JBQjqs1KZpbrE/kO1mxSD6IdbLvRnqQKbUqEhIudRevTbS9 2dIy6Fv7DvJGRRCQIK8nL9wb6stfpL9qtGoY0IU1VE8RS+WiCVJcHm6I0pl/TVgOqhih VZpdaEUgYNeUbN8waF0DhbeAxvSz1YyGfvOH/IALpkWryEoqRHOIoJf1OR6yqSWktvWt 5Nr6fq/u9InyEmlBtYySBDY9NEcH1+GYpD0VzwxITx7906dbV2zJpQk5AqfUE+I+N3n7 Rc3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779700877; x=1780305677; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sSFS8XsJ49zr+uswumEqD50SMXkceam4xnolYqy0+HM=; b=RCmPlKy0hpX7AHOFCVgGLHUwD/jX3VzrBbuL9vCwv9DSVOJfEm8RsyOEMuqbGiOuok AfEwa9qXaZxf9r8pQmRxPNOnsOoddO6VRUTmr3CGRkZwb11Dm7TJEtGXKjuBkHbPzCRL tQBUvgqMmrYBRfNZqaOIgG9bDKMG9Pep9sS3gYx8Q1hG7L7Ccuf+RtnrJ1lcjJzNJy4t +LJbxdFvNDrBTLLiiOa26hFlPtTMtzo4KVUOhWq2T+HoG3q2aqFV8OBPUKPZN7nYC92t Z3P5X3Nn7jMbBEnXd0P3VoKaz46o92PcHy66nXE9MfXsDiAtR/vpJ5nc/mN/GmAIY67t +XKQ== X-Forwarded-Encrypted: i=1; AFNElJ/DbcavjnsiYaQ9Lf84lqe/DNVhKE6yS9fhUIU64L1wWAsATmxAb4nCTNUXB9HUEs1SYLB+V2mFhi/Xl8A=@vger.kernel.org X-Gm-Message-State: AOJu0YzNiaHer4JBz94VH0GW3I3PhxOykT4jLgChhBtSCrnXb1xNo4dS y7OOtqSxTs5qx+L2i8eEXOwkqIjCNYiQqPsElCREoGuRtO8ajaLGFGlinuVD+SWHsgFQjacESTF GITe1U3Y= X-Gm-Gg: Acq92OED9fUBgvoH7IU/atdqeAA7HoLBr/RWczmIiUDzqLOMwT9rvSX+fKQg5sz8C/Z xwBrTwUvX7EIpmB5L+drmmKOsfkFbr6NSGO1u3PLIWRP514tF8PyIeF/Ot5cNRF/ub4hQrvDiWl CT9U5YfqZ0Towivl83wZEK77i7GjNjWgsxLw93hcP2iibulSXixGshCAoaMCCebeW0kUwO7AvO6 J9jlTNorYkVGSEDThbsGE4uH47dgdXBQa0qsZkLGaI1WXmZ2Sh1CCZ46mOIUl2kuTcnmpuIksnj lMS4AYXnrplB6Bukdt/9c27TT6bNAKEn1QaXE3/ZFLlLIAlr4+cuW+p2XQYC26EeckMgeg363zU q6xdZB1dnUqetpX+Sen2+LPdi5O5sNt4Yifekbup6jF1sYF0+YBHGHdXUAtTjGk5M8JP/9MVXWF XFAzFbyA6sPVXvPwTV7LxG0R2QWTK1MDkVwh+rgUpZsHenfeVZxy0= X-Received: by 2002:a05:600c:3e16:b0:490:688b:f10d with SMTP id 5b1f17b1804b1-490688bf142mr27232215e9.7.1779700877371; Mon, 25 May 2026 02:21:17 -0700 (PDT) Received: from alchark-surface.localdomain ([5.194.92.128]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45eb6d4ca0dsm25399989f8f.18.2026.05.25.02.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2026 02:21:17 -0700 (PDT) From: Alexey Charkov Date: Mon, 25 May 2026 13:20:45 +0400 Subject: [PATCH v2 1/2] ASoC: dt-bindings: nau8822: Add supply regulators Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260525-nau8822-reg-v2-1-7d37ae393e46@flipper.net> References: <20260525-nau8822-reg-v2-0-7d37ae393e46@flipper.net> In-Reply-To: <20260525-nau8822-reg-v2-0-7d37ae393e46@flipper.net> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , David Lin , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Charkov X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1609; i=alchark@flipper.net; h=from:subject:message-id; bh=7lRQrxj44SXO53Ulg89F7Nql5dQ+71l+f6jdW6KyPxE=; b=owGbwMvMwCW2adGNfoHIK0sZT6slMWSJiNSJbRefdb+5r9hu90m+E2tOqj90/NYj+HPh21suq 9edmnfqfcdEFgYxLgZLMUWWud+W2E414pu1y8PjK8wcViaQIdIiDQxAwMLAl5uYV2qkY6Rnqm2o Z2ikY6xjxMDFKQBTHZfC8E+L/53MU6t+mX8/96peaGX5zbEk1tip7nfjLafbAWJOvQwM/wwPv73 DyHVHtP/Ll/nZ07efOl5a+PJFmn6K8CXBqtcZJ5gB X-Developer-Key: i=alchark@flipper.net; a=openpgp; fpr=9DF6A43D95320E9ABA4848F5B2A2D88F1059D4A5 NAU8822 has 4 power supply pins: VDDA, VDDB, VDDC and VDDSPK, which need to be online and stable before communication with the device is attempted. List them (as optional) so that device tree users can ensure correct power sequencing. Signed-off-by: Alexey Charkov --- .../devicetree/bindings/sound/nuvoton,nau8822.yaml | 18 ++++++++++++++= ++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8822.yaml b= /Documentation/devicetree/bindings/sound/nuvoton,nau8822.yaml index cb8182bbc491..cf4c13038241 100644 --- a/Documentation/devicetree/bindings/sound/nuvoton,nau8822.yaml +++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8822.yaml @@ -30,6 +30,20 @@ properties: clock-names: const: mclk =20 + vdda-supply: + description: Analog power supply + + vddb-supply: + description: Digital buffer (input/output) supply + + vddc-supply: + description: Digital core supply + + vddspk-supply: + description: + Speaker supply (power supply pin for RSPKOUT, LSPKOUT, AUXOUT2 and + AUXTOUT1 output drivers) + nuvoton,spk-btl: description: If set, configure the two loudspeaker outputs as a Bridge Tied Load = output @@ -54,5 +68,9 @@ examples: codec@1a { compatible =3D "nuvoton,nau8822"; reg =3D <0x1a>; + vdda-supply =3D <&vcca_3v3_s0>; + vddb-supply =3D <&vcca_3v3_s0>; + vddc-supply =3D <&vcca_3v3_s0>; + vddspk-supply =3D <&vcca_3v3_s0>; }; }; --=20 2.52.0 From nobody Mon Jun 8 23:58:06 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F5563E5A29 for ; Mon, 25 May 2026 09:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779700883; cv=none; b=mY1eGQMvvO+A9B/MzJZnYQkLgGjpcmeQqmQrxYL4DNYYORP8J1xDod8Om2oMqHcKB+wyF4cwzTk7Z2kfDvMPPsktaQN66V5Oxf7/x56CmK20lpHRd0v3E47SrxDj/92KXqMLpwPF2RlEX+7DtReKP0xcVvVWPdup9IEwPiAXPMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779700883; c=relaxed/simple; bh=fa0ET2L9z+e7LdfwkYkE9QV9wQKHv7YbNWrLN3yxRBs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TQRM9hZnn2IdT4iI4u9qMJMa5kc7jrJRtNDkW0fvur05173Yp4Ocym/9GHGWMhmMANw0+oVCPpsS1qsBJ8xZ13j5Qsq+uayF0Nh2a9qca1iFhUoAwSsJLYzs5G2GDQand1FBk6LcSG8xnhoVy8sPakzQCaPCOMGU7uHhm9HUjDw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=flipper.net; spf=pass smtp.mailfrom=flipper.net; dkim=pass (2048-bit key) header.d=flipper.net header.i=@flipper.net header.b=15/8lL7i; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=flipper.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flipper.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flipper.net header.i=@flipper.net header.b="15/8lL7i" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-44e1860558fso5956093f8f.0 for ; Mon, 25 May 2026 02:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flipper.net; s=google; t=1779700880; x=1780305680; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NCQ5Osb6tlRXLmYhUdFsQijMzkEIKxVf9Zq+dOggEf8=; b=15/8lL7i+3QfDUeTOkjzdoFAoZtZnnyTcjjsZYaXm1/M2KH3yOPpExxOQhWgf/X8w+ bYh/HwfJR3ftuuig5JsEeox1dZGKQH0bbBJhADuhdMqGLoj1O97wSrRjLYBfHV0AYW+Y sR2cHRgj4Yi5HtM0y9Xta+CMGcskWU4Qs/1rj3ECKN5BD7jVVneT8rWZWk1iJBLXJUjN PC5rTHBbjw1E8AoLzdTzDMH2YAXHI4L6PS6f0gkYnAu1HCl9aA2QCfq8lJ57h+h1QIhU RYP3c3OFpecPaSplKemXbZDaprnP2njeqhbycdnUE1dBWjfX3cROIW9sKi+34NQl9UdG SBag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779700880; x=1780305680; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=NCQ5Osb6tlRXLmYhUdFsQijMzkEIKxVf9Zq+dOggEf8=; b=RWAHQWhcIGDQuwFZRpXb7kQotdhHTWO8ECIl3rH1pmUG5v5UX+gHUS1EFQStjcR8qG d3M7yVo9E8ZwOqGk9okhkzuaCQwpZJZCRQKaCjeVxY5KN74TiyMD/pxT1lIF3kVi+GlN no0aWFnIxwSAYE5/mafo7PAEAtDSN2H0+lvC2GNbTb9HNjIGf1zTmgQiKv6iuvrfy+yC V4bhnnDwmrd4HLKbl3K5zwtgJwTvqpbxctSWlQruinYJp86m3oJCv18u3jOMn8BBNF+r 9MgkRRLvQHvJmpgYI3UpLaI14kIU0d4LT383Q98YTsFEPRFYzQMT7wEdjc+bq9A8ZORM LFHA== X-Forwarded-Encrypted: i=1; AFNElJ/Essmx4Q1jH+Etzn+e2DsFODJM56Bh1/igZab7HS/1jJ75W5ESLBAAhrRtXVwhRLraEM03RerfYyAwsJs=@vger.kernel.org X-Gm-Message-State: AOJu0YyclsFZl0rotWbTT5GXkD/hvT5Ia6xO79qtgrZ1V+X8AA6BKei7 jkScJsizplAKRe9WR/SZqRPU/2RiMIeY8bL2U7DIHnO/4mIc8YnRKiwN6XmHvS6pGQs= X-Gm-Gg: Acq92OGbrZWmPpweBuk4z5FOe7wfmNqh5CbPIWTlgc950oqgmMA2uiLF0kZwNVE7La5 3D60rp7JaR8R6uPZaGiHugw3dtQTtHWaiQPCuiC5iNMRXPs3UEMOPnoWY8P9VJQWljrsp/mkIoe x3cTiseZ41r52xUTBFpy1e/LMtBMpr8VBKhAJOctOvcJrt0dYx91qVQztwmDFPHuUBZXGNyofCx qcHqAXGQskB9cGEwKvPCnSXAVAvaa8Q3EclmdV7ivXEsw3kyeZzViZQcL3sEHHJk4AF/D5qG7mH +pYlgDlCw+rMZjqQP/Z2pIU1gRoB83LBpO/YBqRSQW2050pnDn8c1PLuq1/SxPbfCphRRKf52ng 1NuxTTqd2CSpDbpFojarjHyXDaTDHRv/K9apOUI9RMo6K/28koI2GRRlq14I3YDZC3gnk/BSFKa VObDZ+clWys3s9JsMJlbNF+FgDZDrxMBRMC4v1KnDf X-Received: by 2002:a05:6000:2003:b0:43b:4136:1e6f with SMTP id ffacd0b85a97d-45eb38e4b46mr23030896f8f.38.1779700879936; Mon, 25 May 2026 02:21:19 -0700 (PDT) Received: from alchark-surface.localdomain ([5.194.92.128]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45eb6d4ca0dsm25399989f8f.18.2026.05.25.02.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 May 2026 02:21:19 -0700 (PDT) From: Alexey Charkov Date: Mon, 25 May 2026 13:20:46 +0400 Subject: [PATCH v2 2/2] ASoC: codecs: nau8822: add support for supply regulators Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260525-nau8822-reg-v2-2-7d37ae393e46@flipper.net> References: <20260525-nau8822-reg-v2-0-7d37ae393e46@flipper.net> In-Reply-To: <20260525-nau8822-reg-v2-0-7d37ae393e46@flipper.net> To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , David Lin , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Charkov X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=5040; i=alchark@flipper.net; h=from:subject:message-id; bh=fa0ET2L9z+e7LdfwkYkE9QV9wQKHv7YbNWrLN3yxRBs=; b=owGbwMvMwCW2adGNfoHIK0sZT6slMWSJiNTZ8ccGfFKa3HLvO5/V6vbjC143ZTulqB37bdRhn D3fv2hBx0QWBjEuBksxRZa535bYTjXim7XLw+MrzBxWJpAh0iINDEDAwsCXm5hXaqRjpGeqbahn aKRjrGPEwMUpAFM9yYyRYcG6rbPXrq/xe3choOZS+xflTceS7612fsub/O+ec9o6j8eMDDcuB21 O1nh5LtDGu1FuZ8y8Tl/32S7nD2yfuuaQoZqvOxsA X-Developer-Key: i=alchark@flipper.net; a=openpgp; fpr=9DF6A43D95320E9ABA4848F5B2A2D88F1059D4A5 NAU8822 has four power supply pins: VDDA, VDDB, VDDC, and VDDSPK, which need to be online and stable before communication with the device is attempted. Request and enable these regulators at init time, if provided. Also wait for 100 us after powering up the supply regulators before attempting to access the device registers, as recommended by the datasheet. This helps avoid -ENXIO errors when the codec is probed before the regulators are ready. Signed-off-by: Alexey Charkov --- sound/soc/codecs/nau8822.c | 46 ++++++++++++++++++++++++++++++++++++++++++= +--- sound/soc/codecs/nau8822.h | 3 +++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/nau8822.c b/sound/soc/codecs/nau8822.c index 19fee5f4bf5f..830164e991a7 100644 --- a/sound/soc/codecs/nau8822.c +++ b/sound/soc/codecs/nau8822.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -108,6 +109,10 @@ static const struct reg_default nau8822_reg_defaults[]= =3D { { NAU8822_REG_OUTPUT_TIEOFF, 0x0000 }, }; =20 +static const char * const nau8822_supply_names[NAU8822_NUM_SUPPLIES] =3D { + "vdda", "vddb", "vddc", "vddspk", +}; + static bool nau8822_readable_reg(struct device *dev, unsigned int reg) { switch (reg) { @@ -1056,6 +1061,7 @@ static int nau8822_suspend(struct snd_soc_component *= component) struct snd_soc_dapm_context *dapm =3D snd_soc_component_to_dapm(component= ); =20 snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); + regulator_bulk_disable(NAU8822_NUM_SUPPLIES, nau8822->supplies); =20 regcache_mark_dirty(nau8822->regmap); =20 @@ -1066,6 +1072,15 @@ static int nau8822_resume(struct snd_soc_component *= component) { struct nau8822 *nau8822 =3D snd_soc_component_get_drvdata(component); struct snd_soc_dapm_context *dapm =3D snd_soc_component_to_dapm(component= ); + int ret =3D regulator_bulk_enable(NAU8822_NUM_SUPPLIES, nau8822->supplies= ); + + if (ret) { + dev_err(component->dev, + "Failed to enable regulators: %d\n", ret); + return ret; + } + + fsleep(100); =20 regcache_sync(nau8822->regmap); =20 @@ -1153,7 +1168,7 @@ static int nau8822_i2c_probe(struct i2c_client *i2c) { struct device *dev =3D &i2c->dev; struct nau8822 *nau8822 =3D dev_get_platdata(dev); - int ret; + int ret, i; =20 if (!nau8822) { nau8822 =3D devm_kzalloc(dev, sizeof(*nau8822), GFP_KERNEL); @@ -1167,6 +1182,13 @@ static int nau8822_i2c_probe(struct i2c_client *i2c) return dev_err_probe(&i2c->dev, PTR_ERR(nau8822->mclk), "Error getting mclk\n"); =20 + for (i =3D 0; i < NAU8822_NUM_SUPPLIES; i++) + nau8822->supplies[i].supply =3D nau8822_supply_names[i]; + + ret =3D devm_regulator_bulk_get(dev, NAU8822_NUM_SUPPLIES, nau8822->suppl= ies); + if (ret) + return dev_err_probe(dev, ret, "Failed to get regulators\n"); + nau8822->regmap =3D devm_regmap_init_i2c(i2c, &nau8822_regmap_config); if (IS_ERR(nau8822->regmap)) { ret =3D PTR_ERR(nau8822->regmap); @@ -1175,21 +1197,38 @@ static int nau8822_i2c_probe(struct i2c_client *i2c) } nau8822->dev =3D dev; =20 + ret =3D regulator_bulk_enable(NAU8822_NUM_SUPPLIES, nau8822->supplies); + if (ret) + return dev_err_probe(dev, ret, "Failed to enable regulators\n"); + + fsleep(100); + /* Reset the codec */ ret =3D regmap_write(nau8822->regmap, NAU8822_REG_RESET, 0x00); if (ret !=3D 0) { dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret); - return ret; + goto err_reg; } =20 ret =3D devm_snd_soc_register_component(dev, &soc_component_dev_nau8822, &nau8822_dai, 1); if (ret !=3D 0) { dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); - return ret; + goto err_reg; } =20 return 0; + +err_reg: + regulator_bulk_disable(NAU8822_NUM_SUPPLIES, nau8822->supplies); + return ret; +} + +static void nau8822_i2c_remove(struct i2c_client *i2c) +{ + struct nau8822 *nau8822 =3D i2c_get_clientdata(i2c); + + regulator_bulk_disable(NAU8822_NUM_SUPPLIES, nau8822->supplies); } =20 static const struct i2c_device_id nau8822_i2c_id[] =3D { @@ -1212,6 +1251,7 @@ static struct i2c_driver nau8822_i2c_driver =3D { .of_match_table =3D of_match_ptr(nau8822_of_match), }, .probe =3D nau8822_i2c_probe, + .remove =3D nau8822_i2c_remove, .id_table =3D nau8822_i2c_id, }; module_i2c_driver(nau8822_i2c_driver); diff --git a/sound/soc/codecs/nau8822.h b/sound/soc/codecs/nau8822.h index 13fe0a091e9e..24799c7b5931 100644 --- a/sound/soc/codecs/nau8822.h +++ b/sound/soc/codecs/nau8822.h @@ -211,6 +211,8 @@ struct nau8822_pll { int freq_out; }; =20 +#define NAU8822_NUM_SUPPLIES 4 + /* Codec Private Data */ struct nau8822 { struct device *dev; @@ -219,6 +221,7 @@ struct nau8822 { struct nau8822_pll pll; int sysclk; int div_id; + struct regulator_bulk_data supplies[NAU8822_NUM_SUPPLIES]; }; =20 #endif /* __NAU8822_H__ */ --=20 2.52.0