From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: <cw00.choi@samsung.com>
Cc: <myungjoo.ham@samsung.com>, <patches@opensource.wolfsonmicro.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] extcon: arizona: Simplify micd_pol_gpio handling
Date: Fri, 25 Nov 2016 13:44:36 +0000 [thread overview]
Message-ID: <1480081476-27005-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
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>
---
drivers/extcon/extcon-arizona.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
index 56e6c4c..aeab47d 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,
@@ -1410,21 +1406,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;
--
2.1.4
next reply other threads:[~2016-11-25 14:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20161125134407epcas2p28d76cfcd72f0d308d69ea48888737d67@epcas2p2.samsung.com>
2016-11-25 13:44 ` Charles Keepax [this message]
2016-11-29 9:41 ` [PATCH] extcon: arizona: Simplify micd_pol_gpio handling Chanwoo Choi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480081476-27005-1-git-send-email-ckeepax@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=cw00.choi@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).