Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Ben Dooks | cccb6d3 | 2008-07-23 21:31:37 -0700 | [diff] [blame] | 2 | /* drivers/video/backlight/ili9320.h |
| 3 | * |
| 4 | * ILI9320 LCD controller driver core. |
| 5 | * |
| 6 | * Copyright 2007 Simtec Electronics |
| 7 | * Ben Dooks <ben@simtec.co.uk> |
| 8 | * |
| 9 | * http://armlinux.simtec.co.uk/ |
Ben Dooks | cccb6d3 | 2008-07-23 21:31:37 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | /* Holder for register and value pairs. */ |
| 13 | struct ili9320_reg { |
| 14 | unsigned short address; |
| 15 | unsigned short value; |
| 16 | }; |
| 17 | |
| 18 | struct ili9320; |
| 19 | |
| 20 | struct ili9320_client { |
| 21 | const char *name; |
| 22 | int (*init)(struct ili9320 *ili, struct ili9320_platdata *cfg); |
| 23 | |
| 24 | }; |
| 25 | /* Device attached via an SPI bus. */ |
| 26 | struct ili9320_spi { |
| 27 | struct spi_device *dev; |
| 28 | struct spi_message message; |
| 29 | struct spi_transfer xfer[2]; |
| 30 | |
| 31 | unsigned char id; |
| 32 | unsigned char buffer_addr[4]; |
| 33 | unsigned char buffer_data[4]; |
| 34 | }; |
| 35 | |
| 36 | /* ILI9320 device state. */ |
| 37 | struct ili9320 { |
| 38 | union { |
| 39 | struct ili9320_spi spi; /* SPI attachged device. */ |
| 40 | } access; /* Register access method. */ |
| 41 | |
| 42 | struct device *dev; |
| 43 | struct lcd_device *lcd; /* LCD device we created. */ |
| 44 | struct ili9320_client *client; |
| 45 | struct ili9320_platdata *platdata; |
| 46 | |
| 47 | int power; /* current power state. */ |
| 48 | int initialised; |
| 49 | |
| 50 | unsigned short display1; |
| 51 | unsigned short power1; |
| 52 | |
| 53 | int (*write)(struct ili9320 *ili, unsigned int reg, unsigned int val); |
| 54 | }; |
| 55 | |
| 56 | |
| 57 | /* ILI9320 register access routines */ |
| 58 | |
| 59 | extern int ili9320_write(struct ili9320 *ili, |
| 60 | unsigned int reg, unsigned int value); |
| 61 | |
| 62 | extern int ili9320_write_regs(struct ili9320 *ili, |
Jingoo Han | 3fd0043 | 2012-12-17 16:00:54 -0800 | [diff] [blame] | 63 | const struct ili9320_reg *values, |
Ben Dooks | cccb6d3 | 2008-07-23 21:31:37 -0700 | [diff] [blame] | 64 | int nr_values); |
| 65 | |
| 66 | /* Device probe */ |
| 67 | |
| 68 | extern int ili9320_probe_spi(struct spi_device *spi, |
| 69 | struct ili9320_client *cli); |
| 70 | |
Uwe Kleine-König | 3976e97 | 2021-10-19 14:09:27 +0200 | [diff] [blame] | 71 | extern void ili9320_remove(struct ili9320 *lcd); |
Ben Dooks | cccb6d3 | 2008-07-23 21:31:37 -0700 | [diff] [blame] | 72 | extern void ili9320_shutdown(struct ili9320 *lcd); |
| 73 | |
| 74 | /* PM */ |
| 75 | |
Jingoo Han | eb39ad2 | 2013-04-29 16:18:01 -0700 | [diff] [blame] | 76 | extern int ili9320_suspend(struct ili9320 *lcd); |
Ben Dooks | cccb6d3 | 2008-07-23 21:31:37 -0700 | [diff] [blame] | 77 | extern int ili9320_resume(struct ili9320 *lcd); |