internal.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Register map access API internal header
  3. *
  4. * Copyright 2011 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
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef _REGMAP_INTERNAL_H
  13. #define _REGMAP_INTERNAL_H
  14. #include <linux/regmap.h>
  15. struct regmap;
  16. struct regmap_format {
  17. size_t buf_size;
  18. size_t reg_bytes;
  19. size_t val_bytes;
  20. void (*format_write)(struct regmap *map,
  21. unsigned int reg, unsigned int val);
  22. void (*format_reg)(void *buf, unsigned int reg);
  23. void (*format_val)(void *buf, unsigned int val);
  24. unsigned int (*parse_val)(void *buf);
  25. };
  26. struct regmap {
  27. struct mutex lock;
  28. struct device *dev; /* Device we do I/O on */
  29. void *work_buf; /* Scratch buffer used to format I/O */
  30. struct regmap_format format; /* Buffer format */
  31. const struct regmap_bus *bus;
  32. unsigned int max_register;
  33. bool (*writeable_reg)(struct device *dev, unsigned int reg);
  34. bool (*readable_reg)(struct device *dev, unsigned int reg);
  35. bool (*volatile_reg)(struct device *dev, unsigned int reg);
  36. };
  37. #endif