/* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <dt-bindings/interrupt-controller/irq.h>
#include "mdm9650-v1.1.dtsi"
#include "mdm9650-pinctrl.dtsi"

&soc {
	qcom,ntn_avb {
		compatible = "qcom,ntn_avb";
		qcom,ntn-rst-delay-msec = <100>;
		qcom,ntn-rc-num = <0>;
		qcom,ntn-fw-load-delay-msec = <200>;
		qcom,ntn-pcierst-resx;
		qcom,ntn-timestamp-valid-window = <4>; /* 4 is approx 67 ms */
		qcom,ntn-phy-addr = <7>;
	};
};

&blsp1_uart3 {
	status = "ok";
	pinctrl-names = "default";
	pinctrl-0 = <&uart3_console_active>;
};

&blsp1_uart2_hs {
	status = "ok";
};

&i2c_3 {
	status = "ok";
	smb1351_otg_supply: smb1351-charger@55 {
		compatible = "qcom,smb1351-charger";
		reg = <0x55>;
		interrupt-parent = <&tlmm_pinmux>;
		interrupts = <83 IRQ_TYPE_LEVEL_LOW>;
		qcom,float-voltage-mv = <4200>;
		qcom,charging-timeout = <1536>;
		qcom,recharge-thresh-mv = <200>;
		qcom,iterm-ma = <100>;
		regulator-name = "smb1351_otg_supply";
		pinctrl-names = "default";
		pinctrl-0 = <&smb_stat_active>;
		qcom,id-line-not-connected;
		qcom,switch-freq = <2>;
	};
};

&pmd9650_gpios {
	gpio@c100 { /* GPIO 2 - VADC */
		/* GPIO should be left off, and in the high
		 * impedance state when the pin is used with the VADC
		 */
		status = "ok";
		qcom,master-en = <0>;	/* DISABLE GPIO */
	};

	gpio@c200 { /* GPIO 3 - LED */
		status = "ok";
		qcom,master-en = <0>;    /* Disable GPIO */
	};

	gpio@c400 { /* GPIO 5 - USB_ID */
		status = "ok";
		qcom,mode = <0>;	/* Digital input */
		qcom,pull = <1>;	/* Pull up 1.5 uA */
		qcom,vin-sel = <1>;	/* 1.8 V */
		qcom,master-en = <1>;   /* Enable GPIO */
	};

	gpio@c500 { /* GPIO 6 - Rome 3.3V control */
		status = "ok";
		qcom,mode = <1>;		/* Digital output*/
		qcom,output-type = <0>;		/* CMOS logic */
		qcom,invert = <1>;		/* Output high */
		qcom,vin-sel = <0>;		/* VPH_PWR */
		qcom,src-sel = <0>;		/* Constant */
		qcom,out-strength = <1>;	/* High drive strength */
		qcom,master-en = <1>;		/* Enable GPIO */
	};

	gpio@c700 { /* GPIO 8 - BT_EN */
		status = "ok";
		qcom,mode = <1>;         /* Digital output*/
		qcom,pull = <4>;         /* Pulldown 10uA */
		qcom,vin-sel = <0>;      /* VPH_PWR */
		qcom,src-sel = <0>;      /* GPIO */
		qcom,invert = <0>;       /* Invert */
		qcom,master-en = <1>;    /* Enable GPIO */
	};
};

&pmd9650_misc {
	qcom,pwm-sel = <2>;		/* PWM2 */
	qcom,enable-gp-driver;		/* Enable GP */
};

&pmd9650_pwm_1 {
	status = "ok";
};

&pmd9650_pwm_2 {
	status = "ok";
};

&qnand_1 {
	status = "ok";
};

&usb3 {
	vbus_dwc3-supply = <&smb1351_otg_supply>;
	cpe-gpio = <&tlmm_pinmux 87 0>;
};

&pmd9650_vadc {
	chan@83 {
		label = "vph_pwr";
		reg = <0x83>;
		qcom,decimation = <2>;
		qcom,pre-div-channel-scaling = <1>;
		qcom,calibration-type = "absolute";
		qcom,scale-function = <0>;
		qcom,hw-settle-time = <0>;
		qcom,fast-avg-setup = <0>;
	};

	chan@4c {
		label = "xo_therm_buf";
		reg = <0x4c>;
		qcom,decimation = <2>;
		qcom,pre-div-channel-scaling = <0>;
		qcom,calibration-type = "ratiometric";
		qcom,scale-function = <4>;
		qcom,hw-settle-time = <2>;
		qcom,fast-avg-setup = <0>;
		qcom,vadc-thermal-node;
	};

	chan@53 {
		label = "ambient_therm";
		reg = <0x53>;
		qcom,decimation = <2>;
		qcom,pre-div-channel-scaling = <0>;
		qcom,calibration-type = "ratiometric";
		qcom,scale-function = <2>;
		qcom,hw-settle-time = <2>;
		qcom,fast-avg-setup = <0>;
		qcom,vadc-thermal-node;
	};

	chan@4d {
		label = "mdm_case_therm";
		reg = <0x4d>;
		qcom,decimation = <2>;
		qcom,pre-div-channel-scaling = <0>;
		qcom,calibration-type = "ratiometric";
		qcom,scale-function = <2>;
		qcom,hw-settle-time = <2>;
		qcom,fast-avg-setup = <0>;
		qcom,vadc-thermal-node;
	};

	chan@4e {
		label = "pa_therm1";
		reg = <0x4e>;
		qcom,decimation = <2>;
		qcom,pre-div-channel-scaling = <0>;
		qcom,calibration-type = "ratiometric";
		qcom,scale-function = <2>;
		qcom,hw-settle-time = <2>;
		qcom,fast-avg-setup = <0>;
		qcom,vadc-thermal-node;
	};

	chan@4f {
		label = "pa_therm2";
		reg = <0x4f>;
		qcom,decimation = <2>;
		qcom,pre-div-channel-scaling = <0>;
		qcom,calibration-type = "ratiometric";
		qcom,scale-function = <2>;
		qcom,hw-settle-time = <2>;
		qcom,fast-avg-setup = <0>;
		qcom,vadc-thermal-node;
	};
};
