From nobody Tue Apr 7 18:17:03 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7816EC64990 for ; Thu, 25 Aug 2022 14:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241594AbiHYODL (ORCPT ); Thu, 25 Aug 2022 10:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234778AbiHYOC7 (ORCPT ); Thu, 25 Aug 2022 10:02:59 -0400 Received: from hutie.ust.cz (unknown [IPv6:2a03:3b40:fe:f0::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FED78E45F for ; Thu, 25 Aug 2022 07:02:54 -0700 (PDT) From: =?UTF-8?q?Martin=20Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1661436171; bh=k4JY6gIRcC+FC13JFoBjpofoYgJ49CT9VL+rB5MoeWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WGTOf7S4c+SoeUUUcqErZTjpI0ULWQGgn7XDtYBYDqUOmswbmAhpPQxv3b7/v5B2L l6cODorEj2q1wJ6UvpO2O1abdISoeV1yXguMNrw6Zie2FJyLc54nr5t5Z89jKiu8Xm x3QfKElNGJkbgq75Fvor2eiyqK/lH8ntyIFTMzxo= To: Liam Girdwood , Mark Brown Cc: navada@ti.com, shenghao-ding@ti.com, asyrus@ti.com, raphael-xu@ti.com, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Charles Keepax , Stephen Kitt , Dan Murphy , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev Subject: [PATCH 1/5] ASoC: tas2764: Allow mono streams Date: Thu, 25 Aug 2022 16:02:37 +0200 Message-Id: <20220825140241.53963-2-povik+lin@cutebit.org> In-Reply-To: <20220825140241.53963-1-povik+lin@cutebit.org> References: <20220825140241.53963-1-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2. (This mirrors commit bf54d97a835d ("ASoC: tas2770: Allow mono streams") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er --- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 846d9d3ecc9d..0df5d975c3c9 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -485,7 +485,7 @@ static struct snd_soc_dai_driver tas2764_dai_driver[] = =3D { .id =3D 0, .playback =3D { .stream_name =3D "ASI1 Playback", - .channels_min =3D 2, + .channels_min =3D 1, .channels_max =3D 2, .rates =3D TAS2764_RATES, .formats =3D TAS2764_FORMATS, --=20 2.33.0 From nobody Tue Apr 7 18:17:03 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C06F6C64990 for ; Thu, 25 Aug 2022 14:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242270AbiHYOD0 (ORCPT ); Thu, 25 Aug 2022 10:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241497AbiHYOC7 (ORCPT ); Thu, 25 Aug 2022 10:02:59 -0400 Received: from hutie.ust.cz (hutie.ust.cz [185.8.165.127]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 631DD74CFA for ; Thu, 25 Aug 2022 07:02:54 -0700 (PDT) From: =?UTF-8?q?Martin=20Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1661436171; bh=A9R4hsRTvVB+CrLnhrK0/t3nKWg2k/rONUmXMJ9jpVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LHGby8B8IcDmmOS1FOMosJ6vI7W8wtjCj7+SfXrLtlAQo8Pr1wmcg3VgVN/wOhoL4 YAANjMKAJcSmfGKZtIxqdplAFBp487sEvBJdS0aC5Hj3/UiUEcpZB0UEa282q/xdcc ty3QyWHySBBoaKjjEpnEj1V9gpHG3lWq8XqJWEag= To: Liam Girdwood , Mark Brown Cc: navada@ti.com, shenghao-ding@ti.com, asyrus@ti.com, raphael-xu@ti.com, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Charles Keepax , Stephen Kitt , Dan Murphy , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev Subject: [PATCH 2/5] ASoC: tas2764: Drop conflicting set_bias_level power setting Date: Thu, 25 Aug 2022 16:02:38 +0200 Message-Id: <20220825140241.53963-3-povik+lin@cutebit.org> In-Reply-To: <20220825140241.53963-1-povik+lin@cutebit.org> References: <20220825140241.53963-1-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is setting the PWR_CTRL field in both the set_bias_level callback and on DAPM events of the DAC widget (and also in the mute_stream method). Drop the set_bias_level callback altogether as the power setting it does is in conflict with the other code paths. (This mirrors commit c8a6ae3fe1c8 ("ASoC: tas2770: Drop conflicting set_bias_level power setting") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er --- sound/soc/codecs/tas2764.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 0df5d975c3c9..f4ac6edefdc0 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -50,38 +50,6 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } =20 -static int tas2764_set_bias_level(struct snd_soc_component *component, - enum snd_soc_bias_level level) -{ - struct tas2764_priv *tas2764 =3D snd_soc_component_get_drvdata(component); - - switch (level) { - case SND_SOC_BIAS_ON: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); - break; - case SND_SOC_BIAS_STANDBY: - case SND_SOC_BIAS_PREPARE: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - break; - case SND_SOC_BIAS_OFF: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); - break; - - default: - dev_err(tas2764->dev, - "wrong power level setting %d\n", level); - return -EINVAL; - } - - return 0; -} - #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -549,7 +517,6 @@ static const struct snd_soc_component_driver soc_compon= ent_driver_tas2764 =3D { .probe =3D tas2764_codec_probe, .suspend =3D tas2764_codec_suspend, .resume =3D tas2764_codec_resume, - .set_bias_level =3D tas2764_set_bias_level, .controls =3D tas2764_snd_controls, .num_controls =3D ARRAY_SIZE(tas2764_snd_controls), .dapm_widgets =3D tas2764_dapm_widgets, --=20 2.33.0 From nobody Tue Apr 7 18:17:03 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3343C28D13 for ; Thu, 25 Aug 2022 14:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242208AbiHYODd (ORCPT ); Thu, 25 Aug 2022 10:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241571AbiHYOC7 (ORCPT ); Thu, 25 Aug 2022 10:02:59 -0400 Received: from hutie.ust.cz (unknown [IPv6:2a03:3b40:fe:f0::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 307E6A8327 for ; Thu, 25 Aug 2022 07:02:54 -0700 (PDT) From: =?UTF-8?q?Martin=20Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1661436172; bh=PsCam++xDona5BVDShW7mfj5kX/puOVnGoX+XMGkuc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=r31WAVO2XWASiv4N/KJcm/d/M9XAJsD7XFnrJl5o758Se1fe0WQIwxSkjIsVOH5ON e8LgKJb+uuhADj085h44Fm4WYlFXHOwzPYJ2e2IAOiehHONsugUmqaPGVO5q9VzE8v pGpVTLB8SLg0x9dZdNsml/t7IVBivF031WRMC044= To: Liam Girdwood , Mark Brown Cc: navada@ti.com, shenghao-ding@ti.com, asyrus@ti.com, raphael-xu@ti.com, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Charles Keepax , Stephen Kitt , Dan Murphy , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev Subject: [PATCH 3/5] ASoC: tas2764: Fix mute/unmute Date: Thu, 25 Aug 2022 16:02:39 +0200 Message-Id: <20220825140241.53963-4-povik+lin@cutebit.org> In-Reply-To: <20220825140241.53963-1-povik+lin@cutebit.org> References: <20220825140241.53963-1-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one permanently mutes an ongoing stream by toggling the associated speaker pin control. (This mirrors commit 1e5907bcb3a3 ("ASoC: tas2770: Fix handling of mute/unmute") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povi=C5=A1er --- sound/soc/codecs/tas2764.c | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index f4ac6edefdc0..39902f77a2e0 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -34,6 +34,9 @@ struct tas2764_priv { =09 int v_sense_slot; int i_sense_slot; + + bool dac_powered; + bool unmuted; }; =20 static void tas2764_reset(struct tas2764_priv *tas2764) @@ -50,6 +53,26 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } =20 +static int tas2764_update_pwr_ctrl(struct tas2764_priv *tas2764) +{ + struct snd_soc_component *component =3D tas2764->component; + unsigned int val; + int ret; + + if (tas2764->dac_powered) + val =3D tas2764->unmuted ? + TAS2764_PWR_CTRL_ACTIVE : TAS2764_PWR_CTRL_MUTE; + else + val =3D TAS2764_PWR_CTRL_SHUTDOWN; + + ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK, val); + if (ret < 0) + return ret; + + return 0; +} + #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -82,9 +105,7 @@ static int tas2764_codec_resume(struct snd_soc_component= *component) usleep_range(1000, 2000); } =20 - ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); + ret =3D tas2764_update_pwr_ctrl(tas2764); =20 if (ret < 0) return ret; @@ -118,14 +139,12 @@ static int tas2764_dac_event(struct snd_soc_dapm_widg= et *w, =20 switch (event) { case SND_SOC_DAPM_POST_PMU: - ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); + tas2764->dac_powered =3D true; + ret =3D tas2764_update_pwr_ctrl(tas2764); break; case SND_SOC_DAPM_PRE_PMD: - ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); + tas2764->dac_powered =3D false; + ret =3D tas2764_update_pwr_ctrl(tas2764); break; default: dev_err(tas2764->dev, "Unsupported event\n"); @@ -170,17 +189,11 @@ static const struct snd_soc_dapm_route tas2764_audio_= map[] =3D { =20 static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) { - struct snd_soc_component *component =3D dai->component; - int ret; - - ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - mute ? TAS2764_PWR_CTRL_MUTE : 0); + struct tas2764_priv *tas2764 =3D + snd_soc_component_get_drvdata(dai->component); =20 - if (ret < 0) - return ret; - - return 0; + tas2764->unmuted =3D !mute; + return tas2764_update_pwr_ctrl(tas2764); } =20 static int tas2764_set_bitwidth(struct tas2764_priv *tas2764, int bitwidth) @@ -494,12 +507,6 @@ static int tas2764_codec_probe(struct snd_soc_componen= t *component) if (ret < 0) return ret; =20 - ret =3D snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - if (ret < 0) - return ret; - return 0; } =20 --=20 2.33.0 From nobody Tue Apr 7 18:17:03 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DD13C64990 for ; Thu, 25 Aug 2022 14:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241931AbiHYODP (ORCPT ); Thu, 25 Aug 2022 10:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbiHYOC7 (ORCPT ); Thu, 25 Aug 2022 10:02:59 -0400 Received: from hutie.ust.cz (hutie.ust.cz [185.8.165.127]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 774AC81B11 for ; Thu, 25 Aug 2022 07:02:54 -0700 (PDT) From: =?UTF-8?q?Martin=20Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1661436172; bh=PCDuP/emdbOrjDqBGMDvA3MxPbkFeQu07VmM0kChmGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kX0d3xmSOxwdAWkd8HaT8AyTqnbip/ZMAXN0kert+xkt4DX9cgtL7rP4bb4me81rF gZmH4ypxdZwEMJYMIAa6+k3pVbQtNgKIC8MDbrXuZlT3AWzTrC92N+doQOAMaCzuNh xa68nQhKtVAfgLZ3v1ulN+7AxmoClwTNvwBZXx5c= To: Liam Girdwood , Mark Brown Cc: navada@ti.com, shenghao-ding@ti.com, asyrus@ti.com, raphael-xu@ti.com, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Charles Keepax , Stephen Kitt , Dan Murphy , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev Subject: [PATCH 4/5] ASoC: tas2764: Add IRQ handling Date: Thu, 25 Aug 2022 16:02:40 +0200 Message-Id: <20220825140241.53963-5-povik+lin@cutebit.org> In-Reply-To: <20220825140241.53963-1-povik+lin@cutebit.org> References: <20220825140241.53963-1-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an IRQ handler which logs detected faults (but doesn't do anything else). Signed-off-by: Martin Povi=C5=A1er --- sound/soc/codecs/tas2764.c | 93 ++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/tas2764.h | 19 ++++++++ 2 files changed, 112 insertions(+) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 39902f77a2e0..e99a46fb503f 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -31,6 +31,7 @@ struct tas2764_priv { struct gpio_desc *sdz_gpio; struct regmap *regmap; struct device *dev; + int irq; =09 int v_sense_slot; int i_sense_slot; @@ -39,6 +40,57 @@ struct tas2764_priv { bool unmuted; }; =20 +static const char *tas2764_int_ltch0_msgs[8] =3D { + "fault: over temperature", /* INT_LTCH0 & BIT(0) */ + "fault: over current", + "fault: bad TDM clock", + "limiter active", + "fault: PVDD below limiter inflection point", + "fault: limiter max attenuation", + "fault: BOP infinite hold", + "fault: BOP mute", /* INT_LTCH0 & BIT(7) */ +}; + +static const unsigned int tas2764_int_readout_regs[6] =3D { + TAS2764_INT_LTCH0, + TAS2764_INT_LTCH1, + TAS2764_INT_LTCH1_0, + TAS2764_INT_LTCH2, + TAS2764_INT_LTCH3, + TAS2764_INT_LTCH4, +}; + +static irqreturn_t tas2764_irq(int irq, void *data) +{ + struct tas2764_priv *tas2764 =3D data; + u8 latched[6] =3D {0, 0, 0, 0, 0, 0}; + int ret =3D IRQ_NONE; + int i; + + for (i =3D 0; i < ARRAY_SIZE(latched); i++) + latched[i] =3D snd_soc_component_read(tas2764->component, + tas2764_int_readout_regs[i]); + + for (i =3D 0; i < 8; i++) { + if (latched[0] & BIT(i)) { + dev_crit_ratelimited(tas2764->dev, "%s\n", + tas2764_int_ltch0_msgs[i]); + ret =3D IRQ_HANDLED; + } + } + + if (latched[0]) { + dev_err_ratelimited(tas2764->dev, "other context to the fault: %02x,%02x= ,%02x,%02x,%02x", + latched[1], latched[2], latched[3], latched[4], latched[5]); + snd_soc_component_update_bits(tas2764->component, + TAS2764_INT_CLK_CFG, + TAS2764_INT_CLK_CFG_IRQZ_CLR, + TAS2764_INT_CLK_CFG_IRQZ_CLR); + } + + return ret; +} + static void tas2764_reset(struct tas2764_priv *tas2764) { if (tas2764->reset_gpio) { @@ -497,6 +549,34 @@ static int tas2764_codec_probe(struct snd_soc_componen= t *component) =20 tas2764_reset(tas2764); =20 + if (tas2764->irq) { + ret =3D snd_soc_component_write(tas2764->component, TAS2764_INT_MASK0, 0= xff); + if (ret < 0) + return ret; + + ret =3D snd_soc_component_write(tas2764->component, TAS2764_INT_MASK1, 0= xff); + if (ret < 0) + return ret; + + ret =3D snd_soc_component_write(tas2764->component, TAS2764_INT_MASK2, 0= xff); + if (ret < 0) + return ret; + + ret =3D snd_soc_component_write(tas2764->component, TAS2764_INT_MASK3, 0= xff); + if (ret < 0) + return ret; + + ret =3D snd_soc_component_write(tas2764->component, TAS2764_INT_MASK4, 0= xff); + if (ret < 0) + return ret; + + ret =3D devm_request_threaded_irq(tas2764->dev, tas2764->irq, NULL, tas2= 764_irq, + IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_LOW, + "tas2764", tas2764); + if (ret) + dev_warn(tas2764->dev, "failed to request IRQ: %d\n", ret); + } + ret =3D snd_soc_component_update_bits(tas2764->component, TAS2764_TDM_CFG= 5, TAS2764_TDM_CFG5_VSNS_ENABLE, 0); if (ret < 0) @@ -559,9 +639,21 @@ static const struct regmap_range_cfg tas2764_regmap_ra= nges[] =3D { }, }; =20 +static bool tas2764_volatile_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case TAS2764_INT_LTCH0 ... TAS2764_INT_LTCH4: + case TAS2764_INT_CLK_CFG: + return true; + default: + return false; + } +} + static const struct regmap_config tas2764_i2c_regmap =3D { .reg_bits =3D 8, .val_bits =3D 8, + .volatile_reg =3D tas2764_volatile_register, .reg_defaults =3D tas2764_reg_defaults, .num_reg_defaults =3D ARRAY_SIZE(tas2764_reg_defaults), .cache_type =3D REGCACHE_RBTREE, @@ -615,6 +707,7 @@ static int tas2764_i2c_probe(struct i2c_client *client) return -ENOMEM; =20 tas2764->dev =3D &client->dev; + tas2764->irq =3D client->irq; i2c_set_clientdata(client, tas2764); dev_set_drvdata(&client->dev, tas2764); =20 diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index f015f22a083b..960b337ed0fc 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -87,4 +87,23 @@ #define TAS2764_TDM_CFG6_ISNS_ENABLE BIT(6) #define TAS2764_TDM_CFG6_50_MASK GENMASK(5, 0) =20 +/* Interrupt Masks */ +#define TAS2764_INT_MASK0 TAS2764_REG(0x0, 0x3b) +#define TAS2764_INT_MASK1 TAS2764_REG(0x0, 0x3c) +#define TAS2764_INT_MASK2 TAS2764_REG(0x0, 0x40) +#define TAS2764_INT_MASK3 TAS2764_REG(0x0, 0x41) +#define TAS2764_INT_MASK4 TAS2764_REG(0x0, 0x3d) + +/* Latched Fault Registers */ +#define TAS2764_INT_LTCH0 TAS2764_REG(0x0, 0x49) +#define TAS2764_INT_LTCH1 TAS2764_REG(0x0, 0x4a) +#define TAS2764_INT_LTCH1_0 TAS2764_REG(0x0, 0x4b) +#define TAS2764_INT_LTCH2 TAS2764_REG(0x0, 0x4f) +#define TAS2764_INT_LTCH3 TAS2764_REG(0x0, 0x50) +#define TAS2764_INT_LTCH4 TAS2764_REG(0x0, 0x51) + +/* Clock/IRQ Settings */ +#define TAS2764_INT_CLK_CFG TAS2764_REG(0x0, 0x5c) +#define TAS2764_INT_CLK_CFG_IRQZ_CLR BIT(2) + #endif /* __TAS2764__ */ --=20 2.33.0 From nobody Tue Apr 7 18:17:03 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51325C28D13 for ; Thu, 25 Aug 2022 14:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235148AbiHYODh (ORCPT ); Thu, 25 Aug 2022 10:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241611AbiHYODI (ORCPT ); Thu, 25 Aug 2022 10:03:08 -0400 Received: from hutie.ust.cz (unknown [IPv6:2a03:3b40:fe:f0::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A003CB0B34 for ; Thu, 25 Aug 2022 07:03:00 -0700 (PDT) From: =?UTF-8?q?Martin=20Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1661436172; bh=l8JOb0hAWhVJH3nSwe474gz70FVSVhQNrSMoKlGL5NE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DGrIQhoRsIrW6NeEmOuD5vnKGvGau5m3L5zCZyZQoUzJ4++Obr6tjp31EDTIDVBEH TlSSOvrhZl0DB/Axv0/GvdZDBh9Z+vK0WGxvVs4nksjHbQPrAjpbMQS+HQiCbKubhC CC/7BN32D69v6dlKIeo2vKWi0fDQ1ZfQzTxJrWmQ= To: Liam Girdwood , Mark Brown Cc: navada@ti.com, shenghao-ding@ti.com, asyrus@ti.com, raphael-xu@ti.com, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Charles Keepax , Stephen Kitt , Dan Murphy , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev Subject: [PATCH 5/5] ASoC: tas2764: Export highpass filter setting Date: Thu, 25 Aug 2022 16:02:41 +0200 Message-Id: <20220825140241.53963-6-povik+lin@cutebit.org> In-Reply-To: <20220825140241.53963-1-povik+lin@cutebit.org> References: <20220825140241.53963-1-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Expose a control for the setting of 'DC blocker' highpass filter in the playback path of TAS2764. Signed-off-by: Martin Povi=C5=A1er --- sound/soc/codecs/tas2764.c | 10 ++++++++++ sound/soc/codecs/tas2764.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index e99a46fb503f..51b87a936179 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -593,11 +593,21 @@ static int tas2764_codec_probe(struct snd_soc_compone= nt *component) static DECLARE_TLV_DB_SCALE(tas2764_digital_tlv, 1100, 50, 0); static DECLARE_TLV_DB_SCALE(tas2764_playback_volume, -10050, 50, 1); =20 +static const char * const tas2764_hpf_texts[] =3D { + "Disabled", "2 Hz", "50 Hz", "100 Hz", "200 Hz", + "400 Hz", "800 Hz" +}; + +static SOC_ENUM_SINGLE_DECL( + tas2764_hpf_enum, TAS2764_DC_BLK0, + TAS2764_DC_BLK0_HPF_FREQ_PB_SHIFT, tas2764_hpf_texts); + static const struct snd_kcontrol_new tas2764_snd_controls[] =3D { SOC_SINGLE_TLV("Speaker Volume", TAS2764_DVC, 0, TAS2764_DVC_MAX, 1, tas2764_playback_volume), SOC_SINGLE_TLV("Amp Gain Volume", TAS2764_CHNL_0, 1, 0x14, 0, tas2764_digital_tlv), + SOC_ENUM("HPF Corner Frequency", tas2764_hpf_enum), }; =20 static const struct snd_soc_component_driver soc_component_driver_tas2764 = =3D { diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h index 960b337ed0fc..168af772a898 100644 --- a/sound/soc/codecs/tas2764.h +++ b/sound/soc/codecs/tas2764.h @@ -33,6 +33,10 @@ #define TAS2764_VSENSE_POWER_EN 3 #define TAS2764_ISENSE_POWER_EN 4 =20 +/* DC Blocker Control */ +#define TAS2764_DC_BLK0 TAS2764_REG(0x0, 0x04) +#define TAS2764_DC_BLK0_HPF_FREQ_PB_SHIFT 0 + /* Digital Volume Control */ #define TAS2764_DVC TAS2764_REG(0X0, 0x1a) #define TAS2764_DVC_MAX 0xc9 --=20 2.33.0