Lines Matching +full:panel +full:- +full:dsi
1 // SPDX-License-Identifier: GPL-2.0-only
15 struct drm_panel panel; member
16 struct mipi_dsi_device *dsi; member
22 static inline struct tm5p5_nt35596 *to_tm5p5_nt35596(struct drm_panel *panel) in to_tm5p5_nt35596() argument
24 return container_of(panel, struct tm5p5_nt35596, panel); in to_tm5p5_nt35596()
27 #define dsi_generic_write_seq(dsi, seq...) do { \ argument
30 ret = mipi_dsi_generic_write(dsi, d, ARRAY_SIZE(d)); \
35 #define dsi_dcs_write_seq(dsi, seq...) do { \ argument
38 ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \
45 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in tm5p5_nt35596_reset()
47 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in tm5p5_nt35596_reset()
49 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in tm5p5_nt35596_reset()
55 struct mipi_dsi_device *dsi = ctx->dsi; in tm5p5_nt35596_on() local
57 dsi_generic_write_seq(dsi, 0xff, 0x05); in tm5p5_nt35596_on()
58 dsi_generic_write_seq(dsi, 0xfb, 0x01); in tm5p5_nt35596_on()
59 dsi_generic_write_seq(dsi, 0xc5, 0x31); in tm5p5_nt35596_on()
60 dsi_generic_write_seq(dsi, 0xff, 0x04); in tm5p5_nt35596_on()
61 dsi_generic_write_seq(dsi, 0x01, 0x84); in tm5p5_nt35596_on()
62 dsi_generic_write_seq(dsi, 0x05, 0x25); in tm5p5_nt35596_on()
63 dsi_generic_write_seq(dsi, 0x06, 0x01); in tm5p5_nt35596_on()
64 dsi_generic_write_seq(dsi, 0x07, 0x20); in tm5p5_nt35596_on()
65 dsi_generic_write_seq(dsi, 0x08, 0x06); in tm5p5_nt35596_on()
66 dsi_generic_write_seq(dsi, 0x09, 0x08); in tm5p5_nt35596_on()
67 dsi_generic_write_seq(dsi, 0x0a, 0x10); in tm5p5_nt35596_on()
68 dsi_generic_write_seq(dsi, 0x0b, 0x10); in tm5p5_nt35596_on()
69 dsi_generic_write_seq(dsi, 0x0c, 0x10); in tm5p5_nt35596_on()
70 dsi_generic_write_seq(dsi, 0x0d, 0x14); in tm5p5_nt35596_on()
71 dsi_generic_write_seq(dsi, 0x0e, 0x14); in tm5p5_nt35596_on()
72 dsi_generic_write_seq(dsi, 0x0f, 0x14); in tm5p5_nt35596_on()
73 dsi_generic_write_seq(dsi, 0x10, 0x14); in tm5p5_nt35596_on()
74 dsi_generic_write_seq(dsi, 0x11, 0x14); in tm5p5_nt35596_on()
75 dsi_generic_write_seq(dsi, 0x12, 0x14); in tm5p5_nt35596_on()
76 dsi_generic_write_seq(dsi, 0x17, 0xf3); in tm5p5_nt35596_on()
77 dsi_generic_write_seq(dsi, 0x18, 0xc0); in tm5p5_nt35596_on()
78 dsi_generic_write_seq(dsi, 0x19, 0xc0); in tm5p5_nt35596_on()
79 dsi_generic_write_seq(dsi, 0x1a, 0xc0); in tm5p5_nt35596_on()
80 dsi_generic_write_seq(dsi, 0x1b, 0xb3); in tm5p5_nt35596_on()
81 dsi_generic_write_seq(dsi, 0x1c, 0xb3); in tm5p5_nt35596_on()
82 dsi_generic_write_seq(dsi, 0x1d, 0xb3); in tm5p5_nt35596_on()
83 dsi_generic_write_seq(dsi, 0x1e, 0xb3); in tm5p5_nt35596_on()
84 dsi_generic_write_seq(dsi, 0x1f, 0xb3); in tm5p5_nt35596_on()
85 dsi_generic_write_seq(dsi, 0x20, 0xb3); in tm5p5_nt35596_on()
86 dsi_generic_write_seq(dsi, 0xfb, 0x01); in tm5p5_nt35596_on()
87 dsi_generic_write_seq(dsi, 0xff, 0x00); in tm5p5_nt35596_on()
88 dsi_generic_write_seq(dsi, 0xfb, 0x01); in tm5p5_nt35596_on()
89 dsi_generic_write_seq(dsi, 0x35, 0x01); in tm5p5_nt35596_on()
90 dsi_generic_write_seq(dsi, 0xd3, 0x06); in tm5p5_nt35596_on()
91 dsi_generic_write_seq(dsi, 0xd4, 0x04); in tm5p5_nt35596_on()
92 dsi_generic_write_seq(dsi, 0x5e, 0x0d); in tm5p5_nt35596_on()
93 dsi_generic_write_seq(dsi, 0x11, 0x00); in tm5p5_nt35596_on()
95 dsi_generic_write_seq(dsi, 0x29, 0x00); in tm5p5_nt35596_on()
96 dsi_generic_write_seq(dsi, 0x53, 0x24); in tm5p5_nt35596_on()
103 struct mipi_dsi_device *dsi = ctx->dsi; in tm5p5_nt35596_off() local
104 struct device *dev = &dsi->dev; in tm5p5_nt35596_off()
107 ret = mipi_dsi_dcs_set_display_off(dsi); in tm5p5_nt35596_off()
114 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in tm5p5_nt35596_off()
120 dsi_dcs_write_seq(dsi, 0x4f, 0x01); in tm5p5_nt35596_off()
125 static int tm5p5_nt35596_prepare(struct drm_panel *panel) in tm5p5_nt35596_prepare() argument
127 struct tm5p5_nt35596 *ctx = to_tm5p5_nt35596(panel); in tm5p5_nt35596_prepare()
128 struct device *dev = &ctx->dsi->dev; in tm5p5_nt35596_prepare()
131 if (ctx->prepared) in tm5p5_nt35596_prepare()
134 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in tm5p5_nt35596_prepare()
144 dev_err(dev, "Failed to initialize panel: %d\n", ret); in tm5p5_nt35596_prepare()
145 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in tm5p5_nt35596_prepare()
146 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), in tm5p5_nt35596_prepare()
147 ctx->supplies); in tm5p5_nt35596_prepare()
151 ctx->prepared = true; in tm5p5_nt35596_prepare()
155 static int tm5p5_nt35596_unprepare(struct drm_panel *panel) in tm5p5_nt35596_unprepare() argument
157 struct tm5p5_nt35596 *ctx = to_tm5p5_nt35596(panel); in tm5p5_nt35596_unprepare()
158 struct device *dev = &ctx->dsi->dev; in tm5p5_nt35596_unprepare()
161 if (!ctx->prepared) in tm5p5_nt35596_unprepare()
166 dev_err(dev, "Failed to un-initialize panel: %d\n", ret); in tm5p5_nt35596_unprepare()
168 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in tm5p5_nt35596_unprepare()
169 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), in tm5p5_nt35596_unprepare()
170 ctx->supplies); in tm5p5_nt35596_unprepare()
172 ctx->prepared = false; in tm5p5_nt35596_unprepare()
190 static int tm5p5_nt35596_get_modes(struct drm_panel *panel, in tm5p5_nt35596_get_modes() argument
195 mode = drm_mode_duplicate(connector->dev, &tm5p5_nt35596_mode); in tm5p5_nt35596_get_modes()
197 return -ENOMEM; in tm5p5_nt35596_get_modes()
201 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in tm5p5_nt35596_get_modes()
202 connector->display_info.width_mm = mode->width_mm; in tm5p5_nt35596_get_modes()
203 connector->display_info.height_mm = mode->height_mm; in tm5p5_nt35596_get_modes()
217 struct mipi_dsi_device *dsi = bl_get_data(bl); in tm5p5_nt35596_bl_update_status() local
218 u16 brightness = bl->props.brightness; in tm5p5_nt35596_bl_update_status()
221 if (bl->props.power != FB_BLANK_UNBLANK || in tm5p5_nt35596_bl_update_status()
222 bl->props.fb_blank != FB_BLANK_UNBLANK || in tm5p5_nt35596_bl_update_status()
223 bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) in tm5p5_nt35596_bl_update_status()
226 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; in tm5p5_nt35596_bl_update_status()
228 ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness); in tm5p5_nt35596_bl_update_status()
232 dsi->mode_flags |= MIPI_DSI_MODE_LPM; in tm5p5_nt35596_bl_update_status()
239 struct mipi_dsi_device *dsi = bl_get_data(bl); in tm5p5_nt35596_bl_get_brightness() local
240 u16 brightness = bl->props.brightness; in tm5p5_nt35596_bl_get_brightness()
243 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; in tm5p5_nt35596_bl_get_brightness()
245 ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness); in tm5p5_nt35596_bl_get_brightness()
249 dsi->mode_flags |= MIPI_DSI_MODE_LPM; in tm5p5_nt35596_bl_get_brightness()
260 tm5p5_nt35596_create_backlight(struct mipi_dsi_device *dsi) in tm5p5_nt35596_create_backlight() argument
262 struct device *dev = &dsi->dev; in tm5p5_nt35596_create_backlight()
269 return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, in tm5p5_nt35596_create_backlight()
273 static int tm5p5_nt35596_probe(struct mipi_dsi_device *dsi) in tm5p5_nt35596_probe() argument
275 struct device *dev = &dsi->dev; in tm5p5_nt35596_probe()
281 return -ENOMEM; in tm5p5_nt35596_probe()
283 ctx->supplies[0].supply = "vdd"; in tm5p5_nt35596_probe()
284 ctx->supplies[1].supply = "vddio"; in tm5p5_nt35596_probe()
285 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in tm5p5_nt35596_probe()
286 ctx->supplies); in tm5p5_nt35596_probe()
292 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in tm5p5_nt35596_probe()
293 if (IS_ERR(ctx->reset_gpio)) { in tm5p5_nt35596_probe()
294 ret = PTR_ERR(ctx->reset_gpio); in tm5p5_nt35596_probe()
295 dev_err(dev, "Failed to get reset-gpios: %d\n", ret); in tm5p5_nt35596_probe()
299 ctx->dsi = dsi; in tm5p5_nt35596_probe()
300 mipi_dsi_set_drvdata(dsi, ctx); in tm5p5_nt35596_probe()
302 dsi->lanes = 4; in tm5p5_nt35596_probe()
303 dsi->format = MIPI_DSI_FMT_RGB888; in tm5p5_nt35596_probe()
304 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | in tm5p5_nt35596_probe()
308 drm_panel_init(&ctx->panel, dev, &tm5p5_nt35596_panel_funcs, in tm5p5_nt35596_probe()
311 ctx->panel.backlight = tm5p5_nt35596_create_backlight(dsi); in tm5p5_nt35596_probe()
312 if (IS_ERR(ctx->panel.backlight)) { in tm5p5_nt35596_probe()
313 ret = PTR_ERR(ctx->panel.backlight); in tm5p5_nt35596_probe()
318 drm_panel_add(&ctx->panel); in tm5p5_nt35596_probe()
320 ret = mipi_dsi_attach(dsi); in tm5p5_nt35596_probe()
322 dev_err(dev, "Failed to attach to DSI host: %d\n", ret); in tm5p5_nt35596_probe()
329 static int tm5p5_nt35596_remove(struct mipi_dsi_device *dsi) in tm5p5_nt35596_remove() argument
331 struct tm5p5_nt35596 *ctx = mipi_dsi_get_drvdata(dsi); in tm5p5_nt35596_remove()
334 ret = mipi_dsi_detach(dsi); in tm5p5_nt35596_remove()
336 dev_err(&dsi->dev, in tm5p5_nt35596_remove()
337 "Failed to detach from DSI host: %d\n", ret); in tm5p5_nt35596_remove()
339 drm_panel_remove(&ctx->panel); in tm5p5_nt35596_remove()
345 { .compatible = "asus,z00t-tm5p5-n35596" },
354 .name = "panel-tm5p5-nt35596",
361 MODULE_DESCRIPTION("DRM driver for tm5p5 nt35596 1080p video mode dsi panel");