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()
161 if (!ctx->pre_enabled) in tc358762_post_disable()
164 ctx->pre_enabled = false; in tc358762_post_disable()
166 if (ctx->reset_gpio) in tc358762_post_disable()
167 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in tc358762_post_disable()
169 ret = regulator_disable(ctx->regulator); in tc358762_post_disable()
171 dev_err(ctx->dev, "error disabling regulators (%d)\n", ret); in tc358762_post_disable()
179 ret = regulator_enable(ctx->regulator); in tc358762_pre_enable()
181 dev_err(ctx->dev, "error enabling regulators (%d)\n", ret); in tc358762_pre_enable()
183 if (ctx->reset_gpio) { in tc358762_pre_enable()
184 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in tc358762_pre_enable()
188 ctx->pre_enabled = true; in tc358762_pre_enable()
198 dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); in tc358762_enable()
206 return drm_bridge_attach(bridge->encoder, ctx->panel_bridge, in tc358762_attach()
216 drm_mode_copy(&ctx->mode, mode); in tc358762_bridge_mode_set()
233 struct device *dev = ctx->dev; in tc358762_parse_dt()
235 panel_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); in tc358762_parse_dt()
239 ctx->panel_bridge = panel_bridge; in tc358762_parse_dt()
242 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in tc358762_parse_dt()
243 if (IS_ERR(ctx->reset_gpio)) in tc358762_parse_dt()
244 return PTR_ERR(ctx->reset_gpio); in tc358762_parse_dt()
251 ctx->regulator = devm_regulator_get(ctx->dev, "vddc"); in tc358762_configure_regulators()
252 if (IS_ERR(ctx->regulator)) in tc358762_configure_regulators()
253 return PTR_ERR(ctx->regulator); in tc358762_configure_regulators()
258 static int tc358762_probe(struct mipi_dsi_device *dsi) in tc358762_probe() argument
260 struct device *dev = &dsi->dev; in tc358762_probe()
266 return -ENOMEM; in tc358762_probe()
268 mipi_dsi_set_drvdata(dsi, ctx); in tc358762_probe()
270 ctx->dev = dev; in tc358762_probe()
271 ctx->pre_enabled = false; in tc358762_probe()
273 /* TODO: Find out how to get dual-lane mode working */ in tc358762_probe()
274 dsi->lanes = 1; in tc358762_probe()
275 dsi->format = MIPI_DSI_FMT_RGB888; in tc358762_probe()
276 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | in tc358762_probe()
287 ctx->bridge.funcs = &tc358762_bridge_funcs; in tc358762_probe()
288 ctx->bridge.type = DRM_MODE_CONNECTOR_DPI; in tc358762_probe()
289 ctx->bridge.of_node = dev->of_node; in tc358762_probe()
290 ctx->bridge.pre_enable_prev_first = true; in tc358762_probe()
292 drm_bridge_add(&ctx->bridge); in tc358762_probe()
294 ret = mipi_dsi_attach(dsi); in tc358762_probe()
296 drm_bridge_remove(&ctx->bridge); in tc358762_probe()
297 dev_err(dev, "failed to attach dsi\n"); in tc358762_probe()
303 static void tc358762_remove(struct mipi_dsi_device *dsi) in tc358762_remove() argument
305 struct tc358762 *ctx = mipi_dsi_get_drvdata(dsi); in tc358762_remove()
307 mipi_dsi_detach(dsi); in tc358762_remove()
308 drm_bridge_remove(&ctx->bridge); in tc358762_remove()
328 MODULE_DESCRIPTION("MIPI-DSI based Driver for TC358762 DSI/DPI Bridge");