Lines Matching +full:vcchdmipll +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0
10 #include <linux/media-bus-format.h>
89 return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq)); in lt8912_write_init_config()
102 return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, ARRAY_SIZE(seq)); in lt8912_write_mipi_basic_config()
155 return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, ARRAY_SIZE(seq)); in lt8912_write_dds_config()
162 ret = regmap_write(lt->regmap[I2C_MAIN], 0x03, 0x7f); in lt8912_write_rxlogicres_config()
164 ret |= regmap_write(lt->regmap[I2C_MAIN], 0x03, 0xff); in lt8912_write_rxlogicres_config()
180 {0x52, 0x04}, // loopdiv=0, use second-order PLL in lt8912_write_lvds_config()
200 return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq)); in lt8912_write_lvds_config()
232 return -ENODEV; in lt8912_init_i2c()
236 lt->i2c_client[i] = i2c_new_dummy_device(client->adapter, in lt8912_init_i2c()
238 if (IS_ERR(lt->i2c_client[i])) in lt8912_init_i2c()
239 return PTR_ERR(lt->i2c_client[i]); in lt8912_init_i2c()
242 lt->regmap[i] = devm_regmap_init_i2c(lt->i2c_client[i], in lt8912_init_i2c()
244 if (IS_ERR(lt->regmap[i])) in lt8912_init_i2c()
245 return PTR_ERR(lt->regmap[i]); in lt8912_init_i2c()
255 i2c_unregister_device(lt->i2c_client[i]); in lt8912_free_i2c()
264 ret = regulator_bulk_enable(ARRAY_SIZE(lt->supplies), lt->supplies); in lt8912_hard_power_on()
268 gpiod_set_value_cansleep(lt->gp_reset, 0); in lt8912_hard_power_on()
276 gpiod_set_value_cansleep(lt->gp_reset, 1); in lt8912_hard_power_off()
279 regulator_bulk_disable(ARRAY_SIZE(lt->supplies), lt->supplies); in lt8912_hard_power_off()
281 lt->is_power_on = false; in lt8912_hard_power_off()
292 return -EINVAL; in lt8912_video_setup()
294 hactive = lt->mode.hactive; in lt8912_video_setup()
295 hfp = lt->mode.hfront_porch; in lt8912_video_setup()
296 hpw = lt->mode.hsync_len; in lt8912_video_setup()
297 hbp = lt->mode.hback_porch; in lt8912_video_setup()
299 hsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_HSYNC_HIGH; in lt8912_video_setup()
301 vactive = lt->mode.vactive; in lt8912_video_setup()
302 vfp = lt->mode.vfront_porch; in lt8912_video_setup()
303 vpw = lt->mode.vsync_len; in lt8912_video_setup()
304 vbp = lt->mode.vback_porch; in lt8912_video_setup()
306 vsync_activehigh = lt->mode.flags & DISPLAY_FLAGS_VSYNC_HIGH; in lt8912_video_setup()
313 ret = regmap_write(lt->regmap[I2C_CEC_DSI], 0x10, 0x01); in lt8912_video_setup()
314 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x11, settle); in lt8912_video_setup()
315 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x18, hpw); in lt8912_video_setup()
316 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x19, vpw); in lt8912_video_setup()
317 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x1c, hactive & 0xff); in lt8912_video_setup()
318 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x1d, hactive >> 8); in lt8912_video_setup()
320 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x2f, 0x0c); in lt8912_video_setup()
322 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x34, h_total & 0xff); in lt8912_video_setup()
323 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x35, h_total >> 8); in lt8912_video_setup()
325 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x36, v_total & 0xff); in lt8912_video_setup()
326 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x37, v_total >> 8); in lt8912_video_setup()
328 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x38, vbp & 0xff); in lt8912_video_setup()
329 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x39, vbp >> 8); in lt8912_video_setup()
331 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3a, vfp & 0xff); in lt8912_video_setup()
332 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3b, vfp >> 8); in lt8912_video_setup()
334 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3c, hbp & 0xff); in lt8912_video_setup()
335 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3d, hbp >> 8); in lt8912_video_setup()
337 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3e, hfp & 0xff); in lt8912_video_setup()
338 ret |= regmap_write(lt->regmap[I2C_CEC_DSI], 0x3f, hfp >> 8); in lt8912_video_setup()
340 ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(0), in lt8912_video_setup()
342 ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1), in lt8912_video_setup()
344 ret |= regmap_update_bits(lt->regmap[I2C_MAIN], 0xb2, BIT(0), in lt8912_video_setup()
345 lt->connector.display_info.is_hdmi ? BIT(0) : 0); in lt8912_video_setup()
352 if (!lt->is_power_on) { in lt8912_soft_power_on()
353 u32 lanes = lt->data_lanes; in lt8912_soft_power_on()
356 regmap_write(lt->regmap[I2C_CEC_DSI], 0x13, lanes & 3); in lt8912_soft_power_on()
360 lt->is_power_on = true; in lt8912_soft_power_on()
395 ret = regmap_read(lt->regmap[I2C_MAIN], 0xC1, ®_val); in lt8912_check_cable_status()
410 if (lt->hdmi_port->ops & DRM_BRIDGE_OP_DETECT) in lt8912_connector_detect()
411 return drm_bridge_detect(lt->hdmi_port); in lt8912_connector_detect()
432 drm_edid = drm_bridge_edid_read(lt->hdmi_port, connector); in lt8912_connector_get_modes()
439 ret = drm_display_info_set_bus_formats(&connector->display_info, in lt8912_connector_get_modes()
458 drm_display_mode_to_videomode(adj, <->mode); in lt8912_bridge_mode_set()
470 struct device *dev = lt->dev; in lt8912_attach_dsi()
473 int ret = -1; in lt8912_attach_dsi()
479 host = of_find_mipi_dsi_host_by_node(lt->host_node); in lt8912_attach_dsi()
481 return dev_err_probe(dev, -EPROBE_DEFER, "failed to find dsi host\n"); in lt8912_attach_dsi()
490 lt->dsi = dsi; in lt8912_attach_dsi()
492 dsi->lanes = lt->data_lanes; in lt8912_attach_dsi()
493 dsi->format = MIPI_DSI_FMT_RGB888; in lt8912_attach_dsi()
495 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | in lt8912_attach_dsi()
512 if (lt->bridge.dev) in lt8912_bridge_hpd_cb()
513 drm_helper_hpd_irq_event(lt->bridge.dev); in lt8912_bridge_hpd_cb()
520 struct drm_connector *connector = <->connector; in lt8912_bridge_connector_init()
522 if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) { in lt8912_bridge_connector_init()
523 drm_bridge_hpd_enable(lt->hdmi_port, lt8912_bridge_hpd_cb, lt); in lt8912_bridge_connector_init()
524 connector->polled = DRM_CONNECTOR_POLL_HPD; in lt8912_bridge_connector_init()
526 connector->polled = DRM_CONNECTOR_POLL_CONNECT | in lt8912_bridge_connector_init()
530 ret = drm_connector_init(bridge->dev, connector, in lt8912_bridge_connector_init()
532 lt->hdmi_port->type); in lt8912_bridge_connector_init()
538 connector->dpms = DRM_MODE_DPMS_OFF; in lt8912_bridge_connector_init()
539 drm_connector_attach_encoder(connector, bridge->encoder); in lt8912_bridge_connector_init()
551 ret = drm_bridge_attach(bridge->encoder, lt->hdmi_port, bridge, in lt8912_bridge_attach()
554 dev_err(lt->dev, "Failed to attach next bridge (%d)\n", ret); in lt8912_bridge_attach()
561 dev_err(lt->dev, "Failed to init bridge ! (%d)\n", ret); in lt8912_bridge_attach()
587 if (lt->connector.dev && lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) in lt8912_bridge_detach()
588 drm_bridge_hpd_disable(lt->hdmi_port); in lt8912_bridge_detach()
596 if (mode->clock > 150000) in lt8912_bridge_mode_valid()
599 if (mode->hdisplay > 1920) in lt8912_bridge_mode_valid()
602 if (mode->vdisplay > 1080) in lt8912_bridge_mode_valid()
613 if (lt->hdmi_port->ops & DRM_BRIDGE_OP_DETECT) in lt8912_bridge_detect()
614 return drm_bridge_detect(lt->hdmi_port); in lt8912_bridge_detect()
628 if (lt->hdmi_port->ops & DRM_BRIDGE_OP_EDID) in lt8912_bridge_edid_read()
629 return drm_bridge_edid_read(lt->hdmi_port, connector); in lt8912_bridge_edid_read()
631 dev_warn(lt->dev, "The connected bridge does not supports DRM_BRIDGE_OP_EDID\n"); in lt8912_bridge_edid_read()
677 "vcchdmitx", "vcclvdspll", "vcchdmipll" in lt8912_get_regulators()
680 for (i = 0; i < ARRAY_SIZE(lt->supplies); i++) in lt8912_get_regulators()
681 lt->supplies[i].supply = supply_names[i]; in lt8912_get_regulators()
683 return devm_regulator_bulk_get(lt->dev, ARRAY_SIZE(lt->supplies), in lt8912_get_regulators()
684 lt->supplies); in lt8912_get_regulators()
690 struct device *dev = lt->dev; in lt8912_parse_dt()
698 if (ret != -EPROBE_DEFER) in lt8912_parse_dt()
702 lt->gp_reset = gp_reset; in lt8912_parse_dt()
704 data_lanes = drm_of_get_data_lanes_count_ep(dev->of_node, 0, -1, 1, 4); in lt8912_parse_dt()
706 dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__); in lt8912_parse_dt()
710 lt->data_lanes = data_lanes; in lt8912_parse_dt()
712 lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1); in lt8912_parse_dt()
713 if (!lt->host_node) { in lt8912_parse_dt()
714 dev_err(lt->dev, "%s: Failed to get remote port\n", __func__); in lt8912_parse_dt()
715 return -ENODEV; in lt8912_parse_dt()
718 port_node = of_graph_get_remote_node(dev->of_node, 1, -1); in lt8912_parse_dt()
720 dev_err(lt->dev, "%s: Failed to get connector port\n", __func__); in lt8912_parse_dt()
721 ret = -ENODEV; in lt8912_parse_dt()
725 lt->hdmi_port = of_drm_find_bridge(port_node); in lt8912_parse_dt()
726 if (!lt->hdmi_port) { in lt8912_parse_dt()
727 ret = -EPROBE_DEFER; in lt8912_parse_dt()
728 dev_err_probe(lt->dev, ret, "%s: Failed to get hdmi port\n", __func__); in lt8912_parse_dt()
732 if (!of_device_is_compatible(port_node, "hdmi-connector")) { in lt8912_parse_dt()
733 dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__); in lt8912_parse_dt()
734 ret = -EINVAL; in lt8912_parse_dt()
747 of_node_put(lt->host_node); in lt8912_parse_dt()
753 of_node_put(lt->host_node); in lt8912_put_dt()
761 struct device *dev = &client->dev; in lt8912_probe()
765 return -ENOMEM; in lt8912_probe()
767 lt->dev = dev; in lt8912_probe()
768 lt->i2c_client[0] = client; in lt8912_probe()
780 lt->bridge.funcs = <8912_bridge_funcs; in lt8912_probe()
781 lt->bridge.of_node = dev->of_node; in lt8912_probe()
782 lt->bridge.ops = (DRM_BRIDGE_OP_EDID | in lt8912_probe()
785 drm_bridge_add(<->bridge); in lt8912_probe()
794 drm_bridge_remove(<->bridge); in lt8912_probe()
806 drm_bridge_remove(<->bridge); in lt8912_remove()