Lines Matching +full:panel +full:- +full:timing

1 // SPDX-License-Identifier: GPL-2.0
28 #define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end))
33 #define PPI_LPTXTIMECNT 0x0114 /* LPTX timing signal */
35 #define PPI_TX_RX_TA 0x013C /* BTA timing parameters */
43 #define DSI_STARTDSI 0x0204 /* START control bit of DSI-TX */
50 #define VP_CTRL_VTGEN(v) FLD_VAL(v, 4, 4) /* Use chip clock for timing */
57 #define VP_HTIM1 0x0454 /* Horizontal Timing Control 1 */
60 #define VP_HTIM2 0x0458 /* Horizontal Timing Control 2 */
63 #define VP_VTIM1 0x045C /* Vertical Timing Control 1 */
66 #define VP_VTIM2 0x0460 /* Vertical Timing Control 2 */
69 #define VP_VFUEN 0x0464 /* Video Frame Timing Update Enable */
125 #define SYS_RST_I2CS BIT(0) /* Reset I2C-Slave controller */
126 #define SYS_RST_I2CM BIT(1) /* Reset I2C-Master controller */
129 #define SYS_RST_DSIRX BIT(4) /* Reset DSI-RX and App controller */
159 struct drm_panel *panel; member
165 int ret = ctx->error; in tc358764_clear_error()
167 ctx->error = 0; in tc358764_clear_error()
173 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in tc358764_read()
176 if (ctx->error) in tc358764_read()
184 dev_dbg(ctx->dev, "read: %d, addr: %d\n", addr, *val); in tc358764_read()
189 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in tc358764_write()
193 if (ctx->error) in tc358764_write()
205 ctx->error = ret; in tc358764_write()
224 if (ctx->error) in tc358764_init()
226 dev_info(ctx->dev, "ID: %#x\n", v); in tc358764_init()
275 gpiod_set_value(ctx->gpio_reset, 1); in tc358764_reset()
277 gpiod_set_value(ctx->gpio_reset, 0); in tc358764_reset()
285 return drm_panel_get_modes(ctx->panel, connector); in tc358764_get_modes()
304 int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); in tc358764_disable()
307 dev_err(ctx->dev, "error disabling panel (%d)\n", ret); in tc358764_disable()
315 ret = drm_panel_unprepare(ctx->panel); in tc358764_post_disable()
317 dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); in tc358764_post_disable()
320 ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in tc358764_post_disable()
322 dev_err(ctx->dev, "error disabling regulators (%d)\n", ret); in tc358764_post_disable()
330 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in tc358764_pre_enable()
332 dev_err(ctx->dev, "error enabling regulators (%d)\n", ret); in tc358764_pre_enable()
337 dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); in tc358764_pre_enable()
338 ret = drm_panel_prepare(ctx->panel); in tc358764_pre_enable()
340 dev_err(ctx->dev, "error preparing panel (%d)\n", ret); in tc358764_pre_enable()
346 int ret = drm_panel_enable(ctx->panel); in tc358764_enable()
349 dev_err(ctx->dev, "error enabling panel (%d)\n", ret); in tc358764_enable()
356 struct drm_device *drm = bridge->dev; in tc358764_attach()
361 return -EINVAL; in tc358764_attach()
364 ctx->connector.polled = DRM_CONNECTOR_POLL_HPD; in tc358764_attach()
365 ret = drm_connector_init(drm, &ctx->connector, in tc358764_attach()
373 drm_connector_helper_add(&ctx->connector, in tc358764_attach()
375 drm_connector_attach_encoder(&ctx->connector, bridge->encoder); in tc358764_attach()
376 ctx->connector.funcs->reset(&ctx->connector); in tc358764_attach()
377 drm_connector_register(&ctx->connector); in tc358764_attach()
386 drm_connector_unregister(&ctx->connector); in tc358764_detach()
387 ctx->panel = NULL; in tc358764_detach()
388 drm_connector_put(&ctx->connector); in tc358764_detach()
402 struct device *dev = ctx->dev; in tc358764_parse_dt()
405 ctx->gpio_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in tc358764_parse_dt()
406 if (IS_ERR(ctx->gpio_reset)) { in tc358764_parse_dt()
408 return PTR_ERR(ctx->gpio_reset); in tc358764_parse_dt()
411 ret = drm_of_find_panel_or_bridge(ctx->dev->of_node, 1, 0, &ctx->panel, in tc358764_parse_dt()
413 if (ret && ret != -EPROBE_DEFER) in tc358764_parse_dt()
414 dev_err(dev, "cannot find panel (%d)\n", ret); in tc358764_parse_dt()
423 for (i = 0; i < ARRAY_SIZE(ctx->supplies); ++i) in tc358764_configure_regulators()
424 ctx->supplies[i].supply = tc358764_supplies[i]; in tc358764_configure_regulators()
426 ret = devm_regulator_bulk_get(ctx->dev, ARRAY_SIZE(ctx->supplies), in tc358764_configure_regulators()
427 ctx->supplies); in tc358764_configure_regulators()
429 dev_err(ctx->dev, "failed to get regulators: %d\n", ret); in tc358764_configure_regulators()
436 struct device *dev = &dsi->dev; in tc358764_probe()
442 return -ENOMEM; in tc358764_probe()
446 ctx->dev = dev; in tc358764_probe()
448 dsi->lanes = 4; in tc358764_probe()
449 dsi->format = MIPI_DSI_FMT_RGB888; in tc358764_probe()
450 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST in tc358764_probe()
461 ctx->bridge.funcs = &tc358764_bridge_funcs; in tc358764_probe()
462 ctx->bridge.of_node = dev->of_node; in tc358764_probe()
464 drm_bridge_add(&ctx->bridge); in tc358764_probe()
468 drm_bridge_remove(&ctx->bridge); in tc358764_probe()
480 drm_bridge_remove(&ctx->bridge); in tc358764_remove()
504 MODULE_DESCRIPTION("MIPI-DSI based Driver for TC358764 DSI/LVDS Bridge");