/*
 * Copyright (c) 2022, 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.
 */

&tlmm {
	sar_int_default: sar_int_default {
			mux {
				pins = "gpio19";
				function =  "gpio";
			};
			config {
				pins = "gpio19";
				num-grp-pins = <1>;
				drive-strength = <2>;
				bias-pull-up;
			};
	};

	sar_int_sleep: sar_int_sleep {
			mux {
				pins = "gpio19";
				function =  "gpio";
			};
			config {
				pins = "gpio19";
				num-grp-pins = <1>;
				drive-strength = <2>;
				bias-pull-up;
			};
	};
	sar_int_default_sub: sar_int_default_sub {
			mux {
				pins = "gpio119";
				function =  "gpio";
			};
			config {
				pins = "gpio119";
				num-grp-pins = <1>;
				drive-strength = <2>;
				bias-pull-up;
			};
	};

	sar_int_sleep_sub: sar_int_sleep_sub {
			mux {
				pins = "gpio119";
				function =  "gpio";
			};
			config {
				pins = "gpio119";
				num-grp-pins = <1>;
				drive-strength = <2>;
				bias-pull-up;
			};
	};
};

&qupv3_hub_i2c2 {
	status = "ok";
	sx937x@2c { /* SAR sensor */
		compatible = "Semtech,sx937x";
		reg = <0x2c>;
		Semtech,power-supply-type = <0>;
		//cap_vdd-supply = <&pm_humu_l15>;
                cap_vdd-supply = <&pm_humu_l1>;
		pinctrl-names = "default","sleep";
		pinctrl-0 = <&sar_int_default>;
		pinctrl-1 = <&sar_int_sleep>;
		interrupt-parent = <&tlmm>;
		interrupts = <19 0x02>;
		interrupt-names = "capsense0_irq";
		Semtech,nirq-gpio= <&tlmm 19 0x02>;
		/*use PH4/5/6 as the reference sensor
		set it to 0xff if the ref-phases-x is not used*/
		Semtech,ref-phases-a = <4>;
		Semtech,ref-phases-b = <5>;
		Semtech,ref-phases-c = <6>;
		Semtech,button-flag = <0x3a>;
		Semtech,button-names = "Moto CapSense Ch1","Moto CapSense Ch3","Moto CapSense Ch4","Moto CapSense Ch5";
		Semtech,debug-name = "capsense0";
		Semtech,flip_operation_num = <3>;
		Semtech,flip_operation_far_num = <3>;
		Semtech,flip_near_init = <
			0x80F8 0x8130
			0x8024 0x0800
			0x4280 0xE
		>;
		Semtech,flip_far_init = <
                        0x80F8 0x8830
			0x8024 0xFF00
			0x4280 0xE
		>;
		Semtech,reg-num = <71>;
		Semtech,reg-init = <
			0x4004 0x74
			0x8008 0x0
			0x8020 0x24
			0x8028 0x486
			0x8034 0x486
			0x8040 0x486
			0x804C 0x486
			0x8058 0x48E
			0x8064 0x486
			0x8070 0x486
			0x807C 0xE56
			0x8030 0xFFF9EF
			0x803C 0xFFF97F
			0x8048 0xFFD9FF
			0x8054 0xF7F9FF
			0x8060 0xFFF9FD
			0x806C 0xFEF9FF
			0x8078 0xBFF9FF
			0x8084 0xFFF97F
			0x802C 0x0
			0x8038 0x0
			0x8044 0x0
			0x8050 0x0
			0x805C 0x0
			0x8068 0x0
			0x8074 0x0
			0x8080 0x0
			0x8098 0x0
			0x80B8 0x662D
			0x80D8 0x0
			0x8118 0x8F8F
			0x8138 0x7A7A
			0x8158 0x0
			0x8178 0x8D8D
			0x80A0 0x0
			0x80C0 0x19190003
			0x80E0 0x0
			0x8100 0x0F0F0001
			0x8120 0x21210003
			0x8140 0x14140002
			0x8160 0x0
			0x8180 0x19190003
			0x8188 0x8000010
			0x818C 0x8000012
			0x8190 0x8000016
			0x8194 0x0
			0x8090 0x2AD67000
			0x80B0 0x2AD67000
			0x80D0 0x2AD67000
			0x80F0 0x2AD67000
			0x8110 0x2AD67000
			0x8130 0x2AD67000
			0x8150 0x2AD67000
			0x8170 0x00007000
			0x8088 0x300000
			0x80A8 0x300000
			0x80C8 0x300000
			0x80E8 0x300000
			0x8108 0x300000
			0x8128 0x300000
			0x8148 0x02100000
			0x8168 0x300000
			0x808C 0xA020003C
			0x80AC 0xA020003C
			0x80CC 0xA020003C
			0x80EC 0xA020003C
			0x810C 0xA0200030
			0x812C 0xA020003C
			0x814C 0xA020003C
			0x816C 0xA02000C0
			0x8024 0xFF00
		>;
		status = "ok";
	};
};

&qupv3_hub_i2c2 {
	status = "ok";
	sx937x@24 { /* SAR sensor */
		compatible = "Semtech,sx937x";
		reg = <0x24>;
		Semtech,power-supply-type = <0>;
		//cap_vdd-supply = <&pm_humu_l15>;
                cap_vdd-supply = <&pm_humu_l1>;
		pinctrl-names = "default","sleep";
		pinctrl-0 = <&sar_int_default_sub>;
		pinctrl-1 = <&sar_int_sleep_sub>;
		interrupt-parent = <&tlmm>;
		interrupts = <119 0x02>;
		interrupt-names = "capsense1_irq";
		Semtech,nirq-gpio= <&tlmm 119 0x02>;
		/*use PH4/5/6 as the reference sensor
		set it to 0xff if the ref-phases-x is not used*/
		Semtech,ref-phases-a = <4>;
		Semtech,ref-phases-b = <5>;
		Semtech,ref-phases-c = <6>;
		Semtech,button-flag = <0x45>;
		Semtech,button-names = "Moto CapSense Ch0","Moto CapSense Ch2","Moto CapSense Ch6";
		Semtech,debug-name = "capsense1";
		Semtech,flip_operation_num = <2>;
		Semtech,flip_operation_far_num = <2>;
		Semtech,flip_near_init = <
			0x8024 0x0400
			0x4280 0xE
		>;
		Semtech,flip_far_init = <
			0x8024 0x7F00
			0x4280 0xE
		>;
		Semtech,reg-num = <72>;
		Semtech,reg-init = <
			0x4004 0x74
			0x8008 0x0
			0x8020 0x32
			0x8028 0x456
			0x8034 0x476
			0x8040 0x456
			0x804C 0x476
			0x8058 0x476
			0x8064 0x476
			0x8070 0x456
			0x807C 0x476
			0x8030 0xFFF9FD
			0x803C 0xBFF9FF
			0x8048 0xFFF97F
			0x8054 0xFFD9FF
			0x8060 0xFFF9FF
			0x806C 0xF7F9FF
			0x8078 0xFEF9FF
			0x8084 0x0
			0x802C 0x0
			0x8038 0x0
			0x8044 0x0
			0x8050 0x0
			0x805C 0x0
			0x8068 0x0
			0x8074 0x0
			0x8080 0x0
			0x8098 0x753F
			0x80B8 0x0
			0x80D8 0x7F30
			0x80F8 0x0
			0x8118 0x0
			0x8138 0x0
			0x8158 0x7F7F
			0x8178 0x0
			0x80A0 0x15150001
			0x80C0 0x0
			0x80E0 0x40400002
			0x8100 0x0
			0x8120 0x0
			0x8140 0x0
			0x8160 0x15150003
			0x8180 0x0
			0x8188 0x8000011
			0x818C 0x8000015
			0x8190 0x8000015
			0x8194 0x0
			0x8090 0x2ADE7000
			0x80B0 0x2AD67000
			0x80D0 0x2ADE7000
			0x80F0 0x2AD67000
			0x8110 0x2AD67000
			0x8130 0x2AD67000
			0x8150 0x2AD67000
			0x8170 0x0
			0x8088 0x2300000
			0x80A8 0x300000
			0x80C8 0x300000
			0x80E8 0x300000
			0x8108 0x300000
			0x8128 0x300000
			0x8148 0x2300000
			0x8168 0x0
			0x808C 0xA020003C
			0x80AC 0xA020003C
			0x80CC 0xA020003C
			0x80EC 0xA020003C
			0x810C 0xA020003C
			0x812C 0xA020003C
			0x814C 0xA0200030
			0x816C 0x0
			0x8024 0xFF00
		>;
		status = "ok";
	};
};
