Lines Matching +full:edp +full:- +full:bridge
1 // SPDX-License-Identifier: GPL-2.0-only
3 * NXP PTN3460 DP/LVDS bridge driver
31 struct drm_bridge bridge; member
40 bridge_to_ptn3460(struct drm_bridge *bridge) in bridge_to_ptn3460() argument
42 return container_of(bridge, struct ptn3460_bridge, bridge); in bridge_to_ptn3460()
56 ret = i2c_master_send(ptn_bridge->client, &addr, 1); in ptn3460_read_bytes()
62 ret = i2c_master_recv(ptn_bridge->client, buf, len); in ptn3460_read_bytes()
80 ret = i2c_master_send(ptn_bridge->client, buf, ARRAY_SIZE(buf)); in ptn3460_write_byte()
96 ptn_bridge->edid_emulation); in ptn3460_select_edid()
104 ptn_bridge->edid_emulation << PTN3460_EDID_EMULATION_SELECTION; in ptn3460_select_edid()
115 static void ptn3460_pre_enable(struct drm_bridge *bridge) in ptn3460_pre_enable() argument
117 struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); in ptn3460_pre_enable()
120 if (ptn_bridge->enabled) in ptn3460_pre_enable()
123 gpiod_set_value(ptn_bridge->gpio_pd_n, 1); in ptn3460_pre_enable()
125 gpiod_set_value(ptn_bridge->gpio_rst_n, 0); in ptn3460_pre_enable()
127 gpiod_set_value(ptn_bridge->gpio_rst_n, 1); in ptn3460_pre_enable()
140 ptn_bridge->enabled = true; in ptn3460_pre_enable()
143 static void ptn3460_disable(struct drm_bridge *bridge) in ptn3460_disable() argument
145 struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); in ptn3460_disable()
147 if (!ptn_bridge->enabled) in ptn3460_disable()
150 ptn_bridge->enabled = false; in ptn3460_disable()
152 gpiod_set_value(ptn_bridge->gpio_rst_n, 1); in ptn3460_disable()
153 gpiod_set_value(ptn_bridge->gpio_pd_n, 0); in ptn3460_disable()
157 static const struct drm_edid *ptn3460_edid_read(struct drm_bridge *bridge, in ptn3460_edid_read() argument
160 struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); in ptn3460_edid_read()
166 power_off = !ptn_bridge->enabled; in ptn3460_edid_read()
167 ptn3460_pre_enable(&ptn_bridge->bridge); in ptn3460_edid_read()
186 ptn3460_disable(&ptn_bridge->bridge); in ptn3460_edid_read()
197 drm_edid = ptn3460_edid_read(&ptn_bridge->bridge, connector); in ptn3460_connector_get_modes()
217 static int ptn3460_bridge_attach(struct drm_bridge *bridge, in ptn3460_bridge_attach() argument
220 struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); in ptn3460_bridge_attach()
224 ret = drm_bridge_attach(bridge->encoder, ptn_bridge->panel_bridge, in ptn3460_bridge_attach()
225 bridge, flags | DRM_BRIDGE_ATTACH_NO_CONNECTOR); in ptn3460_bridge_attach()
232 ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD; in ptn3460_bridge_attach()
233 ret = drm_connector_init(bridge->dev, &ptn_bridge->connector, in ptn3460_bridge_attach()
239 drm_connector_helper_add(&ptn_bridge->connector, in ptn3460_bridge_attach()
241 drm_connector_register(&ptn_bridge->connector); in ptn3460_bridge_attach()
242 drm_connector_attach_encoder(&ptn_bridge->connector, in ptn3460_bridge_attach()
243 bridge->encoder); in ptn3460_bridge_attach()
245 drm_helper_hpd_irq_event(ptn_bridge->connector.dev); in ptn3460_bridge_attach()
259 struct device *dev = &client->dev; in ptn3460_probe()
266 return -ENOMEM; in ptn3460_probe()
269 panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); in ptn3460_probe()
273 ptn_bridge->panel_bridge = panel_bridge; in ptn3460_probe()
274 ptn_bridge->client = client; in ptn3460_probe()
276 ptn_bridge->gpio_pd_n = devm_gpiod_get(&client->dev, "powerdown", in ptn3460_probe()
278 if (IS_ERR(ptn_bridge->gpio_pd_n)) { in ptn3460_probe()
279 ret = PTR_ERR(ptn_bridge->gpio_pd_n); in ptn3460_probe()
285 * Request the reset pin low to avoid the bridge being in ptn3460_probe()
288 ptn_bridge->gpio_rst_n = devm_gpiod_get(&client->dev, "reset", in ptn3460_probe()
290 if (IS_ERR(ptn_bridge->gpio_rst_n)) { in ptn3460_probe()
291 ret = PTR_ERR(ptn_bridge->gpio_rst_n); in ptn3460_probe()
296 ret = of_property_read_u32(dev->of_node, "edid-emulation", in ptn3460_probe()
297 &ptn_bridge->edid_emulation); in ptn3460_probe()
303 ptn_bridge->bridge.funcs = &ptn3460_bridge_funcs; in ptn3460_probe()
304 ptn_bridge->bridge.ops = DRM_BRIDGE_OP_EDID; in ptn3460_probe()
305 ptn_bridge->bridge.type = DRM_MODE_CONNECTOR_LVDS; in ptn3460_probe()
306 ptn_bridge->bridge.of_node = dev->of_node; in ptn3460_probe()
307 drm_bridge_add(&ptn_bridge->bridge); in ptn3460_probe()
318 drm_bridge_remove(&ptn_bridge->bridge); in ptn3460_remove()
345 MODULE_DESCRIPTION("NXP ptn3460 eDP-LVDS converter driver");