• Home
  • Raw
  • Download

Lines Matching refs:lcd

57 static void ld9040_regulator_enable(struct ld9040 *lcd)  in ld9040_regulator_enable()  argument
62 pd = lcd->lcd_pd; in ld9040_regulator_enable()
63 mutex_lock(&lcd->lock); in ld9040_regulator_enable()
64 if (!lcd->enabled) { in ld9040_regulator_enable()
69 lcd->enabled = true; in ld9040_regulator_enable()
73 mutex_unlock(&lcd->lock); in ld9040_regulator_enable()
76 static void ld9040_regulator_disable(struct ld9040 *lcd) in ld9040_regulator_disable() argument
80 mutex_lock(&lcd->lock); in ld9040_regulator_disable()
81 if (lcd->enabled) { in ld9040_regulator_disable()
86 lcd->enabled = false; in ld9040_regulator_disable()
89 mutex_unlock(&lcd->lock); in ld9040_regulator_disable()
426 static int ld9040_spi_write_byte(struct ld9040 *lcd, int addr, int data) in ld9040_spi_write_byte() argument
441 return spi_sync(lcd->spi, &msg); in ld9040_spi_write_byte()
444 static int ld9040_spi_write(struct ld9040 *lcd, unsigned char address, in ld9040_spi_write() argument
450 ret = ld9040_spi_write_byte(lcd, 0x0, address); in ld9040_spi_write()
452 ret = ld9040_spi_write_byte(lcd, 0x1, command); in ld9040_spi_write()
457 static int ld9040_panel_send_sequence(struct ld9040 *lcd, in ld9040_panel_send_sequence() argument
464 ret = ld9040_spi_write(lcd, wbuf[i], wbuf[i+1]); in ld9040_panel_send_sequence()
476 static int _ld9040_gamma_ctl(struct ld9040 *lcd, const unsigned int *gamma) in _ld9040_gamma_ctl() argument
482 ret = ld9040_panel_send_sequence(lcd, seq_gamma_start); in _ld9040_gamma_ctl()
484 dev_err(lcd->dev, "failed to disable gamma table updating.\n"); in _ld9040_gamma_ctl()
489 ret = ld9040_spi_write(lcd, DATA_ONLY, gamma[i]); in _ld9040_gamma_ctl()
491 dev_err(lcd->dev, "failed to set gamma table.\n"); in _ld9040_gamma_ctl()
497 ret = ld9040_panel_send_sequence(lcd, seq_gamma_ctrl); in _ld9040_gamma_ctl()
499 dev_err(lcd->dev, "failed to update gamma table.\n"); in _ld9040_gamma_ctl()
505 static int ld9040_gamma_ctl(struct ld9040 *lcd, int gamma) in ld9040_gamma_ctl() argument
507 return _ld9040_gamma_ctl(lcd, gamma_table.gamma_22_table[gamma]); in ld9040_gamma_ctl()
510 static int ld9040_ldi_init(struct ld9040 *lcd) in ld9040_ldi_init() argument
526 ret = ld9040_panel_send_sequence(lcd, init_seq[i]); in ld9040_ldi_init()
536 static int ld9040_ldi_enable(struct ld9040 *lcd) in ld9040_ldi_enable() argument
538 return ld9040_panel_send_sequence(lcd, seq_display_on); in ld9040_ldi_enable()
541 static int ld9040_ldi_disable(struct ld9040 *lcd) in ld9040_ldi_disable() argument
545 ret = ld9040_panel_send_sequence(lcd, seq_display_off); in ld9040_ldi_disable()
546 ret = ld9040_panel_send_sequence(lcd, seq_sleep_in); in ld9040_ldi_disable()
556 static int ld9040_power_on(struct ld9040 *lcd) in ld9040_power_on() argument
561 pd = lcd->lcd_pd; in ld9040_power_on()
564 ld9040_regulator_enable(lcd); in ld9040_power_on()
567 dev_err(lcd->dev, "reset is NULL.\n"); in ld9040_power_on()
570 pd->reset(lcd->ld); in ld9040_power_on()
574 ret = ld9040_ldi_init(lcd); in ld9040_power_on()
576 dev_err(lcd->dev, "failed to initialize ldi.\n"); in ld9040_power_on()
580 ret = ld9040_ldi_enable(lcd); in ld9040_power_on()
582 dev_err(lcd->dev, "failed to enable ldi.\n"); in ld9040_power_on()
589 static int ld9040_power_off(struct ld9040 *lcd) in ld9040_power_off() argument
594 pd = lcd->lcd_pd; in ld9040_power_off()
596 ret = ld9040_ldi_disable(lcd); in ld9040_power_off()
598 dev_err(lcd->dev, "lcd setting failed.\n"); in ld9040_power_off()
605 ld9040_regulator_disable(lcd); in ld9040_power_off()
610 static int ld9040_power(struct ld9040 *lcd, int power) in ld9040_power() argument
614 if (ld9040_power_is_on(power) && !ld9040_power_is_on(lcd->power)) in ld9040_power()
615 ret = ld9040_power_on(lcd); in ld9040_power()
616 else if (!ld9040_power_is_on(power) && ld9040_power_is_on(lcd->power)) in ld9040_power()
617 ret = ld9040_power_off(lcd); in ld9040_power()
620 lcd->power = power; in ld9040_power()
627 struct ld9040 *lcd = lcd_get_data(ld); in ld9040_set_power() local
631 dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); in ld9040_set_power()
635 return ld9040_power(lcd, power); in ld9040_set_power()
640 struct ld9040 *lcd = lcd_get_data(ld); in ld9040_get_power() local
642 return lcd->power; in ld9040_get_power()
653 struct ld9040 *lcd = bl_get_data(bd); in ld9040_set_brightness() local
662 ret = ld9040_gamma_ctl(lcd, bd->props.brightness); in ld9040_set_brightness()
684 struct ld9040 *lcd = NULL; in ld9040_probe() local
689 lcd = devm_kzalloc(&spi->dev, sizeof(struct ld9040), GFP_KERNEL); in ld9040_probe()
690 if (!lcd) in ld9040_probe()
702 lcd->spi = spi; in ld9040_probe()
703 lcd->dev = &spi->dev; in ld9040_probe()
705 lcd->lcd_pd = spi->dev.platform_data; in ld9040_probe()
706 if (!lcd->lcd_pd) { in ld9040_probe()
711 mutex_init(&lcd->lock); in ld9040_probe()
713 ret = devm_regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies); in ld9040_probe()
715 dev_err(lcd->dev, "Failed to get regulators: %d\n", ret); in ld9040_probe()
719 ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops); in ld9040_probe()
723 lcd->ld = ld; in ld9040_probe()
730 lcd, &ld9040_backlight_ops, &props); in ld9040_probe()
737 lcd->bd = bd; in ld9040_probe()
743 if (!lcd->lcd_pd->lcd_enabled) { in ld9040_probe()
749 lcd->power = FB_BLANK_POWERDOWN; in ld9040_probe()
751 ld9040_power(lcd, FB_BLANK_UNBLANK); in ld9040_probe()
753 lcd->power = FB_BLANK_UNBLANK; in ld9040_probe()
756 spi_set_drvdata(spi, lcd); in ld9040_probe()
762 lcd_device_unregister(lcd->ld); in ld9040_probe()
769 struct ld9040 *lcd = spi_get_drvdata(spi); in ld9040_remove() local
771 ld9040_power(lcd, FB_BLANK_POWERDOWN); in ld9040_remove()
772 backlight_device_unregister(lcd->bd); in ld9040_remove()
773 lcd_device_unregister(lcd->ld); in ld9040_remove()
781 struct ld9040 *lcd = dev_get_drvdata(dev); in ld9040_suspend() local
783 dev_dbg(dev, "lcd->power = %d\n", lcd->power); in ld9040_suspend()
789 return ld9040_power(lcd, FB_BLANK_POWERDOWN); in ld9040_suspend()
794 struct ld9040 *lcd = dev_get_drvdata(dev); in ld9040_resume() local
796 lcd->power = FB_BLANK_POWERDOWN; in ld9040_resume()
798 return ld9040_power(lcd, FB_BLANK_UNBLANK); in ld9040_resume()
807 struct ld9040 *lcd = spi_get_drvdata(spi); in ld9040_shutdown() local
809 ld9040_power(lcd, FB_BLANK_POWERDOWN); in ld9040_shutdown()