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
43 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_attach()
47 return -EINVAL; in tpd12s015_attach()
49 ret = drm_bridge_attach(bridge->encoder, tpd->next_bridge, in tpd12s015_attach()
50 bridge, flags); in tpd12s015_attach()
54 gpiod_set_value_cansleep(tpd->ls_oe_gpio, 1); in tpd12s015_attach()
56 /* DC-DC converter needs at max 300us to get to 90% of 5V. */ in tpd12s015_attach()
62 static void tpd12s015_detach(struct drm_bridge *bridge) in tpd12s015_detach() argument
64 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_detach()
66 gpiod_set_value_cansleep(tpd->ls_oe_gpio, 0); in tpd12s015_detach()
69 static enum drm_connector_status tpd12s015_detect(struct drm_bridge *bridge) in tpd12s015_detect() argument
71 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_detect()
73 if (gpiod_get_value_cansleep(tpd->hpd_gpio)) in tpd12s015_detect()
79 static void tpd12s015_hpd_enable(struct drm_bridge *bridge) in tpd12s015_hpd_enable() argument
81 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_hpd_enable()
83 gpiod_set_value_cansleep(tpd->ct_cp_hpd_gpio, 1); in tpd12s015_hpd_enable()
86 static void tpd12s015_hpd_disable(struct drm_bridge *bridge) in tpd12s015_hpd_disable() argument
88 struct tpd12s015_device *tpd = to_tpd12s015(bridge); in tpd12s015_hpd_disable()
90 gpiod_set_value_cansleep(tpd->ct_cp_hpd_gpio, 0); in tpd12s015_hpd_disable()
104 struct drm_bridge *bridge = &tpd->bridge; in tpd12s015_hpd_isr() local
106 drm_bridge_hpd_notify(bridge, tpd12s015_detect(bridge)); in tpd12s015_hpd_isr()
118 tpd = devm_kzalloc(&pdev->dev, sizeof(*tpd), GFP_KERNEL); in tpd12s015_probe()
120 return -ENOMEM; in tpd12s015_probe()
124 tpd->bridge.funcs = &tpd12s015_bridge_funcs; in tpd12s015_probe()
125 tpd->bridge.of_node = pdev->dev.of_node; in tpd12s015_probe()
126 tpd->bridge.type = DRM_MODE_CONNECTOR_HDMIA; in tpd12s015_probe()
127 tpd->bridge.ops = DRM_BRIDGE_OP_DETECT; in tpd12s015_probe()
129 /* Get the next bridge, connected to port@1. */ in tpd12s015_probe()
130 node = of_graph_get_remote_node(pdev->dev.of_node, 1, -1); in tpd12s015_probe()
132 return -ENODEV; in tpd12s015_probe()
134 tpd->next_bridge = of_drm_find_bridge(node); in tpd12s015_probe()
137 if (!tpd->next_bridge) in tpd12s015_probe()
138 return -EPROBE_DEFER; in tpd12s015_probe()
141 gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0, in tpd12s015_probe()
146 tpd->ct_cp_hpd_gpio = gpio; in tpd12s015_probe()
148 gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1, in tpd12s015_probe()
153 tpd->ls_oe_gpio = gpio; in tpd12s015_probe()
155 gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2, GPIOD_IN); in tpd12s015_probe()
159 tpd->hpd_gpio = gpio; in tpd12s015_probe()
161 /* Register the IRQ if the HPD GPIO is IRQ-capable. */ in tpd12s015_probe()
162 tpd->hpd_irq = gpiod_to_irq(tpd->hpd_gpio); in tpd12s015_probe()
163 if (tpd->hpd_irq) { in tpd12s015_probe()
164 ret = devm_request_threaded_irq(&pdev->dev, tpd->hpd_irq, NULL, in tpd12s015_probe()
173 tpd->bridge.ops |= DRM_BRIDGE_OP_HPD; in tpd12s015_probe()
176 /* Register the DRM bridge. */ in tpd12s015_probe()
177 drm_bridge_add(&tpd->bridge); in tpd12s015_probe()
186 drm_bridge_remove(&tpd->bridge); in tpd12s015_remove()
210 MODULE_DESCRIPTION("TPD12S015 HDMI level shifter and ESD protection driver");