/* Copyright (c) 2015, 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 "mdmcalifornium.dtsi"
#include "mdmcalifornium-pinctrl.dtsi"
#include "mdmcalifornium-display.dtsi"
#include "qpic-panel-ili-hvga.dtsi"

&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 0>;
		qcom,float-voltage-mv = <4200>;
		qcom,charging-timeout = <1536>;
		qcom,recharge-thresh-mv = <200>;
		qcom,iterm-ma = <100>;
		regulator-name = "smb1351_otg_supply";
		qcom,charging-disabled;
		qcom,id-line-not-connected;
	};
};

&pmdcalifornium_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@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 */
	};
};

&usb3 {
	vbus_dwc3-supply = <&smb1351_otg_supply>;
};

&pmdcalifornium_vadc {
	chan@83 {
		label = "vph_pwr";
		reg = <0x83>;
		qcom,decimation = <0>;
		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 = <0>;
		qcom,pre-div-channel-scaling = <0>;
		qcom,calibration-type = "ratiometric";
		qcom,scale-function = <4>;
		qcom,hw-settle-time = <2>;
		qcom,fast-avg-setup = <0>;
	};

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

/* Display */
&mdss_qpic {
	pinctrl-names= "mdss_default", "mdss_sleep";
	pinctrl-0 = <&mdss_cs_active &mdss_te_active &mdss_rs_active
		&mdss_ad_active &mdss_bl_active>;
	pinctrl-1 = <&mdss_cs_sleep &mdss_te_sleep
		&mdss_rs_sleep &mdss_ad_sleep &mdss_bl_sleep>;
	status = "ok";
};