ab5500-core.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (C) 2011 ST-Ericsson
  3. * License terms: GNU General Public License (GPL) version 2
  4. * Shared definitions and data structures for the AB5500 MFD driver
  5. */
  6. /* Read/write operation values. */
  7. #define AB5500_PERM_RD (0x01)
  8. #define AB5500_PERM_WR (0x02)
  9. /* Read/write permissions. */
  10. #define AB5500_PERM_RO (AB5500_PERM_RD)
  11. #define AB5500_PERM_RW (AB5500_PERM_RD | AB5500_PERM_WR)
  12. #define AB5500_MASK_BASE (0x60)
  13. #define AB5500_MASK_END (0x79)
  14. #define AB5500_CHIP_ID (0x20)
  15. /**
  16. * struct ab5500_reg_range
  17. * @first: the first address of the range
  18. * @last: the last address of the range
  19. * @perm: access permissions for the range
  20. */
  21. struct ab5500_reg_range {
  22. u8 first;
  23. u8 last;
  24. u8 perm;
  25. };
  26. /**
  27. * struct ab5500_i2c_ranges
  28. * @count: the number of ranges in the list
  29. * @range: the list of register ranges
  30. */
  31. struct ab5500_i2c_ranges {
  32. u8 nranges;
  33. u8 bankid;
  34. const struct ab5500_reg_range *range;
  35. };
  36. /**
  37. * struct ab5500_i2c_banks
  38. * @count: the number of ranges in the list
  39. * @range: the list of register ranges
  40. */
  41. struct ab5500_i2c_banks {
  42. u8 nbanks;
  43. const struct ab5500_i2c_ranges *bank;
  44. };
  45. /**
  46. * struct ab5500_bank
  47. * @slave_addr: I2C slave_addr found in AB5500 specification
  48. * @name: Documentation name of the bank. For reference
  49. */
  50. struct ab5500_bank {
  51. u8 slave_addr;
  52. const char *name;
  53. };
  54. static const struct ab5500_bank bankinfo[AB5500_NUM_BANKS] = {
  55. [AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP] = {
  56. AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP, "VIT_IO_I2C_CLK_TST_OTP"},
  57. [AB5500_BANK_VDDDIG_IO_I2C_CLK_TST] = {
  58. AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST, "VDDDIG_IO_I2C_CLK_TST"},
  59. [AB5500_BANK_VDENC] = {AB5500_ADDR_VDENC, "VDENC"},
  60. [AB5500_BANK_SIM_USBSIM] = {AB5500_ADDR_SIM_USBSIM, "SIM_USBSIM"},
  61. [AB5500_BANK_LED] = {AB5500_ADDR_LED, "LED"},
  62. [AB5500_BANK_ADC] = {AB5500_ADDR_ADC, "ADC"},
  63. [AB5500_BANK_RTC] = {AB5500_ADDR_RTC, "RTC"},
  64. [AB5500_BANK_STARTUP] = {AB5500_ADDR_STARTUP, "STARTUP"},
  65. [AB5500_BANK_DBI_ECI] = {AB5500_ADDR_DBI_ECI, "DBI-ECI"},
  66. [AB5500_BANK_CHG] = {AB5500_ADDR_CHG, "CHG"},
  67. [AB5500_BANK_FG_BATTCOM_ACC] = {
  68. AB5500_ADDR_FG_BATTCOM_ACC, "FG_BATCOM_ACC"},
  69. [AB5500_BANK_USB] = {AB5500_ADDR_USB, "USB"},
  70. [AB5500_BANK_IT] = {AB5500_ADDR_IT, "IT"},
  71. [AB5500_BANK_VIBRA] = {AB5500_ADDR_VIBRA, "VIBRA"},
  72. [AB5500_BANK_AUDIO_HEADSETUSB] = {
  73. AB5500_ADDR_AUDIO_HEADSETUSB, "AUDIO_HEADSETUSB"},
  74. };
  75. int ab5500_get_register_interruptible_raw(struct ab5500 *ab, u8 bank, u8 reg,
  76. u8 *value);
  77. int ab5500_mask_and_set_register_interruptible_raw(struct ab5500 *ab, u8 bank,
  78. u8 reg, u8 bitmask, u8 bitvalues);