init.qcom.class_core.sh 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. #!/vendor/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. # Set platform variables
  29. target=`getprop ro.board.platform`
  30. if [ -f /sys/devices/soc0/hw_platform ]; then
  31. soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
  32. else
  33. soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
  34. fi
  35. if [ -f /sys/devices/soc0/soc_id ]; then
  36. soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
  37. else
  38. soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
  39. fi
  40. if [ -f /sys/devices/soc0/platform_version ]; then
  41. soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
  42. else
  43. soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
  44. fi
  45. # Dynamic Memory Managment (DMM) provides a sys file system to the userspace
  46. # that can be used to plug in/out memory that has been configured as unstable.
  47. # This unstable memory can be in Active or In-Active State.
  48. # Each of which the userspace can request by writing to a sys file.
  49. #
  50. # ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This
  51. # property is set in the Android system properties file.
  52. #
  53. # If ro.dev.dmm.dpd.start_address is set here then the target has a memory
  54. # configuration that supports DynamicMemoryManagement.
  55. init_DMM()
  56. {
  57. block=-1
  58. case "$target" in
  59. "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm8960")
  60. ;;
  61. *)
  62. return
  63. ;;
  64. esac
  65. mem="/sys/devices/system/memory"
  66. op=`cat $mem/movable_start_bytes`
  67. case "$op" in
  68. "0")
  69. log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op
  70. ;;
  71. "$mem/movable_start_bytes: No such file or directory ")
  72. log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op
  73. ;;
  74. *)
  75. log -p i -t DMM DMM available. movable_start_bytes at $op
  76. movable_start_bytes=0x`cat $mem/movable_start_bytes`
  77. block_size_bytes=0x`cat $mem/block_size_bytes`
  78. block=$((#${movable_start_bytes}/${block_size_bytes}))
  79. chown -h system.system $mem/memory$block/state
  80. chown -h system.system $mem/probe
  81. chown -h system.system $mem/active
  82. chown -h system.system $mem/remove
  83. case "$target" in
  84. "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
  85. echo $movable_start_bytes > $mem/probe
  86. case "$?" in
  87. "0")
  88. log -p i -t DMM $movable_start_bytes to physical hotplug succeeded.
  89. ;;
  90. *)
  91. log -p e -t DMM $movable_start_bytes to physical hotplug failed.
  92. return
  93. ;;
  94. esac
  95. echo online > $mem/memory$block/state
  96. case "$?" in
  97. "0")
  98. log -p i -t DMM \'echo online\' to logical hotplug succeeded.
  99. ;;
  100. *)
  101. log -p e -t DMM \'echo online\' to logical hotplug failed.
  102. return
  103. ;;
  104. esac
  105. ;;
  106. esac
  107. setprop ro.dev.dmm.dpd.start_address $movable_start_bytes
  108. setprop ro.dev.dmm.dpd.block $block
  109. ;;
  110. esac
  111. case "$target" in
  112. "msm8960")
  113. return
  114. ;;
  115. esac
  116. # For 7X30 targets:
  117. # ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory
  118. # configuration. This is also used to indicate that the target is capable of
  119. # setting EBI-1 to Deep Power Down or Self Refresh.
  120. op=`cat $mem/low_power_memory_start_bytes`
  121. case "$op" in
  122. "0")
  123. log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op
  124. ;;
  125. "$mem/low_power_memory_start_bytes No such file or directory ")
  126. log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op
  127. ;;
  128. *)
  129. log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op
  130. ;;
  131. esac
  132. }
  133. #
  134. # For controlling console and shell on console on 8960 - perist.serial.enable 8960
  135. # On other target use default ro.debuggable property.
  136. #
  137. serial=`getprop persist.serial.enable`
  138. dserial=`getprop ro.debuggable`
  139. case "$target" in
  140. "msm8960")
  141. case "$serial" in
  142. "0")
  143. echo 0 > /sys/devices/platform/msm_serial_hsl.0/console
  144. ;;
  145. "1")
  146. echo 1 > /sys/devices/platform/msm_serial_hsl.0/console
  147. start console
  148. ;;
  149. *)
  150. case "$dserial" in
  151. "1")
  152. start console
  153. ;;
  154. esac
  155. ;;
  156. esac
  157. ;;
  158. "msm8610" | "msm8974" | "msm8226")
  159. case "$serial" in
  160. "0")
  161. echo 0 > /sys/devices/f991f000.serial/console
  162. ;;
  163. "1")
  164. echo 1 > /sys/devices/f991f000.serial/console
  165. start console
  166. ;;
  167. *)
  168. case "$dserial" in
  169. "1")
  170. start console
  171. ;;
  172. esac
  173. ;;
  174. esac
  175. ;;
  176. *)
  177. case "$dserial" in
  178. "1")
  179. start console
  180. ;;
  181. esac
  182. ;;
  183. esac
  184. case "$target" in
  185. "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
  186. insmod /system/lib/modules/ss_mfcinit.ko
  187. insmod /system/lib/modules/ss_vencoder.ko
  188. insmod /system/lib/modules/ss_vdecoder.ko
  189. chmod -h 0666 /dev/ss_mfc_reg
  190. chmod -h 0666 /dev/ss_vdec
  191. chmod -h 0666 /dev/ss_venc
  192. init_DMM
  193. ;;
  194. "msm8960")
  195. init_DMM
  196. ;;
  197. esac