From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Sen Chu <sen.chu@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Macpaul Lin <macpaul.lin@mediatek.com>,
Lee Jones <lee@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>
Cc: kernel@collabora.com, linux-sound@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Subject: [PATCH v4 15/19] ASoC: mediatek: mt6359-accdet: Always configure hardware as mic-mode 2
Date: Wed, 05 Mar 2025 15:58:30 -0300 [thread overview]
Message-ID: <20250305-mt6359-accdet-dts-v4-15-e5ffa5ee9991@collabora.com> (raw)
In-Reply-To: <20250305-mt6359-accdet-dts-v4-0-e5ffa5ee9991@collabora.com>
The driver currently reads a mediatek,mic-mode property from DT to
determine certain register configurations. Since there are no current
users of the property, the property doesn't directly reflect the
hardware and the default value (2) is known to work on
multiple boards, remove the code handling this property and instead
always configure the hardware according to the known to work default.
This property can be properly introduced in the binding in the future
if it really turns out that different boards need different
configurations.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
sound/soc/codecs/mt6359-accdet.c | 43 ++++++----------------------------------
sound/soc/codecs/mt6359-accdet.h | 5 -----
2 files changed, 6 insertions(+), 42 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index a31e084560c7643b14fb71871699e3167075d9d9..12697b02faff1be39317116cd7d8ffa359f2cd4e 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -494,11 +494,6 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
if (!node)
return -EINVAL;
- ret = of_property_read_u32(node, "mediatek,mic-mode",
- &priv->data->mic_mode);
- if (ret)
- priv->data->mic_mode = 2;
-
priv->data->hp_eint_high = of_property_read_bool(node, "mediatek,hp-eint-high");
ret = of_property_read_u32(node, "mediatek,eint-num", &tmp);
@@ -658,38 +653,12 @@ static void mt6359_accdet_init(struct mt6359_accdet *priv)
RG_AUDMICBIAS1LOWPEN_MASK_SFT);
/* mic mode setting */
regmap_read(priv->regmap, RG_AUDACCDETMICBIAS0PULLLOW_ADDR, ®);
- if (priv->data->mic_mode == HEADSET_MODE_1) {
- /* ACC mode*/
- regmap_write(priv->regmap, RG_AUDACCDETMICBIAS0PULLLOW_ADDR,
- reg | RG_ACCDET_MODE_ANA11_MODE1);
- /* enable analog fast discharge */
- regmap_update_bits(priv->regmap, RG_ANALOGFDEN_ADDR,
- RG_ANALOGFDEN_MASK_SFT,
- BIT(RG_ANALOGFDEN_SFT));
- regmap_update_bits(priv->regmap, RG_ACCDETSPARE_ADDR,
- 0x3 << 11, 0x3 << 11);
- } else if (priv->data->mic_mode == HEADSET_MODE_2) {
- /* DCC mode Low cost mode without internal bias */
- regmap_write(priv->regmap, RG_AUDACCDETMICBIAS0PULLLOW_ADDR,
- reg | RG_ACCDET_MODE_ANA11_MODE2);
- /* enable analog fast discharge */
- regmap_update_bits(priv->regmap, RG_ANALOGFDEN_ADDR,
- 0x3 << RG_ANALOGFDEN_SFT,
- 0x3 << RG_ANALOGFDEN_SFT);
- } else if (priv->data->mic_mode == HEADSET_MODE_6) {
- /* DCC mode Low cost mode with internal bias,
- * bit8 = 1 to use internal bias
- */
- regmap_write(priv->regmap, RG_AUDACCDETMICBIAS0PULLLOW_ADDR,
- reg | RG_ACCDET_MODE_ANA11_MODE6);
- regmap_update_bits(priv->regmap, RG_AUDPWDBMICBIAS1_ADDR,
- RG_AUDMICBIAS1DCSW1PEN_MASK_SFT,
- BIT(RG_AUDMICBIAS1DCSW1PEN_SFT));
- /* enable analog fast discharge */
- regmap_update_bits(priv->regmap, RG_ANALOGFDEN_ADDR,
- 0x3 << RG_ANALOGFDEN_SFT,
- 0x3 << RG_ANALOGFDEN_SFT);
- }
+ /* DCC mode Low cost mode without internal bias */
+ regmap_write(priv->regmap, RG_AUDACCDETMICBIAS0PULLLOW_ADDR,
+ reg | RG_ACCDET_MODE_ANA11_MODE2);
+ /* enable analog fast discharge */
+ regmap_update_bits(priv->regmap, RG_ANALOGFDEN_ADDR,
+ 0x3 << RG_ANALOGFDEN_SFT, 0x3 << RG_ANALOGFDEN_SFT);
config_eint_init_by_mode(priv);
config_digital_init_by_mode(priv);
diff --git a/sound/soc/codecs/mt6359-accdet.h b/sound/soc/codecs/mt6359-accdet.h
index 46dcd4759230a5190434b9b7c785e8b9ed12fd3d..579373807c414130b2a7384db4978e01cf1d046c 100644
--- a/sound/soc/codecs/mt6359-accdet.h
+++ b/sound/soc/codecs/mt6359-accdet.h
@@ -12,10 +12,6 @@
#define ACCDET_DEVNAME "accdet"
-#define HEADSET_MODE_1 (1)
-#define HEADSET_MODE_2 (2)
-#define HEADSET_MODE_6 (6)
-
#define MT6359_ACCDET_NUM_BUTTONS 4
#define MT6359_ACCDET_JACK_MASK (SND_JACK_HEADPHONE | \
SND_JACK_HEADSET | \
@@ -51,7 +47,6 @@ enum {
};
struct dts_data {
- unsigned int mic_mode;
bool hp_eint_high;
unsigned int eint_comp_vth;
};
--
2.48.1
next prev parent reply other threads:[~2025-03-05 19:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 18:58 [PATCH v4 00/19] Get mt6359-accdet ready for usage in Devicetree Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 01/19] dt-bindings: mfd: mediatek: mt6397: Add accdet subnode Nícolas F. R. A. Prado
2025-03-06 7:57 ` Krzysztof Kozlowski
2025-03-06 12:19 ` Nícolas F. R. A. Prado
2025-03-07 7:11 ` Krzysztof Kozlowski
2025-03-07 13:22 ` Nícolas F. R. A. Prado
2025-03-09 19:50 ` Krzysztof Kozlowski
2025-03-05 18:58 ` [PATCH v4 02/19] mfd: mt6397-core: Add mfd_cell for mt6359-accdet Nícolas F. R. A. Prado
2025-03-13 17:02 ` (subset) " Lee Jones
2025-03-05 18:58 ` [PATCH v4 03/19] ASoC: mediatek: mt6359-accdet: Add compatible property Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 04/19] ASoC: mediatek: mt6359-accdet: Handle hp-eint-high property Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 05/19] ASoC: mediatek: mt6359-accdet: Implement HP_EINT polarity configuration Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 06/19] ASoC: mediatek: mt6359-accdet: Drop dead code for EINT/GPIO IRQ handling Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 07/19] ASoC: mediatek: mt6359-accdet: Drop dead code for EINT trigger setting Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 08/19] ASoC: mediatek: mt6359-accdet: Drop dead code for button detection Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 09/19] ASoC: mediatek: mt6359-accdet: Drop dead code for plugout-debounce Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 10/19] ASoC: mediatek: mt6359-accdet: Drop unused moisture variables Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 11/19] ASoC: mediatek: mt6359-accdet: Always use internal resistor Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 12/19] ASoC: mediatek: mt6359-accdet: Make PWM debounce settings internal Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 13/19] ASoC: mediatek: mt6359-accdet: Always use eint detect mode 4 Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 14/19] ASoC: mediatek: mt6359-accdet: Always set micbias1 to 2.8V Nícolas F. R. A. Prado
2025-03-05 18:58 ` Nícolas F. R. A. Prado [this message]
2025-03-05 18:58 ` [PATCH v4 16/19] ASoC: mediatek: mt6359-accdet: Always set comp-vth to 1.6V Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 17/19] ASoC: mediatek: mt6359-accdet: Always use EINT0 IRQ Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 18/19] arm64: dts: mt6359: Add accessory detect node Nícolas F. R. A. Prado
2025-03-05 18:58 ` [PATCH v4 19/19] arm64: defconfig: Enable MT6359 ACCDET Nícolas F. R. A. Prado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250305-mt6359-accdet-dts-v4-15-e5ffa5ee9991@collabora.com \
--to=nfraprado@collabora.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=macpaul.lin@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=sean.wang@mediatek.com \
--cc=sen.chu@mediatek.com \
--cc=tiwai@suse.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®