All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: cw00.choi@samsung.com, myungjoo.ham@samsung.com
Cc: sameo@linux.intel.com, lee.jones@linaro.org, lgirdwood@gmail.com,
	broonie@kernel.org, patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] extcon: arizona: Fix headphone clamping on wm5110
Date: Mon, 16 Feb 2015 15:41:03 +0000	[thread overview]
Message-ID: <1424101263-27593-2-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1424101263-27593-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>

wm5110 requires slightly different configuration of the headphone
clamps to other Arizona devices. Otherwise headphone detection accuracy
will be way off. This patch adds the needed clamping.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/extcon/extcon-arizona.c |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 95cf7f8..d9e763c 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -140,11 +140,24 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info,
 				    bool clamp)
 {
 	struct arizona *arizona = info->arizona;
-	unsigned int val = 0;
+	unsigned int mask = 0, val = 0;
 	int ret;
 
-	if (clamp)
-		val = ARIZONA_RMV_SHRT_HP1L;
+	switch (arizona->type) {
+	case WM5110:
+		mask = ARIZONA_HP1L_SHRTO | ARIZONA_HP1L_FLWR |
+		       ARIZONA_HP1L_SHRTI;
+		if (clamp)
+			val = ARIZONA_HP1L_SHRTO;
+		else
+			val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI;
+		break;
+	default:
+		mask = ARIZONA_RMV_SHRT_HP1L;
+		if (clamp)
+			val = ARIZONA_RMV_SHRT_HP1L;
+		break;
+	};
 
 	mutex_lock(&arizona->dapm->card->dapm_mutex);
 
@@ -163,13 +176,13 @@ static void arizona_extcon_hp_clamp(struct arizona_extcon_info *info,
 	}
 
 	ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L,
-				 ARIZONA_RMV_SHRT_HP1L, val);
+				 mask, val);
 	if (ret != 0)
 		dev_warn(arizona->dev, "Failed to do clamp: %d\n",
 				 ret);
 
 	ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1R,
-				 ARIZONA_RMV_SHRT_HP1R, val);
+				 mask, val);
 	if (ret != 0)
 		dev_warn(arizona->dev, "Failed to do clamp: %d\n",
 			 ret);
-- 
1.7.2.5


  reply	other threads:[~2015-02-16 15:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 15:41 [PATCH 1/2] extcon: arizona: Deobfuscate arizona_extcon_do_magic Charles Keepax
2015-02-16 15:41 ` Charles Keepax [this message]
2015-02-16 16:49   ` [PATCH 2/2] extcon: arizona: Fix headphone clamping on wm5110 Chanwoo Choi
2015-02-16 16:48 ` [PATCH 1/2] extcon: arizona: Deobfuscate arizona_extcon_do_magic Chanwoo Choi
2015-02-16 23:58   ` Chanwoo Choi
2015-02-16 16:50 ` Lee Jones
2015-02-17  1:56 ` 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=1424101263-27593-2-git-send-email-ckeepax@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sameo@linux.intel.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.