From: Linus Walleij <linus.walleij@linaro.org>
To: dri-devel@lists.freedesktop.org,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Sean Paul <sean@poorly.run>
Cc: linux-arm-kernel@lists.infradead.org,
Linus Walleij <linus.walleij@linaro.org>,
Rob Clark <robdclark@gmail.com>,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org
Subject: [PATCH 4/7] gpio: of: Support some legacy Qualcomm HDMI bindings
Date: Sat, 29 Jun 2019 14:59:30 +0200 [thread overview]
Message-ID: <20190629125933.679-4-linus.walleij@linaro.org> (raw)
In-Reply-To: <20190629125933.679-1-linus.walleij@linaro.org>
Insteaf of the MSM DRM code going around and inspecting the
device tree nodes by itself to find "qcom,misc" GPIO phandles,
we add a quirk to the core so that if "qcom,misc-gpios" and
"qcom,misc-gpio" isn't found, we try to find just
"qcom,misc" as a last resort. Provide an explicit whitelist
for those GPIOs.
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Rob/Sean: if the approach is overall OK I will merge this
one patch already for v5.3 so the rest can be queued for
v5.4 later.
---
drivers/gpio/gpiolib-of.c | 43 +++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index aec7bd86ae7e..c927eaf6c88f 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -286,6 +286,45 @@ static struct gpio_desc *of_find_regulator_gpio(struct device *dev, const char *
return desc;
}
+/*
+ * Some non-standard Qualcomm HDMI GPIOs need to be supported as they exist
+ * in random old device trees out there.
+ */
+static struct gpio_desc *of_find_hdmi_gpio(struct device *dev,
+ const char *con_id,
+ enum of_gpio_flags *of_flags)
+{
+ /*
+ * These are the connection IDs we accept as legacy GPIO phandles.
+ * If we get here, the same prefix ending with "-gpio" and "-gpios"
+ * has already been tried so now we finally try with no suffix.
+ */
+ const char *whitelist[] = {
+ "qcom,hdmi-tx-ddc-clk",
+ "qcom,hdmi-tx-ddc-data",
+ "qcom,hdmi-tx-hpd",
+ "qcom,hdmi-tx-mux-en",
+ "qcom,hdmi-tx-mux-sel",
+ "qcom,hdmi-tx-mux-lpm",
+ };
+ struct device_node *np = dev->of_node;
+ struct gpio_desc *desc;
+ int i;
+
+ if (!IS_ENABLED(CONFIG_DRM_MSM))
+ return ERR_PTR(-ENOENT);
+
+ if (!con_id)
+ return ERR_PTR(-ENOENT);
+
+ i = match_string(whitelist, ARRAY_SIZE(whitelist), con_id);
+ if (i < 0)
+ return ERR_PTR(-ENOENT);
+
+ desc = of_get_named_gpiod_flags(np, con_id, 0, of_flags);
+ return desc;
+}
+
struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
unsigned int idx, unsigned long *flags)
{
@@ -330,6 +369,10 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
desc = of_find_regulator_gpio(dev, con_id, &of_flags);
+ /* Special handling for HDMI GPIOs if used */
+ if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER)
+ desc = of_find_hdmi_gpio(dev, con_id, &of_flags);
+
if (IS_ERR(desc))
return desc;
--
2.20.1
next prev parent reply other threads:[~2019-06-29 13:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-29 12:59 [PATCH 1/7] drm/msm/mdp4: Drop unused GPIO include Linus Walleij
2019-06-29 12:59 ` [PATCH 2/7] drm/msm/dsi: Drop unused GPIO includes Linus Walleij
2019-06-29 12:59 ` [PATCH 3/7] drm/msm/dpu: Drop unused GPIO code Linus Walleij
2019-06-29 12:59 ` Linus Walleij [this message]
2019-06-30 13:26 ` [PATCH 4/7] gpio: of: Support some legacy Qualcomm HDMI bindings Rob Clark
2019-06-30 15:18 ` Linus Walleij
2019-06-30 15:25 ` Rob Clark
2019-06-29 12:59 ` [PATCH 5/7] drm/msm/hdmi: Convert to use GPIO descriptors Linus Walleij
2019-06-29 12:59 ` [PATCH 6/7] RFT: drm/msm/hdmi: Bring up HDMI connector OFF Linus Walleij
2019-06-29 12:59 ` [PATCH 7/7] RFT: drm/msm/hdmi: Do not initialize HPD line value Linus Walleij
2019-07-28 10:02 ` [PATCH 1/7] drm/msm/mdp4: Drop unused GPIO include Linus Walleij
2019-08-05 9:01 ` Linus Walleij
2019-08-13 0:22 ` Brian Masney
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=20190629125933.679-4-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime.ripard@bootlin.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
/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).