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