Lines Matching +full:rate +full:- +full:idle +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
16 * per-panel, e.g. for physical size.
128 * struct nt35510_config - the display-specific NT35510 configuration
131 * A = normal / idle off mode
132 * B = idle on mode
133 * C = partial / idle off mode
154 * +------------------------------------------->
180 * @bt1ctr: setting for boost power control for the AVDD step-up
183 * frequency for the step-up circuit:
193 * amplification for the step-up circuit:
204 * @avee: setting for AVEE ranging from 0x00 = -6.5V to 0x14 = -4.5V
205 * in 0.1V steps the default is 0x05 which means -6.0V
209 * @bt2ctr: setting for boost power control for the AVEE step-up
214 * amplification for the step-up circuit.
216 * 1 = -1.5 x VDDB
217 * 2 = -2 x VDDB
218 * 3 = -2.5 x VDDB
219 * 4 = -3 x VDDB
229 * @bt4ctr: setting for boost power control for the VGH step-up
234 * amplification for the step-up circuit.
236 * 1 = AVDD - AVEE
237 * 2 = AVDD - AVEE + VDDB
238 * 3 = AVDD x 2 - AVEE
243 * @vgl: setting for VGL ranging from 0x00 = -2V to 0x0f = -15V in
244 * 1V steps, the default is 0x08 which means -10V
248 * @bt5ctr: setting for boost power control for the VGL step-up
253 * amplification for the step-up circuit.
255 * 1 = AVEE - AVDD
256 * 2 = AVEE + VCL - AVDD
257 * 3 = AVEE x 2 - AVDD
313 * Byte 1 bit 1 selects gate signal mode: 0 = non-overlap, 1 = overlap
315 * 1 = swap all O->E, L->R
349 * struct nt35510 - state container for the NT35510 panel
406 dev_err(nt->dev, "error sending DCS command seq cmd %02x\n", cmd); in nt35510_send_long()
413 chunk = cmdlen - cmdwritten; in nt35510_send_long()
418 dev_err(nt->dev, "error sending generic write seq %02x\n", cmd); in nt35510_send_long()
424 dev_dbg(nt->dev, "sent command %02x %02x bytes\n", cmd, cmdlen); in nt35510_send_long()
430 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_read_id()
436 dev_err(nt->dev, "could not read MTP ID1\n"); in nt35510_read_id()
441 dev_err(nt->dev, "could not read MTP ID2\n"); in nt35510_read_id()
446 dev_err(nt->dev, "could not read MTP ID3\n"); in nt35510_read_id()
451 * Multi-Time Programmable (?) memory contains manufacturer in nt35510_read_id()
455 dev_info(nt->dev, "MTP ID manufacturer: %02x version: %02x driver: %02x\n", id1, id2, id3); in nt35510_read_id()
461 * nt35510_setup_power() - set up power config in page 1
466 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_setup_power()
471 nt->conf->avdd); in nt35510_setup_power()
476 nt->conf->bt1ctr); in nt35510_setup_power()
481 nt->conf->avee); in nt35510_setup_power()
486 nt->conf->bt2ctr); in nt35510_setup_power()
491 nt->conf->vgh); in nt35510_setup_power()
496 nt->conf->bt4ctr); in nt35510_setup_power()
506 nt->conf->vgl); in nt35510_setup_power()
511 nt->conf->bt5ctr); in nt35510_setup_power()
516 nt->conf->vgp); in nt35510_setup_power()
521 nt->conf->vgn); in nt35510_setup_power()
525 /* Typically 10 ms */ in nt35510_setup_power()
532 * nt35510_setup_display() - set up display config in page 0
537 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_setup_display()
538 const struct nt35510_config *conf = nt->conf; in nt35510_setup_display()
584 conf->sdeqctr); in nt35510_setup_display()
589 &conf->sdvpctr, 1); in nt35510_setup_display()
594 * Display timing control for active and idle off mode: in nt35510_setup_display()
605 * PSEL for active and idle off mode, how much the 20MHz clock in nt35510_setup_display()
607 * frame rate. in nt35510_setup_display()
609 dpfrctr[0] = (conf->t1 >> 8) & 0xFF; in nt35510_setup_display()
610 dpfrctr[1] = conf->t1 & 0xFF; in nt35510_setup_display()
612 dpfrctr[2] = conf->vbp; in nt35510_setup_display()
614 dpfrctr[3] = conf->vfp; in nt35510_setup_display()
615 dpfrctr[4] = conf->psel; in nt35510_setup_display()
621 /* For idle and partial idle off mode we decrease front porch by one */ in nt35510_setup_display()
622 dpfrctr[3]--; in nt35510_setup_display()
642 conf->dpmctr12); in nt35510_setup_display()
652 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_set_brightness()
653 u8 brightness = bl->props.brightness; in nt35510_set_brightness()
656 dev_dbg(nt->dev, "set brightness %d\n", brightness); in nt35510_set_brightness()
671 * This power-on sequence
675 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_power_on()
678 ret = regulator_bulk_enable(ARRAY_SIZE(nt->supplies), nt->supplies); in nt35510_power_on()
680 dev_err(nt->dev, "unable to enable regulators\n"); in nt35510_power_on()
685 if (nt->reset_gpio) { in nt35510_power_on()
686 gpiod_set_value(nt->reset_gpio, 1); in nt35510_power_on()
689 gpiod_set_value(nt->reset_gpio, 0); in nt35510_power_on()
691 * 5 ms during sleep mode, 120 ms during sleep out mode in nt35510_power_on()
692 * according to datasheet, let's use 120-140 ms. in nt35510_power_on()
724 nt->conf->gamma_corr_pos_r); in nt35510_power_on()
729 nt->conf->gamma_corr_pos_g); in nt35510_power_on()
734 nt->conf->gamma_corr_pos_b); in nt35510_power_on()
739 nt->conf->gamma_corr_neg_r); in nt35510_power_on()
744 nt->conf->gamma_corr_neg_g); in nt35510_power_on()
749 nt->conf->gamma_corr_neg_b); in nt35510_power_on()
771 ret = regulator_bulk_disable(ARRAY_SIZE(nt->supplies), nt->supplies); in nt35510_power_off()
775 if (nt->reset_gpio) in nt35510_power_off()
776 gpiod_set_value(nt->reset_gpio, 1); in nt35510_power_off()
784 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_unprepare()
789 dev_err(nt->dev, "failed to turn display off (%d)\n", ret); in nt35510_unprepare()
797 dev_err(nt->dev, "failed to enter sleep mode (%d)\n", ret); in nt35510_unprepare()
801 /* Wait 4 frames, how much is that 5ms in the vendor driver */ in nt35510_unprepare()
814 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_prepare()
824 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret); in nt35510_prepare()
827 /* Up to 120 ms */ in nt35510_prepare()
832 dev_err(nt->dev, "failed to turn display on (%d)\n", ret); in nt35510_prepare()
835 /* Some 10 ms */ in nt35510_prepare()
848 info = &connector->display_info; in nt35510_get_modes()
849 info->width_mm = nt->conf->width_mm; in nt35510_get_modes()
850 info->height_mm = nt->conf->height_mm; in nt35510_get_modes()
851 mode = drm_mode_duplicate(connector->dev, &nt->conf->mode); in nt35510_get_modes()
853 dev_err(panel->dev, "bad mode or failed to add mode\n"); in nt35510_get_modes()
854 return -EINVAL; in nt35510_get_modes()
857 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in nt35510_get_modes()
859 mode->width_mm = nt->conf->width_mm; in nt35510_get_modes()
860 mode->height_mm = nt->conf->height_mm; in nt35510_get_modes()
874 struct device *dev = &dsi->dev; in nt35510_probe()
880 return -ENOMEM; in nt35510_probe()
882 nt->dev = dev; in nt35510_probe()
884 dsi->lanes = 2; in nt35510_probe()
885 dsi->format = MIPI_DSI_FMT_RGB888; in nt35510_probe()
887 * Datasheet suggests max HS rate for NT35510 is 250 MHz in nt35510_probe()
888 * (period time 4ns, see figure 7.6.4 page 365) and max LP rate is in nt35510_probe()
895 * maybe make this a per-panel config in struct nt35510_config? in nt35510_probe()
897 dsi->hs_rate = 349440000; in nt35510_probe()
898 dsi->lp_rate = 9600000; in nt35510_probe()
899 dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS; in nt35510_probe()
905 nt->conf = of_device_get_match_data(dev); in nt35510_probe()
906 if (!nt->conf) { in nt35510_probe()
908 return -ENODEV; in nt35510_probe()
911 nt->supplies[0].supply = "vdd"; /* 2.3-4.8 V */ in nt35510_probe()
912 nt->supplies[1].supply = "vddi"; /* 1.65-3.3V */ in nt35510_probe()
913 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(nt->supplies), in nt35510_probe()
914 nt->supplies); in nt35510_probe()
917 ret = regulator_set_voltage(nt->supplies[0].consumer, in nt35510_probe()
921 ret = regulator_set_voltage(nt->supplies[1].consumer, in nt35510_probe()
926 nt->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS); in nt35510_probe()
927 if (IS_ERR(nt->reset_gpio)) { in nt35510_probe()
929 return PTR_ERR(nt->reset_gpio); in nt35510_probe()
932 drm_panel_init(&nt->panel, dev, &nt35510_drm_funcs, in nt35510_probe()
940 ret = drm_panel_of_backlight(&nt->panel); in nt35510_probe()
945 if (!nt->panel.backlight) { in nt35510_probe()
954 bl->props.max_brightness = 255; in nt35510_probe()
955 bl->props.brightness = 255; in nt35510_probe()
956 bl->props.power = FB_BLANK_POWERDOWN; in nt35510_probe()
957 nt->panel.backlight = bl; in nt35510_probe()
960 drm_panel_add(&nt->panel); in nt35510_probe()
964 drm_panel_remove(&nt->panel); in nt35510_probe()
978 dev_err(&dsi->dev, "Failed to power off\n"); in nt35510_remove()
980 drm_panel_remove(&nt->panel); in nt35510_remove()
1017 * Display frame rate control:
1018 * Frame rate = (20 MHz / 1) / (389 * (7 + 50 + 800)) ~= 60 Hz
1037 /* 0x09: AVEE = -5.6V */
1039 /* 0x24: NCK = Hsync/2, BTN = -2 x VDDB */
1043 /* 0x24: NCKA = Hsync/2, VGH = 2 x AVDD - AVEE */
1045 /* 0x0B = -13V */
1047 /* 0x24: LCKA = Hsync, VGL = AVDD + VCL - AVDD */
1065 /* DPTMCTR12: 0x03: LVGL = VGLX, overlap mode, swap R->L O->E */
1089 .name = "panel-novatek-nt35510",
1096 MODULE_DESCRIPTION("NT35510-based panel driver");