90-armh-nexus7.sh 3.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
#!/bin/sh

# FIXME: the exact partition may vary
cat >> /etc/fstab << EOF
# YMMV, this might be /dev/mmcblk0p10 either
/dev/mmcblk0p9 / ext4 defaults 1 1
EOF

cd /etc/udev/rules.d || exit 1

cat > 90-tegra-rt5640.rules << EOF
SUBSYSTEM!="sound", GOTO="tegra_rt5640_end"
ACTION!="change", GOTO="tegra_rt5640_end"
KERNEL!="card*", GOTO="tegra_rt5640_end"

ATTRS{id}=="tegrart5640", ENV{PULSE_PROFILE_SET}="tegra-nexus7.conf"

LABEL="tegra_rt5640_end"
EOF

cd /usr/share/pulseaudio/alsa-mixer/profile-sets || exit 1
cat > tegra-nexus7.conf << EOF
[General]
auto-profiles = yes

[Mapping analog-stereo]
device-strings = front:%f hw:%f plughw:%f
channel-map = left,right
paths-output = tegra-nexus7-speaker tegra-nexus7-headphone
paths-input = tegra-nexus7-intmic
priority = 10
EOF

cd /etc/X11 || exit 1
cat > xorg.conf << EOF
Section "Device"
	Identifier	"nexus"
	Driver		"tegra"
EndSection
EOF

cd /etc/X11/xorg.conf.d || exit 1
cat > 99-nexus-calibration.conf << EOF
Section "InputClass"
    Identifier    "Nexus 7 Touchscreen"
    MatchIsTouchscreen "on"
    MatchProduct  "elan-touchscreen"
    MatchDevicePath "/dev/input/event*"
    MatchDriver   "evdev"
#    Option  "Calibration"   "29 2125 106 1356"
#    Option  "SwapAxes"      "0"
#    Option  "Calibration"   "566 1201 1025 2075"
#    Option  "SwapAxes"      "1"
     Option  "Calibration"   "6 2132 29 1294"
     Option  "SwapAxes"      "0"
EndSection
EOF

cat > 99-nexus-rotation.conf << EOF
Section "Monitor"
    Identifier	"Monitor"
    Option	"Rotate" "right"
EndSection

Section "Screen"
    Identifier    "Screen"
    Monitor       "Monitor"
EndSection
EOF

cd /usr/share/pulseaudio/alsa-mixer/paths || exit 1
cat > tegra-nexus7-headphone.conf << EOF
[General]
priority = 90
name = analog-output-headphones

[Jack HP-detect]
state.plugged = yes

[Element Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element HP]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Headphone Jack]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Int Spk]
switch = off

; Due to a kernel bug (?) the "Int Mic" is a playback control.
; Therefore we enable it here instead of in the proper place
[Element Int Mic]
switch = on

EOF

cat > tegra-nexus7-intmic.conf << EOF
[General]
priority = 90
name = analog-input-microphone-internal

[Element ADC]
; For some reason the ADC volume seems not to be affecting input gain
switch = mute
volume = zero
override-map.1 = all
override-map.2 = all-left,all-right

[Element ADC Boost Gain]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Int Mic]
switch = mute

[Element DMIC]
enumeration = select

[Option DMIC:DMIC1]
priority = 89
name = analog-input-internal-microphone

EOF

cat > tegra-nexus7-speaker.conf << EOF
[General]
priority = 100
name = analog-output-speaker

[Jack HP-detect]
state.plugged = no
state.unplugged = unknown

[Element Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Speaker]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Int Spk]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Headphone Jack]
switch = off

; Due to a kernel bug (?) the "Int Mic" is a playback control.
; Therefore we enable it here instead of in the proper place
[Element Int Mic]
switch = on
EOF