Lines Matching +full:iovcc +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
6 * - 8-bit serial RGB interface
7 * - 24-bit parallel RGB interface
8 * - 8-bit ITU-R BT.601 interface
9 * - 8-bit ITU-R BT.656 interface
10 * - Up to 320RGBx240 dots resolution TFT LCD displays
11 * - Scaling, brightness and contrast
19 * Derived from drivers/drm/gpu/panel/panel-samsung-ld9040.c
63 /* 0 = right-to-left, 1 = left-to-right (default), horizontal flip */
65 /* 0 = down-to-up, 1 = up-to-down (default), vertical flip */
126 /* Formula A for YCbCR->RGB = 0, Formula B = 1 */
139 #define ILI9322_GLOBAL_RESET_ASSERT 0x00 /* bit 0 = 0 -> reset */
143 * Upper nybble, bits 4-7 are negative gamma
144 * Lower nybble, bits 0-3 are positive gamma
156 * enum ili9322_input - the format of the incoming signal to the panel
190 "8 bit ITU-R BT.656 720Y 360CbCr",
191 "8 bit ITU-R BT.656 640Y 320CbCr",
195 * struct ili9322_config - the system specific ILI9322 configuration
198 * @flip_horizontal: flip the image horizontally (right-to-left scan)
200 * @flip_vertical: flip the image vertically (down-to-up scan)
213 * peak-to-peak amplitude of the communcation signals to the physical
242 * +----------------------------------------------------------->
334 /* Just register 0 is read-only */ in ili9322_writeable_reg()
356 ret = regmap_write(ili->regmap, ILI9322_GLOBAL_RESET, in ili9322_init()
359 dev_err(ili->dev, "can't issue GRESET (%d)\n", ret); in ili9322_init()
364 if (ili->vreg1out != U8_MAX) { in ili9322_init()
365 ret = regmap_write(ili->regmap, ILI9322_VREG1_VOLTAGE, in ili9322_init()
366 ili->vreg1out); in ili9322_init()
368 dev_err(ili->dev, "can't set up VREG1OUT (%d)\n", ret); in ili9322_init()
373 if (ili->vcom_amplitude != U8_MAX) { in ili9322_init()
374 ret = regmap_write(ili->regmap, ILI9322_VCOM_AMP, in ili9322_init()
375 ili->vcom_amplitude); in ili9322_init()
377 dev_err(ili->dev, in ili9322_init()
383 if (ili->vcom_high != U8_MAX) { in ili9322_init()
384 ret = regmap_write(ili->regmap, ILI9322_VCOM_HIGH, in ili9322_init()
385 ili->vcom_high); in ili9322_init()
387 dev_err(ili->dev, "can't set up VCOM high (%d)\n", ret); in ili9322_init()
393 for (i = 0; i < ARRAY_SIZE(ili->gamma); i++) { in ili9322_init()
394 ret = regmap_write(ili->regmap, ILI9322_GAMMA_1 + i, in ili9322_init()
395 ili->gamma[i]); in ili9322_init()
397 dev_err(ili->dev, in ili9322_init()
409 if (ili->conf->dclk_active_high) in ili9322_init()
411 if (ili->conf->de_active_high) in ili9322_init()
413 if (ili->conf->hsync_active_high) in ili9322_init()
415 if (ili->conf->vsync_active_high) in ili9322_init()
417 ret = regmap_write(ili->regmap, ILI9322_POL, reg); in ili9322_init()
419 dev_err(ili->dev, "can't write POL register (%d)\n", ret); in ili9322_init()
427 reg = ili->conf->syncmode; in ili9322_init()
429 ret = regmap_write(ili->regmap, ILI9322_IF_CTRL, reg); in ili9322_init()
431 dev_err(ili->dev, "can't write IF CTRL register (%d)\n", ret); in ili9322_init()
436 reg = (ili->input << 4); in ili9322_init()
438 if (!ili->conf->flip_horizontal) in ili9322_init()
440 if (!ili->conf->flip_vertical) in ili9322_init()
443 ret = regmap_write(ili->regmap, ILI9322_ENTRY, reg); in ili9322_init()
445 dev_err(ili->dev, "can't write ENTRY reg (%d)\n", ret); in ili9322_init()
448 dev_info(ili->dev, "display is in %s mode, syncmode %02x\n", in ili9322_init()
449 ili9322_inputs[ili->input], in ili9322_init()
450 ili->conf->syncmode); in ili9322_init()
452 dev_info(ili->dev, "initialized display\n"); in ili9322_init()
458 * This power-on sequence if from the datasheet, page 57.
465 gpiod_set_value(ili->reset_gpio, 1); in ili9322_power_on()
467 ret = regulator_bulk_enable(ARRAY_SIZE(ili->supplies), ili->supplies); in ili9322_power_on()
469 dev_err(ili->dev, "unable to enable regulators\n"); in ili9322_power_on()
474 /* De-assert RESET */ in ili9322_power_on()
475 gpiod_set_value(ili->reset_gpio, 0); in ili9322_power_on()
484 return regulator_bulk_disable(ARRAY_SIZE(ili->supplies), ili->supplies); in ili9322_power_off()
492 ret = regmap_write(ili->regmap, ILI9322_POW_CTRL, in ili9322_disable()
495 dev_err(ili->dev, "unable to go to standby mode\n"); in ili9322_disable()
530 ret = regmap_write(ili->regmap, ILI9322_POW_CTRL, in ili9322_enable()
533 dev_err(ili->dev, "unable to enable panel\n"); in ili9322_enable()
640 struct drm_device *drm = connector->dev; in ili9322_get_modes()
644 info = &connector->display_info; in ili9322_get_modes()
645 info->width_mm = ili->conf->width_mm; in ili9322_get_modes()
646 info->height_mm = ili->conf->height_mm; in ili9322_get_modes()
647 if (ili->conf->dclk_active_high) in ili9322_get_modes()
648 info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE; in ili9322_get_modes()
650 info->bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE; in ili9322_get_modes()
652 if (ili->conf->de_active_high) in ili9322_get_modes()
653 info->bus_flags |= DRM_BUS_FLAG_DE_HIGH; in ili9322_get_modes()
655 info->bus_flags |= DRM_BUS_FLAG_DE_LOW; in ili9322_get_modes()
657 switch (ili->input) { in ili9322_get_modes()
685 dev_err(panel->dev, "bad mode or failed to add mode\n"); in ili9322_get_modes()
686 return -EINVAL; in ili9322_get_modes()
693 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in ili9322_get_modes()
696 if (ili->conf->hsync_active_high) in ili9322_get_modes()
697 mode->flags |= DRM_MODE_FLAG_PHSYNC; in ili9322_get_modes()
699 mode->flags |= DRM_MODE_FLAG_NHSYNC; in ili9322_get_modes()
700 if (ili->conf->vsync_active_high) in ili9322_get_modes()
701 mode->flags |= DRM_MODE_FLAG_PVSYNC; in ili9322_get_modes()
703 mode->flags |= DRM_MODE_FLAG_NVSYNC; in ili9322_get_modes()
705 mode->width_mm = ili->conf->width_mm; in ili9322_get_modes()
706 mode->height_mm = ili->conf->height_mm; in ili9322_get_modes()
722 struct device *dev = &spi->dev; in ili9322_probe()
732 return -ENOMEM; in ili9322_probe()
736 ili->dev = dev; in ili9322_probe()
742 ili->conf = of_device_get_match_data(dev); in ili9322_probe()
743 if (!ili->conf) { in ili9322_probe()
745 return -ENODEV; in ili9322_probe()
748 val = ili->conf->vreg1out_mv; in ili9322_probe()
751 ili->vreg1out = U8_MAX; in ili9322_probe()
755 return -EINVAL; in ili9322_probe()
759 return -EINVAL; in ili9322_probe()
763 return -EINVAL; in ili9322_probe()
765 val -= 3600; in ili9322_probe()
768 ili->vreg1out = val; in ili9322_probe()
771 val = ili->conf->vcom_high_percent; in ili9322_probe()
774 ili->vcom_high = U8_MAX; in ili9322_probe()
778 return -EINVAL; in ili9322_probe()
782 return -EINVAL; in ili9322_probe()
784 val -= 37; in ili9322_probe()
786 ili->vcom_high = val; in ili9322_probe()
789 val = ili->conf->vcom_amplitude_percent; in ili9322_probe()
792 ili->vcom_high = U8_MAX; in ili9322_probe()
796 return -EINVAL; in ili9322_probe()
800 return -EINVAL; in ili9322_probe()
802 val -= 70; in ili9322_probe()
805 ili->vcom_amplitude = val; in ili9322_probe()
808 for (i = 0; i < ARRAY_SIZE(ili->gamma); i++) { in ili9322_probe()
809 val = ili->conf->gamma_corr_neg[i]; in ili9322_probe()
815 val = ili->conf->gamma_corr_pos[i]; in ili9322_probe()
821 ili->gamma[i] = gamma; in ili9322_probe()
825 ili->supplies[0].supply = "vcc"; /* 2.7-3.6 V */ in ili9322_probe()
826 ili->supplies[1].supply = "iovcc"; /* 1.65-3.6V */ in ili9322_probe()
827 ili->supplies[2].supply = "vci"; /* 2.7-3.6V */ in ili9322_probe()
828 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ili->supplies), in ili9322_probe()
829 ili->supplies); in ili9322_probe()
832 ret = regulator_set_voltage(ili->supplies[0].consumer, in ili9322_probe()
836 ret = regulator_set_voltage(ili->supplies[1].consumer, in ili9322_probe()
840 ret = regulator_set_voltage(ili->supplies[2].consumer, in ili9322_probe()
845 ili->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); in ili9322_probe()
846 if (IS_ERR(ili->reset_gpio)) { in ili9322_probe()
848 return PTR_ERR(ili->reset_gpio); in ili9322_probe()
851 spi->bits_per_word = 8; in ili9322_probe()
858 ili->regmap = devm_regmap_init(dev, &ili9322_regmap_bus, dev, in ili9322_probe()
860 if (IS_ERR(ili->regmap)) { in ili9322_probe()
862 return PTR_ERR(ili->regmap); in ili9322_probe()
865 ret = regmap_read(ili->regmap, ILI9322_CHIP_ID, &val); in ili9322_probe()
873 return -ENODEV; in ili9322_probe()
877 if (ili->conf->input == ILI9322_INPUT_UNKNOWN) { in ili9322_probe()
878 ret = regmap_read(ili->regmap, ILI9322_ENTRY, &val); in ili9322_probe()
884 ili->input = (val >> 4) & 0x0f; in ili9322_probe()
885 if (ili->input >= ILI9322_INPUT_UNKNOWN) in ili9322_probe()
886 ili->input = ILI9322_INPUT_UNKNOWN; in ili9322_probe()
888 ili->input = ili->conf->input; in ili9322_probe()
891 drm_panel_init(&ili->panel, dev, &ili9322_drm_funcs, in ili9322_probe()
894 drm_panel_add(&ili->panel); in ili9322_probe()
904 drm_panel_remove(&ili->panel); in ili9322_remove()
910 * The D-Link DIR-685 panel is marked LM918A01-1A SY-B4-091116-E0199
927 .compatible = "dlink,dir-685-panel",
942 .name = "panel-ilitek-ili9322",