Lines Matching refs:nt

394 static int nt35510_send_long(struct nt35510 *nt, struct mipi_dsi_device *dsi,
406 dev_err(nt->dev, "error sending DCS command seq cmd %02x\n", cmd);
418 dev_err(nt->dev, "error sending generic write seq %02x\n", cmd);
424 dev_dbg(nt->dev, "sent command %02x %02x bytes\n", cmd, cmdlen);
428 static int nt35510_read_id(struct nt35510 *nt)
430 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
436 dev_err(nt->dev, "could not read MTP ID1\n");
441 dev_err(nt->dev, "could not read MTP ID2\n");
446 dev_err(nt->dev, "could not read MTP ID3\n");
455 dev_info(nt->dev, "MTP ID manufacturer: %02x version: %02x driver: %02x\n", id1, id2, id3);
462 * @nt: the display instance to set up
464 static int nt35510_setup_power(struct nt35510 *nt)
466 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
469 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETAVDD,
471 nt->conf->avdd);
474 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT1CTR,
476 nt->conf->bt1ctr);
479 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETAVEE,
481 nt->conf->avee);
484 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT2CTR,
486 nt->conf->bt2ctr);
489 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGH,
491 nt->conf->vgh);
494 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT4CTR,
496 nt->conf->bt4ctr);
499 ret = nt35510_send_long(nt, dsi, NT35510_P1_VGHCTR,
504 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGL,
506 nt->conf->vgl);
509 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT5CTR,
511 nt->conf->bt5ctr);
514 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGP,
516 nt->conf->vgp);
519 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGN,
521 nt->conf->vgn);
533 * @nt: the display instance to set up
535 static int nt35510_setup_display(struct nt35510 *nt)
537 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
538 const struct nt35510_config *conf = nt->conf;
551 ret = nt35510_send_long(nt, dsi, NT35510_P0_DOPCTR,
576 ret = nt35510_send_long(nt, dsi, NT35510_P0_GSEQCTR,
582 ret = nt35510_send_long(nt, dsi, NT35510_P0_SDEQCTR,
616 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR1,
623 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR2,
628 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR3,
640 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPMCTR12,
651 struct nt35510 *nt = bl_get_data(bl);
652 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
656 dev_dbg(nt->dev, "set brightness %d\n", brightness);
673 static int nt35510_power_on(struct nt35510 *nt)
675 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
678 ret = regulator_bulk_enable(ARRAY_SIZE(nt->supplies), nt->supplies);
680 dev_err(nt->dev, "unable to enable regulators\n");
685 if (nt->reset_gpio) {
686 gpiod_set_value(nt->reset_gpio, 1);
689 gpiod_set_value(nt->reset_gpio, 0);
697 ret = nt35510_send_long(nt, dsi, MCS_CMD_MTP_READ_PARAM,
703 ret = nt35510_send_long(nt, dsi, MCS_CMD_MTP_READ_SETTING,
709 nt35510_read_id(nt);
712 ret = nt35510_send_long(nt, dsi, MCS_CMD_MAUCCTR,
718 ret = nt35510_setup_power(nt);
722 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_RED_POS,
724 nt->conf->gamma_corr_pos_r);
727 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_GREEN_POS,
729 nt->conf->gamma_corr_pos_g);
732 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_BLUE_POS,
734 nt->conf->gamma_corr_pos_b);
737 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_RED_NEG,
739 nt->conf->gamma_corr_neg_r);
742 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_GREEN_NEG,
744 nt->conf->gamma_corr_neg_g);
747 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_BLUE_NEG,
749 nt->conf->gamma_corr_neg_b);
754 ret = nt35510_send_long(nt, dsi, MCS_CMD_MAUCCTR,
760 ret = nt35510_setup_display(nt);
767 static int nt35510_power_off(struct nt35510 *nt)
771 ret = regulator_bulk_disable(ARRAY_SIZE(nt->supplies), nt->supplies);
775 if (nt->reset_gpio)
776 gpiod_set_value(nt->reset_gpio, 1);
783 struct nt35510 *nt = panel_to_nt35510(panel);
784 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
789 dev_err(nt->dev, "failed to turn display off (%d)\n", ret);
797 dev_err(nt->dev, "failed to enter sleep mode (%d)\n", ret);
804 ret = nt35510_power_off(nt);
813 struct nt35510 *nt = panel_to_nt35510(panel);
814 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
817 ret = nt35510_power_on(nt);
824 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret);
832 dev_err(nt->dev, "failed to turn display on (%d)\n", ret);
844 struct nt35510 *nt = panel_to_nt35510(panel);
849 info->width_mm = nt->conf->width_mm;
850 info->height_mm = nt->conf->height_mm;
851 mode = drm_mode_duplicate(connector->dev, &nt->conf->mode);
859 mode->width_mm = nt->conf->width_mm;
860 mode->height_mm = nt->conf->height_mm;
875 struct nt35510 *nt;
878 nt = devm_kzalloc(dev, sizeof(struct nt35510), GFP_KERNEL);
879 if (!nt)
881 mipi_dsi_set_drvdata(dsi, nt);
882 nt->dev = dev;
905 nt->conf = of_device_get_match_data(dev);
906 if (!nt->conf) {
911 nt->supplies[0].supply = "vdd"; /* 2.3-4.8 V */
912 nt->supplies[1].supply = "vddi"; /* 1.65-3.3V */
913 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(nt->supplies),
914 nt->supplies);
917 ret = regulator_set_voltage(nt->supplies[0].consumer,
921 ret = regulator_set_voltage(nt->supplies[1].consumer,
926 nt->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_ASIS);
927 if (IS_ERR(nt->reset_gpio)) {
929 return PTR_ERR(nt->reset_gpio);
932 drm_panel_init(&nt->panel, dev, &nt35510_drm_funcs,
940 ret = drm_panel_of_backlight(&nt->panel);
945 if (!nt->panel.backlight) {
948 bl = devm_backlight_device_register(dev, "nt35510", dev, nt,
957 nt->panel.backlight = bl;
960 drm_panel_add(&nt->panel);
964 drm_panel_remove(&nt->panel);
971 struct nt35510 *nt = mipi_dsi_get_drvdata(dsi);
976 ret = nt35510_power_off(nt);
980 drm_panel_remove(&nt->panel);