All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oder Chiou <oder_chiou@realtek.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>
Cc: Oder Chiou <oder_chiou@realtek.com>,
	jack.yu@realtek.com, alsa-devel@alsa-project.org,
	jacal_tseng@realtek.com, danielz@nvidia.com, spujar@nvidia.com,
	albertchen@realtek.com, derek.fang@realtek.com,
	shumingf@realtek.com, flove@realtek.com
Subject: [PATCH] ASoC: rt5640: Fix the wrong state of the JD in the HDA header
Date: Wed, 1 Dec 2021 17:56:29 +0800	[thread overview]
Message-ID: <20211201095629.21818-1-oder_chiou@realtek.com> (raw)

The patch fixes the wrong state of the JD with 1M pull up resistor in the
HDA header.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
---
 sound/soc/codecs/rt5640.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 08b37878cb00..f3659b14c74e 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -1973,7 +1973,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component,
 				RT5640_PWR_FV1 | RT5640_PWR_FV2,
 				RT5640_PWR_FV1 | RT5640_PWR_FV2);
 			snd_soc_component_update_bits(component, RT5640_DUMMY1,
-						0x0301, 0x0301);
+						0x1, 0x1);
 			snd_soc_component_update_bits(component, RT5640_MICBIAS,
 						0x0030, 0x0030);
 		}
@@ -2533,7 +2533,7 @@ static void rt5640_enable_hda_jack_detect(
 	snd_soc_component_update_bits(component, RT5640_GPIO_CTRL3,
 		RT5640_GP1_PF_MASK, RT5640_GP1_PF_OUT);
 
-	snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x700, 0x300);
+	snd_soc_component_update_bits(component, RT5640_DUMMY1, 0x400, 0x0);
 
 	rt5640->jack = jack;
 
@@ -2651,13 +2651,16 @@ static int rt5640_probe(struct snd_soc_component *component)
 
 	if (device_property_read_u32(component->dev,
 				     "realtek,jack-detect-source", &val) == 0) {
-		if (val <= RT5640_JD_SRC_GPIO4)
+		if (val <= RT5640_JD_SRC_GPIO4) {
 			rt5640->jd_src = val << RT5640_JD_SFT;
-		else if (val == RT5640_JD_SRC_HDA_HEADER)
+		} else if (val == RT5640_JD_SRC_HDA_HEADER) {
 			rt5640->jd_src = RT5640_JD_SRC_HDA_HEADER;
-		else
+			snd_soc_component_update_bits(component, RT5640_DUMMY1,
+				0x0300, 0x0);
+		} else {
 			dev_warn(component->dev, "Warning: Invalid jack-detect-source value: %d, leaving jack-detect disabled\n",
 				 val);
+		}
 	}
 
 	if (!device_property_read_bool(component->dev, "realtek,jack-detect-not-inverted"))
-- 
2.34.1


             reply	other threads:[~2021-12-01  9:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01  9:56 Oder Chiou [this message]
2021-12-01 12:41 ` [PATCH] ASoC: rt5640: Fix the wrong state of the JD in the HDA header Mark Brown
2021-12-02 13:40 ` Mark Brown

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=20211201095629.21818-1-oder_chiou@realtek.com \
    --to=oder_chiou@realtek.com \
    --cc=albertchen@realtek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=danielz@nvidia.com \
    --cc=derek.fang@realtek.com \
    --cc=flove@realtek.com \
    --cc=jacal_tseng@realtek.com \
    --cc=jack.yu@realtek.com \
    --cc=lgirdwood@gmail.com \
    --cc=shumingf@realtek.com \
    --cc=spujar@nvidia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.