Lines Matching +full:dsi +full:- +full:based

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Based on AUO panel driver by Rob Clark <robdclark@gmail.com>
25 struct mipi_dsi_device *dsi; member
40 struct mipi_dsi_device *dsi = sharp_nt->dsi; in sharp_nt_panel_init() local
43 dsi->mode_flags |= MIPI_DSI_MODE_LPM; in sharp_nt_panel_init()
45 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in sharp_nt_panel_init()
51 /* Novatek two-lane operation */ in sharp_nt_panel_init()
52 ret = mipi_dsi_dcs_write(dsi, 0xae, (u8[]){ 0x03 }, 1); in sharp_nt_panel_init()
57 ret = mipi_dsi_dcs_set_pixel_format(dsi, MIPI_DCS_PIXEL_FMT_24BIT | in sharp_nt_panel_init()
67 struct mipi_dsi_device *dsi = sharp_nt->dsi; in sharp_nt_panel_on() local
70 dsi->mode_flags |= MIPI_DSI_MODE_LPM; in sharp_nt_panel_on()
72 ret = mipi_dsi_dcs_set_display_on(dsi); in sharp_nt_panel_on()
81 struct mipi_dsi_device *dsi = sharp_nt->dsi; in sharp_nt_panel_off() local
84 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; in sharp_nt_panel_off()
86 ret = mipi_dsi_dcs_set_display_off(dsi); in sharp_nt_panel_off()
90 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in sharp_nt_panel_off()
102 if (!sharp_nt->prepared) in sharp_nt_panel_unprepare()
107 dev_err(panel->dev, "failed to set panel off: %d\n", ret); in sharp_nt_panel_unprepare()
111 regulator_disable(sharp_nt->supply); in sharp_nt_panel_unprepare()
112 if (sharp_nt->reset_gpio) in sharp_nt_panel_unprepare()
113 gpiod_set_value(sharp_nt->reset_gpio, 0); in sharp_nt_panel_unprepare()
115 sharp_nt->prepared = false; in sharp_nt_panel_unprepare()
125 if (sharp_nt->prepared) in sharp_nt_panel_prepare()
128 ret = regulator_enable(sharp_nt->supply); in sharp_nt_panel_prepare()
134 if (sharp_nt->reset_gpio) { in sharp_nt_panel_prepare()
135 gpiod_set_value(sharp_nt->reset_gpio, 1); in sharp_nt_panel_prepare()
137 gpiod_set_value(sharp_nt->reset_gpio, 0); in sharp_nt_panel_prepare()
139 gpiod_set_value(sharp_nt->reset_gpio, 1); in sharp_nt_panel_prepare()
145 dev_err(panel->dev, "failed to init panel: %d\n", ret); in sharp_nt_panel_prepare()
151 dev_err(panel->dev, "failed to set panel on: %d\n", ret); in sharp_nt_panel_prepare()
155 sharp_nt->prepared = true; in sharp_nt_panel_prepare()
160 regulator_disable(sharp_nt->supply); in sharp_nt_panel_prepare()
161 if (sharp_nt->reset_gpio) in sharp_nt_panel_prepare()
162 gpiod_set_value(sharp_nt->reset_gpio, 0); in sharp_nt_panel_prepare()
183 mode = drm_mode_duplicate(connector->dev, &default_mode); in sharp_nt_panel_get_modes()
185 dev_err(panel->dev, "failed to add mode %ux%u@%u\n", in sharp_nt_panel_get_modes()
188 return -ENOMEM; in sharp_nt_panel_get_modes()
195 connector->display_info.width_mm = 54; in sharp_nt_panel_get_modes()
196 connector->display_info.height_mm = 95; in sharp_nt_panel_get_modes()
209 struct device *dev = &sharp_nt->dsi->dev; in sharp_nt_panel_add()
212 sharp_nt->supply = devm_regulator_get(dev, "avdd"); in sharp_nt_panel_add()
213 if (IS_ERR(sharp_nt->supply)) in sharp_nt_panel_add()
214 return PTR_ERR(sharp_nt->supply); in sharp_nt_panel_add()
216 sharp_nt->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in sharp_nt_panel_add()
217 if (IS_ERR(sharp_nt->reset_gpio)) { in sharp_nt_panel_add()
218 dev_err(dev, "cannot get reset-gpios %ld\n", in sharp_nt_panel_add()
219 PTR_ERR(sharp_nt->reset_gpio)); in sharp_nt_panel_add()
220 sharp_nt->reset_gpio = NULL; in sharp_nt_panel_add()
222 gpiod_set_value(sharp_nt->reset_gpio, 0); in sharp_nt_panel_add()
225 drm_panel_init(&sharp_nt->base, &sharp_nt->dsi->dev, in sharp_nt_panel_add()
228 ret = drm_panel_of_backlight(&sharp_nt->base); in sharp_nt_panel_add()
232 drm_panel_add(&sharp_nt->base); in sharp_nt_panel_add()
239 if (sharp_nt->base.dev) in sharp_nt_panel_del()
240 drm_panel_remove(&sharp_nt->base); in sharp_nt_panel_del()
243 static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi) in sharp_nt_panel_probe() argument
248 dsi->lanes = 2; in sharp_nt_panel_probe()
249 dsi->format = MIPI_DSI_FMT_RGB888; in sharp_nt_panel_probe()
250 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | in sharp_nt_panel_probe()
256 sharp_nt = devm_kzalloc(&dsi->dev, sizeof(*sharp_nt), GFP_KERNEL); in sharp_nt_panel_probe()
258 return -ENOMEM; in sharp_nt_panel_probe()
260 mipi_dsi_set_drvdata(dsi, sharp_nt); in sharp_nt_panel_probe()
262 sharp_nt->dsi = dsi; in sharp_nt_panel_probe()
268 ret = mipi_dsi_attach(dsi); in sharp_nt_panel_probe()
277 static void sharp_nt_panel_remove(struct mipi_dsi_device *dsi) in sharp_nt_panel_remove() argument
279 struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi); in sharp_nt_panel_remove()
282 ret = drm_panel_disable(&sharp_nt->base); in sharp_nt_panel_remove()
284 dev_err(&dsi->dev, "failed to disable panel: %d\n", ret); in sharp_nt_panel_remove()
286 ret = mipi_dsi_detach(dsi); in sharp_nt_panel_remove()
288 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); in sharp_nt_panel_remove()
293 static void sharp_nt_panel_shutdown(struct mipi_dsi_device *dsi) in sharp_nt_panel_shutdown() argument
295 struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi); in sharp_nt_panel_shutdown()
297 drm_panel_disable(&sharp_nt->base); in sharp_nt_panel_shutdown()
301 { .compatible = "sharp,ls043t1le01-qhd", },
308 .name = "panel-sharp-ls043t1le01-qhd",
318 MODULE_DESCRIPTION("Sharp LS043T1LE01 NT35565-based qHD (540x960) video mode panel driver");