Lines Matching +full:ddc +full:- +full:i2c +full:- +full:bus

1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/i2c.h>
19 #include <media/cec-notifier.h>
31 if (output->panel) { in tegra_output_connector_get_modes()
32 err = drm_panel_get_modes(output->panel, connector); in tegra_output_connector_get_modes()
37 if (output->drm_edid) in tegra_output_connector_get_modes()
38 drm_edid = drm_edid_dup(output->drm_edid); in tegra_output_connector_get_modes()
39 else if (output->ddc) in tegra_output_connector_get_modes()
40 drm_edid = drm_edid_read_ddc(connector, output->ddc); in tegra_output_connector_get_modes()
43 cec_notifier_set_phys_addr(output->cec, in tegra_output_connector_get_modes()
44 connector->display_info.source_physical_address); in tegra_output_connector_get_modes()
58 if (output->hpd_gpio) { in tegra_output_connector_detect()
59 if (gpiod_get_value(output->hpd_gpio) == 0) in tegra_output_connector_detect()
64 if (!output->panel) in tegra_output_connector_detect()
71 cec_notifier_phys_addr_invalidate(output->cec); in tegra_output_connector_detect()
80 if (output->cec) in tegra_output_connector_destroy()
81 cec_notifier_conn_unregister(output->cec); in tegra_output_connector_destroy()
91 if (output->connector.dev) in hpd_irq()
92 drm_helper_hpd_irq_event(output->connector.dev); in hpd_irq()
99 struct device_node *ddc, *panel; in tegra_output_probe() local
104 if (!output->of_node) in tegra_output_probe()
105 output->of_node = output->dev->of_node; in tegra_output_probe()
107 err = drm_of_find_panel_or_bridge(output->of_node, -1, -1, in tegra_output_probe()
108 &output->panel, &output->bridge); in tegra_output_probe()
109 if (err && err != -ENODEV) in tegra_output_probe()
112 panel = of_parse_phandle(output->of_node, "nvidia,panel", 0); in tegra_output_probe()
116 * device-tree. in tegra_output_probe()
118 WARN_ON(output->panel || output->bridge); in tegra_output_probe()
120 output->panel = of_drm_find_panel(panel); in tegra_output_probe()
123 if (IS_ERR(output->panel)) in tegra_output_probe()
124 return PTR_ERR(output->panel); in tegra_output_probe()
127 ddc = of_parse_phandle(output->of_node, "nvidia,ddc-i2c-bus", 0); in tegra_output_probe()
128 if (ddc) { in tegra_output_probe()
129 output->ddc = of_get_i2c_adapter_by_node(ddc); in tegra_output_probe()
130 of_node_put(ddc); in tegra_output_probe()
132 if (!output->ddc) { in tegra_output_probe()
133 err = -EPROBE_DEFER; in tegra_output_probe()
138 edid = of_get_property(output->of_node, "nvidia,edid", &size); in tegra_output_probe()
139 output->drm_edid = drm_edid_alloc(edid, size); in tegra_output_probe()
141 output->hpd_gpio = devm_fwnode_gpiod_get(output->dev, in tegra_output_probe()
142 of_fwnode_handle(output->of_node), in tegra_output_probe()
146 if (IS_ERR(output->hpd_gpio)) { in tegra_output_probe()
147 if (PTR_ERR(output->hpd_gpio) != -ENOENT) { in tegra_output_probe()
148 err = PTR_ERR(output->hpd_gpio); in tegra_output_probe()
152 output->hpd_gpio = NULL; in tegra_output_probe()
155 if (output->hpd_gpio) { in tegra_output_probe()
156 err = gpiod_to_irq(output->hpd_gpio); in tegra_output_probe()
158 dev_err(output->dev, "gpiod_to_irq(): %d\n", err); in tegra_output_probe()
162 output->hpd_irq = err; in tegra_output_probe()
167 err = request_threaded_irq(output->hpd_irq, NULL, hpd_irq, in tegra_output_probe()
170 dev_err(output->dev, "failed to request IRQ#%u: %d\n", in tegra_output_probe()
171 output->hpd_irq, err); in tegra_output_probe()
175 output->connector.polled = DRM_CONNECTOR_POLL_HPD; in tegra_output_probe()
182 disable_irq(output->hpd_irq); in tegra_output_probe()
188 if (output->ddc) in tegra_output_probe()
189 i2c_put_adapter(output->ddc); in tegra_output_probe()
191 drm_edid_free(output->drm_edid); in tegra_output_probe()
198 if (output->hpd_gpio) in tegra_output_remove()
199 free_irq(output->hpd_irq, output); in tegra_output_remove()
201 if (output->ddc) in tegra_output_remove()
202 i2c_put_adapter(output->ddc); in tegra_output_remove()
204 drm_edid_free(output->drm_edid); in tegra_output_remove()
215 if (output->hpd_gpio) in tegra_output_init()
216 enable_irq(output->hpd_irq); in tegra_output_init()
218 connector_type = output->connector.connector_type; in tegra_output_init()
226 cec_fill_conn_info_from_drm(&conn_info, &output->connector); in tegra_output_init()
227 output->cec = cec_notifier_conn_register(output->dev, NULL, in tegra_output_init()
229 if (!output->cec) in tegra_output_init()
230 return -ENOMEM; in tegra_output_init()
242 if (output->hpd_gpio) in tegra_output_exit()
243 disable_irq(output->hpd_irq); in tegra_output_exit()
249 struct device *dev = output->dev; in tegra_output_find_possible_crtcs()
265 output->encoder.possible_crtcs = mask; in tegra_output_find_possible_crtcs()
270 if (output->hpd_irq) in tegra_output_suspend()
271 disable_irq(output->hpd_irq); in tegra_output_suspend()
278 if (output->hpd_irq) in tegra_output_resume()
279 enable_irq(output->hpd_irq); in tegra_output_resume()