Lines Matching full:lcd
3 * tdo24m - SPI-based drivers for Toppoly TDO24M series LCD panels
16 #include <linux/lcd.h>
33 int (*adj_mode)(struct tdo24m *lcd, int mode);
175 static int tdo24m_writes(struct tdo24m *lcd, const uint32_t *array) in tdo24m_writes() argument
177 struct spi_transfer *x = &lcd->xfer; in tdo24m_writes()
183 if (!lcd->color_invert && *p == CMD0(0x21)) in tdo24m_writes()
191 lcd->buf[0] = (data >> 8) & 0xff; in tdo24m_writes()
192 lcd->buf[1] = data & 0xff; in tdo24m_writes()
195 lcd->buf[0] = (data >> 16) & 0xff; in tdo24m_writes()
196 lcd->buf[1] = (data >> 8) & 0xff; in tdo24m_writes()
197 lcd->buf[2] = data & 0xff; in tdo24m_writes()
200 lcd->buf[0] = (data >> 24) & 0xff; in tdo24m_writes()
201 lcd->buf[1] = (data >> 16) & 0xff; in tdo24m_writes()
202 lcd->buf[2] = (data >> 8) & 0xff; in tdo24m_writes()
203 lcd->buf[3] = data & 0xff; in tdo24m_writes()
209 err = spi_sync(lcd->spi_dev, &lcd->msg); in tdo24m_writes()
217 static int tdo24m_adj_mode(struct tdo24m *lcd, int mode) in tdo24m_adj_mode() argument
221 tdo24m_writes(lcd, lcd_vga_pass_through_tdo24m); in tdo24m_adj_mode()
222 tdo24m_writes(lcd, lcd_panel_config); in tdo24m_adj_mode()
223 tdo24m_writes(lcd, lcd_vga_transfer_tdo24m); in tdo24m_adj_mode()
226 tdo24m_writes(lcd, lcd_qvga_pass_through_tdo24m); in tdo24m_adj_mode()
227 tdo24m_writes(lcd, lcd_panel_config); in tdo24m_adj_mode()
228 tdo24m_writes(lcd, lcd_qvga_transfer); in tdo24m_adj_mode()
234 lcd->mode = mode; in tdo24m_adj_mode()
238 static int tdo35s_adj_mode(struct tdo24m *lcd, int mode) in tdo35s_adj_mode() argument
242 tdo24m_writes(lcd, lcd_vga_pass_through_tdo35s); in tdo35s_adj_mode()
243 tdo24m_writes(lcd, lcd_panel_config); in tdo35s_adj_mode()
244 tdo24m_writes(lcd, lcd_vga_transfer_tdo35s); in tdo35s_adj_mode()
247 tdo24m_writes(lcd, lcd_qvga_pass_through_tdo35s); in tdo35s_adj_mode()
248 tdo24m_writes(lcd, lcd_panel_config); in tdo35s_adj_mode()
249 tdo24m_writes(lcd, lcd_qvga_transfer); in tdo35s_adj_mode()
255 lcd->mode = mode; in tdo35s_adj_mode()
259 static int tdo24m_power_on(struct tdo24m *lcd) in tdo24m_power_on() argument
263 err = tdo24m_writes(lcd, lcd_panel_on); in tdo24m_power_on()
267 err = tdo24m_writes(lcd, lcd_panel_reset); in tdo24m_power_on()
271 err = lcd->adj_mode(lcd, lcd->mode); in tdo24m_power_on()
276 static int tdo24m_power_off(struct tdo24m *lcd) in tdo24m_power_off() argument
278 return tdo24m_writes(lcd, lcd_panel_off); in tdo24m_power_off()
281 static int tdo24m_power(struct tdo24m *lcd, int power) in tdo24m_power() argument
285 if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) in tdo24m_power()
286 ret = tdo24m_power_on(lcd); in tdo24m_power()
287 else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) in tdo24m_power()
288 ret = tdo24m_power_off(lcd); in tdo24m_power()
291 lcd->power = power; in tdo24m_power()
299 struct tdo24m *lcd = lcd_get_data(ld); in tdo24m_set_power() local
301 return tdo24m_power(lcd, power); in tdo24m_set_power()
306 struct tdo24m *lcd = lcd_get_data(ld); in tdo24m_get_power() local
308 return lcd->power; in tdo24m_get_power()
313 struct tdo24m *lcd = lcd_get_data(ld); in tdo24m_set_mode() local
319 if (lcd->mode == mode) in tdo24m_set_mode()
322 return lcd->adj_mode(lcd, mode); in tdo24m_set_mode()
333 struct tdo24m *lcd; in tdo24m_probe() local
352 lcd = devm_kzalloc(&spi->dev, sizeof(struct tdo24m), GFP_KERNEL); in tdo24m_probe()
353 if (!lcd) in tdo24m_probe()
356 lcd->spi_dev = spi; in tdo24m_probe()
357 lcd->power = FB_BLANK_POWERDOWN; in tdo24m_probe()
358 lcd->mode = MODE_VGA; /* default to VGA */ in tdo24m_probe()
360 lcd->buf = devm_kzalloc(&spi->dev, TDO24M_SPI_BUFF_SIZE, GFP_KERNEL); in tdo24m_probe()
361 if (lcd->buf == NULL) in tdo24m_probe()
364 m = &lcd->msg; in tdo24m_probe()
365 x = &lcd->xfer; in tdo24m_probe()
370 x->tx_buf = &lcd->buf[0]; in tdo24m_probe()
375 lcd->color_invert = 1; in tdo24m_probe()
376 lcd->adj_mode = tdo24m_adj_mode; in tdo24m_probe()
379 lcd->adj_mode = tdo35s_adj_mode; in tdo24m_probe()
380 lcd->color_invert = 0; in tdo24m_probe()
387 lcd->lcd_dev = devm_lcd_device_register(&spi->dev, "tdo24m", &spi->dev, in tdo24m_probe()
388 lcd, &tdo24m_ops); in tdo24m_probe()
389 if (IS_ERR(lcd->lcd_dev)) in tdo24m_probe()
390 return PTR_ERR(lcd->lcd_dev); in tdo24m_probe()
392 spi_set_drvdata(spi, lcd); in tdo24m_probe()
393 err = tdo24m_power(lcd, FB_BLANK_UNBLANK); in tdo24m_probe()
402 struct tdo24m *lcd = spi_get_drvdata(spi); in tdo24m_remove() local
404 tdo24m_power(lcd, FB_BLANK_POWERDOWN); in tdo24m_remove()
410 struct tdo24m *lcd = dev_get_drvdata(dev); in tdo24m_suspend() local
412 return tdo24m_power(lcd, FB_BLANK_POWERDOWN); in tdo24m_suspend()
417 struct tdo24m *lcd = dev_get_drvdata(dev); in tdo24m_resume() local
419 return tdo24m_power(lcd, FB_BLANK_UNBLANK); in tdo24m_resume()
428 struct tdo24m *lcd = spi_get_drvdata(spi); in tdo24m_shutdown() local
430 tdo24m_power(lcd, FB_BLANK_POWERDOWN); in tdo24m_shutdown()
446 MODULE_DESCRIPTION("Driver for Toppoly TDO24M LCD Panel");