Lines Matching +full:panel +full:- +full:timing
1 // SPDX-License-Identifier: GPL-2.0
27 #define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end))
32 #define PPI_LPTXTIMECNT 0x0114 /* LPTX timing signal */
34 #define PPI_TX_RX_TA 0x013C /* BTA timing parameters */
42 #define DSI_STARTDSI 0x0204 /* START control bit of DSI-TX */
49 #define VP_CTRL_VTGEN(v) FLD_VAL(v, 4, 4) /* Use chip clock for timing */
56 #define VP_HTIM1 0x0454 /* Horizontal Timing Control 1 */
59 #define VP_HTIM2 0x0458 /* Horizontal Timing Control 2 */
62 #define VP_VTIM1 0x045C /* Vertical Timing Control 1 */
65 #define VP_VTIM2 0x0460 /* Vertical Timing Control 2 */
68 #define VP_VFUEN 0x0464 /* Video Frame Timing Update Enable */
124 #define SYS_RST_I2CS BIT(0) /* Reset I2C-Slave controller */
125 #define SYS_RST_I2CM BIT(1) /* Reset I2C-Master controller */
128 #define SYS_RST_DSIRX BIT(4) /* Reset DSI-RX and App controller */
158 struct drm_panel *panel; member
164 int ret = ctx->error; in tc358764_clear_error()
166 ctx->error = 0; in tc358764_clear_error()
172 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in tc358764_read()
175 if (ctx->error) in tc358764_read()
183 dev_dbg(ctx->dev, "read: %d, addr: %d\n", addr, *val); in tc358764_read()
188 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in tc358764_write()
192 if (ctx->error) in tc358764_write()
204 ctx->error = ret; in tc358764_write()
223 if (ctx->error) in tc358764_init()
225 dev_info(ctx->dev, "ID: %#x\n", v); in tc358764_init()
274 gpiod_set_value(ctx->gpio_reset, 1); in tc358764_reset()
276 gpiod_set_value(ctx->gpio_reset, 0); in tc358764_reset()
284 return drm_panel_get_modes(ctx->panel); in tc358764_get_modes()
303 int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); in tc358764_disable()
306 dev_err(ctx->dev, "error disabling panel (%d)\n", ret); in tc358764_disable()
314 ret = drm_panel_unprepare(ctx->panel); in tc358764_post_disable()
316 dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); in tc358764_post_disable()
319 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in tc358764_post_disable()
321 dev_err(ctx->dev, "error disabling regulators (%d)\n", ret); in tc358764_post_disable()
329 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in tc358764_pre_enable()
331 dev_err(ctx->dev, "error enabling regulators (%d)\n", ret); in tc358764_pre_enable()
336 dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); in tc358764_pre_enable()
337 ret = drm_panel_prepare(ctx->panel); in tc358764_pre_enable()
339 dev_err(ctx->dev, "error preparing panel (%d)\n", ret); in tc358764_pre_enable()
345 int ret = drm_panel_enable(ctx->panel); in tc358764_enable()
348 dev_err(ctx->dev, "error enabling panel (%d)\n", ret); in tc358764_enable()
354 struct drm_device *drm = bridge->dev; in tc358764_attach()
357 ctx->connector.polled = DRM_CONNECTOR_POLL_HPD; in tc358764_attach()
358 ret = drm_connector_init(drm, &ctx->connector, in tc358764_attach()
366 drm_connector_helper_add(&ctx->connector, in tc358764_attach()
368 drm_connector_attach_encoder(&ctx->connector, bridge->encoder); in tc358764_attach()
369 drm_panel_attach(ctx->panel, &ctx->connector); in tc358764_attach()
370 ctx->connector.funcs->reset(&ctx->connector); in tc358764_attach()
371 drm_fb_helper_add_one_connector(drm->fb_helper, &ctx->connector); in tc358764_attach()
372 drm_connector_register(&ctx->connector); in tc358764_attach()
380 struct drm_device *drm = bridge->dev; in tc358764_detach()
382 drm_connector_unregister(&ctx->connector); in tc358764_detach()
383 drm_fb_helper_remove_one_connector(drm->fb_helper, &ctx->connector); in tc358764_detach()
384 drm_panel_detach(ctx->panel); in tc358764_detach()
385 ctx->panel = NULL; in tc358764_detach()
386 drm_connector_put(&ctx->connector); in tc358764_detach()
400 struct device *dev = ctx->dev; in tc358764_parse_dt()
403 ctx->gpio_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in tc358764_parse_dt()
404 if (IS_ERR(ctx->gpio_reset)) { in tc358764_parse_dt()
406 return PTR_ERR(ctx->gpio_reset); in tc358764_parse_dt()
409 ret = drm_of_find_panel_or_bridge(ctx->dev->of_node, 1, 0, &ctx->panel, in tc358764_parse_dt()
411 if (ret && ret != -EPROBE_DEFER) in tc358764_parse_dt()
412 dev_err(dev, "cannot find panel (%d)\n", ret); in tc358764_parse_dt()
421 for (i = 0; i < ARRAY_SIZE(ctx->supplies); ++i) in tc358764_configure_regulators()
422 ctx->supplies[i].supply = tc358764_supplies[i]; in tc358764_configure_regulators()
424 ret = devm_regulator_bulk_get(ctx->dev, ARRAY_SIZE(ctx->supplies), in tc358764_configure_regulators()
425 ctx->supplies); in tc358764_configure_regulators()
427 dev_err(ctx->dev, "failed to get regulators: %d\n", ret); in tc358764_configure_regulators()
434 struct device *dev = &dsi->dev; in tc358764_probe()
440 return -ENOMEM; in tc358764_probe()
444 ctx->dev = dev; in tc358764_probe()
446 dsi->lanes = 4; in tc358764_probe()
447 dsi->format = MIPI_DSI_FMT_RGB888; in tc358764_probe()
448 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST in tc358764_probe()
459 ctx->bridge.funcs = &tc358764_bridge_funcs; in tc358764_probe()
460 ctx->bridge.of_node = dev->of_node; in tc358764_probe()
462 drm_bridge_add(&ctx->bridge); in tc358764_probe()
466 drm_bridge_remove(&ctx->bridge); in tc358764_probe()
478 drm_bridge_remove(&ctx->bridge); in tc358764_remove()
502 MODULE_DESCRIPTION("MIPI-DSI based Driver for TC358764 DSI/LVDS Bridge");