ntxec.h 904 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright 2020 Jonathan Neuschäfer
  4. *
  5. * Register access and version information for the Netronix embedded
  6. * controller.
  7. */
  8. #ifndef NTXEC_H
  9. #define NTXEC_H
  10. #include <linux/types.h>
  11. struct device;
  12. struct regmap;
  13. struct ntxec {
  14. struct device *dev;
  15. struct regmap *regmap;
  16. };
  17. /*
  18. * Some registers, such as the battery status register (0x41), are in
  19. * big-endian, but others only have eight significant bits, which are in the
  20. * first byte transmitted over I2C (the MSB of the big-endian value).
  21. * This convenience function converts an 8-bit value to 16-bit for use in the
  22. * second kind of register.
  23. */
  24. static inline u16 ntxec_reg8(u8 value)
  25. {
  26. return value << 8;
  27. }
  28. /* Known firmware versions */
  29. #define NTXEC_VERSION_KOBO_AURA 0xd726 /* found in Kobo Aura */
  30. #define NTXEC_VERSION_TOLINO_SHINE2 0xf110 /* found in Tolino Shine 2 HD */
  31. #endif