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
128 * struct nt35510_config - the display-specific NT35510 configuration
154 * +------------------------------------------->
180 * @bt1ctr: setting for boost power control for the AVDD step-up
183 * frequency for the step-up circuit:
193 * amplification for the 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 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 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 the step-up circuit.
255 * 1 = AVEE - AVDD
256 * 2 = AVEE + VCL - AVDD
257 * 3 = AVEE x 2 - AVDD
281 * and EQS3, setting the rise time for each equalizer step:
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
462 * @nt: the display instance to set up
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()
532 * nt35510_setup_display() - set up display config in page 0
533 * @nt: the display instance to set up
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()
542 /* FIXME: set up any rotation (assume none for now) */ in nt35510_setup_display()
584 conf->sdeqctr); in nt35510_setup_display()
589 &conf->sdvpctr, 1); 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()
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()
692 * according to datasheet, let's use 120-140 ms. in nt35510_power_on()
713 /* Set up stuff in manufacturer control, page 1 */ in nt35510_power_on()
726 nt->conf->gamma_corr_pos_r); in nt35510_power_on()
731 nt->conf->gamma_corr_pos_g); in nt35510_power_on()
736 nt->conf->gamma_corr_pos_b); in nt35510_power_on()
741 nt->conf->gamma_corr_neg_r); in nt35510_power_on()
746 nt->conf->gamma_corr_neg_g); in nt35510_power_on()
751 nt->conf->gamma_corr_neg_b); in nt35510_power_on()
755 /* Set up stuff in manufacturer control, page 0 */ in nt35510_power_on()
773 ret = regulator_bulk_disable(ARRAY_SIZE(nt->supplies), nt->supplies); in nt35510_power_off()
777 if (nt->reset_gpio) in nt35510_power_off()
778 gpiod_set_value(nt->reset_gpio, 1); in nt35510_power_off()
786 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_unprepare()
791 dev_err(nt->dev, "failed to turn display off (%d)\n", ret); in nt35510_unprepare()
799 dev_err(nt->dev, "failed to enter sleep mode (%d)\n", ret); in nt35510_unprepare()
816 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_prepare()
826 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret); in nt35510_prepare()
829 /* Up to 120 ms */ in nt35510_prepare()
834 dev_err(nt->dev, "failed to turn display on (%d)\n", ret); in nt35510_prepare()
850 info = &connector->display_info; in nt35510_get_modes()
851 info->width_mm = nt->conf->width_mm; in nt35510_get_modes()
852 info->height_mm = nt->conf->height_mm; in nt35510_get_modes()
853 mode = drm_mode_duplicate(connector->dev, &nt->conf->mode); in nt35510_get_modes()
855 dev_err(panel->dev, "bad mode or failed to add mode\n"); in nt35510_get_modes()
856 return -EINVAL; in nt35510_get_modes()
859 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in nt35510_get_modes()
861 mode->width_mm = nt->conf->width_mm; in nt35510_get_modes()
862 mode->height_mm = nt->conf->height_mm; in nt35510_get_modes()
876 struct device *dev = &dsi->dev; in nt35510_probe()
882 return -ENOMEM; in nt35510_probe()
884 nt->dev = dev; in nt35510_probe()
886 dsi->lanes = 2; in nt35510_probe()
887 dsi->format = MIPI_DSI_FMT_RGB888; in nt35510_probe()
893 * HVA40WV1 panel and setting up the LP frequency makes the panel in nt35510_probe()
897 * maybe make this a per-panel config in struct nt35510_config? in nt35510_probe()
899 dsi->hs_rate = 349440000; in nt35510_probe()
900 dsi->lp_rate = 9600000; in nt35510_probe()
901 dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS | in nt35510_probe()
908 nt->conf = of_device_get_match_data(dev); in nt35510_probe()
909 if (!nt->conf) { in nt35510_probe()
911 return -ENODEV; in nt35510_probe()
914 nt->supplies[0].supply = "vdd"; /* 2.3-4.8 V */ in nt35510_probe()
915 nt->supplies[1].supply = "vddi"; /* 1.65-3.3V */ in nt35510_probe()
916 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(nt->supplies), in nt35510_probe()
917 nt->supplies); in nt35510_probe()
920 ret = regulator_set_voltage(nt->supplies[0].consumer, in nt35510_probe()
924 ret = regulator_set_voltage(nt->supplies[1].consumer, in nt35510_probe()
929 nt->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS); in nt35510_probe()
930 if (IS_ERR(nt->reset_gpio)) { in nt35510_probe()
932 return PTR_ERR(nt->reset_gpio); in nt35510_probe()
935 drm_panel_init(&nt->panel, dev, &nt35510_drm_funcs, in nt35510_probe()
943 ret = drm_panel_of_backlight(&nt->panel); in nt35510_probe()
948 if (!nt->panel.backlight) { in nt35510_probe()
957 bl->props.max_brightness = 255; in nt35510_probe()
958 bl->props.brightness = 255; in nt35510_probe()
959 bl->props.power = FB_BLANK_POWERDOWN; in nt35510_probe()
960 nt->panel.backlight = bl; in nt35510_probe()
963 drm_panel_add(&nt->panel); in nt35510_probe()
967 drm_panel_remove(&nt->panel); in nt35510_probe()
980 drm_panel_remove(&nt->panel); in nt35510_remove()
989 * step on the curve. As can be seen these default curves goes from 0x0001
1039 /* 0x09: AVEE = -5.6V */
1041 /* 0x24: NCK = Hsync/2, BTN = -2 x VDDB */
1045 /* 0x24: NCKA = Hsync/2, VGH = 2 x AVDD - AVEE */
1047 /* 0x0B = -13V */
1049 /* 0x24: LCKA = Hsync, VGL = AVDD + VCL - AVDD */
1055 /* SDEQCTR: source driver EQ mode 2, 2.5 us rise time on each step */
1067 /* DPTMCTR12: 0x03: LVGL = VGLX, overlap mode, swap R->L O->E */
1091 .name = "panel-novatek-nt35510",
1098 MODULE_DESCRIPTION("NT35510-based panel driver");