Commit 6c467a10 authored by Charles Keepax's avatar Charles Keepax Committed by Chanwoo Choi

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: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent a121103c
...@@ -236,10 +236,6 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode) ...@@ -236,10 +236,6 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
mode %= info->micd_num_modes; 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, gpiod_set_value_cansleep(info->micd_pol_gpio,
info->micd_modes[mode].gpio); info->micd_modes[mode].gpio);
...@@ -1412,21 +1408,21 @@ static int arizona_extcon_probe(struct platform_device *pdev) ...@@ -1412,21 +1408,21 @@ static int arizona_extcon_probe(struct platform_device *pdev)
regmap_update_bits(arizona->regmap, ARIZONA_GP_SWITCH_1, regmap_update_bits(arizona->regmap, ARIZONA_GP_SWITCH_1,
ARIZONA_SW1_MODE_MASK, arizona->pdata.gpsw); 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) if (info->micd_modes[0].gpio)
mode = GPIOF_OUT_INIT_HIGH; mode = GPIOF_OUT_INIT_HIGH;
else else
mode = GPIOF_OUT_INIT_LOW; mode = GPIOF_OUT_INIT_LOW;
ret = devm_gpio_request_one(&pdev->dev, ret = devm_gpio_request_one(&pdev->dev, pdata->micd_pol_gpio,
arizona->pdata.micd_pol_gpio, mode, "MICD polarity");
mode,
"MICD polarity");
if (ret != 0) { if (ret != 0) {
dev_err(arizona->dev, "Failed to request GPIO%d: %d\n", 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; goto err_register;
} }
info->micd_pol_gpio = gpio_to_desc(pdata->micd_pol_gpio);
} else { } else {
if (info->micd_modes[0].gpio) if (info->micd_modes[0].gpio)
mode = GPIOD_OUT_HIGH; mode = GPIOD_OUT_HIGH;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment