public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6] extcon: arizona: Simplify pdata symantics for micd_dbtime
@ 2015-06-30 12:32 Charles Keepax
  2015-07-01  2:05 ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Keepax @ 2015-06-30 12:32 UTC (permalink / raw)
  To: cw00.choi; +Cc: myungjoo.ham, patches, linux-kernel

Currently micd_dbtime can be set to 0 for default, 1 for 4 measurements,
or a greater than 16-bit value for 2 measurements. This patch simplifies
the symantics to 2 for 2 measurements, 4 for 4 measurements and any
other value for the default.

I am not super keen on changing the symantics of the pdata at this stage
in the drivers life, but acceptance of the DT binding for this field has
been made conditional on this happening.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes from v5:
 - Move defines into extcon driver, rather than pdata header, it is
   unlikely that they would have seen any use there anyway and they
   can be moved there in a later change if needed.

Thanks,
Charles

 drivers/extcon/extcon-arizona.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index eaf0644..4b9f09c 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -48,6 +48,9 @@
 #define HPDET_DEBOUNCE 500
 #define DEFAULT_MICD_TIMEOUT 2000
 
+#define MICD_DBTIME_TWO_READINGS 2
+#define MICD_DBTIME_FOUR_READINGS 4
+
 #define MICD_LVL_1_TO_7 (ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 | \
 			 ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 | \
 			 ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 | \
@@ -1318,11 +1321,19 @@ static int arizona_extcon_probe(struct platform_device *pdev)
 				   arizona->pdata.micd_rate
 				   << ARIZONA_MICD_RATE_SHIFT);
 
-	if (arizona->pdata.micd_dbtime)
+	switch (arizona->pdata.micd_dbtime) {
+	case MICD_DBTIME_FOUR_READINGS:
 		regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
 				   ARIZONA_MICD_DBTIME_MASK,
-				   arizona->pdata.micd_dbtime
-				   << ARIZONA_MICD_DBTIME_SHIFT);
+				   ARIZONA_MICD_DBTIME);
+		break;
+	case MICD_DBTIME_TWO_READINGS:
+		regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
+				   ARIZONA_MICD_DBTIME_MASK, 0);
+		break;
+	default:
+		break;
+	}
 
 	BUILD_BUG_ON(ARRAY_SIZE(arizona_micd_levels) != 0x40);
 
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v6] extcon: arizona: Simplify pdata symantics for micd_dbtime
  2015-06-30 12:32 [PATCH v6] extcon: arizona: Simplify pdata symantics for micd_dbtime Charles Keepax
@ 2015-07-01  2:05 ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2015-07-01  2:05 UTC (permalink / raw)
  To: Charles Keepax; +Cc: myungjoo.ham, patches, linux-kernel

On 06/30/2015 09:32 PM, Charles Keepax wrote:
> Currently micd_dbtime can be set to 0 for default, 1 for 4 measurements,
> or a greater than 16-bit value for 2 measurements. This patch simplifies
> the symantics to 2 for 2 measurements, 4 for 4 measurements and any
> other value for the default.
> 
> I am not super keen on changing the symantics of the pdata at this stage
> in the drivers life, but acceptance of the DT binding for this field has
> been made conditional on this happening.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> ---
> 

Applied it.

Thanks,
Chanwoo Choi


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-01  2:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30 12:32 [PATCH v6] extcon: arizona: Simplify pdata symantics for micd_dbtime Charles Keepax
2015-07-01  2:05 ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox