isa1400_vibrator.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* arch/arm/mach-tegra/sec_vibrator.c
  2. *
  3. * Copyright (C) 2011 Samsung Electronics Co. Ltd. All Rights Reserved.
  4. *
  5. * This software is licensed under the terms of the GNU General Public
  6. * License version 2, as published by the Free Software Foundation, and
  7. * may be copied, distributed, and modified under those terms.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #ifndef _LINUX_SEC_VIBRATOR_H
  16. #define _LINUX_SEC_VIBRATOR_H
  17. #define ISA1400_STATUS_SLEEP 0
  18. #define ISA1400_STATUS_STANDBY 1
  19. #define ISA1400_REG_ID 0x00
  20. #define ISA1400_REG_RSTCTRL 0x0f
  21. #define ISA1400_REG_AMPGAIN1 0x10
  22. #define ISA1400_REG_AMPGAIN2 0x11
  23. #define ISA1400_REG_OVDRGAIN1 0x12
  24. #define ISA1400_REG_OVDRGAIN2 0x13
  25. #define ISA1400_REG_OVDRTYP 0x1a
  26. #define ISA1400_REG_AMPSWTCH 0x1b
  27. #define ISA1400_REG_SYSCLK 0x1f
  28. #define ISA1400_REG_GAIN 0x20
  29. #define ISA1400_REG_GAIN1 (ISA1400_REG_GAIN + CH1)
  30. #define ISA1400_REG_GAIN2 (ISA1400_REG_GAIN + CH2)
  31. #define ISA1400_REG_GAIN3 (ISA1400_REG_GAIN + CH3)
  32. #define ISA1400_REG_GAIN4 (ISA1400_REG_GAIN + CH4)
  33. #define ISA1400_REG_FREQ 0x24
  34. #define ISA1400_REG_FREQ1M (ISA1400_REG_FREQ)
  35. #define ISA1400_REG_FREQ1L (ISA1400_REG_FREQ + 1)
  36. #define ISA1400_REG_FREQ2M (ISA1400_REG_FREQ + 2 * CH2)
  37. #define ISA1400_REG_FREQ2L (ISA1400_REG_FREQ + 2 * CH2 + 1)
  38. #define ISA1400_REG_FREQ3M (ISA1400_REG_FREQ + 2 * CH3)
  39. #define ISA1400_REG_FREQ3L (ISA1400_REG_FREQ + 2 * CH3 + 1)
  40. #define ISA1400_REG_FREQ4M (ISA1400_REG_FREQ + 2 * CH4)
  41. #define ISA1400_REG_FREQ4L (ISA1400_REG_FREQ + 2 * CH4 + 1)
  42. #define ISA1400_REG_ODCTRL 0x2c
  43. #define ISA1400_REG_HPTEN 0x2d
  44. #define ISA1400_REG_CHMODE 0x2e
  45. #define ISA1400_REG_WAVESEL 0x2f
  46. #define ISA1400_REG_PHESEL 0x35
  47. #define ISA1400_REG_PHESEL1 (ISA1400_REG_PHESEL)
  48. #define ISA1400_REG_PHESEL2 (ISA1400_REG_PHESEL+1)
  49. #define ISA1400_REG_PHEEN 0x37
  50. #define ISA1400_REG_PHE 0x38
  51. #define ISA1400_REG_PHE1 (ISA1400_REG_PHE)
  52. #define ISA1400_REG_PHE2 (ISA1400_REG_PHE + 6 * 1)
  53. #define ISA1400_REG_PHE3 (ISA1400_REG_PHE + 6 * 2)
  54. #define ISA1400_REG_PHE4 (ISA1400_REG_PHE + 6 * 3)
  55. #define ISA1400_REG_PHE5 (ISA1400_REG_PHE + 6 * 4)
  56. #define ISA1400_REG_PHE6 (ISA1400_REG_PHE + 6 * 5)
  57. #define ISA1400_REG_PHE7 (ISA1400_REG_PHE + 6 * 6)
  58. #define ISA1400_REG_PHE8 (ISA1400_REG_PHE + 6 * 7)
  59. #define ISA1400_REG_PHE9 (ISA1400_REG_PHE + 6 * 8)
  60. #define ISA1400_REG_PHE10 (ISA1400_REG_PHE + 6 * 9)
  61. #define ISA1400_REG_PHE11 (ISA1400_REG_PHE + 6 * 10)
  62. #define ISA1400_REG_PHE12 (ISA1400_REG_PHE + 6 * 11)
  63. #define HPTMOD_EACHPIEZO 0
  64. #define HPTMOD_MOT1PIEZO2 1
  65. #define HPTMOD_MOT2 2
  66. #define HPTMOD_PIEZO4 3
  67. #define WAVE_SINE 0
  68. #define WAVE_PWMLIKE 1
  69. #define WAVE_RECT 2
  70. #define WAVE_DC 3
  71. #define ISA1400_REG_PHE_CTRL1 0
  72. #define ISA1400_REG_PHE_CTRL2 1
  73. #define ISA1400_REG_PHE_CTRL3 2
  74. #define ISA1400_REG_PHE_CTRL4 3
  75. #define ISA1400_REG_PHE_CTRL5 4
  76. #define ISA1400_REG_PHE_CTRL6 5
  77. #define ISA1400_REG_PHE_CTRL_CNT 6
  78. #define ISA1400_REG_INIT 0
  79. #define ISA1400_REG_START 1
  80. #define ISA1400_REG_STOP 2
  81. #define ISA1400_REG_MAX 3
  82. #ifdef __KERNEL__
  83. typedef int8_t VibeInt8;
  84. typedef u_int8_t VibeUInt8;
  85. typedef int16_t VibeInt16;
  86. typedef u_int16_t VibeUInt16;
  87. typedef int32_t VibeInt32;
  88. typedef u_int32_t VibeUInt32;
  89. typedef u_int8_t VibeBool;
  90. typedef VibeInt32 VibeStatus;
  91. #endif
  92. struct isa1400_vibrator_platform_data {
  93. int (*gpio_en) (bool) ;
  94. int (*clk_en) (bool) ;
  95. const u8 **reg_data;
  96. int max_timeout;
  97. };
  98. #if defined(CONFIG_MOTOR_DRV_ISA1400)
  99. extern int isa1400_i2c_write(u8 addr, int length, u8 *data);
  100. extern void isa1400_chip_enable(bool en);
  101. extern void isa1400_clk_config(int duty);
  102. #endif
  103. #endif