Lines Matching +full:panel +full:- +full:dsi
1 // SPDX-License-Identifier: GPL-2.0+
20 struct drm_panel panel; member
21 struct mipi_dsi_device *dsi; member
28 static inline struct feiyang *panel_to_feiyang(struct drm_panel *panel) in panel_to_feiyang() argument
30 return container_of(panel, struct feiyang, panel); in panel_to_feiyang()
47 static int feiyang_prepare(struct drm_panel *panel) in feiyang_prepare() argument
49 struct feiyang *ctx = panel_to_feiyang(panel); in feiyang_prepare()
50 struct mipi_dsi_device *dsi = ctx->dsi; in feiyang_prepare() local
54 ret = regulator_enable(ctx->dvdd); in feiyang_prepare()
61 ret = regulator_enable(ctx->avdd); in feiyang_prepare()
68 gpiod_set_value(ctx->reset, 0); in feiyang_prepare()
76 gpiod_set_value(ctx->reset, 1); in feiyang_prepare()
85 ret = mipi_dsi_dcs_write_buffer(dsi, cmd->data, in feiyang_prepare()
94 static int feiyang_enable(struct drm_panel *panel) in feiyang_enable() argument
96 struct feiyang *ctx = panel_to_feiyang(panel); in feiyang_enable()
101 mipi_dsi_dcs_set_display_on(ctx->dsi); in feiyang_enable()
106 static int feiyang_disable(struct drm_panel *panel) in feiyang_disable() argument
108 struct feiyang *ctx = panel_to_feiyang(panel); in feiyang_disable()
110 return mipi_dsi_dcs_set_display_off(ctx->dsi); in feiyang_disable()
113 static int feiyang_unprepare(struct drm_panel *panel) in feiyang_unprepare() argument
115 struct feiyang *ctx = panel_to_feiyang(panel); in feiyang_unprepare()
118 ret = mipi_dsi_dcs_set_display_off(ctx->dsi); in feiyang_unprepare()
120 dev_err(panel->dev, "failed to set display off: %d\n", ret); in feiyang_unprepare()
122 ret = mipi_dsi_dcs_enter_sleep_mode(ctx->dsi); in feiyang_unprepare()
124 dev_err(panel->dev, "failed to enter sleep mode: %d\n", ret); in feiyang_unprepare()
129 gpiod_set_value(ctx->reset, 0); in feiyang_unprepare()
131 regulator_disable(ctx->avdd); in feiyang_unprepare()
136 regulator_disable(ctx->dvdd); in feiyang_unprepare()
157 static int feiyang_get_modes(struct drm_panel *panel, in feiyang_get_modes() argument
160 struct feiyang *ctx = panel_to_feiyang(panel); in feiyang_get_modes()
163 mode = drm_mode_duplicate(connector->dev, &feiyang_default_mode); in feiyang_get_modes()
165 dev_err(&ctx->dsi->dev, "failed to add mode %ux%u@%u\n", in feiyang_get_modes()
169 return -ENOMEM; in feiyang_get_modes()
187 static int feiyang_dsi_probe(struct mipi_dsi_device *dsi) in feiyang_dsi_probe() argument
192 ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); in feiyang_dsi_probe()
194 return -ENOMEM; in feiyang_dsi_probe()
196 mipi_dsi_set_drvdata(dsi, ctx); in feiyang_dsi_probe()
197 ctx->dsi = dsi; in feiyang_dsi_probe()
199 drm_panel_init(&ctx->panel, &dsi->dev, &feiyang_funcs, in feiyang_dsi_probe()
202 ctx->dvdd = devm_regulator_get(&dsi->dev, "dvdd"); in feiyang_dsi_probe()
203 if (IS_ERR(ctx->dvdd)) in feiyang_dsi_probe()
204 return dev_err_probe(&dsi->dev, PTR_ERR(ctx->dvdd), in feiyang_dsi_probe()
207 ctx->avdd = devm_regulator_get(&dsi->dev, "avdd"); in feiyang_dsi_probe()
208 if (IS_ERR(ctx->avdd)) in feiyang_dsi_probe()
209 return dev_err_probe(&dsi->dev, PTR_ERR(ctx->avdd), in feiyang_dsi_probe()
212 ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW); in feiyang_dsi_probe()
213 if (IS_ERR(ctx->reset)) in feiyang_dsi_probe()
214 return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset), in feiyang_dsi_probe()
217 ret = drm_panel_of_backlight(&ctx->panel); in feiyang_dsi_probe()
221 drm_panel_add(&ctx->panel); in feiyang_dsi_probe()
223 dsi->mode_flags = MIPI_DSI_MODE_VIDEO_BURST; in feiyang_dsi_probe()
224 dsi->format = MIPI_DSI_FMT_RGB888; in feiyang_dsi_probe()
225 dsi->lanes = 4; in feiyang_dsi_probe()
227 ret = mipi_dsi_attach(dsi); in feiyang_dsi_probe()
229 drm_panel_remove(&ctx->panel); in feiyang_dsi_probe()
236 static void feiyang_dsi_remove(struct mipi_dsi_device *dsi) in feiyang_dsi_remove() argument
238 struct feiyang *ctx = mipi_dsi_get_drvdata(dsi); in feiyang_dsi_remove()
240 mipi_dsi_detach(dsi); in feiyang_dsi_remove()
241 drm_panel_remove(&ctx->panel); in feiyang_dsi_remove()
254 .name = "feiyang-fy07024di26a30d",
261 MODULE_DESCRIPTION("Feiyang FY07024DI26A30-D MIPI-DSI LCD panel");