core.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * include/linux/mfd/wm8994/core.h -- Core interface for WM8994
  3. *
  4. * Copyright 2009 Wolfson Microelectronics PLC.
  5. *
  6. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. */
  14. #ifndef __MFD_WM8994_CORE_H__
  15. #define __MFD_WM8994_CORE_H__
  16. struct regulator_dev;
  17. struct regulator_bulk_data;
  18. #define WM8994_NUM_GPIO_REGS 11
  19. #define WM8994_NUM_LDO_REGS 2
  20. struct wm8994 {
  21. struct mutex io_lock;
  22. struct device *dev;
  23. int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
  24. int bytes, void *dest);
  25. int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
  26. int bytes, void *src);
  27. void *control_data;
  28. int gpio_base;
  29. /* Used over suspend/resume */
  30. u16 ldo_regs[WM8994_NUM_LDO_REGS];
  31. u16 gpio_regs[WM8994_NUM_GPIO_REGS];
  32. struct regulator_dev *dbvdd;
  33. struct regulator_bulk_data *supplies;
  34. };
  35. /* Device I/O API */
  36. int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
  37. int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
  38. unsigned short val);
  39. int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
  40. unsigned short mask, unsigned short val);
  41. int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
  42. int count, u16 *buf);
  43. #endif