Lines Matching +full:panel +full:- +full:dsi

1 // SPDX-License-Identifier: GPL-2.0+
3 * MIPI-DSI Samsung s6d16d0 panel driver. This is a 864x480
4 * AMOLED panel with a command-only DSI interface.
19 struct drm_panel panel; member
43 static inline struct s6d16d0 *panel_to_s6d16d0(struct drm_panel *panel) in panel_to_s6d16d0() argument
45 return container_of(panel, struct s6d16d0, panel); in panel_to_s6d16d0()
48 static int s6d16d0_unprepare(struct drm_panel *panel) in s6d16d0_unprepare() argument
50 struct s6d16d0 *s6 = panel_to_s6d16d0(panel); in s6d16d0_unprepare()
51 struct mipi_dsi_device *dsi = to_mipi_dsi_device(s6->dev); in s6d16d0_unprepare() local
55 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in s6d16d0_unprepare()
57 dev_err(s6->dev, "failed to enter sleep mode (%d)\n", ret); in s6d16d0_unprepare()
62 gpiod_set_value_cansleep(s6->reset_gpio, 1); in s6d16d0_unprepare()
63 regulator_disable(s6->supply); in s6d16d0_unprepare()
68 static int s6d16d0_prepare(struct drm_panel *panel) in s6d16d0_prepare() argument
70 struct s6d16d0 *s6 = panel_to_s6d16d0(panel); in s6d16d0_prepare()
71 struct mipi_dsi_device *dsi = to_mipi_dsi_device(s6->dev); in s6d16d0_prepare() local
74 ret = regulator_enable(s6->supply); in s6d16d0_prepare()
76 dev_err(s6->dev, "failed to enable supply (%d)\n", ret); in s6d16d0_prepare()
81 gpiod_set_value_cansleep(s6->reset_gpio, 1); in s6d16d0_prepare()
83 /* De-assert RESET */ in s6d16d0_prepare()
84 gpiod_set_value_cansleep(s6->reset_gpio, 0); in s6d16d0_prepare()
88 ret = mipi_dsi_dcs_set_tear_on(dsi, in s6d16d0_prepare()
91 dev_err(s6->dev, "failed to enable vblank TE (%d)\n", ret); in s6d16d0_prepare()
95 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in s6d16d0_prepare()
97 dev_err(s6->dev, "failed to exit sleep mode (%d)\n", ret); in s6d16d0_prepare()
104 static int s6d16d0_enable(struct drm_panel *panel) in s6d16d0_enable() argument
106 struct s6d16d0 *s6 = panel_to_s6d16d0(panel); in s6d16d0_enable()
107 struct mipi_dsi_device *dsi = to_mipi_dsi_device(s6->dev); in s6d16d0_enable() local
110 ret = mipi_dsi_dcs_set_display_on(dsi); in s6d16d0_enable()
112 dev_err(s6->dev, "failed to turn display on (%d)\n", ret); in s6d16d0_enable()
119 static int s6d16d0_disable(struct drm_panel *panel) in s6d16d0_disable() argument
121 struct s6d16d0 *s6 = panel_to_s6d16d0(panel); in s6d16d0_disable()
122 struct mipi_dsi_device *dsi = to_mipi_dsi_device(s6->dev); in s6d16d0_disable() local
125 ret = mipi_dsi_dcs_set_display_off(dsi); in s6d16d0_disable()
127 dev_err(s6->dev, "failed to turn display off (%d)\n", ret); in s6d16d0_disable()
134 static int s6d16d0_get_modes(struct drm_panel *panel, in s6d16d0_get_modes() argument
139 mode = drm_mode_duplicate(connector->dev, &samsung_s6d16d0_mode); in s6d16d0_get_modes()
141 dev_err(panel->dev, "bad mode or failed to add mode\n"); in s6d16d0_get_modes()
142 return -EINVAL; in s6d16d0_get_modes()
145 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in s6d16d0_get_modes()
147 connector->display_info.width_mm = mode->width_mm; in s6d16d0_get_modes()
148 connector->display_info.height_mm = mode->height_mm; in s6d16d0_get_modes()
163 static int s6d16d0_probe(struct mipi_dsi_device *dsi) in s6d16d0_probe() argument
165 struct device *dev = &dsi->dev; in s6d16d0_probe()
171 return -ENOMEM; in s6d16d0_probe()
173 mipi_dsi_set_drvdata(dsi, s6); in s6d16d0_probe()
174 s6->dev = dev; in s6d16d0_probe()
176 dsi->lanes = 2; in s6d16d0_probe()
177 dsi->format = MIPI_DSI_FMT_RGB888; in s6d16d0_probe()
178 dsi->hs_rate = 420160000; in s6d16d0_probe()
179 dsi->lp_rate = 19200000; in s6d16d0_probe()
187 dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS; in s6d16d0_probe()
189 s6->supply = devm_regulator_get(dev, "vdd1"); in s6d16d0_probe()
190 if (IS_ERR(s6->supply)) in s6d16d0_probe()
191 return PTR_ERR(s6->supply); in s6d16d0_probe()
194 s6->reset_gpio = devm_gpiod_get_optional(dev, "reset", in s6d16d0_probe()
196 if (IS_ERR(s6->reset_gpio)) { in s6d16d0_probe()
197 ret = PTR_ERR(s6->reset_gpio); in s6d16d0_probe()
198 if (ret != -EPROBE_DEFER) in s6d16d0_probe()
203 drm_panel_init(&s6->panel, dev, &s6d16d0_drm_funcs, in s6d16d0_probe()
206 drm_panel_add(&s6->panel); in s6d16d0_probe()
208 ret = mipi_dsi_attach(dsi); in s6d16d0_probe()
210 drm_panel_remove(&s6->panel); in s6d16d0_probe()
215 static void s6d16d0_remove(struct mipi_dsi_device *dsi) in s6d16d0_remove() argument
217 struct s6d16d0 *s6 = mipi_dsi_get_drvdata(dsi); in s6d16d0_remove()
219 mipi_dsi_detach(dsi); in s6d16d0_remove()
220 drm_panel_remove(&s6->panel); in s6d16d0_remove()
233 .name = "panel-samsung-s6d16d0",
240 MODULE_DESCRIPTION("MIPI-DSI s6d16d0 Panel Driver");