Lines Matching +full:step +full:- +full:up
1 // SPDX-License-Identifier: GPL-2.0-only
14 * the code needed to set up and configure the panel will be similar,
16 * per-panel, e.g. for physical size.
21 * I2C or SPI interface for setting up the NT35510. If this is needed
146 * struct nt35510_config - the display-specific NT35510 configuration
172 * +------------------------------------------->
206 * @bt1ctr: setting for boost power control for the AVDD step-up
209 * frequency for the step-up circuit:
219 * amplification for the step-up circuit:
230 * @avee: setting for AVEE ranging from 0x00 = -6.5V to 0x14 = -4.5V
231 * in 0.1V steps the default is 0x05 which means -6.0V
235 * @bt2ctr: setting for boost power control for the AVEE step-up
240 * amplification for the step-up circuit.
242 * 1 = -1.5 x VDDB
243 * 2 = -2 x VDDB
244 * 3 = -2.5 x VDDB
245 * 4 = -3 x VDDB
250 * @vcl: setting for VCL ranging from 0x00 = -2.5V to 0x11 = -4.0V
251 * in 1V steps, the default is 0x00 which means -2.5V
255 * @bt3ctr: setting for boost power control for the VCL step-up
260 * amplification for the step-up circuit.
262 * 1 = -0.5 x VDDB
263 * 2 = -1 x VDDB
264 * 3 = -2 x VDDB
274 * @bt4ctr: setting for boost power control for the VGH step-up
279 * amplification for the step-up circuit.
281 * 1 = AVDD - AVEE
282 * 2 = AVDD - AVEE + VDDB
283 * 3 = AVDD x 2 - AVEE
288 * @vgl: setting for VGL ranging from 0x00 = -2V to 0x0f = -15V in
289 * 1V steps, the default is 0x08 which means -10V
293 * @bt5ctr: setting for boost power control for the VGL step-up
298 * amplification for the step-up circuit.
300 * 1 = AVEE - AVDD
301 * 2 = AVEE + VCL - AVDD
302 * 3 = AVEE x 2 - AVDD
330 * VCM 0x00 = 0V/0 .. 0x118 = 3.5V/280 in steps of 12.5mV/1step
342 * N565 bit 2 in the first byte is the 16-bit/pixel format selection.
363 * sleep-in mode
364 * 0 = contents loss in sleep-in
365 * 1 = contents keep in sleep-in
370 * 0 (RMSX = 0) = S1 -> S1440
371 * 0 (RMSX = 1) = S1440 -> S1
372 * 1 (RMSX = 0) = S1440 -> S1
373 * 1 (RMSX = 1) = S1 -> S1440
378 * 0 (ML = 0) = Forward (top -> bottom)
379 * 0 (ML = 1) = Reverse (bottom -> top)
380 * 1 (ML = 0) = Reverse (bottom -> top)
381 * 1 (ML = 1) = Forward (top -> bottom)
383 * CRGB bit 3 in the second byte is RGB-BGR order selection. This
403 * RGB bit 3 is the RGB-BGR order.
420 * GFEQ_XX[3:0]: time setting of EQ step for falling edge in steps
423 * GREQ_XX[7:4]: time setting of EQ step for rising edge in steps
433 * and EQS3, setting the rise time for each equalizer step:
465 * Byte 1 bit 1 selects gate signal mode: 0 = non-overlap, 1 = overlap
467 * 1 = swap all O->E, L->R
520 * 1: User Interface Image (UI-Mode)
521 * 2: Still Picture Image (Still-Mode)
522 * 3: Moving Picture Image (Moving-Mode)
538 * struct nt35510 - state container for the NT35510 panel
595 dev_err(nt->dev, "error sending DCS command seq cmd %02x\n", cmd); in nt35510_send_long()
602 chunk = cmdlen - cmdwritten; in nt35510_send_long()
607 dev_err(nt->dev, "error sending generic write seq %02x\n", cmd); in nt35510_send_long()
613 dev_dbg(nt->dev, "sent command %02x %02x bytes\n", cmd, cmdlen); in nt35510_send_long()
619 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_read_id()
625 dev_err(nt->dev, "could not read MTP ID1\n"); in nt35510_read_id()
630 dev_err(nt->dev, "could not read MTP ID2\n"); in nt35510_read_id()
635 dev_err(nt->dev, "could not read MTP ID3\n"); in nt35510_read_id()
640 * Multi-Time Programmable (?) memory contains manufacturer in nt35510_read_id()
644 dev_info(nt->dev, "MTP ID manufacturer: %02x version: %02x driver: %02x\n", id1, id2, id3); in nt35510_read_id()
650 * nt35510_setup_power() - set up power config in page 1
651 * @nt: the display instance to set up
655 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_setup_power()
660 nt->conf->avdd); in nt35510_setup_power()
665 nt->conf->bt1ctr); in nt35510_setup_power()
670 nt->conf->avee); in nt35510_setup_power()
675 nt->conf->bt2ctr); in nt35510_setup_power()
680 nt->conf->vcl); in nt35510_setup_power()
685 nt->conf->bt3ctr); in nt35510_setup_power()
690 nt->conf->vgh); in nt35510_setup_power()
695 nt->conf->bt4ctr); in nt35510_setup_power()
705 nt->conf->vgl); in nt35510_setup_power()
710 nt->conf->bt5ctr); in nt35510_setup_power()
715 nt->conf->vgp); in nt35510_setup_power()
720 nt->conf->vgn); in nt35510_setup_power()
726 nt->conf->vcmoff); in nt35510_setup_power()
737 * nt35510_setup_display() - set up display config in page 0
738 * @nt: the display instance to set up
742 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_setup_display()
743 const struct nt35510_config *conf = nt->conf; in nt35510_setup_display()
749 conf->dopctr); in nt35510_setup_display()
753 ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_ADDRESS_MODE, &conf->madctl, in nt35510_setup_display()
754 sizeof(conf->madctl)); in nt35510_setup_display()
758 ret = mipi_dsi_dcs_write(dsi, NT35510_P0_SDHDTCTR, &conf->sdhdtctr, in nt35510_setup_display()
759 sizeof(conf->sdhdtctr)); in nt35510_setup_display()
765 conf->gseqctr); in nt35510_setup_display()
771 conf->sdeqctr); in nt35510_setup_display()
776 &conf->sdvpctr, 1); in nt35510_setup_display()
796 dpfrctr[0] = (conf->t1 >> 8) & 0xFF; in nt35510_setup_display()
797 dpfrctr[1] = conf->t1 & 0xFF; in nt35510_setup_display()
799 dpfrctr[2] = conf->vbp; in nt35510_setup_display()
801 dpfrctr[3] = conf->vfp; in nt35510_setup_display()
802 dpfrctr[4] = conf->psel; in nt35510_setup_display()
809 dpfrctr[3]--; in nt35510_setup_display()
829 conf->dpmctr12); in nt35510_setup_display()
839 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_set_brightness()
840 u8 brightness = bl->props.brightness; in nt35510_set_brightness()
843 dev_dbg(nt->dev, "set brightness %d\n", brightness); in nt35510_set_brightness()
858 * This power-on sequence
862 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_power_on()
865 ret = regulator_bulk_enable(ARRAY_SIZE(nt->supplies), nt->supplies); in nt35510_power_on()
867 dev_err(nt->dev, "unable to enable regulators\n"); in nt35510_power_on()
872 if (nt->reset_gpio) { in nt35510_power_on()
873 gpiod_set_value(nt->reset_gpio, 1); in nt35510_power_on()
876 gpiod_set_value(nt->reset_gpio, 0); in nt35510_power_on()
879 * according to datasheet, let's use 120-140 ms. in nt35510_power_on()
898 /* Set up stuff in manufacturer control, page 1 */ in nt35510_power_on()
909 if (nt->conf->cmds & NT35510_CMD_CORRECT_GAMMA) { in nt35510_power_on()
912 nt->conf->gamma_corr_pos_r); in nt35510_power_on()
917 nt->conf->gamma_corr_pos_g); in nt35510_power_on()
922 nt->conf->gamma_corr_pos_b); in nt35510_power_on()
927 nt->conf->gamma_corr_neg_r); in nt35510_power_on()
932 nt->conf->gamma_corr_neg_g); in nt35510_power_on()
937 nt->conf->gamma_corr_neg_b); in nt35510_power_on()
942 /* Set up stuff in manufacturer control, page 0 */ in nt35510_power_on()
960 ret = regulator_bulk_disable(ARRAY_SIZE(nt->supplies), nt->supplies); in nt35510_power_off()
964 if (nt->reset_gpio) in nt35510_power_off()
965 gpiod_set_value(nt->reset_gpio, 1); in nt35510_power_off()
973 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_unprepare()
978 dev_err(nt->dev, "failed to turn display off (%d)\n", ret); in nt35510_unprepare()
986 dev_err(nt->dev, "failed to enter sleep mode (%d)\n", ret); in nt35510_unprepare()
1003 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_prepare()
1013 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret); in nt35510_prepare()
1016 /* Up to 120 ms */ in nt35510_prepare()
1019 if (nt->conf->cmds & NT35510_CMD_CONTROL_DISPLAY) { in nt35510_prepare()
1021 &nt->conf->wrctrld, in nt35510_prepare()
1022 sizeof(nt->conf->wrctrld)); in nt35510_prepare()
1027 &nt->conf->wrcabc, in nt35510_prepare()
1028 sizeof(nt->conf->wrcabc)); in nt35510_prepare()
1033 &nt->conf->wrcabcmb, in nt35510_prepare()
1034 sizeof(nt->conf->wrcabcmb)); in nt35510_prepare()
1041 dev_err(nt->dev, "failed to turn display on (%d)\n", ret); in nt35510_prepare()
1057 info = &connector->display_info; in nt35510_get_modes()
1058 info->width_mm = nt->conf->width_mm; in nt35510_get_modes()
1059 info->height_mm = nt->conf->height_mm; in nt35510_get_modes()
1060 mode = drm_mode_duplicate(connector->dev, &nt->conf->mode); in nt35510_get_modes()
1062 dev_err(panel->dev, "bad mode or failed to add mode\n"); in nt35510_get_modes()
1063 return -EINVAL; in nt35510_get_modes()
1066 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in nt35510_get_modes()
1068 mode->width_mm = nt->conf->width_mm; in nt35510_get_modes()
1069 mode->height_mm = nt->conf->height_mm; in nt35510_get_modes()
1083 struct device *dev = &dsi->dev; in nt35510_probe()
1089 return -ENOMEM; in nt35510_probe()
1091 nt->dev = dev; in nt35510_probe()
1093 dsi->lanes = 2; in nt35510_probe()
1094 dsi->format = MIPI_DSI_FMT_RGB888; in nt35510_probe()
1100 * HVA40WV1 panel and setting up the LP frequency makes the panel in nt35510_probe()
1104 * maybe make this a per-panel config in struct nt35510_config? in nt35510_probe()
1106 dsi->hs_rate = 349440000; in nt35510_probe()
1107 dsi->lp_rate = 9600000; in nt35510_probe()
1113 nt->conf = of_device_get_match_data(dev); in nt35510_probe()
1114 if (!nt->conf) { in nt35510_probe()
1116 return -ENODEV; in nt35510_probe()
1119 dsi->mode_flags = nt->conf->mode_flags; in nt35510_probe()
1121 nt->supplies[0].supply = "vdd"; /* 2.3-4.8 V */ in nt35510_probe()
1122 nt->supplies[1].supply = "vddi"; /* 1.65-3.3V */ in nt35510_probe()
1123 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(nt->supplies), in nt35510_probe()
1124 nt->supplies); in nt35510_probe()
1127 ret = regulator_set_voltage(nt->supplies[0].consumer, in nt35510_probe()
1131 ret = regulator_set_voltage(nt->supplies[1].consumer, in nt35510_probe()
1136 nt->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); in nt35510_probe()
1137 if (IS_ERR(nt->reset_gpio)) { in nt35510_probe()
1139 return PTR_ERR(nt->reset_gpio); in nt35510_probe()
1142 drm_panel_init(&nt->panel, dev, &nt35510_drm_funcs, in nt35510_probe()
1150 ret = drm_panel_of_backlight(&nt->panel); in nt35510_probe()
1155 if (!nt->panel.backlight) { in nt35510_probe()
1164 bl->props.max_brightness = 255; in nt35510_probe()
1165 if (nt->conf->cmds & NT35510_CMD_CONTROL_DISPLAY) in nt35510_probe()
1166 bl->props.brightness = nt->conf->wrdisbv; in nt35510_probe()
1168 bl->props.brightness = 255; in nt35510_probe()
1169 bl->props.power = BACKLIGHT_POWER_OFF; in nt35510_probe()
1170 nt->panel.backlight = bl; in nt35510_probe()
1173 drm_panel_add(&nt->panel); in nt35510_probe()
1177 drm_panel_remove(&nt->panel); in nt35510_probe()
1191 dev_err(&dsi->dev, "Failed to power off\n"); in nt35510_remove()
1193 drm_panel_remove(&nt->panel); in nt35510_remove()
1200 * step on the curve. As can be seen these default curves goes from 0x0001
1252 /* 0x09: AVEE = -5.6V */
1254 /* 0x24: NCK = Hsync/2, BTN = -2 x VDDB */
1256 /* VBCLA: -2.5V, VBCLB: -2.5V, VBCLC: -2.5V */
1258 /* 0x24: CLCK = Hsync/2, BTN = -1 x VDDB */
1262 /* 0x24: NCKA = Hsync/2, VGH = 2 x AVDD - AVEE */
1264 /* 0x0B = -13V */
1266 /* 0x24: LCKA = Hsync, VGL = AVDD + VCL - AVDD */
1282 /* SDEQCTR: source driver EQ mode 2, 2.5 us rise time on each step */
1294 /* DPTMCTR12: 0x03: LVGL = VGLX, overlap mode, swap R->L O->E */
1327 /* 0x03: AVEE = -6.2V */
1331 /* VBCLA: -2.5V, VBCLB: -2.5V, VBCLC: -3.5V */
1333 /* 0x26: CLCK = 2 x Hsync, BTN = -1 x VDDB */
1337 /* 0x36: HCK = 2 x Hsync, VGH = 2 x AVDD - AVEE */
1339 /* 0x08 = -10V */
1341 /* 0x26: LCK = 2 x Hsync, VGL = AVDD + VCL - AVDD */
1347 /* VCMOFFSEL = VCOM voltage offset mode, VCM = -1V */
1357 /* SDEQCTR: source driver EQ mode 2, 1 us rise time on each step */
1369 /* DPTMCTR12: 0x03: LVGL = VGLX, overlap mode, swap R->L O->E */
1399 .name = "panel-novatek-nt35510",
1406 MODULE_DESCRIPTION("NT35510-based panel driver");