ili9320.h 1.9 KB

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