Re: [PATCH 2/2] extcon: arizona: Fix headphone clamping on wm5110

2015-02-16 Thread Chanwoo Choi
Hi Charles,

On Tue, Feb 17, 2015 at 12:41 AM, Charles Keepax
 wrote:
> 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 
> ---
>  drivers/extcon/extcon-arizona.c |   23 ++-
>  1 files changed, 18 insertions(+), 5 deletions(-)

Looks good to me.

I'll apply this patch on extcon-next branch
after patch1 receives the ack message by MFD maintainer.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] extcon: arizona: Fix headphone clamping on wm5110

2015-02-16 Thread Charles Keepax
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 
---
 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(>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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] extcon: arizona: Fix headphone clamping on wm5110

2015-02-16 Thread Chanwoo Choi
Hi Charles,

On Tue, Feb 17, 2015 at 12:41 AM, Charles Keepax
ckee...@opensource.wolfsonmicro.com wrote:
 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 ckee...@opensource.wolfsonmicro.com
 ---
  drivers/extcon/extcon-arizona.c |   23 ++-
  1 files changed, 18 insertions(+), 5 deletions(-)

Looks good to me.

I'll apply this patch on extcon-next branch
after patch1 receives the ack message by MFD maintainer.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] extcon: arizona: Fix headphone clamping on wm5110

2015-02-16 Thread Charles Keepax
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 ckee...@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

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/