Lines Matching +full:op +full:- +full:panel
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2017-2018, Bootlin
29 enum ili9881c_op op; member
48 struct drm_panel panel; member
60 .op = ILI9881C_SWITCH_PAGE, \
68 .op = ILI9881C_COMMAND, \
398 ILI9881C_COMMAND_INSTR(0x6F, 0x33), /* pumping ratio VGH=5x VGL=-3x */
399 ILI9881C_COMMAND_INSTR(0x8D, 0x1B), /* VGL clamp -10V */
1226 static inline struct ili9881c *panel_to_ili9881c(struct drm_panel *panel) in panel_to_ili9881c() argument
1228 return container_of(panel, struct ili9881c, panel); in panel_to_ili9881c()
1232 * The panel seems to accept some private DCS commands that map
1247 ret = mipi_dsi_dcs_write_buffer(ctx->dsi, buf, sizeof(buf)); in ili9881c_switch_page()
1259 ret = mipi_dsi_dcs_write_buffer(ctx->dsi, buf, sizeof(buf)); in ili9881c_send_cmd_data()
1266 static int ili9881c_prepare(struct drm_panel *panel) in ili9881c_prepare() argument
1268 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_prepare()
1272 /* Power the panel */ in ili9881c_prepare()
1273 ret = regulator_enable(ctx->power); in ili9881c_prepare()
1279 gpiod_set_value_cansleep(ctx->reset, 1); in ili9881c_prepare()
1282 gpiod_set_value_cansleep(ctx->reset, 0); in ili9881c_prepare()
1285 for (i = 0; i < ctx->desc->init_length; i++) { in ili9881c_prepare()
1286 const struct ili9881c_instr *instr = &ctx->desc->init[i]; in ili9881c_prepare()
1288 if (instr->op == ILI9881C_SWITCH_PAGE) in ili9881c_prepare()
1289 ret = ili9881c_switch_page(ctx, instr->arg.page); in ili9881c_prepare()
1290 else if (instr->op == ILI9881C_COMMAND) in ili9881c_prepare()
1291 ret = ili9881c_send_cmd_data(ctx, instr->arg.cmd.cmd, in ili9881c_prepare()
1292 instr->arg.cmd.data); in ili9881c_prepare()
1302 ret = mipi_dsi_dcs_set_tear_on(ctx->dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); in ili9881c_prepare()
1306 ret = mipi_dsi_dcs_exit_sleep_mode(ctx->dsi); in ili9881c_prepare()
1313 static int ili9881c_enable(struct drm_panel *panel) in ili9881c_enable() argument
1315 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_enable()
1319 mipi_dsi_dcs_set_display_on(ctx->dsi); in ili9881c_enable()
1324 static int ili9881c_disable(struct drm_panel *panel) in ili9881c_disable() argument
1326 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_disable()
1328 return mipi_dsi_dcs_set_display_off(ctx->dsi); in ili9881c_disable()
1331 static int ili9881c_unprepare(struct drm_panel *panel) in ili9881c_unprepare() argument
1333 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_unprepare()
1335 mipi_dsi_dcs_enter_sleep_mode(ctx->dsi); in ili9881c_unprepare()
1336 regulator_disable(ctx->power); in ili9881c_unprepare()
1337 gpiod_set_value_cansleep(ctx->reset, 1); in ili9881c_unprepare()
1444 static int ili9881c_get_modes(struct drm_panel *panel, in ili9881c_get_modes() argument
1447 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_get_modes()
1450 mode = drm_mode_duplicate(connector->dev, ctx->desc->mode); in ili9881c_get_modes()
1452 dev_err(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n", in ili9881c_get_modes()
1453 ctx->desc->mode->hdisplay, in ili9881c_get_modes()
1454 ctx->desc->mode->vdisplay, in ili9881c_get_modes()
1455 drm_mode_vrefresh(ctx->desc->mode)); in ili9881c_get_modes()
1456 return -ENOMEM; in ili9881c_get_modes()
1461 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in ili9881c_get_modes()
1464 connector->display_info.width_mm = mode->width_mm; in ili9881c_get_modes()
1465 connector->display_info.height_mm = mode->height_mm; in ili9881c_get_modes()
1471 drm_connector_set_panel_orientation(connector, ctx->orientation); in ili9881c_get_modes()
1476 static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel) in ili9881c_get_orientation() argument
1478 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_get_orientation()
1480 return ctx->orientation; in ili9881c_get_orientation()
1497 ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); in ili9881c_dsi_probe()
1499 return -ENOMEM; in ili9881c_dsi_probe()
1501 ctx->dsi = dsi; in ili9881c_dsi_probe()
1502 ctx->desc = of_device_get_match_data(&dsi->dev); in ili9881c_dsi_probe()
1504 drm_panel_init(&ctx->panel, &dsi->dev, &ili9881c_funcs, in ili9881c_dsi_probe()
1507 ctx->power = devm_regulator_get(&dsi->dev, "power"); in ili9881c_dsi_probe()
1508 if (IS_ERR(ctx->power)) in ili9881c_dsi_probe()
1509 return dev_err_probe(&dsi->dev, PTR_ERR(ctx->power), in ili9881c_dsi_probe()
1512 ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW); in ili9881c_dsi_probe()
1513 if (IS_ERR(ctx->reset)) in ili9881c_dsi_probe()
1514 return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset), in ili9881c_dsi_probe()
1517 ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation); in ili9881c_dsi_probe()
1519 dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n", in ili9881c_dsi_probe()
1520 dsi->dev.of_node, ret); in ili9881c_dsi_probe()
1524 ctx->panel.prepare_prev_first = true; in ili9881c_dsi_probe()
1526 ret = drm_panel_of_backlight(&ctx->panel); in ili9881c_dsi_probe()
1530 drm_panel_add(&ctx->panel); in ili9881c_dsi_probe()
1532 dsi->mode_flags = ctx->desc->mode_flags; in ili9881c_dsi_probe()
1533 dsi->format = MIPI_DSI_FMT_RGB888; in ili9881c_dsi_probe()
1534 dsi->lanes = 4; in ili9881c_dsi_probe()
1544 drm_panel_remove(&ctx->panel); in ili9881c_dsi_remove()
1595 { .compatible = "feixin,k101-im2byl02", .data = &k101_im2byl02_desc },
1608 .name = "ili9881c-dsi",
1614 MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");