arm64: dts: qcom: msm8916/39: Fix SD card detect pinctrl
authorStephan Gerhold <stephan@gerhold.net>
Tue, 30 May 2023 07:15:22 +0000 (09:15 +0200)
committerBjorn Andersson <andersson@kernel.org>
Tue, 13 Jun 2023 23:27:46 +0000 (16:27 -0700)
commitdfbda20dabaa1f284abd550035db5887384c8e4c
tree2ce455f9788f8be3e30791703484c2539ecd2159
parentf43b6dc7d56ecbd96d8dfb3c3225c46e18f1b842
arm64: dts: qcom: msm8916/39: Fix SD card detect pinctrl

The current SD card detect pinctrl setup configures bias-pull-up for
the "default" (active) case and bias-disable for the "sleep" case.
Before commit b5c833b703cc ("mmc: sdhci-msm: Set IO pins in low power
state during suspend") the pull up was permanently active. Since then
it is only active when a valid SD card is inserted.

This does not really make sense: For an active-low CD, the pull up is
needed to pull the GPIO high when the card is not inserted. When the
card gets inserted CD is shorted to ground (low). This means right now
the pull-up is removed exactly when it is needed to detect the next
card insertion. Generally, applying different bias for CD does not
really make sense. It should always stay the same so card removals and
insertions can be detected properly.

The reason why card detection still works fine in practice is that most
boards seem to have external pull up on the CD pin. However, this means
that there is no need to configure an internal pull-up at all and we
can keep bias-disable permanently.

There are also some boards with different CD polarity (acer-a1-724) and
with different GPIO number (huawei-g7). All in all this makes it
obvious that the CD pin is board-specific and the pinctrl for it should
be defined in the board DT.

Move it to the boards that need it and use bias-disable permanently for
the boards that seem to have external pull-up. The vendor device tree
for msm8939-sony-xperia-kanuti-tulip suggests that it needs the
internal pull-up permanently [1] so it gets bias-pull-up to be sure.

[1]: https://github.com/sonyxperiadev/kernel/blob/57b5050e340f40a88e1ddb8d16fd9adb44418923/arch/arm/boot/dts/qcom/msm8939-kanuti_tulip.dtsi#L634-L636

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230529-msm8916-pinctrl-v1-1-11f540b51c93@gerhold.net
13 files changed:
arch/arm64/boot/dts/qcom/apq8016-sbc.dts
arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts
arch/arm64/boot/dts/qcom/msm8916-asus-z00l.dts
arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts
arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
arch/arm64/boot/dts/qcom/msm8916-longcheer-l8910.dts
arch/arm64/boot/dts/qcom/msm8916-pins.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-gt5-common.dtsi
arch/arm64/boot/dts/qcom/msm8916-samsung-j5-common.dtsi
arch/arm64/boot/dts/qcom/msm8939-sony-xperia-kanuti-tulip.dts
arch/arm64/boot/dts/qcom/msm8939.dtsi