Lines Matching +full:panel +full:- +full:dsi
1 // SPDX-License-Identifier: GPL-2.0-only
3 * BOE BF060Y8M-AJ0 5.99" MIPI-DSI OLED Panel on SW43404 DriverIC
33 struct drm_panel panel; member
34 struct mipi_dsi_device *dsi; member
40 struct boe_bf060y8m_aj0 *to_boe_bf060y8m_aj0(struct drm_panel *panel) in to_boe_bf060y8m_aj0() argument
42 return container_of(panel, struct boe_bf060y8m_aj0, panel); in to_boe_bf060y8m_aj0()
47 gpiod_set_value_cansleep(boe->reset_gpio, 0); in boe_bf060y8m_aj0_reset()
49 gpiod_set_value_cansleep(boe->reset_gpio, 1); in boe_bf060y8m_aj0_reset()
51 gpiod_set_value_cansleep(boe->reset_gpio, 0); in boe_bf060y8m_aj0_reset()
57 struct mipi_dsi_device *dsi = boe->dsi; in boe_bf060y8m_aj0_on() local
58 struct device *dev = &dsi->dev; in boe_bf060y8m_aj0_on()
61 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); in boe_bf060y8m_aj0_on()
62 mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x00, 0x4c); in boe_bf060y8m_aj0_on()
63 mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_3D_CONTROL, 0x10); in boe_bf060y8m_aj0_on()
64 mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, DCS_ALLOW_HBM_RANGE); in boe_bf060y8m_aj0_on()
65 mipi_dsi_dcs_write_seq(dsi, 0xf8, in boe_bf060y8m_aj0_on()
68 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in boe_bf060y8m_aj0_on()
75 mipi_dsi_dcs_write_seq(dsi, 0xb0, 0xa5, 0x00); in boe_bf060y8m_aj0_on()
76 mipi_dsi_dcs_write_seq(dsi, 0xc0, in boe_bf060y8m_aj0_on()
79 mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x00, 0x00, 0x00, 0x1f, 0x1f, in boe_bf060y8m_aj0_on()
82 mipi_dsi_dcs_write_seq(dsi, 0xe2, 0x20, 0x04, 0x10, 0x12, 0x92, in boe_bf060y8m_aj0_on()
85 mipi_dsi_dcs_write_seq(dsi, 0xde, 0x01, 0x2c, 0x00, 0x77, 0x3e); in boe_bf060y8m_aj0_on()
89 ret = mipi_dsi_dcs_set_display_on(dsi); in boe_bf060y8m_aj0_on()
101 struct mipi_dsi_device *dsi = boe->dsi; in boe_bf060y8m_aj0_off() local
102 struct device *dev = &dsi->dev; in boe_bf060y8m_aj0_off()
106 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; in boe_bf060y8m_aj0_off()
107 ret = mipi_dsi_dcs_set_display_off(dsi); in boe_bf060y8m_aj0_off()
114 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in boe_bf060y8m_aj0_off()
120 dsi->mode_flags |= MIPI_DSI_MODE_LPM; in boe_bf060y8m_aj0_off()
125 static int boe_bf060y8m_aj0_prepare(struct drm_panel *panel) in boe_bf060y8m_aj0_prepare() argument
127 struct boe_bf060y8m_aj0 *boe = to_boe_bf060y8m_aj0(panel); in boe_bf060y8m_aj0_prepare()
128 struct device *dev = &boe->dsi->dev; in boe_bf060y8m_aj0_prepare()
132 * Enable EL Driving Voltage first - doing that at the beginning in boe_bf060y8m_aj0_prepare()
136 ret = regulator_enable(boe->vregs[BF060Y8M_VREG_EL_VDD].consumer); in boe_bf060y8m_aj0_prepare()
139 ret = regulator_enable(boe->vregs[BF060Y8M_VREG_EL_VSS].consumer); in boe_bf060y8m_aj0_prepare()
143 ret = regulator_enable(boe->vregs[BF060Y8M_VREG_VCC].consumer); in boe_bf060y8m_aj0_prepare()
147 ret = regulator_enable(boe->vregs[BF060Y8M_VREG_VDDIO].consumer); in boe_bf060y8m_aj0_prepare()
151 ret = regulator_enable(boe->vregs[BF060Y8M_VREG_VCI].consumer); in boe_bf060y8m_aj0_prepare()
160 dev_err(dev, "Failed to initialize panel: %d\n", ret); in boe_bf060y8m_aj0_prepare()
161 gpiod_set_value_cansleep(boe->reset_gpio, 1); in boe_bf060y8m_aj0_prepare()
168 regulator_disable(boe->vregs[BF060Y8M_VREG_VDDIO].consumer); in boe_bf060y8m_aj0_prepare()
170 regulator_disable(boe->vregs[BF060Y8M_VREG_VCC].consumer); in boe_bf060y8m_aj0_prepare()
172 regulator_disable(boe->vregs[BF060Y8M_VREG_EL_VSS].consumer); in boe_bf060y8m_aj0_prepare()
174 regulator_disable(boe->vregs[BF060Y8M_VREG_EL_VDD].consumer); in boe_bf060y8m_aj0_prepare()
178 static int boe_bf060y8m_aj0_unprepare(struct drm_panel *panel) in boe_bf060y8m_aj0_unprepare() argument
180 struct boe_bf060y8m_aj0 *boe = to_boe_bf060y8m_aj0(panel); in boe_bf060y8m_aj0_unprepare()
181 struct device *dev = &boe->dsi->dev; in boe_bf060y8m_aj0_unprepare()
186 dev_err(dev, "Failed to un-initialize panel: %d\n", ret); in boe_bf060y8m_aj0_unprepare()
188 gpiod_set_value_cansleep(boe->reset_gpio, 1); in boe_bf060y8m_aj0_unprepare()
189 ret = regulator_bulk_disable(ARRAY_SIZE(boe->vregs), boe->vregs); in boe_bf060y8m_aj0_unprepare()
208 static int boe_bf060y8m_aj0_get_modes(struct drm_panel *panel, in boe_bf060y8m_aj0_get_modes() argument
213 mode = drm_mode_duplicate(connector->dev, &boe_bf060y8m_aj0_mode); in boe_bf060y8m_aj0_get_modes()
215 return -ENOMEM; in boe_bf060y8m_aj0_get_modes()
219 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in boe_bf060y8m_aj0_get_modes()
220 connector->display_info.width_mm = mode->width_mm; in boe_bf060y8m_aj0_get_modes()
221 connector->display_info.height_mm = mode->height_mm; in boe_bf060y8m_aj0_get_modes()
235 struct mipi_dsi_device *dsi = bl_get_data(bl); in boe_bf060y8m_aj0_bl_update_status() local
239 ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness); in boe_bf060y8m_aj0_bl_update_status()
248 struct mipi_dsi_device *dsi = bl_get_data(bl); in boe_bf060y8m_aj0_bl_get_brightness() local
252 ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness); in boe_bf060y8m_aj0_bl_get_brightness()
265 boe_bf060y8m_aj0_create_backlight(struct mipi_dsi_device *dsi) in boe_bf060y8m_aj0_create_backlight() argument
267 struct device *dev = &dsi->dev; in boe_bf060y8m_aj0_create_backlight()
275 return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, in boe_bf060y8m_aj0_create_backlight()
285 boe->vregs[BF060Y8M_VREG_VCC].supply = "vcc"; in boe_bf060y8m_aj0_init_vregs()
286 boe->vregs[BF060Y8M_VREG_VDDIO].supply = "vddio"; in boe_bf060y8m_aj0_init_vregs()
287 boe->vregs[BF060Y8M_VREG_VCI].supply = "vci"; in boe_bf060y8m_aj0_init_vregs()
288 boe->vregs[BF060Y8M_VREG_EL_VDD].supply = "elvdd"; in boe_bf060y8m_aj0_init_vregs()
289 boe->vregs[BF060Y8M_VREG_EL_VSS].supply = "elvss"; in boe_bf060y8m_aj0_init_vregs()
290 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(boe->vregs), in boe_bf060y8m_aj0_init_vregs()
291 boe->vregs); in boe_bf060y8m_aj0_init_vregs()
297 vreg = boe->vregs[BF060Y8M_VREG_VCC].consumer; in boe_bf060y8m_aj0_init_vregs()
302 vreg = boe->vregs[BF060Y8M_VREG_VDDIO].consumer; in boe_bf060y8m_aj0_init_vregs()
307 vreg = boe->vregs[BF060Y8M_VREG_VCI].consumer; in boe_bf060y8m_aj0_init_vregs()
312 vreg = boe->vregs[BF060Y8M_VREG_EL_VDD].consumer; in boe_bf060y8m_aj0_init_vregs()
317 /* ELVSS is negative: -5.00V to -1.40V */ in boe_bf060y8m_aj0_init_vregs()
318 vreg = boe->vregs[BF060Y8M_VREG_EL_VSS].consumer; in boe_bf060y8m_aj0_init_vregs()
329 * be fixed-regulator which, at the time of writing, does not in boe_bf060y8m_aj0_init_vregs()
332 vreg = boe->vregs[BF060Y8M_VREG_VDDIO].consumer; in boe_bf060y8m_aj0_init_vregs()
336 boe->vregs[1].supply, ret); in boe_bf060y8m_aj0_init_vregs()
338 vreg = boe->vregs[BF060Y8M_VREG_VCI].consumer; in boe_bf060y8m_aj0_init_vregs()
342 boe->vregs[2].supply, ret); in boe_bf060y8m_aj0_init_vregs()
347 static int boe_bf060y8m_aj0_probe(struct mipi_dsi_device *dsi) in boe_bf060y8m_aj0_probe() argument
349 struct device *dev = &dsi->dev; in boe_bf060y8m_aj0_probe()
355 return -ENOMEM; in boe_bf060y8m_aj0_probe()
362 boe->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS); in boe_bf060y8m_aj0_probe()
363 if (IS_ERR(boe->reset_gpio)) in boe_bf060y8m_aj0_probe()
364 return dev_err_probe(dev, PTR_ERR(boe->reset_gpio), in boe_bf060y8m_aj0_probe()
365 "Failed to get reset-gpios\n"); in boe_bf060y8m_aj0_probe()
367 boe->dsi = dsi; in boe_bf060y8m_aj0_probe()
368 mipi_dsi_set_drvdata(dsi, boe); in boe_bf060y8m_aj0_probe()
370 dsi->lanes = 4; in boe_bf060y8m_aj0_probe()
371 dsi->format = MIPI_DSI_FMT_RGB888; in boe_bf060y8m_aj0_probe()
372 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET | in boe_bf060y8m_aj0_probe()
377 drm_panel_init(&boe->panel, dev, &boe_bf060y8m_aj0_panel_funcs, in boe_bf060y8m_aj0_probe()
380 boe->panel.prepare_prev_first = true; in boe_bf060y8m_aj0_probe()
382 boe->panel.backlight = boe_bf060y8m_aj0_create_backlight(dsi); in boe_bf060y8m_aj0_probe()
383 if (IS_ERR(boe->panel.backlight)) in boe_bf060y8m_aj0_probe()
384 return dev_err_probe(dev, PTR_ERR(boe->panel.backlight), in boe_bf060y8m_aj0_probe()
387 drm_panel_add(&boe->panel); in boe_bf060y8m_aj0_probe()
389 ret = mipi_dsi_attach(dsi); in boe_bf060y8m_aj0_probe()
391 dev_err(dev, "Failed to attach to DSI host: %d\n", ret); in boe_bf060y8m_aj0_probe()
398 static void boe_bf060y8m_aj0_remove(struct mipi_dsi_device *dsi) in boe_bf060y8m_aj0_remove() argument
400 struct boe_bf060y8m_aj0 *boe = mipi_dsi_get_drvdata(dsi); in boe_bf060y8m_aj0_remove()
403 ret = mipi_dsi_detach(dsi); in boe_bf060y8m_aj0_remove()
405 dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); in boe_bf060y8m_aj0_remove()
407 drm_panel_remove(&boe->panel); in boe_bf060y8m_aj0_remove()
411 { .compatible = "boe,bf060y8m-aj0" },
420 .name = "panel-sw43404-boe-fhd-amoled",
427 MODULE_DESCRIPTION("BOE BF060Y8M-AJ0 MIPI-DSI OLED panel");