Lines Matching +full:panel +full:- +full:dsi

1 //SPDX-License-Identifier: GPL-2.0-only
21 struct drm_panel panel; member
22 struct mipi_dsi_device *dsi; member
27 static inline struct visionox_r66451 *to_visionox_r66451(struct drm_panel *panel) in to_visionox_r66451() argument
29 return container_of(panel, struct visionox_r66451, panel); in to_visionox_r66451()
34 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in visionox_r66451_reset()
36 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in visionox_r66451_reset()
38 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in visionox_r66451_reset()
44 struct mipi_dsi_device *dsi = ctx->dsi; in visionox_r66451_on() local
46 dsi->mode_flags |= MIPI_DSI_MODE_LPM; in visionox_r66451_on()
48 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x00); in visionox_r66451_on()
49 mipi_dsi_dcs_write_seq(dsi, 0xc2, in visionox_r66451_on()
52 mipi_dsi_dcs_write_seq(dsi, 0xd7, in visionox_r66451_on()
56 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x80); in visionox_r66451_on()
57 mipi_dsi_dcs_write_seq(dsi, 0xde, in visionox_r66451_on()
60 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x04); in visionox_r66451_on()
61 mipi_dsi_dcs_write_seq(dsi, 0xe8, 0x00, 0x02); in visionox_r66451_on()
62 mipi_dsi_dcs_write_seq(dsi, 0xe4, 0x00, 0x08); in visionox_r66451_on()
63 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x00); in visionox_r66451_on()
64 mipi_dsi_dcs_write_seq(dsi, 0xc4, in visionox_r66451_on()
67 mipi_dsi_dcs_write_seq(dsi, 0xcf, in visionox_r66451_on()
71 mipi_dsi_dcs_write_seq(dsi, 0xd3, in visionox_r66451_on()
75 mipi_dsi_dcs_write_seq(dsi, 0xd7, in visionox_r66451_on()
79 mipi_dsi_dcs_write_seq(dsi, 0xd8, in visionox_r66451_on()
86 mipi_dsi_dcs_write_seq(dsi, 0xdf, in visionox_r66451_on()
92 mipi_dsi_dcs_write_seq(dsi, 0xf7, 0x01); in visionox_r66451_on()
93 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x80); in visionox_r66451_on()
94 mipi_dsi_dcs_write_seq(dsi, 0xe4, 0x34, 0xb4, 0x00, 0x00, 0x00, 0x39, 0x04, 0x09, 0x34); in visionox_r66451_on()
95 mipi_dsi_dcs_write_seq(dsi, 0xe6, 0x00); in visionox_r66451_on()
96 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0x04); in visionox_r66451_on()
97 mipi_dsi_dcs_write_seq(dsi, 0xdf, 0x50, 0x40); in visionox_r66451_on()
98 mipi_dsi_dcs_write_seq(dsi, 0xf3, 0x50, 0x00, 0x00, 0x00, 0x00); in visionox_r66451_on()
99 mipi_dsi_dcs_write_seq(dsi, 0xf2, 0x11); in visionox_r66451_on()
100 mipi_dsi_dcs_write_seq(dsi, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01); in visionox_r66451_on()
101 mipi_dsi_dcs_write_seq(dsi, 0xf4, 0x00, 0x02); in visionox_r66451_on()
102 mipi_dsi_dcs_write_seq(dsi, 0xf2, 0x19); in visionox_r66451_on()
103 mipi_dsi_dcs_write_seq(dsi, 0xdf, 0x50, 0x42); in visionox_r66451_on()
104 mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); in visionox_r66451_on()
105 mipi_dsi_dcs_set_column_address(dsi, 0, 1080 - 1); in visionox_r66451_on()
106 mipi_dsi_dcs_set_page_address(dsi, 0, 2340 - 1); in visionox_r66451_on()
108 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; in visionox_r66451_on()
115 ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; in visionox_r66451_off()
119 static int visionox_r66451_prepare(struct drm_panel *panel) in visionox_r66451_prepare() argument
121 struct visionox_r66451 *ctx = to_visionox_r66451(panel); in visionox_r66451_prepare()
122 struct mipi_dsi_device *dsi = ctx->dsi; in visionox_r66451_prepare() local
123 struct device *dev = &dsi->dev; in visionox_r66451_prepare()
126 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), in visionox_r66451_prepare()
127 ctx->supplies); in visionox_r66451_prepare()
135 dev_err(dev, "Failed to initialize panel: %d\n", ret); in visionox_r66451_prepare()
136 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in visionox_r66451_prepare()
137 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in visionox_r66451_prepare()
141 mipi_dsi_compression_mode(ctx->dsi, true); in visionox_r66451_prepare()
146 static int visionox_r66451_unprepare(struct drm_panel *panel) in visionox_r66451_unprepare() argument
148 struct visionox_r66451 *ctx = to_visionox_r66451(panel); in visionox_r66451_unprepare()
149 struct device *dev = &ctx->dsi->dev; in visionox_r66451_unprepare()
154 dev_err(dev, "Failed to un-initialize panel: %d\n", ret); in visionox_r66451_unprepare()
156 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in visionox_r66451_unprepare()
157 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in visionox_r66451_unprepare()
177 static int visionox_r66451_enable(struct drm_panel *panel) in visionox_r66451_enable() argument
179 struct visionox_r66451 *ctx = to_visionox_r66451(panel); in visionox_r66451_enable()
180 struct mipi_dsi_device *dsi = ctx->dsi; in visionox_r66451_enable() local
184 if (!dsi->dsc) { in visionox_r66451_enable()
185 dev_err(&dsi->dev, "DSC not attached to DSI\n"); in visionox_r66451_enable()
186 return -ENODEV; in visionox_r66451_enable()
189 drm_dsc_pps_payload_pack(&pps, dsi->dsc); in visionox_r66451_enable()
190 ret = mipi_dsi_picture_parameter_set(dsi, &pps); in visionox_r66451_enable()
192 dev_err(&dsi->dev, "Failed to set PPS\n"); in visionox_r66451_enable()
196 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in visionox_r66451_enable()
198 dev_err(&dsi->dev, "Failed to exit sleep mode: %d\n", ret); in visionox_r66451_enable()
203 ret = mipi_dsi_dcs_set_display_on(dsi); in visionox_r66451_enable()
205 dev_err(&dsi->dev, "Failed on set display on: %d\n", ret); in visionox_r66451_enable()
213 static int visionox_r66451_disable(struct drm_panel *panel) in visionox_r66451_disable() argument
215 struct visionox_r66451 *ctx = to_visionox_r66451(panel); in visionox_r66451_disable()
216 struct mipi_dsi_device *dsi = ctx->dsi; in visionox_r66451_disable() local
217 struct device *dev = &dsi->dev; in visionox_r66451_disable()
220 ret = mipi_dsi_dcs_set_display_off(dsi); in visionox_r66451_disable()
227 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in visionox_r66451_disable()
237 static int visionox_r66451_get_modes(struct drm_panel *panel, in visionox_r66451_get_modes() argument
254 struct mipi_dsi_device *dsi = bl_get_data(bl); in visionox_r66451_bl_update_status() local
257 return mipi_dsi_dcs_set_display_brightness(dsi, brightness); in visionox_r66451_bl_update_status()
265 visionox_r66451_create_backlight(struct mipi_dsi_device *dsi) in visionox_r66451_create_backlight() argument
267 struct device *dev = &dsi->dev; in visionox_r66451_create_backlight()
274 return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, in visionox_r66451_create_backlight()
278 static int visionox_r66451_probe(struct mipi_dsi_device *dsi) in visionox_r66451_probe() argument
280 struct device *dev = &dsi->dev; in visionox_r66451_probe()
287 return -ENOMEM; in visionox_r66451_probe()
291 return -ENOMEM; in visionox_r66451_probe()
294 dsc->dsc_version_major = 0x1; in visionox_r66451_probe()
295 dsc->dsc_version_minor = 0x2; in visionox_r66451_probe()
297 dsc->slice_height = 20; in visionox_r66451_probe()
298 dsc->slice_width = 540; in visionox_r66451_probe()
299 dsc->slice_count = 2; in visionox_r66451_probe()
300 dsc->bits_per_component = 8; in visionox_r66451_probe()
301 dsc->bits_per_pixel = 8 << 4; in visionox_r66451_probe()
302 dsc->block_pred_enable = true; in visionox_r66451_probe()
304 dsi->dsc = dsc; in visionox_r66451_probe()
306 ctx->supplies[0].supply = "vddio"; in visionox_r66451_probe()
307 ctx->supplies[1].supply = "vdd"; in visionox_r66451_probe()
309 ret = devm_regulator_bulk_get(&dsi->dev, ARRAY_SIZE(ctx->supplies), in visionox_r66451_probe()
310 ctx->supplies); in visionox_r66451_probe()
315 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in visionox_r66451_probe()
316 if (IS_ERR(ctx->reset_gpio)) in visionox_r66451_probe()
317 return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "Failed to get reset-gpios\n"); in visionox_r66451_probe()
319 ctx->dsi = dsi; in visionox_r66451_probe()
320 mipi_dsi_set_drvdata(dsi, ctx); in visionox_r66451_probe()
322 dsi->lanes = 4; in visionox_r66451_probe()
323 dsi->format = MIPI_DSI_FMT_RGB888; in visionox_r66451_probe()
324 dsi->mode_flags = MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS; in visionox_r66451_probe()
325 ctx->panel.prepare_prev_first = true; in visionox_r66451_probe()
327 drm_panel_init(&ctx->panel, dev, &visionox_r66451_funcs, DRM_MODE_CONNECTOR_DSI); in visionox_r66451_probe()
328 ctx->panel.backlight = visionox_r66451_create_backlight(dsi); in visionox_r66451_probe()
329 if (IS_ERR(ctx->panel.backlight)) in visionox_r66451_probe()
330 return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), in visionox_r66451_probe()
333 drm_panel_add(&ctx->panel); in visionox_r66451_probe()
335 ret = mipi_dsi_attach(dsi); in visionox_r66451_probe()
337 dev_err(dev, "Failed to attach to DSI host: %d\n", ret); in visionox_r66451_probe()
338 drm_panel_remove(&ctx->panel); in visionox_r66451_probe()
344 static void visionox_r66451_remove(struct mipi_dsi_device *dsi) in visionox_r66451_remove() argument
346 struct visionox_r66451 *ctx = mipi_dsi_get_drvdata(dsi); in visionox_r66451_remove()
349 ret = mipi_dsi_detach(dsi); in visionox_r66451_remove()
351 dev_err(&dsi->dev, "Failed to detach DSI host: %d\n", ret); in visionox_r66451_remove()
353 drm_panel_remove(&ctx->panel); in visionox_r66451_remove()
366 .name = "panel-visionox-r66451",
374 MODULE_DESCRIPTION("Panel driver for the Visionox R66451 AMOLED DSI panel");