Lines Matching +full:dsi +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0
28 #define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end))
42 /* DSI layer registers */
43 #define DSI_STARTDSI 0x0204 /* START control bit of DSI-TX */
125 #define SYS_RST_I2CS BIT(0) /* Reset I2C-Slave controller */
126 #define SYS_RST_I2CM BIT(1) /* Reset I2C-Master controller */
127 #define SYS_RST_LCD BIT(2) /* Reset LCD controller */
128 #define SYS_RST_BM BIT(3) /* Reset Bus Management controller */
129 #define SYS_RST_DSIRX BIT(4) /* Reset DSI-RX and App controller */
136 /* Lane enable PPI and DSI register bits */
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() local
176 if (ctx->error) in tc358764_read()
180 ret = mipi_dsi_generic_read(dsi, &addr, sizeof(addr), val, sizeof(*val)); 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() local
193 if (ctx->error) in tc358764_write()
203 ret = mipi_dsi_generic_write(dsi, data, sizeof(data)); 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()
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()
434 static int tc358764_probe(struct mipi_dsi_device *dsi) in tc358764_probe() argument
436 struct device *dev = &dsi->dev; in tc358764_probe()
442 return -ENOMEM; in tc358764_probe()
444 mipi_dsi_set_drvdata(dsi, ctx); 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()
466 ret = mipi_dsi_attach(dsi); in tc358764_probe()
468 drm_bridge_remove(&ctx->bridge); in tc358764_probe()
469 dev_err(dev, "failed to attach dsi\n"); in tc358764_probe()
475 static int tc358764_remove(struct mipi_dsi_device *dsi) in tc358764_remove() argument
477 struct tc358764 *ctx = mipi_dsi_get_drvdata(dsi); in tc358764_remove()
479 mipi_dsi_detach(dsi); in tc358764_remove()
480 drm_bridge_remove(&ctx->bridge); in tc358764_remove()
504 MODULE_DESCRIPTION("MIPI-DSI based Driver for TC358764 DSI/LVDS Bridge");