From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Linus Walleij <linus.walleij@linaro.org>,
"Ivan T. Ivanov" <ivan.ivanov@linaro.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Subject: [PATCH 3/8] pinctrl: qcom: spmi-mpp: Introduce defines for MODE_CTL
Date: Wed, 17 Jun 2015 23:47:27 -0700 [thread overview]
Message-ID: <1434610052-602-4-git-send-email-bjorn.andersson@sonymobile.com> (raw)
In-Reply-To: <1434610052-602-1-git-send-email-bjorn.andersson@sonymobile.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
index 6d9abeea810d..745c37dea7d0 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
@@ -85,6 +85,14 @@
#define PMIC_MPP_REG_AIN_ROUTE_SHIFT 0
#define PMIC_MPP_REG_AIN_ROUTE_MASK 0x7
+#define PMIC_MPP_MODE_DIGITAL_INPUT 0
+#define PMIC_MPP_MODE_DIGITAL_OUTPUT 1
+#define PMIC_MPP_MODE_DIGITAL_BIDIR 2
+#define PMIC_MPP_MODE_ANALOG_BIDIR 3
+#define PMIC_MPP_MODE_ANALOG_INPUT 4
+#define PMIC_MPP_MODE_ANALOG_OUTPUT 5
+#define PMIC_MPP_MODE_CURRENT_SINK 6
+
#define PMIC_MPP_PHYSICAL_OFFSET 1
/* Qualcomm specific pin configurations */
@@ -248,20 +256,20 @@ static int pmic_mpp_set_mux(struct pinctrl_dev *pctldev, unsigned function,
pad->function = function;
if (!pad->analog_mode) {
- val = 0; /* just digital input */
+ val = PMIC_MPP_MODE_DIGITAL_INPUT;
if (pad->output_enabled) {
if (pad->input_enabled)
- val = 2; /* digital input and output */
+ val = PMIC_MPP_MODE_DIGITAL_BIDIR;
else
- val = 1; /* just digital output */
+ val = PMIC_MPP_MODE_DIGITAL_OUTPUT;
}
} else {
- val = 4; /* just analog input */
+ val = PMIC_MPP_MODE_ANALOG_INPUT;
if (pad->output_enabled) {
if (pad->input_enabled)
- val = 3; /* analog input and output */
+ val = PMIC_MPP_MODE_ANALOG_BIDIR;
else
- val = 5; /* just analog output */
+ val = PMIC_MPP_MODE_ANALOG_OUTPUT;
}
}
@@ -654,32 +662,32 @@ static int pmic_mpp_populate(struct pmic_mpp_state *state,
dir &= PMIC_MPP_REG_MODE_DIR_MASK;
switch (dir) {
- case 0:
+ case PMIC_MPP_MODE_DIGITAL_INPUT:
pad->input_enabled = true;
pad->output_enabled = false;
pad->analog_mode = false;
break;
- case 1:
+ case PMIC_MPP_MODE_DIGITAL_OUTPUT:
pad->input_enabled = false;
pad->output_enabled = true;
pad->analog_mode = false;
break;
- case 2:
+ case PMIC_MPP_MODE_DIGITAL_BIDIR:
pad->input_enabled = true;
pad->output_enabled = true;
pad->analog_mode = false;
break;
- case 3:
+ case PMIC_MPP_MODE_ANALOG_BIDIR:
pad->input_enabled = true;
pad->output_enabled = true;
pad->analog_mode = true;
break;
- case 4:
+ case PMIC_MPP_MODE_ANALOG_INPUT:
pad->input_enabled = true;
pad->output_enabled = false;
pad->analog_mode = true;
break;
- case 5:
+ case PMIC_MPP_MODE_ANALOG_OUTPUT:
pad->input_enabled = false;
pad->output_enabled = true;
pad->analog_mode = true;
--
1.8.2.2
next prev parent reply other threads:[~2015-06-18 6:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-18 6:47 [PATCH 0/8] Qualcomm PMIC pinctrl additions Bjorn Andersson
2015-06-18 6:47 ` [PATCH 1/8] pinctrl: qcom: spmi-mpp: Transition to generic dt binding parser Bjorn Andersson
2015-07-14 10:56 ` Linus Walleij
2015-06-18 6:47 ` [PATCH 2/8] pinctrl: qcom: spmi-mpp: Fixes related to enable handling Bjorn Andersson
2015-07-14 10:57 ` Linus Walleij
2015-06-18 6:47 ` Bjorn Andersson [this message]
2015-07-14 10:58 ` [PATCH 3/8] pinctrl: qcom: spmi-mpp: Introduce defines for MODE_CTL Linus Walleij
2015-06-18 6:47 ` [PATCH 4/8] pinctrl: qcom: spmi-mpp: Implement support for sink mode Bjorn Andersson
2015-07-14 11:01 ` Linus Walleij
2015-06-18 6:47 ` [PATCH 5/8] pinctrl: qcom: spmi-mpp: Add support for setting analog output level Bjorn Andersson
2015-06-24 8:17 ` Ivan T. Ivanov
2015-07-14 11:04 ` Linus Walleij
2015-07-15 6:40 ` [PATCH v2 " Bjorn Andersson
2015-07-17 12:30 ` Linus Walleij
[not found] ` <1434610052-602-1-git-send-email-bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
2015-06-18 6:47 ` [PATCH 6/8] pinctrl: qcom: spmi-mpp: Transpose pinmux function Bjorn Andersson
2015-07-17 12:31 ` Linus Walleij
2015-06-18 6:47 ` [PATCH 8/8] pinctrl: qcom: ssbi: Family A gpio & mpp drivers Bjorn Andersson
2015-06-24 8:17 ` Ivan T. Ivanov
2015-06-24 19:54 ` Srinivas Kandagatla
2015-07-15 6:40 ` [PATCH v2 " Bjorn Andersson
2015-07-17 12:35 ` Linus Walleij
2015-06-24 8:29 ` [PATCH 0/8] Qualcomm PMIC pinctrl additions Ivan T. Ivanov
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=1434610052-602-4-git-send-email-bjorn.andersson@sonymobile.com \
--to=bjorn.andersson@sonymobile.com \
--cc=ivan.ivanov@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).