i2c-algo-pcf.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* -------------------------------------------------------------------- */
  3. /* i2c-pcf8584.h: PCF 8584 global defines */
  4. /* -------------------------------------------------------------------- */
  5. /* Copyright (C) 1996 Simon G. Vogl
  6. 1999 Hans Berglund
  7. */
  8. /* -------------------------------------------------------------------- */
  9. /* With some changes from Frodo Looijaard <[email protected]> */
  10. #ifndef I2C_PCF8584_H
  11. #define I2C_PCF8584_H 1
  12. /* ----- Control register bits ---------------------------------------- */
  13. #define I2C_PCF_PIN 0x80
  14. #define I2C_PCF_ESO 0x40
  15. #define I2C_PCF_ES1 0x20
  16. #define I2C_PCF_ES2 0x10
  17. #define I2C_PCF_ENI 0x08
  18. #define I2C_PCF_STA 0x04
  19. #define I2C_PCF_STO 0x02
  20. #define I2C_PCF_ACK 0x01
  21. #define I2C_PCF_START (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
  22. #define I2C_PCF_STOP (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_STO | I2C_PCF_ACK)
  23. #define I2C_PCF_REPSTART ( I2C_PCF_ESO | I2C_PCF_STA | I2C_PCF_ACK)
  24. #define I2C_PCF_IDLE (I2C_PCF_PIN | I2C_PCF_ESO | I2C_PCF_ACK)
  25. /* ----- Status register bits ----------------------------------------- */
  26. /*#define I2C_PCF_PIN 0x80 as above*/
  27. #define I2C_PCF_INI 0x40 /* 1 if not initialized */
  28. #define I2C_PCF_STS 0x20
  29. #define I2C_PCF_BER 0x10
  30. #define I2C_PCF_AD0 0x08
  31. #define I2C_PCF_LRB 0x08
  32. #define I2C_PCF_AAS 0x04
  33. #define I2C_PCF_LAB 0x02
  34. #define I2C_PCF_BB 0x01
  35. /* ----- Chip clock frequencies --------------------------------------- */
  36. #define I2C_PCF_CLK3 0x00
  37. #define I2C_PCF_CLK443 0x10
  38. #define I2C_PCF_CLK6 0x14
  39. #define I2C_PCF_CLK 0x18
  40. #define I2C_PCF_CLK12 0x1c
  41. /* ----- transmission frequencies ------------------------------------- */
  42. #define I2C_PCF_TRNS90 0x00 /* 90 kHz */
  43. #define I2C_PCF_TRNS45 0x01 /* 45 kHz */
  44. #define I2C_PCF_TRNS11 0x02 /* 11 kHz */
  45. #define I2C_PCF_TRNS15 0x03 /* 1.5 kHz */
  46. /* ----- Access to internal registers according to ES1,ES2 ------------ */
  47. /* they are mapped to the data port ( a0 = 0 ) */
  48. /* available when ESO == 0 : */
  49. #define I2C_PCF_OWNADR 0
  50. #define I2C_PCF_INTREG I2C_PCF_ES2
  51. #define I2C_PCF_CLKREG I2C_PCF_ES1
  52. #endif /* I2C_PCF8584_H */