/*
 * 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 "msm8952-qrd.dtsi"

&spmi_bus {
	qcom,pmi8950@2 {
		qcom,leds@a100 {
			status = "okay";
			qcom,led_mpp_2 {
				label = "mpp";
				linux,name = "green";
				linux,default-trigger = "none";
				qcom,default-state = "off";
				qcom,max-current = <40>;
				qcom,current-setting = <5>;
				qcom,id = <6>;
				qcom,mode = "manual";
				qcom,source-sel = <1>;
				qcom,mode-ctrl = <0x60>;
			};
		};
	};
};

&i2c_3 { /* BLSP1 QUP3 */
	synaptics@20 {
		compatible = "synaptics,rmi4";
		reg = <0x20>;
		interrupt-parent = <&msm_gpio>;
		interrupts = <65 0x2008>;
		vdd-supply = <&pm8950_l17>;
		vcc_i2c-supply = <&pm8950_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>;
		synaptics,display-coords = <0 0 1079 1919>;
		synaptics,panel-coords = <0 0 1079 2084>;
		synaptics,irq-gpio = <&msm_gpio 65 0x2008>;
		synaptics,reset-gpio = <&msm_gpio 64 0x0>;
		synaptics,i2c-pull-up;
		synaptics,power-down;
		synaptics,disable-gpios;
		synaptics,bypass-packrat-id-check;
		synaptics,button-map = <139 172 158>;
	};
};

&soc {
	gpio_keys {
		compatible = "gpio-keys";
		input-name = "gpio-keys";
		pinctrl-names = "tlmm_gpio_key_active","tlmm_gpio_key_suspend";
		pinctrl-0 = <&gpio_key_active>;
		pinctrl-1 = <&gpio_key_suspend>;

		vol_up {
			label = "volume_up";
			gpios = <&msm_gpio 85 0x1>;
			linux,input-type = <1>;
			linux,code = <115>;
			gpio-key,wakeup;
			debounce-interval = <15>;
		};

		home {
			label = "home";
			gpios = <&msm_gpio 93 0x1>;
			linux,input-type = <1>;
			linux,code = <102>;
			gpio-key,wakeup;
			debounce-interval = <15>;
		};
	};

	sound {
		compatible = "qcom,msm8952-audio-codec";
		qcom,model = "msm8952-skum-snd-card";
		reg = <0xc051000 0x4>,
		      <0xc051004 0x4>,
		      <0xc055000 0x4>;
		reg-names = "csr_gp_io_mux_mic_ctl",
			    "csr_gp_io_mux_spkr_ctl",
			    "csr_gp_io_lpaif_pri_pcm_pri_mode_muxsel";

		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 External", "Handset Mic",
			"MIC BIAS Internal2", "Headset Mic",
			"MIC BIAS External", "Secondary Mic",
			"AMIC1", "MIC BIAS External",
			"AMIC2", "MIC BIAS Internal2",
			"AMIC3", "MIC BIAS External",
			"SpkrMono WSA_IN", "WSA_SPK OUT";
		qcom,msm-gpios =
			"pri_i2s";
		qcom,pinctrl-names =
			"all_off",
			"pri_i2s_act";
		pinctrl-names =
			"all_off",
			"pri_i2s_act";
		pinctrl-0 = <&cdc_pdm_lines_sus &cdc_pdm_lines_2_sus>;
		pinctrl-1 = <&cdc_pdm_lines_act &cdc_pdm_lines_2_act>;
		asoc-platform = <&pcm0>, <&pcm1>, <&pcm2>, <&voip>, <&voice>,
				<&loopback>, <&compress>, <&hostless>,
				<&afe>, <&lsm>, <&routing>, <&lpa>,
				<&voice_svc>;
		asoc-platform-names = "msm-pcm-dsp.0", "msm-pcm-dsp.1", "msm-pcm-dsp.2",
				"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>, <&pm8950_cajon_dig>;
		asoc-codec-names = "msm-stub-codec.1", "cajon_codec";
	};
};

&msm_gpio {
	tlmm_gpio_key {
		gpio_key_active: gpio_key_active {
			mux {
				pins = "gpio85", "gpio93";
				function = "gpio";
			};

			config {
				pins = "gpio85", "gpios93";
			};
		};

		gpio_key_suspend: gpio_key_suspend {
			mux {
				pins = "gpio85", "gpio93";
				function = "gpio";
			};

			config {
				pins = "gpio85", "gpios93";
			};
		};
	};
};

&pmi_haptic {
	qcom,vmax-mv = <3300>;
};

&labibb {
	status = "ok";
	qpnp,qpnp-labibb-mode = "lcd";
};

&pmi8950_charger {
	qcom,float-voltage-mv = <4400>;
	qcom,chg-led-sw-controls;
	qcom,chg-led-support;
	status = "okay";
};

/ {
	qrd_batterydata: qcom,battery-data {
		qcom,batt-id-range-pct = <15>;
		#include "batterydata-qrd-skum-4v4-2920mah.dtsi"
	};
};

&pmi8950_fg {
	qcom,battery-data = <&qrd_batterydata>;
};

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

&msm_gpio {
	pmx_mdss {
		mdss_dsi_active: mdss_dsi_active {
			mux {
				pins = "gpio0";
			};
			config {
				pins = "gpio0";
			};
		};

		mdss_dsi_suspend: mdss_dsi_suspend {
			mux {
				pins = "gpio0";
			};
			config {
				pins = "gpio0";
			};
		};

	};

	pmx_mdss_te {
		mdss_te_active: mdss_te_active {
			mux {
				qcom,pins = "gpio24";
			};
			config {
				qcom,pins = "gpio24";
			};
		};

		mdss_te_suspend: mdss_te_suspend {
			mux {
				qcom,pins = "gpio24";
			};
			config {
				qcom,pins = "gpio24";
			};
		};

	};
};

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

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

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

&dsi_otm1906c_1080p_cmd {
	qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
};
