msm8916-huawei-g7.dts 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. // Copyright (C) 2021 Stephan Gerhold
  3. /dts-v1/;
  4. #include "msm8916-pm8916.dtsi"
  5. #include <dt-bindings/gpio/gpio.h>
  6. #include <dt-bindings/input/input.h>
  7. #include <dt-bindings/interrupt-controller/irq.h>
  8. #include <dt-bindings/leds/common.h>
  9. #include <dt-bindings/sound/apq8016-lpass.h>
  10. /*
  11. * Note: The original firmware from Huawei can only boot 32-bit kernels.
  12. * To boot this device tree using arm64 it is necessary to flash 64-bit TZ/HYP
  13. * firmware (e.g. taken from the DragonBoard 410c).
  14. * See https://wiki.postmarketos.org/wiki/Huawei_Ascend_G7_(huawei-g7)
  15. * for suggested installation instructions.
  16. */
  17. / {
  18. model = "Huawei Ascend G7";
  19. compatible = "huawei,g7", "qcom,msm8916";
  20. chassis-type = "handset";
  21. aliases {
  22. serial0 = &blsp1_uart2;
  23. };
  24. chosen {
  25. stdout-path = "serial0";
  26. };
  27. gpio-keys {
  28. compatible = "gpio-keys";
  29. pinctrl-names = "default";
  30. pinctrl-0 = <&gpio_keys_default>;
  31. label = "GPIO Buttons";
  32. button-volume-up {
  33. label = "Volume Up";
  34. gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
  35. linux,code = <KEY_VOLUMEUP>;
  36. };
  37. };
  38. leds {
  39. compatible = "gpio-leds";
  40. pinctrl-names = "default";
  41. pinctrl-0 = <&gpio_leds_default>;
  42. led-0 {
  43. gpios = <&msmgpio 8 GPIO_ACTIVE_HIGH>;
  44. color = <LED_COLOR_ID_RED>;
  45. default-state = "off";
  46. function = LED_FUNCTION_INDICATOR;
  47. };
  48. led-1 {
  49. gpios = <&msmgpio 9 GPIO_ACTIVE_HIGH>;
  50. color = <LED_COLOR_ID_GREEN>;
  51. default-state = "off";
  52. function = LED_FUNCTION_INDICATOR;
  53. };
  54. led-2 {
  55. gpios = <&msmgpio 10 GPIO_ACTIVE_HIGH>;
  56. color = <LED_COLOR_ID_BLUE>;
  57. default-state = "off";
  58. function = LED_FUNCTION_INDICATOR;
  59. };
  60. };
  61. usb_id: usb-id {
  62. compatible = "linux,extcon-usb-gpio";
  63. id-gpio = <&msmgpio 117 GPIO_ACTIVE_HIGH>;
  64. pinctrl-names = "default";
  65. pinctrl-0 = <&usb_id_default>;
  66. };
  67. };
  68. &blsp_i2c2 {
  69. status = "okay";
  70. magnetometer@c {
  71. compatible = "asahi-kasei,ak09911";
  72. reg = <0x0c>;
  73. vdd-supply = <&pm8916_l17>;
  74. vid-supply = <&pm8916_l6>;
  75. reset-gpios = <&msmgpio 36 GPIO_ACTIVE_LOW>;
  76. pinctrl-names = "default";
  77. pinctrl-0 = <&mag_reset_default>;
  78. };
  79. accelerometer@1e {
  80. compatible = "kionix,kx023-1025";
  81. reg = <0x1e>;
  82. interrupt-parent = <&msmgpio>;
  83. interrupts = <115 IRQ_TYPE_EDGE_RISING>;
  84. vdd-supply = <&pm8916_l17>;
  85. vddio-supply = <&pm8916_l6>;
  86. pinctrl-names = "default";
  87. pinctrl-0 = <&accel_irq_default>;
  88. mount-matrix = "-1", "0", "0",
  89. "0", "1", "0",
  90. "0", "0", "1";
  91. };
  92. proximity@39 {
  93. compatible = "avago,apds9930";
  94. reg = <0x39>;
  95. interrupt-parent = <&msmgpio>;
  96. interrupts = <113 IRQ_TYPE_EDGE_FALLING>;
  97. vdd-supply = <&pm8916_l17>;
  98. vddio-supply = <&pm8916_l6>;
  99. led-max-microamp = <100000>;
  100. amstaos,proximity-diodes = <1>;
  101. pinctrl-names = "default";
  102. pinctrl-0 = <&prox_irq_default>;
  103. };
  104. regulator@3e {
  105. compatible = "ti,tps65132";
  106. reg = <0x3e>;
  107. pinctrl-names = "default";
  108. pinctrl-0 = <&reg_lcd_en_default>;
  109. reg_lcd_pos: outp {
  110. regulator-name = "outp";
  111. regulator-min-microvolt = <5400000>;
  112. regulator-max-microvolt = <5400000>;
  113. enable-gpios = <&msmgpio 97 GPIO_ACTIVE_HIGH>;
  114. regulator-active-discharge = <1>;
  115. };
  116. reg_lcd_neg: outn {
  117. regulator-name = "outn";
  118. regulator-min-microvolt = <5400000>;
  119. regulator-max-microvolt = <5400000>;
  120. enable-gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>;
  121. regulator-active-discharge = <1>;
  122. };
  123. };
  124. };
  125. &blsp_i2c5 {
  126. status = "okay";
  127. rmi4@70 {
  128. compatible = "syna,rmi4-i2c";
  129. reg = <0x70>;
  130. #address-cells = <1>;
  131. #size-cells = <0>;
  132. interrupt-parent = <&msmgpio>;
  133. interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
  134. vdd-supply = <&pm8916_l17>;
  135. vio-supply = <&pm8916_l16>;
  136. pinctrl-names = "default";
  137. pinctrl-0 = <&ts_irq_default>;
  138. syna,startup-delay-ms = <100>;
  139. rmi4-f01@1 {
  140. reg = <0x1>;
  141. syna,nosleep-mode = <1>; /* Allow sleeping */
  142. };
  143. rmi4-f11@11 {
  144. reg = <0x11>;
  145. syna,sensor-type = <1>; /* Touchscreen */
  146. };
  147. };
  148. };
  149. &blsp_i2c6 {
  150. status = "okay";
  151. nfc@28 {
  152. compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
  153. reg = <0x28>;
  154. interrupt-parent = <&msmgpio>;
  155. interrupts = <21 IRQ_TYPE_EDGE_RISING>;
  156. enable-gpios = <&msmgpio 20 GPIO_ACTIVE_HIGH>;
  157. firmware-gpios = <&msmgpio 2 GPIO_ACTIVE_HIGH>;
  158. pinctrl-names = "default";
  159. pinctrl-0 = <&nfc_default>;
  160. };
  161. };
  162. &blsp1_uart2 {
  163. status = "okay";
  164. };
  165. &lpass {
  166. status = "okay";
  167. };
  168. &pm8916_resin {
  169. status = "okay";
  170. linux,code = <KEY_VOLUMEDOWN>;
  171. };
  172. &pm8916_vib {
  173. status = "okay";
  174. };
  175. &pronto {
  176. status = "okay";
  177. };
  178. &sdhc_1 {
  179. status = "okay";
  180. pinctrl-names = "default", "sleep";
  181. pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
  182. pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
  183. };
  184. &sdhc_2 {
  185. status = "okay";
  186. pinctrl-names = "default", "sleep";
  187. pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on &sdhc2_cd_default>;
  188. pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off &sdhc2_cd_default>;
  189. /*
  190. * The Huawei device tree sets cd-gpios = <&msmgpio 38 GPIO_ACTIVE_HIGH>.
  191. * However, gpio38 does not change its state when inserting/removing the
  192. * SD card, it's just low all the time. The Huawei kernel seems to use
  193. * polling for SD card detection instead.
  194. *
  195. * However, looking closer at the GPIO debug output it turns out that
  196. * gpio56 switches its state when inserting/removing the SD card.
  197. * It behaves just like gpio38 normally does. Usually GPIO56 is used as
  198. * "UIM2_PRESENT", i.e. to check if a second SIM card is inserted.
  199. * Maybe Huawei decided to replace the second SIM card slot with the
  200. * SD card slot and forgot to re-route to gpio38.
  201. */
  202. cd-gpios = <&msmgpio 56 GPIO_ACTIVE_LOW>;
  203. };
  204. &sound {
  205. status = "okay";
  206. model = "msm8916";
  207. audio-routing =
  208. "AMIC1", "MIC BIAS External1",
  209. "AMIC2", "MIC BIAS External2",
  210. "AMIC3", "MIC BIAS External1";
  211. pinctrl-names = "default", "sleep";
  212. pinctrl-0 = <&cdc_pdm_lines_act>;
  213. pinctrl-1 = <&cdc_pdm_lines_sus>;
  214. primary-dai-link {
  215. link-name = "WCD";
  216. cpu {
  217. sound-dai = <&lpass MI2S_PRIMARY>;
  218. };
  219. codec {
  220. sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
  221. };
  222. };
  223. tertiary-dai-link {
  224. link-name = "WCD-Capture";
  225. cpu {
  226. sound-dai = <&lpass MI2S_TERTIARY>;
  227. };
  228. codec {
  229. sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
  230. };
  231. };
  232. };
  233. &usb {
  234. status = "okay";
  235. extcon = <&usb_id>, <&usb_id>;
  236. };
  237. &usb_hs_phy {
  238. extcon = <&usb_id>;
  239. };
  240. &wcd_codec {
  241. qcom,micbias-lvl = <2800>;
  242. qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
  243. qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
  244. qcom,hphl-jack-type-normally-open;
  245. };
  246. &smd_rpm_regulators {
  247. vdd_l1_l2_l3-supply = <&pm8916_s3>;
  248. vdd_l4_l5_l6-supply = <&pm8916_s4>;
  249. vdd_l7-supply = <&pm8916_s4>;
  250. s3 {
  251. regulator-min-microvolt = <1200000>;
  252. regulator-max-microvolt = <1300000>;
  253. };
  254. s4 {
  255. regulator-min-microvolt = <1800000>;
  256. regulator-max-microvolt = <2100000>;
  257. };
  258. l1 {
  259. regulator-min-microvolt = <1225000>;
  260. regulator-max-microvolt = <1225000>;
  261. };
  262. l2 {
  263. regulator-min-microvolt = <1200000>;
  264. regulator-max-microvolt = <1200000>;
  265. };
  266. l4 {
  267. regulator-min-microvolt = <2050000>;
  268. regulator-max-microvolt = <2050000>;
  269. };
  270. l5 {
  271. regulator-min-microvolt = <1800000>;
  272. regulator-max-microvolt = <1800000>;
  273. };
  274. l6 {
  275. regulator-min-microvolt = <1800000>;
  276. regulator-max-microvolt = <1800000>;
  277. };
  278. l7 {
  279. regulator-min-microvolt = <1800000>;
  280. regulator-max-microvolt = <1800000>;
  281. };
  282. l8 {
  283. regulator-min-microvolt = <2950000>;
  284. regulator-max-microvolt = <2950000>;
  285. };
  286. l9 {
  287. regulator-min-microvolt = <3300000>;
  288. regulator-max-microvolt = <3300000>;
  289. };
  290. l10 {
  291. regulator-min-microvolt = <2700000>;
  292. regulator-max-microvolt = <2800000>;
  293. };
  294. l11 {
  295. regulator-min-microvolt = <1800000>;
  296. regulator-max-microvolt = <2950000>;
  297. regulator-allow-set-load;
  298. regulator-system-load = <200000>;
  299. };
  300. l12 {
  301. regulator-min-microvolt = <1800000>;
  302. regulator-max-microvolt = <2950000>;
  303. };
  304. l13 {
  305. regulator-min-microvolt = <3075000>;
  306. regulator-max-microvolt = <3075000>;
  307. };
  308. l14 {
  309. regulator-min-microvolt = <1800000>;
  310. regulator-max-microvolt = <3300000>;
  311. };
  312. l15 {
  313. regulator-min-microvolt = <1800000>;
  314. regulator-max-microvolt = <3300000>;
  315. };
  316. l16 {
  317. regulator-min-microvolt = <1800000>;
  318. regulator-max-microvolt = <1800000>;
  319. };
  320. l17 {
  321. regulator-min-microvolt = <2850000>;
  322. regulator-max-microvolt = <2850000>;
  323. };
  324. l18 {
  325. regulator-min-microvolt = <2700000>;
  326. regulator-max-microvolt = <2700000>;
  327. };
  328. };
  329. &msmgpio {
  330. accel_irq_default: accel-irq-default {
  331. pins = "gpio115";
  332. function = "gpio";
  333. drive-strength = <2>;
  334. bias-disable;
  335. };
  336. gpio_keys_default: gpio-keys-default {
  337. pins = "gpio107";
  338. function = "gpio";
  339. drive-strength = <2>;
  340. bias-pull-up;
  341. };
  342. gpio_leds_default: gpio-leds-default {
  343. pins = "gpio8", "gpio9", "gpio10";
  344. function = "gpio";
  345. drive-strength = <2>;
  346. bias-disable;
  347. };
  348. nfc_default: nfc-default {
  349. pins = "gpio2", "gpio20", "gpio21";
  350. function = "gpio";
  351. drive-strength = <2>;
  352. bias-disable;
  353. };
  354. mag_reset_default: mag-reset-default {
  355. pins = "gpio36";
  356. function = "gpio";
  357. drive-strength = <2>;
  358. bias-disable;
  359. };
  360. prox_irq_default: prox-irq-default {
  361. pins = "gpio113";
  362. function = "gpio";
  363. drive-strength = <2>;
  364. bias-disable;
  365. };
  366. reg_lcd_en_default: reg-lcd-en-default {
  367. pins = "gpio32", "gpio97";
  368. function = "gpio";
  369. drive-strength = <2>;
  370. bias-disable;
  371. };
  372. sdhc2_cd_default: sdhc2-cd-default {
  373. pins = "gpio56";
  374. function = "gpio";
  375. drive-strength = <2>;
  376. bias-disable;
  377. };
  378. ts_irq_default: ts-irq-default {
  379. pins = "gpio13";
  380. function = "gpio";
  381. drive-strength = <2>;
  382. bias-disable;
  383. };
  384. usb_id_default: usb-id-default {
  385. pins = "gpio117";
  386. function = "gpio";
  387. drive-strength = <8>;
  388. bias-pull-up;
  389. };
  390. };