Lines Matching +full:panel +full:- +full:dsi
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com
20 struct mipi_dsi_device *dsi; member
30 static inline struct osd101t2587_panel *ti_osd_panel(struct drm_panel *panel) in ti_osd_panel() argument
32 return container_of(panel, struct osd101t2587_panel, base); in ti_osd_panel()
35 static int osd101t2587_panel_disable(struct drm_panel *panel) in osd101t2587_panel_disable() argument
37 struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); in osd101t2587_panel_disable()
40 if (!osd101t2587->enabled) in osd101t2587_panel_disable()
43 ret = mipi_dsi_shutdown_peripheral(osd101t2587->dsi); in osd101t2587_panel_disable()
45 osd101t2587->enabled = false; in osd101t2587_panel_disable()
50 static int osd101t2587_panel_unprepare(struct drm_panel *panel) in osd101t2587_panel_unprepare() argument
52 struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); in osd101t2587_panel_unprepare()
54 if (!osd101t2587->prepared) in osd101t2587_panel_unprepare()
57 regulator_disable(osd101t2587->supply); in osd101t2587_panel_unprepare()
58 osd101t2587->prepared = false; in osd101t2587_panel_unprepare()
63 static int osd101t2587_panel_prepare(struct drm_panel *panel) in osd101t2587_panel_prepare() argument
65 struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); in osd101t2587_panel_prepare()
68 if (osd101t2587->prepared) in osd101t2587_panel_prepare()
71 ret = regulator_enable(osd101t2587->supply); in osd101t2587_panel_prepare()
73 osd101t2587->prepared = true; in osd101t2587_panel_prepare()
78 static int osd101t2587_panel_enable(struct drm_panel *panel) in osd101t2587_panel_enable() argument
80 struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); in osd101t2587_panel_enable()
83 if (osd101t2587->enabled) in osd101t2587_panel_enable()
86 ret = mipi_dsi_turn_on_peripheral(osd101t2587->dsi); in osd101t2587_panel_enable()
90 osd101t2587->enabled = true; in osd101t2587_panel_enable()
108 static int osd101t2587_panel_get_modes(struct drm_panel *panel, in osd101t2587_panel_get_modes() argument
111 struct osd101t2587_panel *osd101t2587 = ti_osd_panel(panel); in osd101t2587_panel_get_modes()
114 mode = drm_mode_duplicate(connector->dev, osd101t2587->default_mode); in osd101t2587_panel_get_modes()
116 dev_err(panel->dev, "failed to add mode %ux%ux@%u\n", in osd101t2587_panel_get_modes()
117 osd101t2587->default_mode->hdisplay, in osd101t2587_panel_get_modes()
118 osd101t2587->default_mode->vdisplay, in osd101t2587_panel_get_modes()
119 drm_mode_vrefresh(osd101t2587->default_mode)); in osd101t2587_panel_get_modes()
120 return -ENOMEM; in osd101t2587_panel_get_modes()
127 connector->display_info.width_mm = 217; in osd101t2587_panel_get_modes()
128 connector->display_info.height_mm = 136; in osd101t2587_panel_get_modes()
143 .compatible = "osddisplays,osd101t2587-53ts",
153 struct device *dev = &osd101t2587->dsi->dev; in osd101t2587_panel_add()
156 osd101t2587->supply = devm_regulator_get(dev, "power"); in osd101t2587_panel_add()
157 if (IS_ERR(osd101t2587->supply)) in osd101t2587_panel_add()
158 return PTR_ERR(osd101t2587->supply); in osd101t2587_panel_add()
160 drm_panel_init(&osd101t2587->base, &osd101t2587->dsi->dev, in osd101t2587_panel_add()
163 ret = drm_panel_of_backlight(&osd101t2587->base); in osd101t2587_panel_add()
167 drm_panel_add(&osd101t2587->base); in osd101t2587_panel_add()
172 static int osd101t2587_panel_probe(struct mipi_dsi_device *dsi) in osd101t2587_panel_probe() argument
178 id = of_match_node(osd101t2587_of_match, dsi->dev.of_node); in osd101t2587_panel_probe()
180 return -ENODEV; in osd101t2587_panel_probe()
182 dsi->lanes = 4; in osd101t2587_panel_probe()
183 dsi->format = MIPI_DSI_FMT_RGB888; in osd101t2587_panel_probe()
184 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | in osd101t2587_panel_probe()
189 osd101t2587 = devm_kzalloc(&dsi->dev, sizeof(*osd101t2587), GFP_KERNEL); in osd101t2587_panel_probe()
191 return -ENOMEM; in osd101t2587_panel_probe()
193 mipi_dsi_set_drvdata(dsi, osd101t2587); in osd101t2587_panel_probe()
195 osd101t2587->dsi = dsi; in osd101t2587_panel_probe()
196 osd101t2587->default_mode = id->data; in osd101t2587_panel_probe()
202 ret = mipi_dsi_attach(dsi); in osd101t2587_panel_probe()
204 drm_panel_remove(&osd101t2587->base); in osd101t2587_panel_probe()
209 static void osd101t2587_panel_remove(struct mipi_dsi_device *dsi) in osd101t2587_panel_remove() argument
211 struct osd101t2587_panel *osd101t2587 = mipi_dsi_get_drvdata(dsi); in osd101t2587_panel_remove()
214 ret = drm_panel_disable(&osd101t2587->base); in osd101t2587_panel_remove()
216 dev_warn(&dsi->dev, "failed to disable panel: %d\n", ret); in osd101t2587_panel_remove()
218 drm_panel_unprepare(&osd101t2587->base); in osd101t2587_panel_remove()
219 drm_panel_remove(&osd101t2587->base); in osd101t2587_panel_remove()
221 ret = mipi_dsi_detach(dsi); in osd101t2587_panel_remove()
223 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); in osd101t2587_panel_remove()
226 static void osd101t2587_panel_shutdown(struct mipi_dsi_device *dsi) in osd101t2587_panel_shutdown() argument
228 struct osd101t2587_panel *osd101t2587 = mipi_dsi_get_drvdata(dsi); in osd101t2587_panel_shutdown()
230 drm_panel_disable(&osd101t2587->base); in osd101t2587_panel_shutdown()
231 drm_panel_unprepare(&osd101t2587->base); in osd101t2587_panel_shutdown()
236 .name = "panel-osd-osd101t2587-53ts",
246 MODULE_DESCRIPTION("OSD101T2587-53TS DSI panel");