Lines Matching refs:lcd
357 static int s6e63m0_spi_write_byte(struct s6e63m0 *lcd, int addr, int data) in s6e63m0_spi_write_byte() argument
372 return spi_sync(lcd->spi, &msg); in s6e63m0_spi_write_byte()
375 static int s6e63m0_spi_write(struct s6e63m0 *lcd, unsigned char address, in s6e63m0_spi_write() argument
381 ret = s6e63m0_spi_write_byte(lcd, 0x0, address); in s6e63m0_spi_write()
383 ret = s6e63m0_spi_write_byte(lcd, 0x1, command); in s6e63m0_spi_write()
388 static int s6e63m0_panel_send_sequence(struct s6e63m0 *lcd, in s6e63m0_panel_send_sequence() argument
395 ret = s6e63m0_spi_write(lcd, wbuf[i], wbuf[i+1]); in s6e63m0_panel_send_sequence()
407 static int _s6e63m0_gamma_ctl(struct s6e63m0 *lcd, const unsigned int *gamma) in _s6e63m0_gamma_ctl() argument
413 ret = s6e63m0_spi_write(lcd, 0xfa, 0x00); in _s6e63m0_gamma_ctl()
415 dev_err(lcd->dev, "failed to disable gamma table updating.\n"); in _s6e63m0_gamma_ctl()
420 ret = s6e63m0_spi_write(lcd, DATA_ONLY, gamma[i]); in _s6e63m0_gamma_ctl()
422 dev_err(lcd->dev, "failed to set gamma table.\n"); in _s6e63m0_gamma_ctl()
428 ret = s6e63m0_spi_write(lcd, 0xfa, 0x01); in _s6e63m0_gamma_ctl()
430 dev_err(lcd->dev, "failed to update gamma table.\n"); in _s6e63m0_gamma_ctl()
436 static int s6e63m0_gamma_ctl(struct s6e63m0 *lcd, int gamma) in s6e63m0_gamma_ctl() argument
440 ret = _s6e63m0_gamma_ctl(lcd, gamma_table.gamma_22_table[gamma]); in s6e63m0_gamma_ctl()
446 static int s6e63m0_ldi_init(struct s6e63m0 *lcd) in s6e63m0_ldi_init() argument
459 ret = s6e63m0_panel_send_sequence(lcd, init_seq[i]); in s6e63m0_ldi_init()
467 static int s6e63m0_ldi_enable(struct s6e63m0 *lcd) in s6e63m0_ldi_enable() argument
476 ret = s6e63m0_panel_send_sequence(lcd, enable_seq[i]); in s6e63m0_ldi_enable()
484 static int s6e63m0_ldi_disable(struct s6e63m0 *lcd) in s6e63m0_ldi_disable() argument
488 ret = s6e63m0_panel_send_sequence(lcd, seq_stand_by_on); in s6e63m0_ldi_disable()
498 static int s6e63m0_power_on(struct s6e63m0 *lcd) in s6e63m0_power_on() argument
504 pd = lcd->lcd_pd; in s6e63m0_power_on()
505 bd = lcd->bd; in s6e63m0_power_on()
508 dev_err(lcd->dev, "power_on is NULL.\n"); in s6e63m0_power_on()
511 pd->power_on(lcd->ld, 1); in s6e63m0_power_on()
516 dev_err(lcd->dev, "reset is NULL.\n"); in s6e63m0_power_on()
519 pd->reset(lcd->ld); in s6e63m0_power_on()
523 ret = s6e63m0_ldi_init(lcd); in s6e63m0_power_on()
525 dev_err(lcd->dev, "failed to initialize ldi.\n"); in s6e63m0_power_on()
529 ret = s6e63m0_ldi_enable(lcd); in s6e63m0_power_on()
531 dev_err(lcd->dev, "failed to enable ldi.\n"); in s6e63m0_power_on()
536 ret = s6e63m0_gamma_ctl(lcd, bd->props.brightness); in s6e63m0_power_on()
538 dev_err(lcd->dev, "lcd gamma setting failed.\n"); in s6e63m0_power_on()
545 static int s6e63m0_power_off(struct s6e63m0 *lcd) in s6e63m0_power_off() argument
550 pd = lcd->lcd_pd; in s6e63m0_power_off()
552 ret = s6e63m0_ldi_disable(lcd); in s6e63m0_power_off()
554 dev_err(lcd->dev, "lcd setting failed.\n"); in s6e63m0_power_off()
560 pd->power_on(lcd->ld, 0); in s6e63m0_power_off()
565 static int s6e63m0_power(struct s6e63m0 *lcd, int power) in s6e63m0_power() argument
569 if (s6e63m0_power_is_on(power) && !s6e63m0_power_is_on(lcd->power)) in s6e63m0_power()
570 ret = s6e63m0_power_on(lcd); in s6e63m0_power()
571 else if (!s6e63m0_power_is_on(power) && s6e63m0_power_is_on(lcd->power)) in s6e63m0_power()
572 ret = s6e63m0_power_off(lcd); in s6e63m0_power()
575 lcd->power = power; in s6e63m0_power()
582 struct s6e63m0 *lcd = lcd_get_data(ld); in s6e63m0_set_power() local
586 dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); in s6e63m0_set_power()
590 return s6e63m0_power(lcd, power); in s6e63m0_set_power()
595 struct s6e63m0 *lcd = lcd_get_data(ld); in s6e63m0_get_power() local
597 return lcd->power; in s6e63m0_get_power()
608 struct s6e63m0 *lcd = bl_get_data(bd); in s6e63m0_set_brightness() local
617 ret = s6e63m0_gamma_ctl(lcd, bd->props.brightness); in s6e63m0_set_brightness()
639 struct s6e63m0 *lcd = dev_get_drvdata(dev); in s6e63m0_sysfs_show_gamma_mode() local
642 switch (lcd->gamma_mode) { in s6e63m0_sysfs_show_gamma_mode()
667 struct s6e63m0 *lcd = dev_get_drvdata(dev); in s6e63m0_sysfs_store_gamma_mode() local
671 rc = kstrtouint(buf, 0, &lcd->gamma_mode); in s6e63m0_sysfs_store_gamma_mode()
675 bd = lcd->bd; in s6e63m0_sysfs_store_gamma_mode()
679 switch (lcd->gamma_mode) { in s6e63m0_sysfs_store_gamma_mode()
681 _s6e63m0_gamma_ctl(lcd, gamma_table.gamma_22_table[brightness]); in s6e63m0_sysfs_store_gamma_mode()
684 _s6e63m0_gamma_ctl(lcd, gamma_table.gamma_19_table[brightness]); in s6e63m0_sysfs_store_gamma_mode()
687 _s6e63m0_gamma_ctl(lcd, gamma_table.gamma_17_table[brightness]); in s6e63m0_sysfs_store_gamma_mode()
691 _s6e63m0_gamma_ctl(lcd, gamma_table.gamma_22_table[brightness]); in s6e63m0_sysfs_store_gamma_mode()
703 struct s6e63m0 *lcd = dev_get_drvdata(dev); in s6e63m0_sysfs_show_gamma_table() local
706 sprintf(temp, "%d\n", lcd->gamma_table_count); in s6e63m0_sysfs_show_gamma_table()
717 struct s6e63m0 *lcd = NULL; in s6e63m0_probe() local
722 lcd = devm_kzalloc(&spi->dev, sizeof(struct s6e63m0), GFP_KERNEL); in s6e63m0_probe()
723 if (!lcd) in s6e63m0_probe()
735 lcd->spi = spi; in s6e63m0_probe()
736 lcd->dev = &spi->dev; in s6e63m0_probe()
738 lcd->lcd_pd = spi->dev.platform_data; in s6e63m0_probe()
739 if (!lcd->lcd_pd) { in s6e63m0_probe()
744 ld = lcd_device_register("s6e63m0", &spi->dev, lcd, &s6e63m0_lcd_ops); in s6e63m0_probe()
748 lcd->ld = ld; in s6e63m0_probe()
754 bd = backlight_device_register("s6e63m0bl-bl", &spi->dev, lcd, in s6e63m0_probe()
762 lcd->bd = bd; in s6e63m0_probe()
768 lcd->gamma_table_count = in s6e63m0_probe()
783 if (!lcd->lcd_pd->lcd_enabled) { in s6e63m0_probe()
789 lcd->power = FB_BLANK_POWERDOWN; in s6e63m0_probe()
791 s6e63m0_power(lcd, FB_BLANK_UNBLANK); in s6e63m0_probe()
793 lcd->power = FB_BLANK_UNBLANK; in s6e63m0_probe()
796 spi_set_drvdata(spi, lcd); in s6e63m0_probe()
809 struct s6e63m0 *lcd = spi_get_drvdata(spi); in s6e63m0_remove() local
811 s6e63m0_power(lcd, FB_BLANK_POWERDOWN); in s6e63m0_remove()
814 backlight_device_unregister(lcd->bd); in s6e63m0_remove()
815 lcd_device_unregister(lcd->ld); in s6e63m0_remove()
823 struct s6e63m0 *lcd = dev_get_drvdata(dev); in s6e63m0_suspend() local
825 dev_dbg(dev, "lcd->power = %d\n", lcd->power); in s6e63m0_suspend()
831 return s6e63m0_power(lcd, FB_BLANK_POWERDOWN); in s6e63m0_suspend()
836 struct s6e63m0 *lcd = dev_get_drvdata(dev); in s6e63m0_resume() local
838 lcd->power = FB_BLANK_POWERDOWN; in s6e63m0_resume()
840 return s6e63m0_power(lcd, FB_BLANK_UNBLANK); in s6e63m0_resume()
849 struct s6e63m0 *lcd = spi_get_drvdata(spi); in s6e63m0_shutdown() local
851 s6e63m0_power(lcd, FB_BLANK_POWERDOWN); in s6e63m0_shutdown()