Advertisement
OdSazib

Confusion about the base (Kernel of MSM8228)

Apr 8th, 2014
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.49 KB | None | 0 0
  1. #!/system/bin/sh
  2. # Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions are met:
  6. # * Redistributions of source code must retain the above copyright
  7. # notice, this list of conditions and the following disclaimer.
  8. # * Redistributions in binary form must reproduce the above copyright
  9. # notice, this list of conditions and the following disclaimer in the
  10. # documentation and/or other materials provided with the distribution.
  11. # * Neither the name of The Linux Foundation nor
  12. # the names of its contributors may be used to endorse or promote
  13. # products derived from this software without specific prior written
  14. # permission.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  20. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  23. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  24. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  25. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  26. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. #
  28.  
  29. # Set platform variables
  30. target=`getprop ro.board.platform`
  31. if [ -f /sys/devices/soc0/hw_platform ]; then
  32. soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
  33. else
  34. soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
  35. fi
  36. if [ -f /sys/devices/soc0/soc_id ]; then
  37. soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
  38. else
  39. soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
  40. fi
  41. if [ -f /sys/devices/soc0/platform_version ]; then
  42. soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
  43. else
  44. soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
  45. fi
  46.  
  47. # Dynamic Memory Managment (DMM) provides a sys file system to the userspace
  48. # that can be used to plug in/out memory that has been configured as unstable.
  49. # This unstable memory can be in Active or In-Active State.
  50. # Each of which the userspace can request by writing to a sys file.
  51. #
  52. # ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This
  53. # property is set in the Android system properties file.
  54. #
  55. # If ro.dev.dmm.dpd.start_address is set here then the target has a memory
  56. # configuration that supports DynamicMemoryManagement.
  57. init_DMM()
  58. {
  59. block=-1
  60.  
  61. case "$target" in
  62. "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm8960")
  63. ;;
  64. *)
  65. return
  66. ;;
  67. esac
  68.  
  69. mem="/sys/devices/system/memory"
  70. op=`cat $mem/movable_start_bytes`
  71. case "$op" in
  72. "0")
  73. log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op
  74. ;;
  75.  
  76. "$mem/movable_start_bytes: No such file or directory ")
  77. log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op
  78. ;;
  79.  
  80. *)
  81. log -p i -t DMM DMM available. movable_start_bytes at $op
  82. movable_start_bytes=0x`cat $mem/movable_start_bytes`
  83. block_size_bytes=0x`cat $mem/block_size_bytes`
  84. block=$((#${movable_start_bytes}/${block_size_bytes}))
  85.  
  86. chown system.system $mem/memory$block/state
  87. chown system.system $mem/probe
  88. chown system.system $mem/active
  89. chown system.system $mem/remove
  90.  
  91. case "$target" in
  92. "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
  93. echo $movable_start_bytes > $mem/probe
  94. case "$?" in
  95. "0")
  96. log -p i -t DMM $movable_start_bytes to physical hotplug succeeded.
  97. ;;
  98. *)
  99. log -p e -t DMM $movable_start_bytes to physical hotplug failed.
  100. return
  101. ;;
  102. esac
  103.  
  104. echo online > $mem/memory$block/state
  105. case "$?" in
  106. "0")
  107. log -p i -t DMM \'echo online\' to logical hotplug succeeded.
  108. ;;
  109. *)
  110. log -p e -t DMM \'echo online\' to logical hotplug failed.
  111. return
  112. ;;
  113. esac
  114. ;;
  115. esac
  116.  
  117. setprop ro.dev.dmm.dpd.start_address $movable_start_bytes
  118. setprop ro.dev.dmm.dpd.block $block
  119. ;;
  120. esac
  121.  
  122. case "$target" in
  123. "msm8960")
  124. return
  125. ;;
  126. esac
  127.  
  128. # For 7X30 targets:
  129. # ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory
  130. # configuration. This is also used to indicate that the target is capable of
  131. # setting EBI-1 to Deep Power Down or Self Refresh.
  132. op=`cat $mem/low_power_memory_start_bytes`
  133. case "$op" in
  134. "0")
  135. log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op
  136. ;;
  137. "$mem/low_power_memory_start_bytes No such file or directory ")
  138. log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op
  139. ;;
  140. *)
  141. log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op
  142. ;;
  143. esac
  144. }
  145.  
  146. #
  147. # For controlling console and shell on console on 8960 - perist.serial.enable 8960
  148. # On other target use default ro.debuggable property.
  149. #
  150. serial=`getprop persist.serial.enable`
  151. dserial=`getprop ro.debuggable`
  152. case "$target" in
  153. "msm8960")
  154. case "$serial" in
  155. "0")
  156. echo 0 > /sys/devices/platform/msm_serial_hsl.0/console
  157. ;;
  158. "1")
  159. echo 1 > /sys/devices/platform/msm_serial_hsl.0/console
  160. start console
  161. ;;
  162. *)
  163. case "$dserial" in
  164. "1")
  165. start console
  166. ;;
  167. esac
  168. ;;
  169. esac
  170. ;;
  171. *)
  172. case "$dserial" in
  173. "1")
  174. start console
  175. ;;
  176. esac
  177. ;;
  178. esac
  179.  
  180. #
  181. # Allow persistent faking of bms
  182. # User needs to set fake bms charge in persist.bms.fake_batt_capacity
  183. #
  184. fake_batt_capacity=`getprop persist.bms.fake_batt_capacity`
  185. case "$fake_batt_capacity" in
  186. "") ;; #Do nothing here
  187. * )
  188. case $target in
  189. "msm8960")
  190. echo "$fake_batt_capacity" > /sys/module/pm8921_bms/parameters/bms_fake_battery
  191. ;;
  192.  
  193. "msm8974")
  194. echo "$fake_batt_capacity" > /sys/module/qpnp_bms/parameters/bms_fake_battery
  195. ;;
  196.  
  197. "msm8226" | "msm8228")
  198. echo "$fake_batt_capacity" > /sys/module/qpnp_bms/parameters/bms_fake_battery
  199. ;;
  200.  
  201. "msm8610")
  202. echo "$fake_batt_capacity" > /sys/module/qpnp_bms/parameters/bms_fake_battery
  203. ;;
  204. esac
  205. esac
  206.  
  207. case "$target" in
  208. "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
  209. insmod /system/lib/modules/ss_mfcinit.ko
  210. insmod /system/lib/modules/ss_vencoder.ko
  211. insmod /system/lib/modules/ss_vdecoder.ko
  212. chmod 0666 /dev/ss_mfc_reg
  213. chmod 0666 /dev/ss_vdec
  214. chmod 0666 /dev/ss_venc
  215.  
  216. init_DMM
  217. ;;
  218.  
  219. "msm8960")
  220. init_DMM
  221. ;;
  222. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement