Lines Matching +full:hdmi +full:- +full:bridge

1 // SPDX-License-Identifier: GPL-2.0
3 * TPD12S015 HDMI ESD protection & level shifter chip driver
7 * Based on the omapdrm-specific encoder-opa362 driver
25 struct drm_bridge bridge; member
35 static inline struct tpd12s015_device *to_tpd12s015(struct drm_bridge *bridge) in to_tpd12s015() argument
37 return container_of(bridge, struct tpd12s015_device, bridge); in to_tpd12s015()
40 static int tpd12s015_attach(struct drm_bridge *bridge, in tpd12s015_attach() argument
44 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_attach()
48 return -EINVAL; in tpd12s015_attach()
50 ret = drm_bridge_attach(encoder, tpd->next_bridge, in tpd12s015_attach()
51 bridge, flags); in tpd12s015_attach()
55 gpiod_set_value_cansleep(tpd->ls_oe_gpio, 1); in tpd12s015_attach()
57 /* DC-DC converter needs at max 300us to get to 90% of 5V. */ in tpd12s015_attach()
63 static void tpd12s015_detach(struct drm_bridge *bridge) in tpd12s015_detach() argument
65 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_detach()
67 gpiod_set_value_cansleep(tpd->ls_oe_gpio, 0); in tpd12s015_detach()
70 static enum drm_connector_status tpd12s015_detect(struct drm_bridge *bridge) in tpd12s015_detect() argument
72 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_detect()
74 if (gpiod_get_value_cansleep(tpd->hpd_gpio)) in tpd12s015_detect()
81 tpd12s015_bridge_detect(struct drm_bridge *bridge, struct drm_connector *connector) in tpd12s015_bridge_detect() argument
83 return tpd12s015_detect(bridge); in tpd12s015_bridge_detect()
86 static void tpd12s015_hpd_enable(struct drm_bridge *bridge) in tpd12s015_hpd_enable() argument
88 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_hpd_enable()
90 gpiod_set_value_cansleep(tpd->ct_cp_hpd_gpio, 1); in tpd12s015_hpd_enable()
93 static void tpd12s015_hpd_disable(struct drm_bridge *bridge) in tpd12s015_hpd_disable() argument
95 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_hpd_disable()
97 gpiod_set_value_cansleep(tpd->ct_cp_hpd_gpio, 0); in tpd12s015_hpd_disable()
111 struct drm_bridge *bridge = &tpd->bridge; in tpd12s015_hpd_isr() local
113 drm_bridge_hpd_notify(bridge, tpd12s015_detect(bridge)); in tpd12s015_hpd_isr()
125 tpd = devm_drm_bridge_alloc(&pdev->dev, struct tpd12s015_device, in tpd12s015_probe()
126 bridge, &tpd12s015_bridge_funcs); in tpd12s015_probe()
132 tpd->bridge.of_node = pdev->dev.of_node; in tpd12s015_probe()
133 tpd->bridge.type = DRM_MODE_CONNECTOR_HDMIA; in tpd12s015_probe()
134 tpd->bridge.ops = DRM_BRIDGE_OP_DETECT; in tpd12s015_probe()
136 /* Get the next bridge, connected to port@1. */ in tpd12s015_probe()
137 node = of_graph_get_remote_node(pdev->dev.of_node, 1, -1); in tpd12s015_probe()
139 return -ENODEV; in tpd12s015_probe()
141 tpd->next_bridge = of_drm_find_bridge(node); in tpd12s015_probe()
144 if (!tpd->next_bridge) in tpd12s015_probe()
145 return -EPROBE_DEFER; in tpd12s015_probe()
148 gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0, in tpd12s015_probe()
153 tpd->ct_cp_hpd_gpio = gpio; in tpd12s015_probe()
155 gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1, in tpd12s015_probe()
160 tpd->ls_oe_gpio = gpio; in tpd12s015_probe()
162 gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2, GPIOD_IN); in tpd12s015_probe()
166 tpd->hpd_gpio = gpio; in tpd12s015_probe()
168 /* Register the IRQ if the HPD GPIO is IRQ-capable. */ in tpd12s015_probe()
169 tpd->hpd_irq = gpiod_to_irq(tpd->hpd_gpio); in tpd12s015_probe()
170 if (tpd->hpd_irq >= 0) { in tpd12s015_probe()
171 ret = devm_request_threaded_irq(&pdev->dev, tpd->hpd_irq, NULL, in tpd12s015_probe()
180 tpd->bridge.ops |= DRM_BRIDGE_OP_HPD; in tpd12s015_probe()
183 /* Register the DRM bridge. */ in tpd12s015_probe()
184 drm_bridge_add(&tpd->bridge); in tpd12s015_probe()
193 drm_bridge_remove(&tpd->bridge); in tpd12s015_remove()
215 MODULE_DESCRIPTION("TPD12S015 HDMI level shifter and ESD protection driver");