Lines Matching full:lcd
3 * Power control for Samsung LTV350QV Quarter VGA LCD Panel
11 #include <linux/lcd.h>
36 static int ltv350qv_write_reg(struct ltv350qv *lcd, u8 reg, u16 val) in ltv350qv_write_reg() argument
50 lcd->buffer[0] = LTV_OPC_INDEX; in ltv350qv_write_reg()
51 lcd->buffer[1] = 0x00; in ltv350qv_write_reg()
52 lcd->buffer[2] = reg & 0x7f; in ltv350qv_write_reg()
53 index_xfer.tx_buf = lcd->buffer; in ltv350qv_write_reg()
57 lcd->buffer[4] = LTV_OPC_DATA; in ltv350qv_write_reg()
58 lcd->buffer[5] = val >> 8; in ltv350qv_write_reg()
59 lcd->buffer[6] = val; in ltv350qv_write_reg()
60 value_xfer.tx_buf = lcd->buffer + 4; in ltv350qv_write_reg()
63 return spi_sync(lcd->spi, &msg); in ltv350qv_write_reg()
67 static int ltv350qv_power_on(struct ltv350qv *lcd) in ltv350qv_power_on() argument
72 if (ltv350qv_write_reg(lcd, LTV_PWRCTL1, 0x0000)) in ltv350qv_power_on()
77 if (ltv350qv_write_reg(lcd, LTV_PWRCTL1, LTV_VCOM_DISABLE)) in ltv350qv_power_on()
79 if (ltv350qv_write_reg(lcd, LTV_PWRCTL2, LTV_VCOML_ENABLE)) in ltv350qv_power_on()
83 if (ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_on()
91 ret = ltv350qv_write_reg(lcd, LTV_IFCTL, in ltv350qv_power_on()
93 ret |= ltv350qv_write_reg(lcd, LTV_DATACTL, in ltv350qv_power_on()
96 ret |= ltv350qv_write_reg(lcd, LTV_ENTRY_MODE, in ltv350qv_power_on()
102 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL1, LTV_CLW(3)); in ltv350qv_power_on()
103 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_on()
105 ret |= ltv350qv_write_reg(lcd, LTV_VBP, 0x000a); in ltv350qv_power_on()
106 ret |= ltv350qv_write_reg(lcd, LTV_HBP, 0x0021); in ltv350qv_power_on()
107 ret |= ltv350qv_write_reg(lcd, LTV_SOTCTL, LTV_SDT(3) | LTV_EQ(0)); in ltv350qv_power_on()
108 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(0), 0x0103); in ltv350qv_power_on()
109 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(1), 0x0301); in ltv350qv_power_on()
110 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(2), 0x1f0f); in ltv350qv_power_on()
111 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(3), 0x1f0f); in ltv350qv_power_on()
112 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(4), 0x0707); in ltv350qv_power_on()
113 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(5), 0x0307); in ltv350qv_power_on()
114 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(6), 0x0707); in ltv350qv_power_on()
115 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(7), 0x0000); in ltv350qv_power_on()
116 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(8), 0x0004); in ltv350qv_power_on()
117 ret |= ltv350qv_write_reg(lcd, LTV_GAMMA(9), 0x0000); in ltv350qv_power_on()
125 ret = ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_on()
129 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_on()
143 ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_on()
146 ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_on()
151 ltv350qv_write_reg(lcd, LTV_PWRCTL2, 0x0000); in ltv350qv_power_on()
154 ltv350qv_write_reg(lcd, LTV_PWRCTL1, LTV_VCOM_DISABLE); in ltv350qv_power_on()
158 static int ltv350qv_power_off(struct ltv350qv *lcd) in ltv350qv_power_off() argument
163 ret = ltv350qv_write_reg(lcd, LTV_PWRCTL1, in ltv350qv_power_off()
167 ret |= ltv350qv_write_reg(lcd, LTV_GATECTL2, in ltv350qv_power_off()
171 ret |= ltv350qv_write_reg(lcd, LTV_PWRCTL2, 0x0000); in ltv350qv_power_off()
177 ret |= ltv350qv_write_reg(lcd, LTV_PWRCTL1, LTV_VCOM_DISABLE); in ltv350qv_power_off()
191 static int ltv350qv_power(struct ltv350qv *lcd, int power) in ltv350qv_power() argument
195 if (POWER_IS_ON(power) && !POWER_IS_ON(lcd->power)) in ltv350qv_power()
196 ret = ltv350qv_power_on(lcd); in ltv350qv_power()
197 else if (!POWER_IS_ON(power) && POWER_IS_ON(lcd->power)) in ltv350qv_power()
198 ret = ltv350qv_power_off(lcd); in ltv350qv_power()
201 lcd->power = power; in ltv350qv_power()
208 struct ltv350qv *lcd = lcd_get_data(ld); in ltv350qv_set_power() local
210 return ltv350qv_power(lcd, power); in ltv350qv_set_power()
215 struct ltv350qv *lcd = lcd_get_data(ld); in ltv350qv_get_power() local
217 return lcd->power; in ltv350qv_get_power()
227 struct ltv350qv *lcd; in ltv350qv_probe() local
231 lcd = devm_kzalloc(&spi->dev, sizeof(struct ltv350qv), GFP_KERNEL); in ltv350qv_probe()
232 if (!lcd) in ltv350qv_probe()
235 lcd->spi = spi; in ltv350qv_probe()
236 lcd->power = FB_BLANK_POWERDOWN; in ltv350qv_probe()
237 lcd->buffer = devm_kzalloc(&spi->dev, 8, GFP_KERNEL); in ltv350qv_probe()
238 if (!lcd->buffer) in ltv350qv_probe()
241 ld = devm_lcd_device_register(&spi->dev, "ltv350qv", &spi->dev, lcd, in ltv350qv_probe()
246 lcd->ld = ld; in ltv350qv_probe()
248 ret = ltv350qv_power(lcd, FB_BLANK_UNBLANK); in ltv350qv_probe()
252 spi_set_drvdata(spi, lcd); in ltv350qv_probe()
259 struct ltv350qv *lcd = spi_get_drvdata(spi); in ltv350qv_remove() local
261 ltv350qv_power(lcd, FB_BLANK_POWERDOWN); in ltv350qv_remove()
267 struct ltv350qv *lcd = dev_get_drvdata(dev); in ltv350qv_suspend() local
269 return ltv350qv_power(lcd, FB_BLANK_POWERDOWN); in ltv350qv_suspend()
274 struct ltv350qv *lcd = dev_get_drvdata(dev); in ltv350qv_resume() local
276 return ltv350qv_power(lcd, FB_BLANK_UNBLANK); in ltv350qv_resume()
285 struct ltv350qv *lcd = spi_get_drvdata(spi); in ltv350qv_shutdown() local
287 ltv350qv_power(lcd, FB_BLANK_POWERDOWN); in ltv350qv_shutdown()
304 MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver");