[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250214-mt6359-accdet-dts-v1-11-677a151b9b4c@collabora.com>
Date: Fri, 14 Feb 2025 14:18:42 -0300
From: Nícolas F. R. A. Prado <nfraprado@...labora.com>
To: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Sen Chu <sen.chu@...iatek.com>, Sean Wang <sean.wang@...iatek.com>,
Macpaul Lin <macpaul.lin@...iatek.com>, Lee Jones <lee@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>
Cc: kernel@...labora.com, linux-sound@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
linux-pm@...r.kernel.org,
Nícolas F. R. A. Prado <nfraprado@...labora.com>
Subject: [PATCH 11/13] ASoC: mediatek: mt6359-accdet: Handle
mediatek,eint-use-ext-res as bool
The code currently allows for values between 0 and 4 for the
eint_use_ext_res property, but it should be handled as a boolean, either
configuring the internal resistor to be used or not. Update the code
accordingly.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@...labora.com>
---
sound/soc/codecs/mt6359-accdet.c | 12 +++---------
sound/soc/codecs/mt6359-accdet.h | 2 +-
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c
index c3d51c0753c815cd92935736300f57fd18e033f7..646cdd4e0b57f2a007fdcfcaecb7534e08ae61c4 100644
--- a/sound/soc/codecs/mt6359-accdet.c
+++ b/sound/soc/codecs/mt6359-accdet.c
@@ -82,8 +82,7 @@ static unsigned int adjust_eint_analog_setting(struct mt6359_accdet *priv)
RG_EINT1CONFIGACCDET_MASK_SFT,
BIT(RG_EINT1CONFIGACCDET_SFT));
}
- if (priv->data->eint_use_ext_res == 0x3 ||
- priv->data->eint_use_ext_res == 0x4) {
+ if (!priv->data->eint_use_ext_res) {
/*select 500k, use internal resistor */
regmap_update_bits(priv->regmap,
RG_EINT0HIRENB_ADDR,
@@ -547,12 +546,7 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet *priv)
else if (tmp == 2)
priv->caps |= ACCDET_PMIC_BI_EINT;
- ret = of_property_read_u32(node, "mediatek,eint-use-ext-res",
- &priv->data->eint_use_ext_res);
- if (ret) {
- /* eint use internal resister */
- priv->data->eint_use_ext_res = 0x0;
- }
+ priv->data->eint_use_ext_res = of_property_read_bool(node, "mediatek,eint-use-ext-res");
ret = of_property_read_u32(node, "mediatek,eint-comp-vth",
&priv->data->eint_comp_vth);
@@ -660,7 +654,7 @@ static void config_eint_init_by_mode(struct mt6359_accdet *priv)
if (priv->data->eint_detect_mode == 0x1 ||
priv->data->eint_detect_mode == 0x2 ||
priv->data->eint_detect_mode == 0x3) {
- if (priv->data->eint_use_ext_res == 0x1) {
+ if (priv->data->eint_use_ext_res) {
if (priv->caps & ACCDET_PMIC_EINT0) {
regmap_update_bits(priv->regmap,
RG_EINT0CONFIGACCDET_ADDR,
diff --git a/sound/soc/codecs/mt6359-accdet.h b/sound/soc/codecs/mt6359-accdet.h
index 148e181fc00048ea349c029b382507542a33202e..1a255a360b2319396e9b7a5a145a9317e575587f 100644
--- a/sound/soc/codecs/mt6359-accdet.h
+++ b/sound/soc/codecs/mt6359-accdet.h
@@ -76,7 +76,7 @@ struct dts_data {
struct pwm_deb_settings *pwm_deb;
unsigned int moisture_detect_enable;
unsigned int eint_detect_mode;
- unsigned int eint_use_ext_res;
+ bool eint_use_ext_res;
unsigned int eint_comp_vth;
unsigned int moisture_detect_mode;
unsigned int moisture_comp_vth;
--
2.48.1
Powered by blists - more mailing lists