diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2016-11-25 13:44:36 +0000 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2017-01-09 10:04:09 +0900 |
commit | 6c467a106f4c93a05b359b6732bb2161d74a29ae (patch) | |
tree | f5e2b09a6be9d6f552c28eec10c31b9978b6e94d /drivers/extcon/extcon-arizona.c | |
parent | a121103c922847ba5010819a3f250f1f7fc84ab8 (diff) | |
download | linux-stable-6c467a106f4c93a05b359b6732bb2161d74a29ae.tar.gz linux-stable-6c467a106f4c93a05b359b6732bb2161d74a29ae.tar.bz2 linux-stable-6c467a106f4c93a05b359b6732bb2161d74a29ae.zip |
extcon: arizona: Simplify micd_pol_gpio handling
Currently we handle both old style GPIO and new style GPIOD differently
simplify this slightly by converting the old style GPIO to a GPIOD and
just using that from then on.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-arizona.c')
-rw-r--r-- | drivers/extcon/extcon-arizona.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index d836d4ce5ee4..ed78b7c26627 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -236,12 +236,8 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode) mode %= info->micd_num_modes; - if (arizona->pdata.micd_pol_gpio > 0) - gpio_set_value_cansleep(arizona->pdata.micd_pol_gpio, - info->micd_modes[mode].gpio); - else - gpiod_set_value_cansleep(info->micd_pol_gpio, - info->micd_modes[mode].gpio); + gpiod_set_value_cansleep(info->micd_pol_gpio, + info->micd_modes[mode].gpio); regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1, ARIZONA_MICD_BIAS_SRC_MASK, @@ -1412,21 +1408,21 @@ static int arizona_extcon_probe(struct platform_device *pdev) regmap_update_bits(arizona->regmap, ARIZONA_GP_SWITCH_1, ARIZONA_SW1_MODE_MASK, arizona->pdata.gpsw); - if (arizona->pdata.micd_pol_gpio > 0) { + if (pdata->micd_pol_gpio > 0) { if (info->micd_modes[0].gpio) mode = GPIOF_OUT_INIT_HIGH; else mode = GPIOF_OUT_INIT_LOW; - ret = devm_gpio_request_one(&pdev->dev, - arizona->pdata.micd_pol_gpio, - mode, - "MICD polarity"); + ret = devm_gpio_request_one(&pdev->dev, pdata->micd_pol_gpio, + mode, "MICD polarity"); if (ret != 0) { dev_err(arizona->dev, "Failed to request GPIO%d: %d\n", - arizona->pdata.micd_pol_gpio, ret); + pdata->micd_pol_gpio, ret); goto err_register; } + + info->micd_pol_gpio = gpio_to_desc(pdata->micd_pol_gpio); } else { if (info->micd_modes[0].gpio) mode = GPIOD_OUT_HIGH; |