extcon: arizona: Only set GPIO if it has been requested
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 27 Nov 2012 07:14:26 +0000 (16:14 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 15 Jan 2013 06:42:17 +0000 (15:42 +0900)
The micd_pol GPIO is only requested if we've specified one greater than 0
so apply the same test before we set it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
drivers/extcon/extcon-arizona.c

index 7dbefe8..9e1d104 100644 (file)
@@ -85,8 +85,9 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
 {
        struct arizona *arizona = info->arizona;
 
-       gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio,
-                               info->micd_modes[mode].gpio);
+       if (arizona->pdata.micd_pol_gpio > 0)
+               gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio,
+                                       info->micd_modes[mode].gpio);
        regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
                           ARIZONA_MICD_BIAS_SRC_MASK,
                           info->micd_modes[mode].bias);