Lines Matching +full:regulator +full:- +full:booster

1 // SPDX-License-Identifier: GPL-2.0-only
16 * per-panel, e.g. for physical size.
31 #include <linux/regulator/consumer.h>
147 * struct nt35510_config - the display-specific NT35510 configuration
173 * +------------------------------------------->
207 * @bt1ctr: setting for boost power control for the AVDD step-up
209 * bits 0..2 in the lower nibble controls PCK, the booster clock
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
238 * bits 0..2 in the lower nibble controls NCK, the booster clock
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
258 * bits 0..2 in the lower nibble controls CLCK, the booster clock
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
277 * bits 0..2 in the lower nibble controls HCK, the booster clock
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
296 * bits 0..2 in the lower nibble controls LCK, the booster clock
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);
603 chunk = cmdlen - cmdwritten;
608 dev_err(nt->dev, "error sending generic write seq %02x\n", cmd);
614 dev_dbg(nt->dev, "sent command %02x %02x bytes\n", cmd, cmdlen);
620 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
626 dev_err(nt->dev, "could not read MTP ID1\n");
631 dev_err(nt->dev, "could not read MTP ID2\n");
636 dev_err(nt->dev, "could not read MTP ID3\n");
641 * Multi-Time Programmable (?) memory contains manufacturer
645 dev_info(nt->dev, "MTP ID manufacturer: %02x version: %02x driver: %02x\n", id1, id2, id3);
651 * nt35510_setup_power() - set up power config in page 1
656 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
661 nt->conf->avdd);
666 nt->conf->bt1ctr);
671 nt->conf->avee);
676 nt->conf->bt2ctr);
681 nt->conf->vcl);
686 nt->conf->bt3ctr);
691 nt->conf->vgh);
696 nt->conf->bt4ctr);
706 nt->conf->vgl);
711 nt->conf->bt5ctr);
716 nt->conf->vgp);
721 nt->conf->vgn);
725 if (nt->conf->cmds & NT35510_CMD_SETVCMOFF) {
728 nt->conf->vcmoff);
740 * nt35510_setup_display() - set up display config in page 0
745 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
746 const struct nt35510_config *conf = nt->conf;
752 conf->dopctr);
756 ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_ADDRESS_MODE, &conf->madctl,
757 sizeof(conf->madctl));
761 ret = mipi_dsi_dcs_write(dsi, NT35510_P0_SDHDTCTR, &conf->sdhdtctr,
762 sizeof(conf->sdhdtctr));
768 conf->gseqctr);
774 conf->sdeqctr);
779 &conf->sdvpctr, 1);
799 dpfrctr[0] = (conf->t1 >> 8) & 0xFF;
800 dpfrctr[1] = conf->t1 & 0xFF;
802 dpfrctr[2] = conf->vbp;
804 dpfrctr[3] = conf->vfp;
805 dpfrctr[4] = conf->psel;
812 dpfrctr[3]--;
832 conf->dpmctr12);
842 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
843 u8 brightness = bl->props.brightness;
846 dev_dbg(nt->dev, "set brightness %d\n", brightness);
861 * This power-on sequence
865 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
868 ret = regulator_bulk_enable(ARRAY_SIZE(nt->supplies), nt->supplies);
870 dev_err(nt->dev, "unable to enable regulators\n");
875 if (nt->reset_gpio) {
876 gpiod_set_value(nt->reset_gpio, 1);
879 gpiod_set_value(nt->reset_gpio, 0);
882 * according to datasheet, let's use 120-140 ms.
912 if (nt->conf->cmds & NT35510_CMD_CORRECT_GAMMA) {
915 nt->conf->gamma_corr_pos_r);
920 nt->conf->gamma_corr_pos_g);
925 nt->conf->gamma_corr_pos_b);
930 nt->conf->gamma_corr_neg_r);
935 nt->conf->gamma_corr_neg_g);
940 nt->conf->gamma_corr_neg_b);
963 ret = regulator_bulk_disable(ARRAY_SIZE(nt->supplies), nt->supplies);
967 if (nt->reset_gpio)
968 gpiod_set_value(nt->reset_gpio, 1);
976 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
981 dev_err(nt->dev, "failed to turn display off (%d)\n", ret);
989 dev_err(nt->dev, "failed to enter sleep mode (%d)\n", ret);
1006 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
1016 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret);
1022 if (nt->conf->cmds & NT35510_CMD_CONTROL_DISPLAY) {
1024 &nt->conf->wrctrld,
1025 sizeof(nt->conf->wrctrld));
1030 &nt->conf->wrcabc,
1031 sizeof(nt->conf->wrcabc));
1036 &nt->conf->wrcabcmb,
1037 sizeof(nt->conf->wrcabcmb));
1044 dev_err(nt->dev, "failed to turn display on (%d)\n", ret);
1060 info = &connector->display_info;
1061 info->width_mm = nt->conf->width_mm;
1062 info->height_mm = nt->conf->height_mm;
1063 mode = drm_mode_duplicate(connector->dev, &nt->conf->mode);
1065 dev_err(panel->dev, "bad mode or failed to add mode\n");
1066 return -EINVAL;
1069 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
1071 mode->width_mm = nt->conf->width_mm;
1072 mode->height_mm = nt->conf->height_mm;
1086 struct device *dev = &dsi->dev;
1097 nt->dev = dev;
1099 dsi->lanes = 2;
1100 dsi->format = MIPI_DSI_FMT_RGB888;
1110 * maybe make this a per-panel config in struct nt35510_config?
1112 dsi->hs_rate = 349440000;
1113 dsi->lp_rate = 9600000;
1119 nt->conf = of_device_get_match_data(dev);
1120 if (!nt->conf) {
1122 return -ENODEV;
1125 dsi->mode_flags = nt->conf->mode_flags;
1127 nt->supplies[0].supply = "vdd"; /* 2.3-4.8 V */
1128 nt->supplies[1].supply = "vddi"; /* 1.65-3.3V */
1129 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(nt->supplies),
1130 nt->supplies);
1133 ret = regulator_set_voltage(nt->supplies[0].consumer,
1137 ret = regulator_set_voltage(nt->supplies[1].consumer,
1142 nt->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
1143 if (IS_ERR(nt->reset_gpio)) {
1145 return PTR_ERR(nt->reset_gpio);
1153 ret = drm_panel_of_backlight(&nt->panel);
1158 if (!nt->panel.backlight) {
1167 bl->props.max_brightness = 255;
1168 if (nt->conf->cmds & NT35510_CMD_CONTROL_DISPLAY)
1169 bl->props.brightness = nt->conf->wrdisbv;
1171 bl->props.brightness = 255;
1172 bl->props.power = BACKLIGHT_POWER_OFF;
1173 nt->panel.backlight = bl;
1176 drm_panel_add(&nt->panel);
1180 drm_panel_remove(&nt->panel);
1194 dev_err(&dsi->dev, "Failed to power off\n");
1196 drm_panel_remove(&nt->panel);
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");