aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2015-06-30 08:32:39 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2015-08-09 22:48:56 -0400
commitbb327e92a9651c4d9bbf8ee9a367d575d7e6a102 (patch)
treee95401a705fd012b2a00f3446a17c23399164914 /drivers/extcon
parent57f70ef9bd19378b51a282be6b46b45b70d4980d (diff)
extcon: arizona: Simplify pdata symantics for micd_dbtime
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> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-arizona.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index eaf0644b5506..4b9f09cc38d8 100644
--- a/drivers/extcon/extcon-arizona.c
+++ b/drivers/extcon/extcon-arizona.c
@@ -48,6 +48,9 @@
48#define HPDET_DEBOUNCE 500 48#define HPDET_DEBOUNCE 500
49#define DEFAULT_MICD_TIMEOUT 2000 49#define DEFAULT_MICD_TIMEOUT 2000
50 50
51#define MICD_DBTIME_TWO_READINGS 2
52#define MICD_DBTIME_FOUR_READINGS 4
53
51#define MICD_LVL_1_TO_7 (ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 | \ 54#define MICD_LVL_1_TO_7 (ARIZONA_MICD_LVL_1 | ARIZONA_MICD_LVL_2 | \
52 ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 | \ 55 ARIZONA_MICD_LVL_3 | ARIZONA_MICD_LVL_4 | \
53 ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 | \ 56 ARIZONA_MICD_LVL_5 | ARIZONA_MICD_LVL_6 | \
@@ -1318,11 +1321,19 @@ static int arizona_extcon_probe(struct platform_device *pdev)
1318 arizona->pdata.micd_rate 1321 arizona->pdata.micd_rate
1319 << ARIZONA_MICD_RATE_SHIFT); 1322 << ARIZONA_MICD_RATE_SHIFT);
1320 1323
1321 if (arizona->pdata.micd_dbtime) 1324 switch (arizona->pdata.micd_dbtime) {
1325 case MICD_DBTIME_FOUR_READINGS:
1322 regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1, 1326 regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
1323 ARIZONA_MICD_DBTIME_MASK, 1327 ARIZONA_MICD_DBTIME_MASK,
1324 arizona->pdata.micd_dbtime 1328 ARIZONA_MICD_DBTIME);
1325 << ARIZONA_MICD_DBTIME_SHIFT); 1329 break;
1330 case MICD_DBTIME_TWO_READINGS:
1331 regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
1332 ARIZONA_MICD_DBTIME_MASK, 0);
1333 break;
1334 default:
1335 break;
1336 }
1326 1337
1327 BUILD_BUG_ON(ARRAY_SIZE(arizona_micd_levels) != 0x40); 1338 BUILD_BUG_ON(ARRAY_SIZE(arizona_micd_levels) != 0x40);
1328 1339