Lines Matching +full:ddc +full:- +full:i2c +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/i2c.h>
18 #include <media/cec-notifier.h>
30 if (output->panel) { in tegra_output_connector_get_modes()
31 err = drm_panel_get_modes(output->panel, connector); in tegra_output_connector_get_modes()
36 if (output->edid) in tegra_output_connector_get_modes()
37 edid = kmemdup(output->edid, sizeof(*edid), GFP_KERNEL); in tegra_output_connector_get_modes()
38 else if (output->ddc) in tegra_output_connector_get_modes()
39 edid = drm_get_edid(connector, output->ddc); in tegra_output_connector_get_modes()
41 cec_notifier_set_phys_addr_from_edid(output->cec, edid); 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
103 if (!output->of_node) in tegra_output_probe()
104 output->of_node = output->dev->of_node; in tegra_output_probe()
106 err = drm_of_find_panel_or_bridge(output->of_node, -1, -1, in tegra_output_probe()
107 &output->panel, &output->bridge); in tegra_output_probe()
108 if (err && err != -ENODEV) in tegra_output_probe()
111 panel = of_parse_phandle(output->of_node, "nvidia,panel", 0); in tegra_output_probe()
115 * device-tree. in tegra_output_probe()
117 WARN_ON(output->panel || output->bridge); in tegra_output_probe()
119 output->panel = of_drm_find_panel(panel); in tegra_output_probe()
122 if (IS_ERR(output->panel)) in tegra_output_probe()
123 return PTR_ERR(output->panel); in tegra_output_probe()
126 output->edid = of_get_property(output->of_node, "nvidia,edid", &size); in tegra_output_probe()
128 ddc = of_parse_phandle(output->of_node, "nvidia,ddc-i2c-bus", 0); in tegra_output_probe()
129 if (ddc) { in tegra_output_probe()
130 output->ddc = of_get_i2c_adapter_by_node(ddc); in tegra_output_probe()
131 of_node_put(ddc); in tegra_output_probe()
133 if (!output->ddc) { in tegra_output_probe()
134 err = -EPROBE_DEFER; in tegra_output_probe()
139 output->hpd_gpio = devm_fwnode_gpiod_get(output->dev, in tegra_output_probe()
140 of_fwnode_handle(output->of_node), in tegra_output_probe()
144 if (IS_ERR(output->hpd_gpio)) { in tegra_output_probe()
145 if (PTR_ERR(output->hpd_gpio) != -ENOENT) in tegra_output_probe()
146 return PTR_ERR(output->hpd_gpio); in tegra_output_probe()
148 output->hpd_gpio = NULL; in tegra_output_probe()
151 if (output->hpd_gpio) { in tegra_output_probe()
152 err = gpiod_to_irq(output->hpd_gpio); in tegra_output_probe()
154 dev_err(output->dev, "gpiod_to_irq(): %d\n", err); in tegra_output_probe()
158 output->hpd_irq = err; in tegra_output_probe()
163 err = request_threaded_irq(output->hpd_irq, NULL, hpd_irq, in tegra_output_probe()
166 dev_err(output->dev, "failed to request IRQ#%u: %d\n", in tegra_output_probe()
167 output->hpd_irq, err); in tegra_output_probe()
171 output->connector.polled = DRM_CONNECTOR_POLL_HPD; in tegra_output_probe()
178 disable_irq(output->hpd_irq); in tegra_output_probe()
186 if (output->hpd_gpio) in tegra_output_remove()
187 free_irq(output->hpd_irq, output); in tegra_output_remove()
189 if (output->ddc) in tegra_output_remove()
190 i2c_put_adapter(output->ddc); in tegra_output_remove()
201 if (output->hpd_gpio) in tegra_output_init()
202 enable_irq(output->hpd_irq); in tegra_output_init()
204 connector_type = output->connector.connector_type; in tegra_output_init()
212 cec_fill_conn_info_from_drm(&conn_info, &output->connector); in tegra_output_init()
213 output->cec = cec_notifier_conn_register(output->dev, NULL, in tegra_output_init()
215 if (!output->cec) in tegra_output_init()
216 return -ENOMEM; in tegra_output_init()
228 if (output->hpd_gpio) in tegra_output_exit()
229 disable_irq(output->hpd_irq); in tegra_output_exit()
235 struct device *dev = output->dev; in tegra_output_find_possible_crtcs()
251 output->encoder.possible_crtcs = mask; in tegra_output_find_possible_crtcs()
256 if (output->hpd_irq) in tegra_output_suspend()
257 disable_irq(output->hpd_irq); in tegra_output_suspend()
264 if (output->hpd_irq) in tegra_output_resume()
265 enable_irq(output->hpd_irq); in tegra_output_resume()