Lines Matching +full:edid +full:- +full:emulation
1 // SPDX-License-Identifier: GPL-2.0-only
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()
94 /* Load the selected edid into SRAM (accessed at PTN3460_EDID_ADDR) */ in ptn3460_select_edid()
96 ptn_bridge->edid_emulation); in ptn3460_select_edid()
98 DRM_ERROR("Failed to transfer EDID to sram, ret=%d\n", ret); in ptn3460_select_edid()
102 /* Enable EDID emulation and select the desired EDID */ in ptn3460_select_edid()
104 ptn_bridge->edid_emulation << PTN3460_EDID_EMULATION_SELECTION; in ptn3460_select_edid()
108 DRM_ERROR("Failed to write EDID value, ret=%d\n", ret); in ptn3460_select_edid()
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()
138 DRM_ERROR("Select EDID failed ret=%d\n", ret); in ptn3460_pre_enable()
140 ptn_bridge->enabled = true; in ptn3460_pre_enable()
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 struct edid *ptn3460_get_edid(struct drm_bridge *bridge, in ptn3460_get_edid()
162 u8 *edid; in ptn3460_get_edid() local
165 power_off = !ptn_bridge->enabled; in ptn3460_get_edid()
166 ptn3460_pre_enable(&ptn_bridge->bridge); in ptn3460_get_edid()
168 edid = kmalloc(EDID_LENGTH, GFP_KERNEL); in ptn3460_get_edid()
169 if (!edid) { in ptn3460_get_edid()
170 DRM_ERROR("Failed to allocate EDID\n"); in ptn3460_get_edid()
174 ret = ptn3460_read_bytes(ptn_bridge, PTN3460_EDID_ADDR, edid, in ptn3460_get_edid()
177 kfree(edid); in ptn3460_get_edid()
178 edid = NULL; in ptn3460_get_edid()
184 ptn3460_disable(&ptn_bridge->bridge); in ptn3460_get_edid()
186 return (struct edid *)edid; in ptn3460_get_edid()
192 struct edid *edid; in ptn3460_connector_get_modes() local
195 edid = ptn3460_get_edid(&ptn_bridge->bridge, connector); in ptn3460_connector_get_modes()
196 drm_connector_update_edid_property(connector, edid); in ptn3460_connector_get_modes()
197 num_modes = drm_add_edid_modes(connector, edid); in ptn3460_connector_get_modes()
198 kfree(edid); in ptn3460_connector_get_modes()
222 ret = drm_bridge_attach(bridge->encoder, ptn_bridge->panel_bridge, in ptn3460_bridge_attach()
230 if (!bridge->encoder) { in ptn3460_bridge_attach()
232 return -ENODEV; in ptn3460_bridge_attach()
235 ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD; in ptn3460_bridge_attach()
236 ret = drm_connector_init(bridge->dev, &ptn_bridge->connector, in ptn3460_bridge_attach()
242 drm_connector_helper_add(&ptn_bridge->connector, in ptn3460_bridge_attach()
244 drm_connector_register(&ptn_bridge->connector); in ptn3460_bridge_attach()
245 drm_connector_attach_encoder(&ptn_bridge->connector, in ptn3460_bridge_attach()
246 bridge->encoder); in ptn3460_bridge_attach()
248 drm_helper_hpd_irq_event(ptn_bridge->connector.dev); in ptn3460_bridge_attach()
263 struct device *dev = &client->dev; in ptn3460_probe()
270 return -ENOMEM; in ptn3460_probe()
273 panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); in ptn3460_probe()
277 ptn_bridge->panel_bridge = panel_bridge; in ptn3460_probe()
278 ptn_bridge->client = client; in ptn3460_probe()
280 ptn_bridge->gpio_pd_n = devm_gpiod_get(&client->dev, "powerdown", in ptn3460_probe()
282 if (IS_ERR(ptn_bridge->gpio_pd_n)) { in ptn3460_probe()
283 ret = PTR_ERR(ptn_bridge->gpio_pd_n); in ptn3460_probe()
292 ptn_bridge->gpio_rst_n = devm_gpiod_get(&client->dev, "reset", in ptn3460_probe()
294 if (IS_ERR(ptn_bridge->gpio_rst_n)) { in ptn3460_probe()
295 ret = PTR_ERR(ptn_bridge->gpio_rst_n); in ptn3460_probe()
300 ret = of_property_read_u32(dev->of_node, "edid-emulation", in ptn3460_probe()
301 &ptn_bridge->edid_emulation); in ptn3460_probe()
303 dev_err(dev, "Can't read EDID emulation value\n"); in ptn3460_probe()
307 ptn_bridge->bridge.funcs = &ptn3460_bridge_funcs; in ptn3460_probe()
308 ptn_bridge->bridge.ops = DRM_BRIDGE_OP_EDID; in ptn3460_probe()
309 ptn_bridge->bridge.type = DRM_MODE_CONNECTOR_LVDS; in ptn3460_probe()
310 ptn_bridge->bridge.of_node = dev->of_node; in ptn3460_probe()
311 drm_bridge_add(&ptn_bridge->bridge); in ptn3460_probe()
322 drm_bridge_remove(&ptn_bridge->bridge); in ptn3460_remove()
349 MODULE_DESCRIPTION("NXP ptn3460 eDP-LVDS converter driver");