Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / video / backlight / ili9320.h
1 /* drivers/video/backlight/ili9320.h
2  *
3  * ILI9320 LCD controller driver core.
4  *
5  * Copyright 2007 Simtec Electronics
6  *      Ben Dooks <ben@simtec.co.uk>
7  *
8  * http://armlinux.simtec.co.uk/
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13 */
14
15 /* Holder for register and value pairs. */
16 struct ili9320_reg {
17         unsigned short          address;
18         unsigned short          value;
19 };
20
21 struct ili9320;
22
23 struct ili9320_client {
24         const char      *name;
25         int     (*init)(struct ili9320 *ili, struct ili9320_platdata *cfg);
26
27 };
28 /* Device attached via an SPI bus. */
29 struct  ili9320_spi {
30         struct spi_device       *dev;
31         struct spi_message      message;
32         struct spi_transfer     xfer[2];
33
34         unsigned char           id;
35         unsigned char           buffer_addr[4];
36         unsigned char           buffer_data[4];
37 };
38
39 /* ILI9320 device state. */
40 struct ili9320 {
41         union {
42                 struct ili9320_spi      spi;    /* SPI attachged device. */
43         } access;                               /* Register access method. */
44
45         struct device                   *dev;
46         struct lcd_device               *lcd;   /* LCD device we created. */
47         struct ili9320_client           *client;
48         struct ili9320_platdata         *platdata;
49
50         int                              power; /* current power state. */
51         int                              initialised;
52
53         unsigned short                   display1;
54         unsigned short                   power1;
55
56         int (*write)(struct ili9320 *ili, unsigned int reg, unsigned int val);
57 };
58
59
60 /* ILI9320 register access routines */
61
62 extern int ili9320_write(struct ili9320 *ili,
63                          unsigned int reg, unsigned int value);
64
65 extern int ili9320_write_regs(struct ili9320 *ili,
66                               const struct ili9320_reg *values,
67                               int nr_values);
68
69 /* Device probe */
70
71 extern int ili9320_probe_spi(struct spi_device *spi,
72                              struct ili9320_client *cli);
73
74 extern int ili9320_remove(struct ili9320 *lcd);
75 extern void ili9320_shutdown(struct ili9320 *lcd);
76
77 /* PM */
78
79 extern int ili9320_suspend(struct ili9320 *lcd);
80 extern int ili9320_resume(struct ili9320 *lcd);