pinctrl: qcom: spmi-mpp: Introduce defines for MODE_CTL
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
7682b3740d
commit
eaaf5dd464
1 changed files with 20 additions and 12 deletions
|
@ -85,6 +85,14 @@
|
||||||
#define PMIC_MPP_REG_AIN_ROUTE_SHIFT 0
|
#define PMIC_MPP_REG_AIN_ROUTE_SHIFT 0
|
||||||
#define PMIC_MPP_REG_AIN_ROUTE_MASK 0x7
|
#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
|
#define PMIC_MPP_PHYSICAL_OFFSET 1
|
||||||
|
|
||||||
/* Qualcomm specific pin configurations */
|
/* Qualcomm specific pin configurations */
|
||||||
|
@ -248,20 +256,20 @@ static int pmic_mpp_set_mux(struct pinctrl_dev *pctldev, unsigned function,
|
||||||
pad->function = function;
|
pad->function = function;
|
||||||
|
|
||||||
if (!pad->analog_mode) {
|
if (!pad->analog_mode) {
|
||||||
val = 0; /* just digital input */
|
val = PMIC_MPP_MODE_DIGITAL_INPUT;
|
||||||
if (pad->output_enabled) {
|
if (pad->output_enabled) {
|
||||||
if (pad->input_enabled)
|
if (pad->input_enabled)
|
||||||
val = 2; /* digital input and output */
|
val = PMIC_MPP_MODE_DIGITAL_BIDIR;
|
||||||
else
|
else
|
||||||
val = 1; /* just digital output */
|
val = PMIC_MPP_MODE_DIGITAL_OUTPUT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val = 4; /* just analog input */
|
val = PMIC_MPP_MODE_ANALOG_INPUT;
|
||||||
if (pad->output_enabled) {
|
if (pad->output_enabled) {
|
||||||
if (pad->input_enabled)
|
if (pad->input_enabled)
|
||||||
val = 3; /* analog input and output */
|
val = PMIC_MPP_MODE_ANALOG_BIDIR;
|
||||||
else
|
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;
|
dir &= PMIC_MPP_REG_MODE_DIR_MASK;
|
||||||
|
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case 0:
|
case PMIC_MPP_MODE_DIGITAL_INPUT:
|
||||||
pad->input_enabled = true;
|
pad->input_enabled = true;
|
||||||
pad->output_enabled = false;
|
pad->output_enabled = false;
|
||||||
pad->analog_mode = false;
|
pad->analog_mode = false;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case PMIC_MPP_MODE_DIGITAL_OUTPUT:
|
||||||
pad->input_enabled = false;
|
pad->input_enabled = false;
|
||||||
pad->output_enabled = true;
|
pad->output_enabled = true;
|
||||||
pad->analog_mode = false;
|
pad->analog_mode = false;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case PMIC_MPP_MODE_DIGITAL_BIDIR:
|
||||||
pad->input_enabled = true;
|
pad->input_enabled = true;
|
||||||
pad->output_enabled = true;
|
pad->output_enabled = true;
|
||||||
pad->analog_mode = false;
|
pad->analog_mode = false;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case PMIC_MPP_MODE_ANALOG_BIDIR:
|
||||||
pad->input_enabled = true;
|
pad->input_enabled = true;
|
||||||
pad->output_enabled = true;
|
pad->output_enabled = true;
|
||||||
pad->analog_mode = true;
|
pad->analog_mode = true;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case PMIC_MPP_MODE_ANALOG_INPUT:
|
||||||
pad->input_enabled = true;
|
pad->input_enabled = true;
|
||||||
pad->output_enabled = false;
|
pad->output_enabled = false;
|
||||||
pad->analog_mode = true;
|
pad->analog_mode = true;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case PMIC_MPP_MODE_ANALOG_OUTPUT:
|
||||||
pad->input_enabled = false;
|
pad->input_enabled = false;
|
||||||
pad->output_enabled = true;
|
pad->output_enabled = true;
|
||||||
pad->analog_mode = true;
|
pad->analog_mode = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue