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 */
833 static inline struct ili9881c *panel_to_ili9881c(struct drm_panel *panel) in panel_to_ili9881c() argument
835 return container_of(panel, struct ili9881c, panel); in panel_to_ili9881c()
839 * The panel seems to accept some private DCS commands that map
854 ret = mipi_dsi_dcs_write_buffer(ctx->dsi, buf, sizeof(buf)); in ili9881c_switch_page()
866 ret = mipi_dsi_dcs_write_buffer(ctx->dsi, buf, sizeof(buf)); in ili9881c_send_cmd_data()
873 static int ili9881c_prepare(struct drm_panel *panel) in ili9881c_prepare() argument
875 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_prepare()
879 /* Power the panel */ in ili9881c_prepare()
880 ret = regulator_enable(ctx->power); in ili9881c_prepare()
886 gpiod_set_value_cansleep(ctx->reset, 1); in ili9881c_prepare()
889 gpiod_set_value_cansleep(ctx->reset, 0); in ili9881c_prepare()
892 for (i = 0; i < ctx->desc->init_length; i++) { in ili9881c_prepare()
893 const struct ili9881c_instr *instr = &ctx->desc->init[i]; in ili9881c_prepare()
895 if (instr->op == ILI9881C_SWITCH_PAGE) in ili9881c_prepare()
896 ret = ili9881c_switch_page(ctx, instr->arg.page); in ili9881c_prepare()
897 else if (instr->op == ILI9881C_COMMAND) in ili9881c_prepare()
898 ret = ili9881c_send_cmd_data(ctx, instr->arg.cmd.cmd, in ili9881c_prepare()
899 instr->arg.cmd.data); in ili9881c_prepare()
909 ret = mipi_dsi_dcs_set_tear_on(ctx->dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK); in ili9881c_prepare()
913 ret = mipi_dsi_dcs_exit_sleep_mode(ctx->dsi); in ili9881c_prepare()
920 static int ili9881c_enable(struct drm_panel *panel) in ili9881c_enable() argument
922 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_enable()
926 mipi_dsi_dcs_set_display_on(ctx->dsi); in ili9881c_enable()
931 static int ili9881c_disable(struct drm_panel *panel) in ili9881c_disable() argument
933 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_disable()
935 return mipi_dsi_dcs_set_display_off(ctx->dsi); in ili9881c_disable()
938 static int ili9881c_unprepare(struct drm_panel *panel) in ili9881c_unprepare() argument
940 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_unprepare()
942 mipi_dsi_dcs_enter_sleep_mode(ctx->dsi); in ili9881c_unprepare()
943 regulator_disable(ctx->power); in ili9881c_unprepare()
944 gpiod_set_value_cansleep(ctx->reset, 1); in ili9881c_unprepare()
1017 static int ili9881c_get_modes(struct drm_panel *panel, in ili9881c_get_modes() argument
1020 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_get_modes()
1023 mode = drm_mode_duplicate(connector->dev, ctx->desc->mode); in ili9881c_get_modes()
1025 dev_err(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n", in ili9881c_get_modes()
1026 ctx->desc->mode->hdisplay, in ili9881c_get_modes()
1027 ctx->desc->mode->vdisplay, in ili9881c_get_modes()
1028 drm_mode_vrefresh(ctx->desc->mode)); in ili9881c_get_modes()
1029 return -ENOMEM; in ili9881c_get_modes()
1034 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in ili9881c_get_modes()
1037 connector->display_info.width_mm = mode->width_mm; in ili9881c_get_modes()
1038 connector->display_info.height_mm = mode->height_mm; in ili9881c_get_modes()
1044 drm_connector_set_panel_orientation(connector, ctx->orientation); in ili9881c_get_modes()
1049 static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel) in ili9881c_get_orientation() argument
1051 struct ili9881c *ctx = panel_to_ili9881c(panel); in ili9881c_get_orientation()
1053 return ctx->orientation; in ili9881c_get_orientation()
1070 ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); in ili9881c_dsi_probe()
1072 return -ENOMEM; in ili9881c_dsi_probe()
1074 ctx->dsi = dsi; in ili9881c_dsi_probe()
1075 ctx->desc = of_device_get_match_data(&dsi->dev); in ili9881c_dsi_probe()
1077 drm_panel_init(&ctx->panel, &dsi->dev, &ili9881c_funcs, in ili9881c_dsi_probe()
1080 ctx->power = devm_regulator_get(&dsi->dev, "power"); in ili9881c_dsi_probe()
1081 if (IS_ERR(ctx->power)) in ili9881c_dsi_probe()
1082 return dev_err_probe(&dsi->dev, PTR_ERR(ctx->power), in ili9881c_dsi_probe()
1085 ctx->reset = devm_gpiod_get_optional(&dsi->dev, "reset", GPIOD_OUT_LOW); in ili9881c_dsi_probe()
1086 if (IS_ERR(ctx->reset)) in ili9881c_dsi_probe()
1087 return dev_err_probe(&dsi->dev, PTR_ERR(ctx->reset), in ili9881c_dsi_probe()
1090 ret = of_drm_get_panel_orientation(dsi->dev.of_node, &ctx->orientation); in ili9881c_dsi_probe()
1092 dev_err(&dsi->dev, "%pOF: failed to get orientation: %d\n", in ili9881c_dsi_probe()
1093 dsi->dev.of_node, ret); in ili9881c_dsi_probe()
1097 ret = drm_panel_of_backlight(&ctx->panel); in ili9881c_dsi_probe()
1101 drm_panel_add(&ctx->panel); in ili9881c_dsi_probe()
1103 dsi->mode_flags = ctx->desc->mode_flags; in ili9881c_dsi_probe()
1104 dsi->format = MIPI_DSI_FMT_RGB888; in ili9881c_dsi_probe()
1105 dsi->lanes = 4; in ili9881c_dsi_probe()
1115 drm_panel_remove(&ctx->panel); in ili9881c_dsi_remove()
1150 { .compatible = "feixin,k101-im2byl02", .data = &k101_im2byl02_desc },
1161 .name = "ili9881c-dsi",
1167 MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");