ili9320.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  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/
  10. */
  11. /* Holder for register and value pairs. */
  12. struct ili9320_reg {
  13. unsigned short address;
  14. unsigned short value;
  15. };
  16. struct ili9320;
  17. struct ili9320_client {
  18. const char *name;
  19. int (*init)(struct ili9320 *ili, struct ili9320_platdata *cfg);
  20. };
  21. /* Device attached via an SPI bus. */
  22. struct ili9320_spi {
  23. struct spi_device *dev;
  24. struct spi_message message;
  25. struct spi_transfer xfer[2];
  26. unsigned char id;
  27. unsigned char buffer_addr[4];
  28. unsigned char buffer_data[4];
  29. };
  30. /* ILI9320 device state. */
  31. struct ili9320 {
  32. union {
  33. struct ili9320_spi spi; /* SPI attachged device. */
  34. } access; /* Register access method. */
  35. struct device *dev;
  36. struct lcd_device *lcd; /* LCD device we created. */
  37. struct ili9320_client *client;
  38. struct ili9320_platdata *platdata;
  39. int power; /* current power state. */
  40. int initialised;
  41. unsigned short display1;
  42. unsigned short power1;
  43. int (*write)(struct ili9320 *ili, unsigned int reg, unsigned int val);
  44. };
  45. /* ILI9320 register access routines */
  46. extern int ili9320_write(struct ili9320 *ili,
  47. unsigned int reg, unsigned int value);
  48. extern int ili9320_write_regs(struct ili9320 *ili,
  49. const struct ili9320_reg *values,
  50. int nr_values);
  51. /* Device probe */
  52. extern int ili9320_probe_spi(struct spi_device *spi,
  53. struct ili9320_client *cli);
  54. extern int ili9320_remove(struct ili9320 *lcd);
  55. extern void ili9320_shutdown(struct ili9320 *lcd);
  56. /* PM */
  57. extern int ili9320_suspend(struct ili9320 *lcd);
  58. extern int ili9320_resume(struct ili9320 *lcd);