disp: msm: fix GPIO lookup for kernel >= 7.1#19
Merged
Conversation
of_get_named_gpio() was removed in kernel 7.1. The msm_gpio.h shim
uses fwnode_gpiod_get_index() which appends "-gpios"/"-gpio" suffixes
to the con_id, so passing the full property name (e.g.
"qcom,dp-hpd-gpio" or "qcom,platform-te-gpio") causes a
double-suffix lookup that fails to find the DT property.
Replace all of_get_named_gpio() / utils->get_named_gpio() calls in
dp_gpio_hpd.c, dp_lphw_hpd.c, dsi_display.c and dsi_panel.c with
devm_gpiod_get(dev, con_id, flags) where con_id is the property name
with the trailing "-gpio" stripped. The kernel appends "-gpio" back,
matching the DT property on both 6.18 and 7.1. devm handles GPIO
direction and cleanup, removing manual gpio_request()/gpio_free() calls.
DP changes (dp_gpio_hpd.c, dp_lphw_hpd.c):
- Replace of_get_named_gpio("qcom,dp-hpd-gpio") with
devm_gpiod_get(dev, "qcom,dp-hpd", GPIOD_IN).
- Remove manual gpio_request()/gpio_direction_input()/gpio_free().
- Replace gpio_to_irq() with gpiod_to_irq().
DSI display changes (dsi_display.c, dsi_display.h):
- Add struct gpio_desc *disp_te_gpiod field to struct dsi_display and
include <linux/gpio/consumer.h>.
- Replace of_get_named_gpio for disp_te_gpio with devm_gpiod_get;
populate int disp_te_gpio via desc_to_gpio() so all existing
gpio_is_valid()/gpio_to_irq() call sites remain unchanged.
- Reuse disp_te_gpio in dsi_display_get_io_resources(); replace
avdd-regulator-gpio lookup with devm_gpiod_get.
DSI panel changes (dsi_panel.c):
- Replace utils->get_named_gpio + gpio_request/gpio_free with
devm_gpiod_get + desc_to_gpio() for reset, disp_en (5v-boost /
platform-en), oled_en, lcd_mode_sel and bklt_en GPIOs.
- dsi_panel_gpio_request() and dsi_panel_gpio_release() reduced to
no-ops; devm handles GPIO lifecycle.
- qcom,mdss-dsi-panel-test-pin (ends in -pin, not -gpio) is left on
the shim path as it is an optional debug pin not present in
production DT.
msm_gpio.h: add comment clarifying the non-const fwnode signature.
Signed-off-by: Yash Gupta <yash.gupta@oss.qualcomm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
of_get_named_gpio() was removed in kernel 7.1. The msm_gpio.h shim passes the full DT property name as con_id to fwnode_gpiod_get_index(), which appends -gpio again causing a double-suffix lookup failure.
Replace all of_get_named_gpio() / utils->get_named_gpio() calls in the DP and DSI drivers with devm_gpiod_get(dev, con_id, flags), stripping the trailing -gpio from the con_id so the kernel resolves the DT
property correctly on both 6.18 and 7.1. devm handles GPIO lifecycle, removing manual gpio_request()/gpio_free() chains.