Lines Matching full:lcd
3 * lms501kf03 TFT LCD panel driver.
12 #include <linux/lcd.h>
103 static int lms501kf03_spi_write_byte(struct lms501kf03 *lcd, int addr, int data) in lms501kf03_spi_write_byte() argument
118 return spi_sync(lcd->spi, &msg); in lms501kf03_spi_write_byte()
121 static int lms501kf03_spi_write(struct lms501kf03 *lcd, unsigned char address, in lms501kf03_spi_write() argument
124 return lms501kf03_spi_write_byte(lcd, address, command); in lms501kf03_spi_write()
127 static int lms501kf03_panel_send_sequence(struct lms501kf03 *lcd, in lms501kf03_panel_send_sequence() argument
135 ret = lms501kf03_spi_write(lcd, COMMAND_ONLY, wbuf[i]); in lms501kf03_panel_send_sequence()
137 ret = lms501kf03_spi_write(lcd, DATA_ONLY, wbuf[i]); in lms501kf03_panel_send_sequence()
146 static int lms501kf03_ldi_init(struct lms501kf03 *lcd) in lms501kf03_ldi_init() argument
180 ret = lms501kf03_panel_send_sequence(lcd, init_seq[i], in lms501kf03_ldi_init()
195 static int lms501kf03_ldi_enable(struct lms501kf03 *lcd) in lms501kf03_ldi_enable() argument
197 return lms501kf03_panel_send_sequence(lcd, seq_display_on, in lms501kf03_ldi_enable()
201 static int lms501kf03_ldi_disable(struct lms501kf03 *lcd) in lms501kf03_ldi_disable() argument
203 return lms501kf03_panel_send_sequence(lcd, seq_display_off, in lms501kf03_ldi_disable()
212 static int lms501kf03_power_on(struct lms501kf03 *lcd) in lms501kf03_power_on() argument
217 pd = lcd->lcd_pd; in lms501kf03_power_on()
220 dev_err(lcd->dev, "power_on is NULL.\n"); in lms501kf03_power_on()
224 pd->power_on(lcd->ld, 1); in lms501kf03_power_on()
228 dev_err(lcd->dev, "reset is NULL.\n"); in lms501kf03_power_on()
232 pd->reset(lcd->ld); in lms501kf03_power_on()
235 ret = lms501kf03_ldi_init(lcd); in lms501kf03_power_on()
237 dev_err(lcd->dev, "failed to initialize ldi.\n"); in lms501kf03_power_on()
241 ret = lms501kf03_ldi_enable(lcd); in lms501kf03_power_on()
243 dev_err(lcd->dev, "failed to enable ldi.\n"); in lms501kf03_power_on()
250 static int lms501kf03_power_off(struct lms501kf03 *lcd) in lms501kf03_power_off() argument
255 pd = lcd->lcd_pd; in lms501kf03_power_off()
257 ret = lms501kf03_ldi_disable(lcd); in lms501kf03_power_off()
259 dev_err(lcd->dev, "lcd setting failed.\n"); in lms501kf03_power_off()
265 pd->power_on(lcd->ld, 0); in lms501kf03_power_off()
270 static int lms501kf03_power(struct lms501kf03 *lcd, int power) in lms501kf03_power() argument
275 !lms501kf03_power_is_on(lcd->power)) in lms501kf03_power()
276 ret = lms501kf03_power_on(lcd); in lms501kf03_power()
278 lms501kf03_power_is_on(lcd->power)) in lms501kf03_power()
279 ret = lms501kf03_power_off(lcd); in lms501kf03_power()
282 lcd->power = power; in lms501kf03_power()
289 struct lms501kf03 *lcd = lcd_get_data(ld); in lms501kf03_get_power() local
291 return lcd->power; in lms501kf03_get_power()
296 struct lms501kf03 *lcd = lcd_get_data(ld); in lms501kf03_set_power() local
300 dev_err(lcd->dev, "power value should be 0, 1 or 4.\n"); in lms501kf03_set_power()
304 return lms501kf03_power(lcd, power); in lms501kf03_set_power()
314 struct lms501kf03 *lcd = NULL; in lms501kf03_probe() local
318 lcd = devm_kzalloc(&spi->dev, sizeof(struct lms501kf03), GFP_KERNEL); in lms501kf03_probe()
319 if (!lcd) in lms501kf03_probe()
322 /* lms501kf03 lcd panel uses 3-wire 9-bit SPI Mode. */ in lms501kf03_probe()
331 lcd->spi = spi; in lms501kf03_probe()
332 lcd->dev = &spi->dev; in lms501kf03_probe()
334 lcd->lcd_pd = dev_get_platdata(&spi->dev); in lms501kf03_probe()
335 if (!lcd->lcd_pd) { in lms501kf03_probe()
340 ld = devm_lcd_device_register(&spi->dev, "lms501kf03", &spi->dev, lcd, in lms501kf03_probe()
345 lcd->ld = ld; in lms501kf03_probe()
347 if (!lcd->lcd_pd->lcd_enabled) { in lms501kf03_probe()
349 * if lcd panel was off from bootloader then in lms501kf03_probe()
350 * current lcd status is powerdown and then in lms501kf03_probe()
351 * it enables lcd panel. in lms501kf03_probe()
353 lcd->power = FB_BLANK_POWERDOWN; in lms501kf03_probe()
355 lms501kf03_power(lcd, FB_BLANK_UNBLANK); in lms501kf03_probe()
357 lcd->power = FB_BLANK_UNBLANK; in lms501kf03_probe()
360 spi_set_drvdata(spi, lcd); in lms501kf03_probe()
369 struct lms501kf03 *lcd = spi_get_drvdata(spi); in lms501kf03_remove() local
371 lms501kf03_power(lcd, FB_BLANK_POWERDOWN); in lms501kf03_remove()
377 struct lms501kf03 *lcd = dev_get_drvdata(dev); in lms501kf03_suspend() local
379 dev_dbg(dev, "lcd->power = %d\n", lcd->power); in lms501kf03_suspend()
382 * when lcd panel is suspend, lcd panel becomes off in lms501kf03_suspend()
385 return lms501kf03_power(lcd, FB_BLANK_POWERDOWN); in lms501kf03_suspend()
390 struct lms501kf03 *lcd = dev_get_drvdata(dev); in lms501kf03_resume() local
392 lcd->power = FB_BLANK_POWERDOWN; in lms501kf03_resume()
394 return lms501kf03_power(lcd, FB_BLANK_UNBLANK); in lms501kf03_resume()
403 struct lms501kf03 *lcd = spi_get_drvdata(spi); in lms501kf03_shutdown() local
405 lms501kf03_power(lcd, FB_BLANK_POWERDOWN); in lms501kf03_shutdown()
421 MODULE_DESCRIPTION("lms501kf03 LCD Driver");