Lines Matching +full:master +full:- +full:dsi

1 // SPDX-License-Identifier: GPL-2.0
39 /* DSI layer registers */
40 #define DSI_STARTDSI 0x0204 /* START control bit of DSI-TX */
56 /* SPI Master Registers */
66 /* Lane enable PPI and DSI register bits */
84 int ret = ctx->error; in tc358762_clear_error()
86 ctx->error = 0; in tc358762_clear_error()
92 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in tc358762_write() local
96 if (ctx->error) in tc358762_write()
106 ret = mipi_dsi_generic_write(dsi, data, sizeof(data)); in tc358762_write()
108 ctx->error = ret; in tc358762_write()
133 if (ctx->mode.flags & DRM_MODE_FLAG_NHSYNC) in tc358762_init()
136 if (ctx->mode.flags & DRM_MODE_FLAG_NVSYNC) in tc358762_init()
162 if (!ctx->pre_enabled) in tc358762_post_disable()
165 ctx->pre_enabled = false; in tc358762_post_disable()
167 if (ctx->reset_gpio) in tc358762_post_disable()
168 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in tc358762_post_disable()
170 ret = regulator_disable(ctx->regulator); in tc358762_post_disable()
172 dev_err(ctx->dev, "error disabling regulators (%d)\n", ret); in tc358762_post_disable()
181 ret = regulator_enable(ctx->regulator); in tc358762_pre_enable()
183 dev_err(ctx->dev, "error enabling regulators (%d)\n", ret); in tc358762_pre_enable()
185 if (ctx->reset_gpio) { in tc358762_pre_enable()
186 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in tc358762_pre_enable()
190 ctx->pre_enabled = true; in tc358762_pre_enable()
201 dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); in tc358762_enable()
209 return drm_bridge_attach(bridge->encoder, ctx->panel_bridge, in tc358762_attach()
219 drm_mode_copy(&ctx->mode, mode); in tc358762_bridge_mode_set()
236 struct device *dev = ctx->dev; in tc358762_parse_dt()
238 panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); in tc358762_parse_dt()
242 ctx->panel_bridge = panel_bridge; in tc358762_parse_dt()
245 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in tc358762_parse_dt()
246 if (IS_ERR(ctx->reset_gpio)) in tc358762_parse_dt()
247 return PTR_ERR(ctx->reset_gpio); in tc358762_parse_dt()
254 ctx->regulator = devm_regulator_get(ctx->dev, "vddc"); in tc358762_configure_regulators()
255 if (IS_ERR(ctx->regulator)) in tc358762_configure_regulators()
256 return PTR_ERR(ctx->regulator); in tc358762_configure_regulators()
261 static int tc358762_probe(struct mipi_dsi_device *dsi) in tc358762_probe() argument
263 struct device *dev = &dsi->dev; in tc358762_probe()
269 return -ENOMEM; in tc358762_probe()
271 mipi_dsi_set_drvdata(dsi, ctx); in tc358762_probe()
273 ctx->dev = dev; in tc358762_probe()
274 ctx->pre_enabled = false; in tc358762_probe()
276 /* TODO: Find out how to get dual-lane mode working */ in tc358762_probe()
277 dsi->lanes = 1; in tc358762_probe()
278 dsi->format = MIPI_DSI_FMT_RGB888; in tc358762_probe()
279 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | in tc358762_probe()
290 ctx->bridge.funcs = &tc358762_bridge_funcs; in tc358762_probe()
291 ctx->bridge.type = DRM_MODE_CONNECTOR_DPI; in tc358762_probe()
292 ctx->bridge.of_node = dev->of_node; in tc358762_probe()
293 ctx->bridge.pre_enable_prev_first = true; in tc358762_probe()
295 drm_bridge_add(&ctx->bridge); in tc358762_probe()
297 ret = mipi_dsi_attach(dsi); in tc358762_probe()
299 drm_bridge_remove(&ctx->bridge); in tc358762_probe()
300 dev_err(dev, "failed to attach dsi\n"); in tc358762_probe()
306 static void tc358762_remove(struct mipi_dsi_device *dsi) in tc358762_remove() argument
308 struct tc358762 *ctx = mipi_dsi_get_drvdata(dsi); in tc358762_remove()
310 mipi_dsi_detach(dsi); in tc358762_remove()
311 drm_bridge_remove(&ctx->bridge); in tc358762_remove()
331 MODULE_DESCRIPTION("MIPI-DSI based Driver for TC358762 DSI/DPI Bridge");