Lines Matching +full:rate +full:- +full:lp +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
16 * per-panel, e.g. for physical size.
147 * struct nt35510_config - the display-specific NT35510 configuration
173 * +------------------------------------------->
207 * @bt1ctr: setting for boost power control for the AVDD step-up
210 * frequency for the step-up circuit:
220 * amplification for the step-up circuit:
231 * @avee: setting for AVEE ranging from 0x00 = -6.5V to 0x14 = -4.5V
232 * in 0.1V steps the default is 0x05 which means -6.0V
236 * @bt2ctr: setting for boost power control for the AVEE step-up
241 * amplification for the step-up circuit.
243 * 1 = -1.5 x VDDB
244 * 2 = -2 x VDDB
245 * 3 = -2.5 x VDDB
246 * 4 = -3 x VDDB
251 * @vcl: setting for VCL ranging from 0x00 = -2.5V to 0x11 = -4.0V
252 * in 1V steps, the default is 0x00 which means -2.5V
256 * @bt3ctr: setting for boost power control for the VCL step-up
261 * amplification for the step-up circuit.
263 * 1 = -0.5 x VDDB
264 * 2 = -1 x VDDB
265 * 3 = -2 x VDDB
275 * @bt4ctr: setting for boost power control for the VGH step-up
280 * amplification for the step-up circuit.
282 * 1 = AVDD - AVEE
283 * 2 = AVDD - AVEE + VDDB
284 * 3 = AVDD x 2 - AVEE
289 * @vgl: setting for VGL ranging from 0x00 = -2V to 0x0f = -15V in
290 * 1V steps, the default is 0x08 which means -10V
294 * @bt5ctr: setting for boost power control for the VGL step-up
299 * amplification for the step-up circuit.
301 * 1 = AVEE - AVDD
302 * 2 = AVEE + VCL - AVDD
303 * 3 = AVEE x 2 - AVDD
343 * N565 bit 2 in the first byte is the 16-bit/pixel format selection.
364 * sleep-in mode
365 * 0 = contents loss in sleep-in
366 * 1 = contents keep in sleep-in
371 * 0 (RMSX = 0) = S1 -> S1440
372 * 0 (RMSX = 1) = S1440 -> S1
373 * 1 (RMSX = 0) = S1440 -> S1
374 * 1 (RMSX = 1) = S1 -> S1440
379 * 0 (ML = 0) = Forward (top -> bottom)
380 * 0 (ML = 1) = Reverse (bottom -> top)
381 * 1 (ML = 0) = Reverse (bottom -> top)
382 * 1 (ML = 1) = Forward (top -> bottom)
384 * CRGB bit 3 in the second byte is RGB-BGR order selection. This
404 * RGB bit 3 is the RGB-BGR order.
466 * Byte 1 bit 1 selects gate signal mode: 0 = non-overlap, 1 = overlap
468 * 1 = swap all O->E, L->R
521 * 1: User Interface Image (UI-Mode)
522 * 2: Still Picture Image (Still-Mode)
523 * 3: Moving Picture Image (Moving-Mode)
539 * struct nt35510 - state container for the NT35510 panel
596 dev_err(nt->dev, "error sending DCS command seq cmd %02x\n", cmd); in nt35510_send_long()
603 chunk = cmdlen - cmdwritten; in nt35510_send_long()
608 dev_err(nt->dev, "error sending generic write seq %02x\n", cmd); in nt35510_send_long()
614 dev_dbg(nt->dev, "sent command %02x %02x bytes\n", cmd, cmdlen); in nt35510_send_long()
620 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_read_id()
626 dev_err(nt->dev, "could not read MTP ID1\n"); in nt35510_read_id()
631 dev_err(nt->dev, "could not read MTP ID2\n"); in nt35510_read_id()
636 dev_err(nt->dev, "could not read MTP ID3\n"); in nt35510_read_id()
641 * Multi-Time Programmable (?) memory contains manufacturer in nt35510_read_id()
645 dev_info(nt->dev, "MTP ID manufacturer: %02x version: %02x driver: %02x\n", id1, id2, id3); in nt35510_read_id()
651 * nt35510_setup_power() - set up power config in page 1
656 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_setup_power()
661 nt->conf->avdd); in nt35510_setup_power()
666 nt->conf->bt1ctr); in nt35510_setup_power()
671 nt->conf->avee); in nt35510_setup_power()
676 nt->conf->bt2ctr); in nt35510_setup_power()
681 nt->conf->vcl); in nt35510_setup_power()
686 nt->conf->bt3ctr); in nt35510_setup_power()
691 nt->conf->vgh); in nt35510_setup_power()
696 nt->conf->bt4ctr); in nt35510_setup_power()
706 nt->conf->vgl); in nt35510_setup_power()
711 nt->conf->bt5ctr); in nt35510_setup_power()
716 nt->conf->vgp); in nt35510_setup_power()
721 nt->conf->vgn); in nt35510_setup_power()
725 if (nt->conf->cmds & NT35510_CMD_SETVCMOFF) { in nt35510_setup_power()
728 nt->conf->vcmoff); in nt35510_setup_power()
733 /* Typically 10 ms */ in nt35510_setup_power()
740 * nt35510_setup_display() - set up display config in page 0
745 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_setup_display()
746 const struct nt35510_config *conf = nt->conf; in nt35510_setup_display()
752 conf->dopctr); in nt35510_setup_display()
756 ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_ADDRESS_MODE, &conf->madctl, in nt35510_setup_display()
757 sizeof(conf->madctl)); in nt35510_setup_display()
761 ret = mipi_dsi_dcs_write(dsi, NT35510_P0_SDHDTCTR, &conf->sdhdtctr, in nt35510_setup_display()
762 sizeof(conf->sdhdtctr)); in nt35510_setup_display()
768 conf->gseqctr); in nt35510_setup_display()
774 conf->sdeqctr); in nt35510_setup_display()
779 &conf->sdvpctr, 1); in nt35510_setup_display()
797 * frame rate. in nt35510_setup_display()
799 dpfrctr[0] = (conf->t1 >> 8) & 0xFF; in nt35510_setup_display()
800 dpfrctr[1] = conf->t1 & 0xFF; in nt35510_setup_display()
802 dpfrctr[2] = conf->vbp; in nt35510_setup_display()
804 dpfrctr[3] = conf->vfp; in nt35510_setup_display()
805 dpfrctr[4] = conf->psel; in nt35510_setup_display()
812 dpfrctr[3]--; in nt35510_setup_display()
832 conf->dpmctr12); in nt35510_setup_display()
842 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_set_brightness()
843 u8 brightness = bl->props.brightness; in nt35510_set_brightness()
846 dev_dbg(nt->dev, "set brightness %d\n", brightness); in nt35510_set_brightness()
861 * This power-on sequence
865 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_power_on()
868 ret = regulator_bulk_enable(ARRAY_SIZE(nt->supplies), nt->supplies); in nt35510_power_on()
870 dev_err(nt->dev, "unable to enable regulators\n"); in nt35510_power_on()
875 if (nt->reset_gpio) { in nt35510_power_on()
876 gpiod_set_value(nt->reset_gpio, 1); in nt35510_power_on()
879 gpiod_set_value(nt->reset_gpio, 0); in nt35510_power_on()
881 * 5 ms during sleep mode, 120 ms during sleep out mode in nt35510_power_on()
882 * according to datasheet, let's use 120-140 ms. in nt35510_power_on()
912 if (nt->conf->cmds & NT35510_CMD_CORRECT_GAMMA) { in nt35510_power_on()
915 nt->conf->gamma_corr_pos_r); in nt35510_power_on()
920 nt->conf->gamma_corr_pos_g); in nt35510_power_on()
925 nt->conf->gamma_corr_pos_b); in nt35510_power_on()
930 nt->conf->gamma_corr_neg_r); in nt35510_power_on()
935 nt->conf->gamma_corr_neg_g); in nt35510_power_on()
940 nt->conf->gamma_corr_neg_b); in nt35510_power_on()
963 ret = regulator_bulk_disable(ARRAY_SIZE(nt->supplies), nt->supplies); in nt35510_power_off()
967 if (nt->reset_gpio) in nt35510_power_off()
968 gpiod_set_value(nt->reset_gpio, 1); in nt35510_power_off()
976 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_unprepare()
981 dev_err(nt->dev, "failed to turn display off (%d)\n", ret); in nt35510_unprepare()
989 dev_err(nt->dev, "failed to enter sleep mode (%d)\n", ret); in nt35510_unprepare()
993 /* Wait 4 frames, how much is that 5ms in the vendor driver */ in nt35510_unprepare()
1006 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_prepare()
1016 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret); in nt35510_prepare()
1019 /* Up to 120 ms */ in nt35510_prepare()
1022 if (nt->conf->cmds & NT35510_CMD_CONTROL_DISPLAY) { in nt35510_prepare()
1024 &nt->conf->wrctrld, in nt35510_prepare()
1025 sizeof(nt->conf->wrctrld)); in nt35510_prepare()
1030 &nt->conf->wrcabc, in nt35510_prepare()
1031 sizeof(nt->conf->wrcabc)); in nt35510_prepare()
1036 &nt->conf->wrcabcmb, in nt35510_prepare()
1037 sizeof(nt->conf->wrcabcmb)); in nt35510_prepare()
1044 dev_err(nt->dev, "failed to turn display on (%d)\n", ret); in nt35510_prepare()
1047 /* Some 10 ms */ in nt35510_prepare()
1060 info = &connector->display_info; in nt35510_get_modes()
1061 info->width_mm = nt->conf->width_mm; in nt35510_get_modes()
1062 info->height_mm = nt->conf->height_mm; in nt35510_get_modes()
1063 mode = drm_mode_duplicate(connector->dev, &nt->conf->mode); in nt35510_get_modes()
1065 dev_err(panel->dev, "bad mode or failed to add mode\n"); in nt35510_get_modes()
1066 return -EINVAL; in nt35510_get_modes()
1069 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in nt35510_get_modes()
1071 mode->width_mm = nt->conf->width_mm; in nt35510_get_modes()
1072 mode->height_mm = nt->conf->height_mm; in nt35510_get_modes()
1086 struct device *dev = &dsi->dev; in nt35510_probe()
1092 return -ENOMEM; in nt35510_probe()
1094 nt->dev = dev; in nt35510_probe()
1096 dsi->lanes = 2; in nt35510_probe()
1097 dsi->format = MIPI_DSI_FMT_RGB888; in nt35510_probe()
1099 * Datasheet suggests max HS rate for NT35510 is 250 MHz in nt35510_probe()
1100 * (period time 4ns, see figure 7.6.4 page 365) and max LP rate is in nt35510_probe()
1103 * HVA40WV1 panel and setting up the LP frequency makes the panel in nt35510_probe()
1107 * maybe make this a per-panel config in struct nt35510_config? in nt35510_probe()
1109 dsi->hs_rate = 349440000; in nt35510_probe()
1110 dsi->lp_rate = 9600000; in nt35510_probe()
1116 nt->conf = of_device_get_match_data(dev); in nt35510_probe()
1117 if (!nt->conf) { in nt35510_probe()
1119 return -ENODEV; in nt35510_probe()
1122 dsi->mode_flags = nt->conf->mode_flags; in nt35510_probe()
1124 nt->supplies[0].supply = "vdd"; /* 2.3-4.8 V */ in nt35510_probe()
1125 nt->supplies[1].supply = "vddi"; /* 1.65-3.3V */ in nt35510_probe()
1126 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(nt->supplies), in nt35510_probe()
1127 nt->supplies); in nt35510_probe()
1130 ret = regulator_set_voltage(nt->supplies[0].consumer, in nt35510_probe()
1134 ret = regulator_set_voltage(nt->supplies[1].consumer, in nt35510_probe()
1139 nt->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); in nt35510_probe()
1140 if (IS_ERR(nt->reset_gpio)) { in nt35510_probe()
1142 return PTR_ERR(nt->reset_gpio); in nt35510_probe()
1145 drm_panel_init(&nt->panel, dev, &nt35510_drm_funcs, in nt35510_probe()
1153 ret = drm_panel_of_backlight(&nt->panel); in nt35510_probe()
1158 if (!nt->panel.backlight) { in nt35510_probe()
1167 bl->props.max_brightness = 255; in nt35510_probe()
1168 if (nt->conf->cmds & NT35510_CMD_CONTROL_DISPLAY) in nt35510_probe()
1169 bl->props.brightness = nt->conf->wrdisbv; in nt35510_probe()
1171 bl->props.brightness = 255; in nt35510_probe()
1172 bl->props.power = BACKLIGHT_POWER_OFF; in nt35510_probe()
1173 nt->panel.backlight = bl; in nt35510_probe()
1176 drm_panel_add(&nt->panel); in nt35510_probe()
1180 drm_panel_remove(&nt->panel); in nt35510_probe()
1194 dev_err(&dsi->dev, "Failed to power off\n"); in nt35510_remove()
1196 drm_panel_remove(&nt->panel); in nt35510_remove()
1233 * Display frame rate control:
1234 * Frame rate = (20 MHz / 1) / (389 * (7 + 50 + 800)) ~= 60 Hz
1255 /* 0x09: AVEE = -5.6V */
1257 /* 0x24: NCK = Hsync/2, BTN = -2 x VDDB */
1259 /* VBCLA: -2.5V, VBCLB: -2.5V, VBCLC: -2.5V */
1261 /* 0x24: CLCK = Hsync/2, BTN = -1 x VDDB */
1265 /* 0x24: NCKA = Hsync/2, VGH = 2 x AVDD - AVEE */
1267 /* 0x0B = -13V */
1269 /* 0x24: LCKA = Hsync, VGL = AVDD + VCL - AVDD */
1297 /* DPTMCTR12: 0x03: LVGL = VGLX, overlap mode, swap R->L O->E */
1330 /* 0x03: AVEE = -6.2V */
1334 /* VBCLA: -2.5V, VBCLB: -2.5V, VBCLC: -3.5V */
1336 /* 0x26: CLCK = 2 x Hsync, BTN = -1 x VDDB */
1340 /* 0x36: HCK = 2 x Hsync, VGH = 2 x AVDD - AVEE */
1342 /* 0x08 = -10V */
1344 /* 0x26: LCK = 2 x Hsync, VGL = AVDD + VCL - AVDD */
1350 /* VCMOFFSEL = VCOM voltage offset mode, VCM = -1V */
1372 /* DPTMCTR12: 0x03: LVGL = VGLX, overlap mode, swap R->L O->E */
1402 .name = "panel-novatek-nt35510",
1409 MODULE_DESCRIPTION("NT35510-based panel driver");