19 #include <linux/module.h>
20 #include <linux/slab.h>
29 static inline int ili9320_write_spi(
struct ili9320 *ili,
56 dev_dbg(ili->
dev,
"write: reg=%02x, val=%04x\n", reg, value);
57 return ili->
write(ili, reg, value);
69 for (index = 0; index < nr_values; index++, values++) {
94 static inline int ili9320_init_chip(
struct ili9320 *lcd)
102 dev_err(lcd->
dev,
"failed to initialise display\n");
110 static inline int ili9320_power_on(
struct ili9320 *lcd)
113 ili9320_init_chip(lcd);
121 static inline int ili9320_power_off(
struct ili9320 *lcd)
129 #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL)
131 static int ili9320_power(
struct ili9320 *lcd,
int power)
138 ret = ili9320_power_on(lcd);
140 ret = ili9320_power_off(lcd);
145 dev_warn(lcd->
dev,
"failed to set power mode %d\n", power);
152 return lcd_get_data(lcd);
157 struct ili9320 *lcd = to_our_lcd(ld);
159 return ili9320_power(lcd, power);
164 struct ili9320 *lcd = to_our_lcd(ld);
169 static struct lcd_ops ili9320_ops = {
170 .get_power = ili9320_get_power,
171 .set_power = ili9320_set_power,
179 ili->
write = ili9320_write_spi;
189 spi->
xfer[0].len = 3;
190 spi->
xfer[1].len = 3;
191 spi->
xfer[0].bits_per_word = 8;
192 spi->
xfer[1].bits_per_word = 8;
193 spi->
xfer[0].cs_change = 1;
195 spi_message_init(&spi->
message);
196 spi_message_add_tail(&spi->
xfer[0], &spi->
message);
197 spi_message_add_tail(&spi->
xfer[1], &spi->
message);
212 dev_err(dev,
"no platform data supplied\n");
217 dev_err(dev,
"invalid platform data supplied\n");
225 dev_err(dev,
"no memory for device\n");
238 ili9320_setup_spi(ili, spi);
242 dev_err(dev,
"failed to register lcd device\n");
252 dev_err(dev,
"failed to set lcd power state\n");