Lines Matching refs:nt

584 static int nt35510_send_long(struct nt35510 *nt, struct mipi_dsi_device *dsi,  in nt35510_send_long()  argument
596 dev_err(nt->dev, "error sending DCS command seq cmd %02x\n", cmd); 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()
618 static int nt35510_read_id(struct nt35510 *nt) in nt35510_read_id() argument
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()
645 dev_info(nt->dev, "MTP ID manufacturer: %02x version: %02x driver: %02x\n", id1, id2, id3); in nt35510_read_id()
654 static int nt35510_setup_power(struct nt35510 *nt) in nt35510_setup_power() argument
656 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_setup_power()
659 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETAVDD, in nt35510_setup_power()
661 nt->conf->avdd); in nt35510_setup_power()
664 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT1CTR, in nt35510_setup_power()
666 nt->conf->bt1ctr); in nt35510_setup_power()
669 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETAVEE, in nt35510_setup_power()
671 nt->conf->avee); in nt35510_setup_power()
674 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT2CTR, in nt35510_setup_power()
676 nt->conf->bt2ctr); in nt35510_setup_power()
679 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVCL, in nt35510_setup_power()
681 nt->conf->vcl); in nt35510_setup_power()
684 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT3CTR, in nt35510_setup_power()
686 nt->conf->bt3ctr); in nt35510_setup_power()
689 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGH, in nt35510_setup_power()
691 nt->conf->vgh); in nt35510_setup_power()
694 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT4CTR, in nt35510_setup_power()
696 nt->conf->bt4ctr); in nt35510_setup_power()
699 ret = nt35510_send_long(nt, dsi, NT35510_P1_VGHCTR, in nt35510_setup_power()
704 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGL, in nt35510_setup_power()
706 nt->conf->vgl); in nt35510_setup_power()
709 ret = nt35510_send_long(nt, dsi, NT35510_P1_BT5CTR, in nt35510_setup_power()
711 nt->conf->bt5ctr); in nt35510_setup_power()
714 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGP, in nt35510_setup_power()
716 nt->conf->vgp); in nt35510_setup_power()
719 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVGN, in nt35510_setup_power()
721 nt->conf->vgn); in nt35510_setup_power()
725 if (nt->conf->cmds & NT35510_CMD_SETVCMOFF) { in nt35510_setup_power()
726 ret = nt35510_send_long(nt, dsi, NT35510_P1_SETVCMOFF, in nt35510_setup_power()
728 nt->conf->vcmoff); in nt35510_setup_power()
743 static int nt35510_setup_display(struct nt35510 *nt) in nt35510_setup_display() argument
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()
750 ret = nt35510_send_long(nt, dsi, NT35510_P0_DOPCTR, in nt35510_setup_display()
766 ret = nt35510_send_long(nt, dsi, NT35510_P0_GSEQCTR, in nt35510_setup_display()
772 ret = nt35510_send_long(nt, dsi, NT35510_P0_SDEQCTR, in nt35510_setup_display()
806 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR1, in nt35510_setup_display()
813 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR2, in nt35510_setup_display()
818 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPFRCTR3, in nt35510_setup_display()
830 ret = nt35510_send_long(nt, dsi, NT35510_P0_DPMCTR12, in nt35510_setup_display()
841 struct nt35510 *nt = bl_get_data(bl); in nt35510_set_brightness() local
842 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_set_brightness()
846 dev_dbg(nt->dev, "set brightness %d\n", brightness); in nt35510_set_brightness()
863 static int nt35510_power_on(struct nt35510 *nt) in nt35510_power_on() argument
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()
887 ret = nt35510_send_long(nt, dsi, MCS_CMD_MTP_READ_PARAM, in nt35510_power_on()
893 ret = nt35510_send_long(nt, dsi, MCS_CMD_MTP_READ_SETTING, in nt35510_power_on()
899 nt35510_read_id(nt); in nt35510_power_on()
902 ret = nt35510_send_long(nt, dsi, MCS_CMD_MAUCCTR, in nt35510_power_on()
908 ret = nt35510_setup_power(nt); in nt35510_power_on()
912 if (nt->conf->cmds & NT35510_CMD_CORRECT_GAMMA) { in nt35510_power_on()
913 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_RED_POS, in nt35510_power_on()
915 nt->conf->gamma_corr_pos_r); in nt35510_power_on()
918 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_GREEN_POS, in nt35510_power_on()
920 nt->conf->gamma_corr_pos_g); in nt35510_power_on()
923 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_BLUE_POS, in nt35510_power_on()
925 nt->conf->gamma_corr_pos_b); in nt35510_power_on()
928 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_RED_NEG, in nt35510_power_on()
930 nt->conf->gamma_corr_neg_r); in nt35510_power_on()
933 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_GREEN_NEG, in nt35510_power_on()
935 nt->conf->gamma_corr_neg_g); in nt35510_power_on()
938 ret = nt35510_send_long(nt, dsi, NT35510_P1_SET_GAMMA_BLUE_NEG, in nt35510_power_on()
940 nt->conf->gamma_corr_neg_b); in nt35510_power_on()
946 ret = nt35510_send_long(nt, dsi, MCS_CMD_MAUCCTR, in nt35510_power_on()
952 ret = nt35510_setup_display(nt); in nt35510_power_on()
959 static int nt35510_power_off(struct nt35510 *nt) in nt35510_power_off() argument
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()
975 struct nt35510 *nt = panel_to_nt35510(panel); in nt35510_unprepare() local
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()
996 ret = nt35510_power_off(nt); in nt35510_unprepare()
1005 struct nt35510 *nt = panel_to_nt35510(panel); in nt35510_prepare() local
1006 struct mipi_dsi_device *dsi = to_mipi_dsi_device(nt->dev); in nt35510_prepare()
1009 ret = nt35510_power_on(nt); in nt35510_prepare()
1016 dev_err(nt->dev, "failed to exit sleep mode (%d)\n", ret); 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()
1056 struct nt35510 *nt = panel_to_nt35510(panel); in nt35510_get_modes() local
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()
1071 mode->width_mm = nt->conf->width_mm; in nt35510_get_modes()
1072 mode->height_mm = nt->conf->height_mm; in nt35510_get_modes()
1087 struct nt35510 *nt; in nt35510_probe() local
1090 nt = devm_kzalloc(dev, sizeof(struct nt35510), GFP_KERNEL); in nt35510_probe()
1091 if (!nt) in nt35510_probe()
1093 mipi_dsi_set_drvdata(dsi, nt); in nt35510_probe()
1094 nt->dev = dev; in nt35510_probe()
1116 nt->conf = of_device_get_match_data(dev); in nt35510_probe()
1117 if (!nt->conf) { 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()
1161 bl = devm_backlight_device_register(dev, "nt35510", dev, nt, 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()
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()
1187 struct nt35510 *nt = mipi_dsi_get_drvdata(dsi); in nt35510_remove() local
1192 ret = nt35510_power_off(nt); in nt35510_remove()
1196 drm_panel_remove(&nt->panel); in nt35510_remove()