/* Copyright (c) 2014-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 "msm8909-qrd.dtsi"

/ {
	model = "Qualcomm Technologies, Inc. MSM8909 QRD SKUA";
	compatible = "qcom,msm8909-qrd", "qcom,msm8909", "qcom,qrd";
};

&soc {
	i2c@78b9000 { /* BLSP1 QUP5 */
		focaltech@38 {
			compatible = "focaltech,5x06";
			reg = <0x38>;
			interrupt-parent = <&msm_gpio>;
			interrupts = <13 0x2>;
			vdd-supply = <&pm8909_l17>;
			vcc_i2c-supply = <&pm8909_l6>;
			/* pins used by touchscreen */
			pinctrl-names = "pmx_ts_active","pmx_ts_suspend","pmx_ts_release";
			pinctrl-0 = <&ts_int_active &ts_reset_active>;
			pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
			pinctrl-2 = <&ts_release>;
			focaltech,name = "ft6336";
			focaltech,family-id = <0x36>;
			focaltech,reset-gpio = <&msm_gpio 12 0x0>;
			focaltech,irq-gpio = <&msm_gpio 13 0x0>;
			focaltech,display-coords = <0 0 480 854>;
			focaltech,panel-coords = <0 0 480 950>;
			focaltech,button-map= <139 102 158>;
			focaltech,no-force-update;
			focaltech,i2c-pull-up;
			focaltech,group-id = <1>;
			focaltech,hard-reset-delay-ms = <20>;
			focaltech,soft-reset-delay-ms = <200>;
			focaltech,num-max-touches = <2>;
			focaltech,fw-delay-aa-ms = <30>;
			focaltech,fw-delay-55-ms = <30>;
			focaltech,fw-upgrade-id1 = <0x79>;
			focaltech,fw-upgrade-id2 = <0x18>;
			focaltech,fw-delay-readid-ms = <10>;
			focaltech,fw-delay-era-flsh-ms = <2000>;
			focaltech,fw-auto-cal;
			focaltech,ignore-id-check;
		};
	};

	gen-vkeys {
		compatible = "qcom,gen-vkeys";
		label = "ft5x06_ts";
		qcom,disp-maxx = <480>;
		qcom,disp-maxy = <854>;
		qcom,panel-maxx = <480>;
		qcom,panel-maxy = <946>;
		qcom,key-codes = <139 172 158>;
		qcom,y-offset = <0>;
	};

	sound {
		compatible = "qcom,msm8x16-audio-codec";
		qcom,model = "msm8909-skua-snd-card";
		qcom,msm-snd-card-id = <0>;
		qcom,msm-codec-type = "internal";
		qcom,msm-ext-pa = "primary";
		qcom,msm-mclk-freq = <9600000>;
		qcom,msm-mbhc-hphl-swh = <1>;
		qcom,msm-mbhc-gnd-swh = <0>;
		qcom,msm-hs-micbias-type = "internal";
		qcom,msm-micbias1-ext-cap;
		qcom,msm-micbias2-ext-cap;
		qcom,audio-routing =
			"RX_BIAS", "MCLK",
			"SPK_RX_BIAS", "MCLK",
			"INT_LDO_H", "MCLK",
			"MIC BIAS Internal1", "Handset Mic",
			"MIC BIAS Internal2", "Headset Mic",
			"AMIC1", "MIC BIAS Internal1",
			"AMIC2", "MIC BIAS Internal2";
		pinctrl-names = "cdc_lines_act",
				"cdc_lines_sus";
		pinctrl-0 = <&cdc_pdm_lines_act>;
		pinctrl-1 = <&cdc_pdm_lines_sus>;
		asoc-platform = <&pcm0>, <&pcm1>, <&voip>, <&voice>,
				<&loopback>, <&compress>, <&hostless>,
				<&afe>, <&lsm>, <&routing>, <&lpa>,
				<&voice_svc>;
		asoc-platform-names = "msm-pcm-dsp.0", "msm-pcm-dsp.1",
				"msm-voip-dsp", "msm-pcm-voice", "msm-pcm-loopback",
				"msm-compress-dsp", "msm-pcm-hostless", "msm-pcm-afe",
				"msm-lsm-client", "msm-pcm-routing", "msm-pcm-lpa",
				"msm-voice-svc";
		asoc-cpu = <&dai_pri_auxpcm>, <&dai_hdmi>,
				<&dai_mi2s0>, <&dai_mi2s1>, <&dai_mi2s2>, <&dai_mi2s3>,
				<&sb_0_rx>, <&sb_0_tx>, <&sb_1_rx>, <&sb_1_tx>,
				<&sb_3_rx>, <&sb_3_tx>, <&sb_4_rx>, <&sb_4_tx>,
				<&bt_sco_rx>, <&bt_sco_tx>, <&int_fm_rx>, <&int_fm_tx>,
				<&afe_pcm_rx>, <&afe_pcm_tx>, <&afe_proxy_rx>, <&afe_proxy_tx>,
				<&incall_record_rx>, <&incall_record_tx>, <&incall_music_rx>,
				<&incall_music_2_rx>;
		asoc-cpu-names = "msm-dai-q6-auxpcm.1", "msm-dai-q6-hdmi.8",
				"msm-dai-q6-mi2s.0", "msm-dai-q6-mi2s.1",
				"msm-dai-q6-mi2s.2", "msm-dai-q6-mi2s.3",
				"msm-dai-q6-dev.16384",	"msm-dai-q6-dev.16385",
				"msm-dai-q6-dev.16386", "msm-dai-q6-dev.16387",
				"msm-dai-q6-dev.16390", "msm-dai-q6-dev.16391",
				"msm-dai-q6-dev.16392",	"msm-dai-q6-dev.16393",
				"msm-dai-q6-dev.12288", "msm-dai-q6-dev.12289",
				"msm-dai-q6-dev.12292", "msm-dai-q6-dev.12293",
				"msm-dai-q6-dev.224", "msm-dai-q6-dev.225",
				"msm-dai-q6-dev.241", "msm-dai-q6-dev.240",
				"msm-dai-q6-dev.32771", "msm-dai-q6-dev.32772",
				"msm-dai-q6-dev.32773", "msm-dai-q6-dev.32770";
		asoc-codec = <&stub_codec>, <&pm8909_conga_dig>;
		asoc-codec-names = "msm-stub-codec.1", "tombak_codec";
	};
};

&tlmm_pinmux {
	bma2x2_int1_pin {
		qcom,pins = <&gp 96>;
		qcom,num-grp-pins = <1>;
		label = "bma2x2_int1_pin";
		bma2x2_int1_default: int1_default {
			  drive-strength = <6>;
			  bias-pull-up;
		};
	};

	bma2x2_int2_pin {
		qcom,pins = <&gp 65>;
		qcom,num-grp-pins = <1>;
		label = "bma2x2_int2_pin";
		bma2x2_int2_default: int2_default {
			  drive-strength = <6>;
			  bias-pull-up;
		};
	};
};

&i2c_1 { /* BLSP1 QUP1 */
	bosch@18 { /* Accelerometer sensor */
		compatible = "bosch,bma2x2";
		reg = <0x18>;
		pinctrl-names = "default";
		pinctrl-0 = <&bma2x2_int1_default &bma2x2_int2_default>;
		interrupt-parent = <&msm_gpio>;
		interrupts = <96 0x2002>;
		vdd-supply = <&pm8909_l17>;
		vio-supply = <&pm8909_l6>;
		bosch,init-interval = <200>;
		bosch,place = <2>;
		bosch,gpio-int1 = <&msm_gpio 96 0x2002>;
		bosch,gpio-int2 = <&msm_gpio 65 0x2002>;
	};
};

&pm8909_vadc {
	chan@30 {
		qcom,scale-function = <6>;
	};
};

&pm8909_chg {
	qcom,vddmax-mv = <4350>;
	qcom,vddsafe-mv = <4380>;
	qcom,vinmin-mv = <4470>;
	qcom,batt-hot-percentage = <35>;
	qcom,batt-cold-percentage = <70>;
	qcom,tchg-mins = <360>;
	qcom,chgr-led-support;
	qcom,disable-vbatdet-based-recharge;
	status = "okay";
};

/ {
	qrd_batterydata: qcom,battery-data {
		qcom,rpull-up-kohm = <100>;
		qcom,vref-batt-therm = <1800000>;

		#include "batterydata-qrd-skua-4v35-2000mah.dtsi"
	};
};

&pm8909_bms {
	status = "okay";
	qcom,force-bms-active-on-charger;
	qcom,battery-data = <&qrd_batterydata>;
};

&sdc2_cd_on {
	/delete-property/ bias-pull-up;
	bias-pull-down;
};

&sdc2_cd_off {
	/delete-property/ bias-disable;
	bias-pull-down;
};

&sdhc_2 {
	qcom,nonhotplug;
	interrupts = <0 1>;
	interrupt-map = <0 &intc 0 125 0
		1 &intc 0 221 0>;
	interrupt-names = "hc_irq", "pwr_irq";
	/delete-property/ cd-gpios;
};

&pm8909_mpps {
	mpp@a000 { /* MPP 1 */
		/* VDD_PX */
		status = "disabled";
	};

	mpp@a100 { /* MPP 2 */
		/* Backlight PWM */
		qcom,mode = <1>;		/* Digital output */
		qcom,invert = <0>;		/* Disable invert */
		qcom,src-sel = <4>;		/* DTEST1 */
		qcom,vin-sel = <0>;		/* VPH_PWR */
		qcom,master-en = <1>;		/* Enable MPP */
	};

	mpp@a200 { /* MPP 3 */
		/* VREF DAC */
		status = "disabled";
	};

	mpp@a300 { /* MPP 4 */
		/* HR LED */
		status = "disabled";
	};
};

&mdss_mdp {
	qcom,mdss-pref-prim-intf = "dsi";
};

&dsi_hx8379a_fwvga_skua_vid {
	qcom,mdss-dsi-pwm-gpio = <&pm8909_mpps 2 0>;
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
};

&pmx_mdss {
	qcom,num-grp-pins = <1>;
	qcom,pins = <&gp 25>;
};

&pmx_mdss_te {
	qcom,num-grp-pins = <1>;
	qcom,pins = <&gp 24>;
};

&mdss_dsi0 {
	qcom,dsi-pref-prim-pan = <&dsi_hx8379a_fwvga_skua_vid>;
	pinctrl-names = "mdss_default", "mdss_sleep";
	pinctrl-0 = <&mdss_dsi_active &mdss_te_active>;
	pinctrl-1 = <&mdss_dsi_suspend &mdss_te_suspend>;

	qcom,platform-reset-gpio = <&msm_gpio 25 0>;
};
