18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* drivers/video/backlight/ili9320.h 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * ILI9320 LCD controller driver core. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright 2007 Simtec Electronics 78c2ecf20Sopenharmony_ci * Ben Dooks <ben@simtec.co.uk> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * http://armlinux.simtec.co.uk/ 108c2ecf20Sopenharmony_ci*/ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/* Holder for register and value pairs. */ 138c2ecf20Sopenharmony_cistruct ili9320_reg { 148c2ecf20Sopenharmony_ci unsigned short address; 158c2ecf20Sopenharmony_ci unsigned short value; 168c2ecf20Sopenharmony_ci}; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_cistruct ili9320; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cistruct ili9320_client { 218c2ecf20Sopenharmony_ci const char *name; 228c2ecf20Sopenharmony_ci int (*init)(struct ili9320 *ili, struct ili9320_platdata *cfg); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci/* Device attached via an SPI bus. */ 268c2ecf20Sopenharmony_cistruct ili9320_spi { 278c2ecf20Sopenharmony_ci struct spi_device *dev; 288c2ecf20Sopenharmony_ci struct spi_message message; 298c2ecf20Sopenharmony_ci struct spi_transfer xfer[2]; 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci unsigned char id; 328c2ecf20Sopenharmony_ci unsigned char buffer_addr[4]; 338c2ecf20Sopenharmony_ci unsigned char buffer_data[4]; 348c2ecf20Sopenharmony_ci}; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* ILI9320 device state. */ 378c2ecf20Sopenharmony_cistruct ili9320 { 388c2ecf20Sopenharmony_ci union { 398c2ecf20Sopenharmony_ci struct ili9320_spi spi; /* SPI attachged device. */ 408c2ecf20Sopenharmony_ci } access; /* Register access method. */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci struct device *dev; 438c2ecf20Sopenharmony_ci struct lcd_device *lcd; /* LCD device we created. */ 448c2ecf20Sopenharmony_ci struct ili9320_client *client; 458c2ecf20Sopenharmony_ci struct ili9320_platdata *platdata; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci int power; /* current power state. */ 488c2ecf20Sopenharmony_ci int initialised; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci unsigned short display1; 518c2ecf20Sopenharmony_ci unsigned short power1; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci int (*write)(struct ili9320 *ili, unsigned int reg, unsigned int val); 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* ILI9320 register access routines */ 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciextern int ili9320_write(struct ili9320 *ili, 608c2ecf20Sopenharmony_ci unsigned int reg, unsigned int value); 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciextern int ili9320_write_regs(struct ili9320 *ili, 638c2ecf20Sopenharmony_ci const struct ili9320_reg *values, 648c2ecf20Sopenharmony_ci int nr_values); 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* Device probe */ 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciextern int ili9320_probe_spi(struct spi_device *spi, 698c2ecf20Sopenharmony_ci struct ili9320_client *cli); 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ciextern int ili9320_remove(struct ili9320 *lcd); 728c2ecf20Sopenharmony_ciextern void ili9320_shutdown(struct ili9320 *lcd); 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* PM */ 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ciextern int ili9320_suspend(struct ili9320 *lcd); 778c2ecf20Sopenharmony_ciextern int ili9320_resume(struct ili9320 *lcd); 78