Merge tag 'mmc-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
[cascardo/linux.git] / drivers / gpu / drm / msm / hdmi / hdmi.c
index 9737207..a968cad 100644 (file)
@@ -422,11 +422,28 @@ static const struct {
 
 static int msm_hdmi_get_gpio(struct device_node *of_node, const char *name)
 {
-       int gpio = of_get_named_gpio(of_node, name, 0);
+       int gpio;
+
+       /* try with the gpio names as in the table (downstream bindings) */
+       gpio = of_get_named_gpio(of_node, name, 0);
        if (gpio < 0) {
                char name2[32];
-               snprintf(name2, sizeof(name2), "%s-gpio", name);
+
+               /* try with the gpio names as in the upstream bindings */
+               snprintf(name2, sizeof(name2), "%s-gpios", name);
                gpio = of_get_named_gpio(of_node, name2, 0);
+               if (gpio < 0) {
+                       char name3[32];
+
+                       /*
+                        * try again after stripping out the "qcom,hdmi-tx"
+                        * prefix. This is mainly to match "hpd-gpios" used
+                        * in the upstream bindings
+                        */
+                       if (sscanf(name2, "qcom,hdmi-tx-%s", name3))
+                               gpio = of_get_named_gpio(of_node, name3, 0);
+               }
+
                if (gpio < 0) {
                        DBG("failed to get gpio: %s (%d)", name, gpio);
                        gpio = -1;