Lines Matching +full:no +full:- +full:hpd

1 // SPDX-License-Identifier: GPL-2.0
9 #include <linux/media-bus-format.h>
40 return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL; in display_connector_attach()
48 if (conn->hpd_gpio) { in display_connector_detect()
49 if (gpiod_get_value_cansleep(conn->hpd_gpio)) in display_connector_detect()
55 if (conn->bridge.ddc && drm_probe_ddc(conn->bridge.ddc)) in display_connector_detect()
58 switch (conn->bridge.type) { in display_connector_detect()
66 * that no cable is connected. in display_connector_detect()
75 * Composite and S-Video connectors have no other detection in display_connector_detect()
76 * mean than the HPD GPIO. For VGA connectors, even if we have in display_connector_detect()
90 return drm_get_edid(connector, conn->bridge.ddc); in display_connector_get_edid()
109 if (!prev_bridge || !prev_bridge->funcs->atomic_get_output_bus_fmts) { in display_connector_get_output_bus_fmts()
110 struct drm_connector *conn = conn_state->connector; in display_connector_get_output_bus_fmts()
118 if (conn->display_info.num_bus_formats && in display_connector_get_output_bus_fmts()
119 conn->display_info.bus_formats) in display_connector_get_output_bus_fmts()
120 out_bus_fmts[0] = conn->display_info.bus_formats[0]; in display_connector_get_output_bus_fmts()
127 prev_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in display_connector_get_output_bus_fmts()
130 return prev_bridge->funcs->atomic_get_output_bus_fmts(prev_bridge, prev_bridge_state, in display_connector_get_output_bus_fmts()
152 if (!prev_bridge || !prev_bridge->funcs->atomic_get_input_bus_fmts) { in display_connector_get_input_bus_fmts()
165 prev_bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state, in display_connector_get_input_bus_fmts()
168 return prev_bridge->funcs->atomic_get_input_bus_fmts(prev_bridge, prev_bridge_state, in display_connector_get_input_bus_fmts()
187 struct drm_bridge *bridge = &conn->bridge; in display_connector_hpd_irq()
201 conn = devm_kzalloc(&pdev->dev, sizeof(*conn), GFP_KERNEL); in display_connector_probe()
203 return -ENOMEM; in display_connector_probe()
207 type = (uintptr_t)of_device_get_match_data(&pdev->dev); in display_connector_probe()
214 analog = of_property_read_bool(pdev->dev.of_node, "analog"); in display_connector_probe()
215 digital = of_property_read_bool(pdev->dev.of_node, "digital"); in display_connector_probe()
217 conn->bridge.type = DRM_MODE_CONNECTOR_DVIA; in display_connector_probe()
219 conn->bridge.type = DRM_MODE_CONNECTOR_DVID; in display_connector_probe()
221 conn->bridge.type = DRM_MODE_CONNECTOR_DVII; in display_connector_probe()
223 dev_err(&pdev->dev, "DVI connector with no type\n"); in display_connector_probe()
224 return -EINVAL; in display_connector_probe()
232 ret = of_property_read_string(pdev->dev.of_node, "type", in display_connector_probe()
235 dev_err(&pdev->dev, "HDMI connector with no type\n"); in display_connector_probe()
236 return -EINVAL; in display_connector_probe()
241 conn->bridge.type = DRM_MODE_CONNECTOR_HDMIA; in display_connector_probe()
243 conn->bridge.type = DRM_MODE_CONNECTOR_HDMIB; in display_connector_probe()
245 dev_err(&pdev->dev, in display_connector_probe()
248 return -EINVAL; in display_connector_probe()
255 conn->bridge.type = type; in display_connector_probe()
260 conn->bridge.interlace_allowed = true; in display_connector_probe()
263 of_property_read_string(pdev->dev.of_node, "label", &label); in display_connector_probe()
266 * Get the HPD GPIO for DVI, HDMI and DP connectors. If the GPIO can provide in display_connector_probe()
272 conn->hpd_gpio = devm_gpiod_get_optional(&pdev->dev, "hpd", in display_connector_probe()
274 if (IS_ERR(conn->hpd_gpio)) { in display_connector_probe()
275 if (PTR_ERR(conn->hpd_gpio) != -EPROBE_DEFER) in display_connector_probe()
276 dev_err(&pdev->dev, in display_connector_probe()
277 "Unable to retrieve HPD GPIO\n"); in display_connector_probe()
278 return PTR_ERR(conn->hpd_gpio); in display_connector_probe()
281 conn->hpd_irq = gpiod_to_irq(conn->hpd_gpio); in display_connector_probe()
283 conn->hpd_irq = -EINVAL; in display_connector_probe()
286 if (conn->hpd_irq >= 0) { in display_connector_probe()
287 ret = devm_request_threaded_irq(&pdev->dev, conn->hpd_irq, in display_connector_probe()
292 "HPD", conn); in display_connector_probe()
294 dev_info(&pdev->dev, in display_connector_probe()
295 "Failed to request HPD edge interrupt, falling back to polling\n"); in display_connector_probe()
296 conn->hpd_irq = -EINVAL; in display_connector_probe()
306 phandle = of_parse_phandle(pdev->dev.of_node, "ddc-i2c-bus", 0); in display_connector_probe()
308 conn->bridge.ddc = of_get_i2c_adapter_by_node(phandle); in display_connector_probe()
310 if (!conn->bridge.ddc) in display_connector_probe()
311 return -EPROBE_DEFER; in display_connector_probe()
313 dev_dbg(&pdev->dev, in display_connector_probe()
314 "No I2C bus specified, disabling EDID readout\n"); in display_connector_probe()
322 conn->dp_pwr = devm_regulator_get_optional(&pdev->dev, "dp-pwr"); in display_connector_probe()
324 if (IS_ERR(conn->dp_pwr)) { in display_connector_probe()
325 ret = PTR_ERR(conn->dp_pwr); in display_connector_probe()
328 case -ENODEV: in display_connector_probe()
329 conn->dp_pwr = NULL; in display_connector_probe()
332 case -EPROBE_DEFER: in display_connector_probe()
333 return -EPROBE_DEFER; in display_connector_probe()
336 dev_err(&pdev->dev, "failed to get DP PWR regulator: %d\n", ret); in display_connector_probe()
341 if (conn->dp_pwr) { in display_connector_probe()
342 ret = regulator_enable(conn->dp_pwr); in display_connector_probe()
344 dev_err(&pdev->dev, "failed to enable DP PWR regulator: %d\n", ret); in display_connector_probe()
352 conn->ddc_en = devm_gpiod_get_optional(&pdev->dev, "ddc-en", in display_connector_probe()
355 if (IS_ERR(conn->ddc_en)) { in display_connector_probe()
356 dev_err(&pdev->dev, "Couldn't get ddc-en gpio\n"); in display_connector_probe()
357 return PTR_ERR(conn->ddc_en); in display_connector_probe()
361 conn->bridge.funcs = &display_connector_bridge_funcs; in display_connector_probe()
362 conn->bridge.of_node = pdev->dev.of_node; in display_connector_probe()
364 if (conn->bridge.ddc) in display_connector_probe()
365 conn->bridge.ops |= DRM_BRIDGE_OP_EDID in display_connector_probe()
367 if (conn->hpd_gpio) in display_connector_probe()
368 conn->bridge.ops |= DRM_BRIDGE_OP_DETECT; in display_connector_probe()
369 if (conn->hpd_irq >= 0) in display_connector_probe()
370 conn->bridge.ops |= DRM_BRIDGE_OP_HPD; in display_connector_probe()
372 dev_dbg(&pdev->dev, in display_connector_probe()
373 "Found %s display connector '%s' %s DDC bus and %s HPD GPIO (ops 0x%x)\n", in display_connector_probe()
374 drm_get_connector_type_name(conn->bridge.type), in display_connector_probe()
376 conn->bridge.ddc ? "with" : "without", in display_connector_probe()
377 conn->hpd_gpio ? "with" : "without", in display_connector_probe()
378 conn->bridge.ops); in display_connector_probe()
380 drm_bridge_add(&conn->bridge); in display_connector_probe()
389 if (conn->ddc_en) in display_connector_remove()
390 gpiod_set_value(conn->ddc_en, 0); in display_connector_remove()
392 if (conn->dp_pwr) in display_connector_remove()
393 regulator_disable(conn->dp_pwr); in display_connector_remove()
395 drm_bridge_remove(&conn->bridge); in display_connector_remove()
397 if (!IS_ERR(conn->bridge.ddc)) in display_connector_remove()
398 i2c_put_adapter(conn->bridge.ddc); in display_connector_remove()
405 .compatible = "composite-video-connector",
408 .compatible = "dvi-connector",
411 .compatible = "hdmi-connector",
414 .compatible = "svideo-connector",
417 .compatible = "vga-connector",
420 .compatible = "dp-connector",
431 .name = "display-connector",