diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2016-01-08 15:25:53 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-27 09:06:19 -0500 |
commit | ae6d54fd695d7e1bd7b0bdaf457074ae4b5ad7bb (patch) | |
tree | d538b53289c80cfdc63d86a84064daf57ddd789a /drivers/pinctrl/qcom | |
parent | 23c3960dfe6faea6fa8b8cb0bfedba2a03bda0c1 (diff) |
pinctrl: qcom: spmi-mpp: Skip pullup on ULT type MPPs
The ULT type of MPPs don't have a pullup. Skip configuring the
pullup on these types of pins.
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/qcom')
-rw-r--r-- | drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c index 2f18323571a6..2a3e5490a483 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | |||
@@ -117,6 +117,7 @@ | |||
117 | * @output_enabled: Set to true if MPP output logic is enabled. | 117 | * @output_enabled: Set to true if MPP output logic is enabled. |
118 | * @input_enabled: Set to true if MPP input buffer logic is enabled. | 118 | * @input_enabled: Set to true if MPP input buffer logic is enabled. |
119 | * @paired: Pin operates in paired mode | 119 | * @paired: Pin operates in paired mode |
120 | * @has_pullup: Pin has support to configure pullup | ||
120 | * @num_sources: Number of power-sources supported by this MPP. | 121 | * @num_sources: Number of power-sources supported by this MPP. |
121 | * @power_source: Current power-source used. | 122 | * @power_source: Current power-source used. |
122 | * @amux_input: Set the source for analog input. | 123 | * @amux_input: Set the source for analog input. |
@@ -134,6 +135,7 @@ struct pmic_mpp_pad { | |||
134 | bool output_enabled; | 135 | bool output_enabled; |
135 | bool input_enabled; | 136 | bool input_enabled; |
136 | bool paired; | 137 | bool paired; |
138 | bool has_pullup; | ||
137 | unsigned int num_sources; | 139 | unsigned int num_sources; |
138 | unsigned int power_source; | 140 | unsigned int power_source; |
139 | unsigned int amux_input; | 141 | unsigned int amux_input; |
@@ -477,11 +479,14 @@ static int pmic_mpp_config_set(struct pinctrl_dev *pctldev, unsigned int pin, | |||
477 | if (ret < 0) | 479 | if (ret < 0) |
478 | return ret; | 480 | return ret; |
479 | 481 | ||
480 | val = pad->pullup << PMIC_MPP_REG_PULL_SHIFT; | 482 | if (pad->has_pullup) { |
483 | val = pad->pullup << PMIC_MPP_REG_PULL_SHIFT; | ||
481 | 484 | ||
482 | ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_DIG_PULL_CTL, val); | 485 | ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_DIG_PULL_CTL, |
483 | if (ret < 0) | 486 | val); |
484 | return ret; | 487 | if (ret < 0) |
488 | return ret; | ||
489 | } | ||
485 | 490 | ||
486 | val = pad->amux_input & PMIC_MPP_REG_AIN_ROUTE_MASK; | 491 | val = pad->amux_input & PMIC_MPP_REG_AIN_ROUTE_MASK; |
487 | 492 | ||
@@ -534,7 +539,8 @@ static void pmic_mpp_config_dbg_show(struct pinctrl_dev *pctldev, | |||
534 | seq_printf(s, " %-7s", pmic_mpp_functions[pad->function]); | 539 | seq_printf(s, " %-7s", pmic_mpp_functions[pad->function]); |
535 | seq_printf(s, " vin-%d", pad->power_source); | 540 | seq_printf(s, " vin-%d", pad->power_source); |
536 | seq_printf(s, " %d", pad->aout_level); | 541 | seq_printf(s, " %d", pad->aout_level); |
537 | seq_printf(s, " %-8s", biases[pad->pullup]); | 542 | if (pad->has_pullup) |
543 | seq_printf(s, " %-8s", biases[pad->pullup]); | ||
538 | seq_printf(s, " %-4s", pad->out_value ? "high" : "low"); | 544 | seq_printf(s, " %-4s", pad->out_value ? "high" : "low"); |
539 | if (pad->dtest) | 545 | if (pad->dtest) |
540 | seq_printf(s, " dtest%d", pad->dtest); | 546 | seq_printf(s, " dtest%d", pad->dtest); |
@@ -748,12 +754,16 @@ static int pmic_mpp_populate(struct pmic_mpp_state *state, | |||
748 | pad->power_source = val >> PMIC_MPP_REG_VIN_SHIFT; | 754 | pad->power_source = val >> PMIC_MPP_REG_VIN_SHIFT; |
749 | pad->power_source &= PMIC_MPP_REG_VIN_MASK; | 755 | pad->power_source &= PMIC_MPP_REG_VIN_MASK; |
750 | 756 | ||
751 | val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_PULL_CTL); | 757 | if (subtype != PMIC_MPP_SUBTYPE_ULT_4CH_NO_ANA_OUT && |
752 | if (val < 0) | 758 | subtype != PMIC_MPP_SUBTYPE_ULT_4CH_NO_SINK) { |
753 | return val; | 759 | val = pmic_mpp_read(state, pad, PMIC_MPP_REG_DIG_PULL_CTL); |
760 | if (val < 0) | ||
761 | return val; | ||
754 | 762 | ||
755 | pad->pullup = val >> PMIC_MPP_REG_PULL_SHIFT; | 763 | pad->pullup = val >> PMIC_MPP_REG_PULL_SHIFT; |
756 | pad->pullup &= PMIC_MPP_REG_PULL_MASK; | 764 | pad->pullup &= PMIC_MPP_REG_PULL_MASK; |
765 | pad->has_pullup = true; | ||
766 | } | ||
757 | 767 | ||
758 | val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AIN_CTL); | 768 | val = pmic_mpp_read(state, pad, PMIC_MPP_REG_AIN_CTL); |
759 | if (val < 0) | 769 | if (val < 0) |