@@ -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,
@@ -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;
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@collabora.com> --- sound/soc/codecs/mt6359-accdet.c | 12 +++--------- sound/soc/codecs/mt6359-accdet.h | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-)