Lines Matching full:lcd

3  * ams369fg06 AMOLED LCD panel driver.
14 #include <linux/lcd.h>
158 static int ams369fg06_spi_write_byte(struct ams369fg06 *lcd, int addr, int data) in ams369fg06_spi_write_byte() argument
173 return spi_sync(lcd->spi, &msg); in ams369fg06_spi_write_byte()
176 static int ams369fg06_spi_write(struct ams369fg06 *lcd, unsigned char address, in ams369fg06_spi_write() argument
182 ret = ams369fg06_spi_write_byte(lcd, 0x70, address); in ams369fg06_spi_write()
184 ret = ams369fg06_spi_write_byte(lcd, 0x72, command); in ams369fg06_spi_write()
189 static int ams369fg06_panel_send_sequence(struct ams369fg06 *lcd, in ams369fg06_panel_send_sequence() argument
196 ret = ams369fg06_spi_write(lcd, wbuf[i], wbuf[i+1]); in ams369fg06_panel_send_sequence()
208 static int _ams369fg06_gamma_ctl(struct ams369fg06 *lcd, in _ams369fg06_gamma_ctl() argument
215 ret = ams369fg06_spi_write(lcd, 0x40 + i, gamma[i]); in _ams369fg06_gamma_ctl()
216 ret = ams369fg06_spi_write(lcd, 0x50 + i, gamma[i+7*1]); in _ams369fg06_gamma_ctl()
217 ret = ams369fg06_spi_write(lcd, 0x60 + i, gamma[i+7*2]); in _ams369fg06_gamma_ctl()
219 dev_err(lcd->dev, "failed to set gamma table.\n"); in _ams369fg06_gamma_ctl()
228 static int ams369fg06_gamma_ctl(struct ams369fg06 *lcd, int brightness) in ams369fg06_gamma_ctl() argument
244 ret = _ams369fg06_gamma_ctl(lcd, gamma_table.gamma_22_table[gamma]); in ams369fg06_gamma_ctl()
249 static int ams369fg06_ldi_init(struct ams369fg06 *lcd) in ams369fg06_ldi_init() argument
258 ret = ams369fg06_panel_send_sequence(lcd, init_seq[i]); in ams369fg06_ldi_init()
266 static int ams369fg06_ldi_enable(struct ams369fg06 *lcd) in ams369fg06_ldi_enable() argument
275 ret = ams369fg06_panel_send_sequence(lcd, init_seq[i]); in ams369fg06_ldi_enable()
283 static int ams369fg06_ldi_disable(struct ams369fg06 *lcd) in ams369fg06_ldi_disable() argument
293 ret = ams369fg06_panel_send_sequence(lcd, init_seq[i]); in ams369fg06_ldi_disable()
306 static int ams369fg06_power_on(struct ams369fg06 *lcd) in ams369fg06_power_on() argument
312 pd = lcd->lcd_pd; in ams369fg06_power_on()
313 bd = lcd->bd; in ams369fg06_power_on()
316 pd->power_on(lcd->ld, 1); in ams369fg06_power_on()
321 dev_err(lcd->dev, "reset is NULL.\n"); in ams369fg06_power_on()
325 pd->reset(lcd->ld); in ams369fg06_power_on()
328 ret = ams369fg06_ldi_init(lcd); in ams369fg06_power_on()
330 dev_err(lcd->dev, "failed to initialize ldi.\n"); in ams369fg06_power_on()
334 ret = ams369fg06_ldi_enable(lcd); in ams369fg06_power_on()
336 dev_err(lcd->dev, "failed to enable ldi.\n"); in ams369fg06_power_on()
341 ret = ams369fg06_gamma_ctl(lcd, bd->props.brightness); in ams369fg06_power_on()
343 dev_err(lcd->dev, "lcd gamma setting failed.\n"); in ams369fg06_power_on()
350 static int ams369fg06_power_off(struct ams369fg06 *lcd) in ams369fg06_power_off() argument
355 pd = lcd->lcd_pd; in ams369fg06_power_off()
357 ret = ams369fg06_ldi_disable(lcd); in ams369fg06_power_off()
359 dev_err(lcd->dev, "lcd setting failed.\n"); in ams369fg06_power_off()
366 pd->power_on(lcd->ld, 0); in ams369fg06_power_off()
371 static int ams369fg06_power(struct ams369fg06 *lcd, int power) in ams369fg06_power() argument
376 !ams369fg06_power_is_on(lcd->power)) in ams369fg06_power()
377 ret = ams369fg06_power_on(lcd); in ams369fg06_power()
379 ams369fg06_power_is_on(lcd->power)) in ams369fg06_power()
380 ret = ams369fg06_power_off(lcd); in ams369fg06_power()
383 lcd->power = power; in ams369fg06_power()
390 struct ams369fg06 *lcd = lcd_get_data(ld); in ams369fg06_get_power() local
392 return lcd->power; in ams369fg06_get_power()
397 struct ams369fg06 *lcd = lcd_get_data(ld); in ams369fg06_set_power() local
401 dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); in ams369fg06_set_power()
405 return ams369fg06_power(lcd, power); in ams369fg06_set_power()
412 struct ams369fg06 *lcd = bl_get_data(bd); in ams369fg06_set_brightness() local
416 dev_err(&bd->dev, "lcd brightness should be %d to %d.\n", in ams369fg06_set_brightness()
421 ret = ams369fg06_gamma_ctl(lcd, bd->props.brightness); in ams369fg06_set_brightness()
423 dev_err(&bd->dev, "lcd brightness setting failed.\n"); in ams369fg06_set_brightness()
442 struct ams369fg06 *lcd = NULL; in ams369fg06_probe() local
447 lcd = devm_kzalloc(&spi->dev, sizeof(struct ams369fg06), GFP_KERNEL); in ams369fg06_probe()
448 if (!lcd) in ams369fg06_probe()
451 /* ams369fg06 lcd panel uses 3-wire 16bits SPI Mode. */ in ams369fg06_probe()
460 lcd->spi = spi; in ams369fg06_probe()
461 lcd->dev = &spi->dev; in ams369fg06_probe()
463 lcd->lcd_pd = dev_get_platdata(&spi->dev); in ams369fg06_probe()
464 if (!lcd->lcd_pd) { in ams369fg06_probe()
469 ld = devm_lcd_device_register(&spi->dev, "ams369fg06", &spi->dev, lcd, in ams369fg06_probe()
474 lcd->ld = ld; in ams369fg06_probe()
481 &spi->dev, lcd, in ams369fg06_probe()
487 lcd->bd = bd; in ams369fg06_probe()
489 if (!lcd->lcd_pd->lcd_enabled) { in ams369fg06_probe()
491 * if lcd panel was off from bootloader then in ams369fg06_probe()
492 * current lcd status is powerdown and then in ams369fg06_probe()
493 * it enables lcd panel. in ams369fg06_probe()
495 lcd->power = FB_BLANK_POWERDOWN; in ams369fg06_probe()
497 ams369fg06_power(lcd, FB_BLANK_UNBLANK); in ams369fg06_probe()
499 lcd->power = FB_BLANK_UNBLANK; in ams369fg06_probe()
502 spi_set_drvdata(spi, lcd); in ams369fg06_probe()
511 struct ams369fg06 *lcd = spi_get_drvdata(spi); in ams369fg06_remove() local
513 ams369fg06_power(lcd, FB_BLANK_POWERDOWN); in ams369fg06_remove()
519 struct ams369fg06 *lcd = dev_get_drvdata(dev); in ams369fg06_suspend() local
521 dev_dbg(dev, "lcd->power = %d\n", lcd->power); in ams369fg06_suspend()
524 * when lcd panel is suspend, lcd panel becomes off in ams369fg06_suspend()
527 return ams369fg06_power(lcd, FB_BLANK_POWERDOWN); in ams369fg06_suspend()
532 struct ams369fg06 *lcd = dev_get_drvdata(dev); in ams369fg06_resume() local
534 lcd->power = FB_BLANK_POWERDOWN; in ams369fg06_resume()
536 return ams369fg06_power(lcd, FB_BLANK_UNBLANK); in ams369fg06_resume()
545 struct ams369fg06 *lcd = spi_get_drvdata(spi); in ams369fg06_shutdown() local
547 ams369fg06_power(lcd, FB_BLANK_POWERDOWN); in ams369fg06_shutdown()
563 MODULE_DESCRIPTION("ams369fg06 LCD Driver");