max86900.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef _MAX86900_H_
  2. #define _MAX86900_H_
  3. #include <linux/delay.h>
  4. #include <linux/i2c.h>
  5. #include <linux/irq.h>
  6. #include <linux/input.h>
  7. #include <linux/init.h>
  8. #include <linux/kernel.h>
  9. #include <linux/module.h>
  10. #include <linux/interrupt.h>
  11. #include <linux/leds.h>
  12. #include <linux/miscdevice.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/regulator/consumer.h>
  15. #include <linux/slab.h>
  16. #include <linux/types.h>
  17. #include <linux/uaccess.h>
  18. #include <linux/workqueue.h>
  19. #include <linux/spinlock.h>
  20. #include <linux/gpio.h>
  21. #include <linux/kthread.h>
  22. #include <linux/sched.h>
  23. #include <linux/time.h>
  24. #include <linux/timer.h>
  25. #define MAX86900_DEBUG
  26. #define MAX86900_SLAVE_ADDR 0x51
  27. #define MAX86900A_SLAVE_ADDR 0x57
  28. //MAX86900 Registers
  29. #define MAX86900_INTERRUPT_STATUS 0x00
  30. #define MAX86900_INTERRUPT_ENABLE 0x01
  31. #define MAX86900_FIFO_WRITE_POINTER 0x02
  32. #define MAX86900_OVF_COUNTER 0x03
  33. #define MAX86900_FIFO_READ_POINTER 0x04
  34. #define MAX86900_FIFO_DATA 0x05
  35. #define MAX86900_MODE_CONFIGURATION 0x06
  36. #define MAX86900_SPO2_CONFIGURATION 0x07
  37. #define MAX86900_LED_CONFIGURATION 0x09
  38. #define MAX86900_TEMP_INTEGER 0x16
  39. #define MAX86900_TEMP_FRACTION 0x17
  40. //Self Test
  41. #define MAX86900_TEST_MODE 0xFF
  42. #define MAX86900_TEST_GTST 0x80
  43. #define MAX86900_TEST_ENABLE_IDAC 0x81
  44. #define MAX86900_TEST_ENABLE_PLETH 0x82
  45. #define MAX86900_TEST_ALC 0x8F
  46. #define MAX86900_TEST_ROUTE_MODULATOR 0x97
  47. #define MAX86900_TEST_LOOK_MODE_RED 0x98
  48. #define MAX86900_TEST_LOOK_MODE_IR 0x99
  49. #define MAX86900_TEST_IDAC_GAIN 0x9C
  50. #define MAX86900_FIFO_SIZE 16
  51. typedef enum _PART_TYPE
  52. {
  53. PART_TYPE_MAX86900 = 0,
  54. PART_TYPE_MAX86900A,
  55. PART_TYPE_MAX86900B,
  56. PART_TYPE_MAX86900C,
  57. } PART_TYPE;
  58. struct max86900_platform_data
  59. {
  60. int (*init)(void);
  61. int (*deinit)(void);
  62. };
  63. struct max86900_device_data
  64. {
  65. struct i2c_client *client; // represents the slave device
  66. struct device *dev;
  67. struct input_dev *hrm_input_dev;
  68. struct mutex i2clock;
  69. struct mutex activelock;
  70. struct mutex storelock;
  71. struct regulator *vdd_1p8;
  72. #if defined(CONFIG_SEC_KACTIVE_PROJECT) || defined(CONFIG_MACH_KSPORTSLTE_SPR) || defined(CONFIG_SEC_S_PROJECT)
  73. struct regulator *vdd_3p3;
  74. #endif
  75. const char *sub_ldo4;
  76. #if defined(CONFIG_SEC_KACTIVE_PROJECT) || defined(CONFIG_MACH_KSPORTSLTE_SPR) || defined(CONFIG_SEC_S_PROJECT)
  77. const char *led_l19;
  78. #endif
  79. bool *bio_status;
  80. atomic_t is_enable;
  81. atomic_t is_suspend;
  82. u8 led_current;
  83. u8 hr_range;
  84. u8 hr_range2;
  85. u8 look_mode_ir;
  86. u8 look_mode_red;
  87. u8 eol_test_is_enable;
  88. u8 part_type;
  89. u8 default_current;
  90. u8 test_current_ir;
  91. u8 test_current_red;
  92. u8 eol_test_status;
  93. u16 led;
  94. u16 sample_cnt;
  95. int hrm_int;
  96. int irq;
  97. int hrm_temp;
  98. char *eol_test_result;
  99. char *lib_ver;
  100. int ir_sum;
  101. int r_sum;
  102. };
  103. extern int sensors_create_symlink(struct kobject *target, const char *name);
  104. extern void sensors_remove_symlink(struct kobject *target, const char *name);
  105. extern int sensors_register(struct device *dev, void * drvdata,
  106. struct device_attribute *attributes[], char *name);
  107. extern void sensors_unregister(struct device *dev,
  108. struct device_attribute *attributes[]);
  109. #endif