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