Lines Matching defs:nt

584 static int nt35510_send_long(struct nt35510 *nt, struct mipi_dsi_device *dsi,
596 dev_err(nt->dev, "error sending DCS command seq cmd %02x\n", cmd);
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);
618 static int nt35510_read_id(struct nt35510 *nt)
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");
645 dev_info(nt->dev, "MTP ID manufacturer: %02x version: %02x driver: %02x\n", id1, id2, id3);
652 * @nt: the display instance to set up
654 static int nt35510_setup_power(struct nt35510 *nt)
656 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
659 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETAVDD,
661 nt->conf->avdd);
664 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT1CTR,
666 nt->conf->bt1ctr);
669 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETAVEE,
671 nt->conf->avee);
674 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT2CTR,
676 nt->conf->bt2ctr);
679 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVCL,
681 nt->conf->vcl);
684 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT3CTR,
686 nt->conf->bt3ctr);
689 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGH,
691 nt->conf->vgh);
694 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT4CTR,
696 nt->conf->bt4ctr);
699 ret = nt35510_send_long(nt, dsi, NT35510_P1_VGHCTR,
704 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGL,
706 nt->conf->vgl);
709 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT5CTR,
711 nt->conf->bt5ctr);
714 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGP,
716 nt->conf->vgp);
719 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGN,
721 nt->conf->vgn);
725 if (nt->conf->cmds & NT35510_CMD_SETVCMOFF) {
726 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVCMOFF,
728 nt->conf->vcmoff);
741 * @nt: the display instance to set up
743 static int nt35510_setup_display(struct nt35510 *nt)
745 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
746 const struct nt35510_config *conf = nt->conf;
750 ret = nt35510_send_long(nt, dsi, NT35510_P0_DOPCTR,
766 ret = nt35510_send_long(nt, dsi, NT35510_P0_GSEQCTR,
772 ret = nt35510_send_long(nt, dsi, NT35510_P0_SDEQCTR,
806 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR1,
813 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR2,
818 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR3,
830 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPMCTR12,
841 struct nt35510 *nt = bl_get_data(bl);
842 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
846 dev_dbg(nt->dev, "set brightness %d\n", brightness);
863 static int nt35510_power_on(struct nt35510 *nt)
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);
887 ret = nt35510_send_long(nt, dsi, MCS_CMD_MTP_READ_PARAM,
893 ret = nt35510_send_long(nt, dsi, MCS_CMD_MTP_READ_SETTING,
899 nt35510_read_id(nt);
902 ret = nt35510_send_long(nt, dsi, MCS_CMD_MAUCCTR,
908 ret = nt35510_setup_power(nt);
912 if (nt->conf->cmds & NT35510_CMD_CORRECT_GAMMA) {
913 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_RED_POS,
915 nt->conf->gamma_corr_pos_r);
918 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_GREEN_POS,
920 nt->conf->gamma_corr_pos_g);
923 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_BLUE_POS,
925 nt->conf->gamma_corr_pos_b);
928 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_RED_NEG,
930 nt->conf->gamma_corr_neg_r);
933 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_GREEN_NEG,
935 nt->conf->gamma_corr_neg_g);
938 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_BLUE_NEG,
940 nt->conf->gamma_corr_neg_b);
946 ret = nt35510_send_long(nt, dsi, MCS_CMD_MAUCCTR,
952 ret = nt35510_setup_display(nt);
959 static int nt35510_power_off(struct nt35510 *nt)
963 ret = regulator_bulk_disable(ARRAY_SIZE(nt->supplies), nt->supplies);
967 if (nt->reset_gpio)
968 gpiod_set_value(nt->reset_gpio, 1);
975 struct nt35510 *nt = panel_to_nt35510(panel);
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);
996 ret = nt35510_power_off(nt);
1005 struct nt35510 *nt = panel_to_nt35510(panel);
1006 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev);
1009 ret = nt35510_power_on(nt);
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);
1056 struct nt35510 *nt = panel_to_nt35510(panel);
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);
1071 mode->width_mm = nt->conf->width_mm;
1072 mode->height_mm = nt->conf->height_mm;
1087 struct nt35510 *nt;
1090 nt = devm_drm_panel_alloc(dev, struct nt35510, panel,
1093 if (IS_ERR(nt))
1094 return PTR_ERR(nt);
1096 mipi_dsi_set_drvdata(dsi, nt);
1097 nt->dev = dev;
1119 nt->conf = of_device_get_match_data(dev);
1120 if (!nt->conf) {
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) {
1161 bl = devm_backlight_device_register(dev, "nt35510", dev, nt,
1168 if (nt->conf->cmds & NT35510_CMD_CONTROL_DISPLAY)
1169 bl->props.brightness = nt->conf->wrdisbv;
1173 nt->panel.backlight = bl;
1176 drm_panel_add(&nt->panel);
1180 drm_panel_remove(&nt->panel);
1187 struct nt35510 *nt = mipi_dsi_get_drvdata(dsi);
1192 ret = nt35510_power_off(nt);
1196 drm_panel_remove(&nt->panel);