blob: a8bcf09e9e7651714afaf2d458d043eb2f0f7fbc [file] [log] [blame]
Zvikomborero VIncent Zvikarambaa25011a2016-07-21 16:32:35 -04001#!/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
29export PATH=/system/bin
30
31# Set platform variables
32if [ -f /sys/devices/soc0/hw_platform ]; then
33 soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
34else
35 soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
36fi
37if [ -f /sys/devices/soc0/soc_id ]; then
38 soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
39else
40 soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
41fi
42if [ -f /sys/devices/soc0/platform_version ]; then
43 soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
44else
45 soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
46fi
47
48log -t BOOT -p i "MSM target '$1', SoC '$soc_hwplatform', HwID '$soc_hwid', SoC ver '$soc_hwver'"
49
50case "$1" in
51 "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
52 case "$soc_hwplatform" in
53 "FFA" | "SVLTE_FFA")
54 # linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that
55 # the UI keyboard works fine.
56 ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
57 ;;
58 "Fluid")
59 setprop ro.sf.lcd_density 240
60 setprop qcom.bt.dev_power_class 2
61 ;;
62 *)
63 ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
64 ;;
65 esac
66 ;;
67
68 "msm8660")
69 case "$soc_hwplatform" in
70 "Fluid")
71 setprop ro.sf.lcd_density 240
72 ;;
73 "Dragon")
74 setprop ro.sound.alsa "WM8903"
75 ;;
76 esac
77 ;;
78
79 "msm8960")
80 # lcd density is write-once. Hence the separate switch case
81 case "$soc_hwplatform" in
82 "Liquid")
83 if [ "$soc_hwver" == "196608" ]; then # version 0x30000 is 3D sku
84 setprop ro.sf.hwrotation 90
85 fi
86
87 setprop ro.sf.lcd_density 160
88 ;;
89 "MTP")
90 setprop ro.sf.lcd_density 240
91 ;;
92 *)
93 case "$soc_hwid" in
94 "109")
95 setprop ro.sf.lcd_density 160
96 ;;
97 *)
98 setprop ro.sf.lcd_density 240
99 ;;
100 esac
101 ;;
102 esac
103
104 #Set up composition type based on the target
105 case "$soc_hwid" in
106 87)
107 #8960
108 setprop debug.composition.type dyn
109 ;;
110 153|154|155|156|157|138)
111 #8064 V2 PRIME | 8930AB | 8630AB | 8230AB | 8030AB | 8960AB
112 setprop debug.composition.type c2d
113 ;;
114 *)
115 esac
116 ;;
117
118 "msm8974")
119 case "$soc_hwplatform" in
120 "Liquid")
121 setprop ro.sf.lcd_density 160
122 # Liquid do not have hardware navigation keys, so enable
123 # Android sw navigation bar
124 setprop ro.hw.nav_keys 0
125 ;;
126 "Dragon")
127 setprop ro.sf.lcd_density 240
128 ;;
129 *)
130 setprop ro.sf.lcd_density 320
131 ;;
132 esac
133 ;;
134
135 "msm8226")
136 case "$soc_hwplatform" in
137 *)
138 setprop ro.sf.lcd_density 320
139 ;;
140 esac
141 ;;
142
143 "msm8610" | "apq8084" | "mpq8092")
144 case "$soc_hwplatform" in
145 *)
146 setprop ro.sf.lcd_density 240
147 ;;
148 esac
149 ;;
150 "apq8084")
151 case "$soc_hwplatform" in
152 "Liquid")
153 setprop ro.sf.lcd_density 320
154 # Liquid do not have hardware navigation keys, so enable
155 # Android sw navigation bar
156 setprop ro.hw.nav_keys 0
157 ;;
158 "SBC")
159 setprop ro.sf.lcd_density 200
160 # SBC do not have hardware navigation keys, so enable
161 # Android sw navigation bar
162 setprop qemu.hw.mainkeys 0
163 ;;
164 *)
165 setprop ro.sf.lcd_density 480
166 ;;
167 esac
168 ;;
169esac
170
171# Setup HDMI related nodes & permissions
172# HDMI can be fb1 or fb2
173# Loop through the sysfs nodes and determine
174# the HDMI(dtv panel)
175for fb_cnt in 0 1 2
176do
177file=/sys/class/graphics/fb$fb_cnt
178dev_file=/dev/graphics/fb$fb_cnt
179 if [ -d "$file" ]
180 then
181 value=`cat $file/msm_fb_type`
182 case "$value" in
183 "dtv panel")
184 chown -h system.graphics $file/hpd
185 chown -h system.system $file/hdcp/tp
186 chown -h system.graphics $file/vendor_name
187 chown -h system.graphics $file/product_description
188 chmod -h 0664 $file/hpd
189 chmod -h 0664 $file/hdcp/tp
190 chmod -h 0664 $file/vendor_name
191 chmod -h 0664 $file/product_description
192 chmod -h 0664 $file/video_mode
193 chmod -h 0664 $file/format_3d
194 # create symbolic link
195 ln -s $dev_file /dev/graphics/hdmi
196 # Change owner and group for media server and surface flinger
197 chown -h system.system $file/format_3d;;
198 esac
199 fi
200done