Lines Matching refs:ili
349 static int ili9322_init(struct drm_panel *panel, struct ili9322 *ili) in ili9322_init() argument
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()
460 static int ili9322_power_on(struct ili9322 *ili) in ili9322_power_on() argument
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()
475 gpiod_set_value(ili->reset_gpio, 0); in ili9322_power_on()
482 static int ili9322_power_off(struct ili9322 *ili) in ili9322_power_off() argument
484 return regulator_bulk_disable(ARRAY_SIZE(ili->supplies), ili->supplies); in ili9322_power_off()
489 struct ili9322 *ili = panel_to_ili9322(panel); in ili9322_disable() local
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()
504 struct ili9322 *ili = panel_to_ili9322(panel); in ili9322_unprepare() local
506 return ili9322_power_off(ili); in ili9322_unprepare()
511 struct ili9322 *ili = panel_to_ili9322(panel); in ili9322_prepare() local
514 ret = ili9322_power_on(ili); in ili9322_prepare()
518 ret = ili9322_init(panel, ili); in ili9322_prepare()
527 struct ili9322 *ili = panel_to_ili9322(panel); in ili9322_enable() local
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()
639 struct ili9322 *ili = panel_to_ili9322(panel); in ili9322_get_modes() local
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()
652 if (ili->conf->de_active_high) in ili9322_get_modes()
657 switch (ili->input) { in ili9322_get_modes()
696 if (ili->conf->hsync_active_high) in ili9322_get_modes()
700 if (ili->conf->vsync_active_high) 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()
723 struct ili9322 *ili; in ili9322_probe() local
730 ili = devm_kzalloc(dev, sizeof(struct ili9322), GFP_KERNEL); in ili9322_probe()
731 if (!ili) in ili9322_probe()
734 spi_set_drvdata(spi, ili); 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()
748 val = ili->conf->vreg1out_mv; in ili9322_probe()
751 ili->vreg1out = U8_MAX; 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()
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()
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()
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()
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()
901 struct ili9322 *ili = spi_get_drvdata(spi); in ili9322_remove() local
903 ili9322_power_off(ili); in ili9322_remove()
904 drm_panel_remove(&ili->panel); in ili9322_remove()