Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/tegra: output: Support low-active hotplug detect

Support low-active hotplug detect signals by storing the GPIO flags
parsed from device tree.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+14 -8
+2
drivers/gpu/drm/tegra/drm.h
··· 12 12 13 13 #include <uapi/drm/tegra_drm.h> 14 14 #include <linux/host1x.h> 15 + #include <linux/of_gpio.h> 15 16 16 17 #include <drm/drmP.h> 17 18 #include <drm/drm_crtc_helper.h> ··· 201 200 const struct edid *edid; 202 201 unsigned int hpd_irq; 203 202 int hpd_gpio; 203 + enum of_gpio_flags hpd_gpio_flags; 204 204 205 205 struct drm_encoder encoder; 206 206 struct drm_connector connector;
+12 -8
drivers/gpu/drm/tegra/output.c
··· 7 7 * published by the Free Software Foundation. 8 8 */ 9 9 10 - #include <linux/of_gpio.h> 11 - 12 10 #include <drm/drm_atomic_helper.h> 13 11 #include <drm/drm_panel.h> 14 12 #include "drm.h" ··· 57 59 enum drm_connector_status status = connector_status_unknown; 58 60 59 61 if (gpio_is_valid(output->hpd_gpio)) { 60 - if (gpio_get_value(output->hpd_gpio) == 0) 61 - status = connector_status_disconnected; 62 - else 63 - status = connector_status_connected; 62 + if (output->hpd_gpio_flags & OF_GPIO_ACTIVE_LOW) { 63 + if (gpio_get_value(output->hpd_gpio) != 0) 64 + status = connector_status_disconnected; 65 + else 66 + status = connector_status_connected; 67 + } else { 68 + if (gpio_get_value(output->hpd_gpio) == 0) 69 + status = connector_status_disconnected; 70 + else 71 + status = connector_status_connected; 72 + } 64 73 } else { 65 74 if (!output->panel) 66 75 status = connector_status_disconnected; ··· 102 97 int tegra_output_probe(struct tegra_output *output) 103 98 { 104 99 struct device_node *ddc, *panel; 105 - enum of_gpio_flags flags; 106 100 int err, size; 107 101 108 102 if (!output->of_node) ··· 132 128 133 129 output->hpd_gpio = of_get_named_gpio_flags(output->of_node, 134 130 "nvidia,hpd-gpio", 0, 135 - &flags); 131 + &output->hpd_gpio_flags); 136 132 if (gpio_is_valid(output->hpd_gpio)) { 137 133 unsigned long flags; 138 134