Lines Matching full:lcd
3 * Power control for Samsung LTV350QV Quarter VGA LCD Panel
11 #include <linux/lcd.h>
37 static int ltv350qv_write_reg(struct ltv350qv *lcd, u8 reg, u16 val) in ltv350qv_write_reg() argument
51 lcd->buffer[0] = LTV_OPC_INDEX; in ltv350qv_write_reg()
52 lcd->buffer[1] = 0x00; in ltv350qv_write_reg()
53 lcd->buffer[2] = reg & 0x7f; in ltv350qv_write_reg()
54 index_xfer.tx_buf = lcd->buffer; in ltv350qv_write_reg()
58 lcd->buffer[4] = LTV_OPC_DATA; in ltv350qv_write_reg()
59 lcd->buffer[5] = val >> 8; in ltv350qv_write_reg()
60 lcd->buffer[6] = val; in ltv350qv_write_reg()
61 value_xfer.tx_buf = lcd->buffer + 4; in ltv350qv_write_reg()
64 return spi_sync(lcd->spi, &msg); in ltv350qv_write_reg()
68 static int ltv350qv_power_on(struct ltv350qv *lcd) in ltv350qv_power_on() argument
73 if (ltv350qv_write_reg(lcd, LTV_PWRCTL1, 0x0000)) in ltv350qv_power_on()
78 if (ltv350qv_write_reg(lcd, LTV_PWRCTL1, LTV_VCOM_DISABLE)) in ltv350qv_power_on()
80 if (ltv350qv_write_reg(lcd, LTV_PWRCTL2, LTV_VCOML_ENABLE)) in ltv350qv_power_on()
84 if (ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_on()
92 ret = ltv350qv_write_reg(lcd, LTV_IFCTL, in ltv350qv_power_on()
94 ret |= ltv350qv_write_reg(lcd, LTV_DATACTL, in ltv350qv_power_on()
97 ret |= ltv350qv_write_reg(lcd, LTV_ENTRY_MODE, in ltv350qv_power_on()
103 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL1, LTV_CLW(3)); in ltv350qv_power_on()
104 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_on()
106 ret |= ltv350qv_write_reg(lcd, LTV_VBP, 0x000a); in ltv350qv_power_on()
107 ret |= ltv350qv_write_reg(lcd, LTV_HBP, 0x0021); in ltv350qv_power_on()
108 ret |= ltv350qv_write_reg(lcd, LTV_SOTCTL, LTV_SDT(3) | LTV_EQ(0)); in ltv350qv_power_on()
109 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(0), 0x0103); in ltv350qv_power_on()
110 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(1), 0x0301); in ltv350qv_power_on()
111 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(2), 0x1f0f); in ltv350qv_power_on()
112 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(3), 0x1f0f); in ltv350qv_power_on()
113 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(4), 0x0707); in ltv350qv_power_on()
114 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(5), 0x0307); in ltv350qv_power_on()
115 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(6), 0x0707); in ltv350qv_power_on()
116 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(7), 0x0000); in ltv350qv_power_on()
117 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(8), 0x0004); in ltv350qv_power_on()
118 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(9), 0x0000); in ltv350qv_power_on()
126 ret = ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_on()
130 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_on()
144 ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_on()
147 ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_on()
152 ltv350qv_write_reg(lcd, LTV_PWRCTL2, 0x0000); in ltv350qv_power_on()
155 ltv350qv_write_reg(lcd, LTV_PWRCTL1, LTV_VCOM_DISABLE); in ltv350qv_power_on()
159 static int ltv350qv_power_off(struct ltv350qv *lcd) in ltv350qv_power_off() argument
164 ret = ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_off()
168 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_off()
172 ret |= ltv350qv_write_reg(lcd, LTV_PWRCTL2, 0x0000); in ltv350qv_power_off()
178 ret |= ltv350qv_write_reg(lcd, LTV_PWRCTL1, LTV_VCOM_DISABLE); in ltv350qv_power_off()
192 static int ltv350qv_power(struct ltv350qv *lcd, int power) in ltv350qv_power() argument
196 if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) in ltv350qv_power()
197 ret = ltv350qv_power_on(lcd); in ltv350qv_power()
198 else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) in ltv350qv_power()
199 ret = ltv350qv_power_off(lcd); in ltv350qv_power()
202 lcd->power = power; in ltv350qv_power()
209 struct ltv350qv *lcd = lcd_get_data(ld); in ltv350qv_set_power() local
211 return ltv350qv_power(lcd, power); in ltv350qv_set_power()
216 struct ltv350qv *lcd = lcd_get_data(ld); in ltv350qv_get_power() local
218 return lcd->power; in ltv350qv_get_power()
228 struct ltv350qv *lcd; in ltv350qv_probe() local
232 lcd = devm_kzalloc(&spi->dev, sizeof(struct ltv350qv), GFP_KERNEL); in ltv350qv_probe()
233 if (!lcd) in ltv350qv_probe()
236 lcd->spi = spi; in ltv350qv_probe()
237 lcd->power = FB_BLANK_POWERDOWN; in ltv350qv_probe()
238 lcd->buffer = devm_kzalloc(&spi->dev, 8, GFP_KERNEL); in ltv350qv_probe()
239 if (!lcd->buffer) in ltv350qv_probe()
242 ld = devm_lcd_device_register(&spi->dev, "ltv350qv", &spi->dev, lcd, in ltv350qv_probe()
247 lcd->ld = ld; in ltv350qv_probe()
249 ret = ltv350qv_power(lcd, FB_BLANK_UNBLANK); in ltv350qv_probe()
253 spi_set_drvdata(spi, lcd); in ltv350qv_probe()
260 struct ltv350qv *lcd = spi_get_drvdata(spi); in ltv350qv_remove() local
262 ltv350qv_power(lcd, FB_BLANK_POWERDOWN); in ltv350qv_remove()
269 struct ltv350qv *lcd = dev_get_drvdata(dev); in ltv350qv_suspend() local
271 return ltv350qv_power(lcd, FB_BLANK_POWERDOWN); in ltv350qv_suspend()
276 struct ltv350qv *lcd = dev_get_drvdata(dev); in ltv350qv_resume() local
278 return ltv350qv_power(lcd, FB_BLANK_UNBLANK); in ltv350qv_resume()
287 struct ltv350qv *lcd = spi_get_drvdata(spi); in ltv350qv_shutdown() local
289 ltv350qv_power(lcd, FB_BLANK_POWERDOWN); in ltv350qv_shutdown()
306 MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver");