Advertisement
Guest User

Untitled

a guest
Jan 12th, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. From 703ef897003d8cc85e02e1792f3fa605ffcfe3cc Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
  3. Date: Mon, 12 Jan 2015 07:14:44 +0100
  4. Subject: [PATCH] n950: fix accelerometer configuration
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8.  
  9. Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
  10. ---
  11. arch/arm/mach-omap2/board-rm680.c | 97 +++++++++++++++++++++++++++++++++++----
  12. 1 file changed, 88 insertions(+), 9 deletions(-)
  13.  
  14. diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
  15. index 1dbaa15..dc7d8c8 100644
  16. --- a/arch/arm/mach-omap2/board-rm680.c
  17. +++ b/arch/arm/mach-omap2/board-rm680.c
  18. @@ -1119,6 +1119,9 @@ static int lis302_release(void)
  19. return 0;
  20. }
  21.  
  22. +#define LIS3_IRQ1_USE_BOTH_EDGES 1
  23. +#define LIS3_IRQ2_USE_BOTH_EDGES 2
  24. +
  25. static struct lis3lv02d_platform_data rm696_lis302dl_data = {
  26. .click_flags = LIS3_CLICK_SINGLE_X | LIS3_CLICK_SINGLE_Y |
  27. LIS3_CLICK_SINGLE_Z,
  28. @@ -1142,9 +1145,6 @@ static struct lis3lv02d_platform_data rm696_lis302dl_data = {
  29. /* Interrupt line 2 for click detection, line 1 for thresholds */
  30. .irq_cfg = LIS3_IRQ2_CLICK | LIS3_IRQ1_FF_WU_12,
  31.  
  32. -#define LIS3_IRQ1_USE_BOTH_EDGES 1
  33. -#define LIS3_IRQ2_USE_BOTH_EDGES 2
  34. -
  35. .irq_flags1 = LIS3_IRQ1_USE_BOTH_EDGES,
  36. .irq_flags2 = LIS3_IRQ2_USE_BOTH_EDGES,
  37. .duration1 = 8,
  38. @@ -1159,6 +1159,43 @@ static struct lis3lv02d_platform_data rm696_lis302dl_data = {
  39. .st_max_limits = {-3, 46, 46},
  40. };
  41.  
  42. +static struct lis3lv02d_platform_data rm680_lis302dl_data = {
  43. + .click_flags = LIS3_CLICK_SINGLE_X | LIS3_CLICK_SINGLE_Y |
  44. + LIS3_CLICK_SINGLE_Z,
  45. + /* Limits are 0.5g * value */
  46. + .click_thresh_x = 8,
  47. + .click_thresh_y = 8,
  48. + .click_thresh_z = 10,
  49. + /* Click must be longer than time limit */
  50. + .click_time_limit = 9,
  51. + /* Kind of debounce filter */
  52. + .click_latency = 50,
  53. +
  54. + /* Limits for all axis. millig-value / 18 to get HW values */
  55. + .wakeup_flags = LIS3_WAKEUP_X_HI | LIS3_WAKEUP_Y_HI,
  56. + .wakeup_thresh = 8,
  57. + .wakeup_flags2 = LIS3_WAKEUP_Z_HI,
  58. + .wakeup_thresh2 = 10,
  59. +
  60. + .hipass_ctrl = LIS3_HIPASS_CUTFF_2HZ,
  61. +
  62. + /* Interrupt line 2 for click detection, line 1 for thresholds */
  63. + .irq_cfg = LIS3_IRQ2_CLICK | LIS3_IRQ1_FF_WU_12,
  64. +
  65. + .irq_flags1 = LIS3_IRQ1_USE_BOTH_EDGES,
  66. + .irq_flags2 = LIS3_IRQ2_USE_BOTH_EDGES,
  67. + .duration1 = 8,
  68. + .duration2 = 8,
  69. +
  70. + .axis_x = LIS3_INV_DEV_Y,
  71. + .axis_y = LIS3_INV_DEV_X,
  72. + .axis_z = LIS3_INV_DEV_Z,
  73. + .setup_resources = lis302_setup,
  74. + .release_resources = lis302_release,
  75. + .st_min_limits = {-46, 3, 3},
  76. + .st_max_limits = {-3, 46, 46},
  77. +};
  78. +
  79. #endif
  80.  
  81. #if defined(CONFIG_SENSORS_AK8975) || defined(CONFIG_SENSORS_AK8975_MODULE)
  82. @@ -1412,6 +1449,39 @@ static struct i2c_board_info rm696_peripherals_i2c_board_info_3[] /*__initdata *
  83.  
  84. };
  85.  
  86. +static struct i2c_board_info rm680_peripherals_i2c_board_info_3[] /*__initdata */= {
  87. +#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
  88. + {
  89. + /* Keep this first */
  90. + I2C_BOARD_INFO("lis3lv02d", 0x1d),
  91. + .platform_data = &rm680_lis302dl_data,
  92. + },
  93. +#endif
  94. +
  95. +#if defined(CONFIG_RADIO_WL1273) || defined(CONFIG_RADIO_WL1273_MODULE)
  96. + {
  97. + I2C_BOARD_INFO(WL1273_FM_DRIVER_NAME, RX71_FM_I2C_ADDR),
  98. + .platform_data = &rm696_fm_data,
  99. + },
  100. +#endif
  101. +
  102. +#if defined(CONFIG_SENSORS_AK8975) || defined(CONFIG_SENSORS_AK8975_MODULE)
  103. + {
  104. + I2C_BOARD_INFO("ak8975", 0x0f),
  105. + .platform_data = &rm696_ak8975_data,
  106. + },
  107. +#endif
  108. +
  109. +#if defined(CONFIG_BCM4751_GPS) || defined(CONFIG_BCM4751_GPS_MODULE)
  110. + {
  111. + I2C_BOARD_INFO("bcm4751-gps", 0x1fa),
  112. + .platform_data = &rm696_bcm4751_gps_platform_data,
  113. + .flags = I2C_CLIENT_TEN,
  114. + },
  115. +#endif
  116. +
  117. +};
  118. +
  119. static void rm696_vibra_set_power(bool enable)
  120. {
  121. gpio_set_value(RM696_VIBRA_POWER_GPIO, enable);
  122. @@ -1481,26 +1551,35 @@ static void __init rm680_i2c_init(void)
  123. codec_data->check_defaults = 0;
  124. codec_data->reset_registers = 0;
  125. codec_data->digimic_delay = 0;
  126. -
  127. +
  128. #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
  129. - rm696_lis302dl_data.irq2 = gpio_to_irq(LIS302_IRQ2_GPIO);
  130. - rm696_peripherals_i2c_board_info_3[0].irq = gpio_to_irq(LIS302_IRQ1_GPIO);
  131. + if (!board_is_rm680()) {
  132. + rm696_lis302dl_data.irq2 = gpio_to_irq(LIS302_IRQ2_GPIO);
  133. + rm696_peripherals_i2c_board_info_3[0].irq = gpio_to_irq(LIS302_IRQ1_GPIO);
  134. + } else {
  135. + rm680_lis302dl_data.irq2 = gpio_to_irq(LIS302_IRQ2_GPIO);
  136. + rm680_peripherals_i2c_board_info_3[0].irq = gpio_to_irq(LIS302_IRQ1_GPIO);
  137. + }
  138. #endif
  139.  
  140. #if defined(CONFIG_PN544_NFC) || defined(CONFIG_PN544_NFC_MODULE)
  141. - rm696_peripherals_i2c_board_info_3[1].irq = gpio_to_irq(NFC_HOST_INT_GPIO);
  142. + if (!board_is_rm680()) {
  143. + rm696_peripherals_i2c_board_info_3[1].irq = gpio_to_irq(NFC_HOST_INT_GPIO);
  144. + }
  145. #endif
  146.  
  147. omap_pmic_init(1, 2900, "twl5031", INT_34XX_SYS_NIRQ, &rm680_twl_data);
  148. if (!board_is_rm680()) {
  149. omap_register_i2c_bus(2, 400, rm696_peripherals_i2c_board_info_2,
  150. ARRAY_SIZE(rm696_peripherals_i2c_board_info_2));
  151. + omap_register_i2c_bus(3, 400, rm696_peripherals_i2c_board_info_3,
  152. + ARRAY_SIZE(rm696_peripherals_i2c_board_info_3));
  153. } else {
  154. omap_register_i2c_bus(2, 400, rm680_peripherals_i2c_board_info_2,
  155. ARRAY_SIZE(rm680_peripherals_i2c_board_info_2));
  156. + omap_register_i2c_bus(3, 400, rm680_peripherals_i2c_board_info_3,
  157. + ARRAY_SIZE(rm680_peripherals_i2c_board_info_3));
  158. }
  159. - omap_register_i2c_bus(3, 400, rm696_peripherals_i2c_board_info_3,
  160. - ARRAY_SIZE(rm696_peripherals_i2c_board_info_3));
  161. }
  162.  
  163. #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
  164. --
  165. 2.1.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement