Lines Matching +full:panel +full:- +full:specific
1 // SPDX-License-Identifier: GPL-2.0
3 * Elida kd35t133 3.5" MIPI-DSI panel driver
8 * Rockteck jh057n00900 5.5" MIPI-DSI panel driver
14 #include <linux/media-bus-format.h>
26 /* Manufacturer specific Commands send via DSI */
41 struct drm_panel panel; member
48 static inline struct kd35t133 *panel_to_kd35t133(struct drm_panel *panel) in panel_to_kd35t133() argument
50 return container_of(panel, struct kd35t133, panel); in panel_to_kd35t133()
55 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in kd35t133_init_sequence()
56 struct device *dev = ctx->dev; in kd35t133_init_sequence()
59 * Init sequence was supplied by the panel vendor with minimal in kd35t133_init_sequence()
83 dev_dbg(dev, "Panel init sequence done\n"); in kd35t133_init_sequence()
87 static int kd35t133_unprepare(struct drm_panel *panel) in kd35t133_unprepare() argument
89 struct kd35t133 *ctx = panel_to_kd35t133(panel); in kd35t133_unprepare()
90 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in kd35t133_unprepare()
95 dev_err(ctx->dev, "failed to set display off: %d\n", ret); in kd35t133_unprepare()
99 dev_err(ctx->dev, "failed to enter sleep mode: %d\n", ret); in kd35t133_unprepare()
103 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in kd35t133_unprepare()
105 regulator_disable(ctx->iovcc); in kd35t133_unprepare()
106 regulator_disable(ctx->vdd); in kd35t133_unprepare()
111 static int kd35t133_prepare(struct drm_panel *panel) in kd35t133_prepare() argument
113 struct kd35t133 *ctx = panel_to_kd35t133(panel); in kd35t133_prepare()
114 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in kd35t133_prepare()
117 dev_dbg(ctx->dev, "Resetting the panel\n"); in kd35t133_prepare()
118 ret = regulator_enable(ctx->vdd); in kd35t133_prepare()
120 dev_err(ctx->dev, "Failed to enable vdd supply: %d\n", ret); in kd35t133_prepare()
124 ret = regulator_enable(ctx->iovcc); in kd35t133_prepare()
126 dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); in kd35t133_prepare()
132 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in kd35t133_prepare()
134 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in kd35t133_prepare()
140 dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret); in kd35t133_prepare()
148 dev_err(ctx->dev, "Panel init sequence failed: %d\n", ret); in kd35t133_prepare()
154 dev_err(ctx->dev, "Failed to set display on: %d\n", ret); in kd35t133_prepare()
163 regulator_disable(ctx->iovcc); in kd35t133_prepare()
165 regulator_disable(ctx->vdd); in kd35t133_prepare()
183 static int kd35t133_get_modes(struct drm_panel *panel, in kd35t133_get_modes() argument
186 struct kd35t133 *ctx = panel_to_kd35t133(panel); in kd35t133_get_modes()
189 mode = drm_mode_duplicate(connector->dev, &default_mode); in kd35t133_get_modes()
191 dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n", in kd35t133_get_modes()
194 return -ENOMEM; in kd35t133_get_modes()
199 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in kd35t133_get_modes()
200 connector->display_info.width_mm = mode->width_mm; in kd35t133_get_modes()
201 connector->display_info.height_mm = mode->height_mm; in kd35t133_get_modes()
207 static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel) in kd35t133_get_orientation() argument
209 struct kd35t133 *ctx = panel_to_kd35t133(panel); in kd35t133_get_orientation()
211 return ctx->orientation; in kd35t133_get_orientation()
223 struct device *dev = &dsi->dev; in kd35t133_probe()
229 return -ENOMEM; in kd35t133_probe()
231 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in kd35t133_probe()
232 if (IS_ERR(ctx->reset_gpio)) { in kd35t133_probe()
234 return PTR_ERR(ctx->reset_gpio); in kd35t133_probe()
237 ctx->vdd = devm_regulator_get(dev, "vdd"); in kd35t133_probe()
238 if (IS_ERR(ctx->vdd)) { in kd35t133_probe()
239 ret = PTR_ERR(ctx->vdd); in kd35t133_probe()
240 if (ret != -EPROBE_DEFER) in kd35t133_probe()
245 ctx->iovcc = devm_regulator_get(dev, "iovcc"); in kd35t133_probe()
246 if (IS_ERR(ctx->iovcc)) { in kd35t133_probe()
247 ret = PTR_ERR(ctx->iovcc); in kd35t133_probe()
248 if (ret != -EPROBE_DEFER) in kd35t133_probe()
253 ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); in kd35t133_probe()
255 dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret); in kd35t133_probe()
261 ctx->dev = dev; in kd35t133_probe()
263 dsi->lanes = 1; in kd35t133_probe()
264 dsi->format = MIPI_DSI_FMT_RGB888; in kd35t133_probe()
265 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | in kd35t133_probe()
269 drm_panel_init(&ctx->panel, &dsi->dev, &kd35t133_funcs, in kd35t133_probe()
272 ret = drm_panel_of_backlight(&ctx->panel); in kd35t133_probe()
276 drm_panel_add(&ctx->panel); in kd35t133_probe()
281 drm_panel_remove(&ctx->panel); in kd35t133_probe()
295 dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); in kd35t133_remove()
297 drm_panel_remove(&ctx->panel); in kd35t133_remove()
308 .name = "panel-elida-kd35t133",
316 MODULE_AUTHOR("Heiko Stuebner <heiko.stuebner@theobroma-systems.com>");
317 MODULE_DESCRIPTION("DRM driver for Elida kd35t133 MIPI DSI panel");