core.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Definitions for DA9063 MFD driver
  3. *
  4. * Copyright 2012 Dialog Semiconductor Ltd.
  5. *
  6. * Author: Michal Hajduk <michal.hajduk@diasemi.com>
  7. * Krystian Garbaciak <krystian.garbaciak@diasemi.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. */
  15. #ifndef __MFD_DA9063_CORE_H__
  16. #define __MFD_DA9063_CORE_H__
  17. #include <linux/interrupt.h>
  18. #include <linux/mfd/da9063/registers.h>
  19. /* DA9063 modules */
  20. #define DA9063_DRVNAME_CORE "da9063-core"
  21. #define DA9063_DRVNAME_REGULATORS "da9063-regulators"
  22. #define DA9063_DRVNAME_LEDS "da9063-leds"
  23. #define DA9063_DRVNAME_WATCHDOG "da9063-watchdog"
  24. #define DA9063_DRVNAME_HWMON "da9063-hwmon"
  25. #define DA9063_DRVNAME_ONKEY "da9063-onkey"
  26. #define DA9063_DRVNAME_RTC "da9063-rtc"
  27. #define DA9063_DRVNAME_VIBRATION "da9063-vibration"
  28. enum da9063_models {
  29. PMIC_DA9063 = 0x61,
  30. };
  31. enum da9063_variant_codes {
  32. PMIC_DA9063_AD = 0x3,
  33. PMIC_DA9063_BB = 0x5,
  34. PMIC_DA9063_CA = 0x6,
  35. };
  36. /* Interrupts */
  37. enum da9063_irqs {
  38. DA9063_IRQ_ONKEY = 0,
  39. DA9063_IRQ_ALARM,
  40. DA9063_IRQ_TICK,
  41. DA9063_IRQ_ADC_RDY,
  42. DA9063_IRQ_SEQ_RDY,
  43. DA9063_IRQ_WAKE,
  44. DA9063_IRQ_TEMP,
  45. DA9063_IRQ_COMP_1V2,
  46. DA9063_IRQ_LDO_LIM,
  47. DA9063_IRQ_REG_UVOV,
  48. DA9063_IRQ_DVC_RDY,
  49. DA9063_IRQ_VDD_MON,
  50. DA9063_IRQ_WARN,
  51. DA9063_IRQ_GPI0,
  52. DA9063_IRQ_GPI1,
  53. DA9063_IRQ_GPI2,
  54. DA9063_IRQ_GPI3,
  55. DA9063_IRQ_GPI4,
  56. DA9063_IRQ_GPI5,
  57. DA9063_IRQ_GPI6,
  58. DA9063_IRQ_GPI7,
  59. DA9063_IRQ_GPI8,
  60. DA9063_IRQ_GPI9,
  61. DA9063_IRQ_GPI10,
  62. DA9063_IRQ_GPI11,
  63. DA9063_IRQ_GPI12,
  64. DA9063_IRQ_GPI13,
  65. DA9063_IRQ_GPI14,
  66. DA9063_IRQ_GPI15,
  67. };
  68. #define DA9063_IRQ_BASE_OFFSET 0
  69. #define DA9063_NUM_IRQ (DA9063_IRQ_GPI15 + 1 - DA9063_IRQ_BASE_OFFSET)
  70. struct da9063 {
  71. /* Device */
  72. struct device *dev;
  73. unsigned short model;
  74. unsigned char variant_code;
  75. unsigned int flags;
  76. /* Control interface */
  77. struct regmap *regmap;
  78. /* Interrupts */
  79. int chip_irq;
  80. unsigned int irq_base;
  81. struct regmap_irq_chip_data *regmap_irq;
  82. };
  83. int da9063_device_init(struct da9063 *da9063, unsigned int irq);
  84. int da9063_irq_init(struct da9063 *da9063);
  85. void da9063_device_exit(struct da9063 *da9063);
  86. void da9063_irq_exit(struct da9063 *da9063);
  87. #endif /* __MFD_DA9063_CORE_H__ */