diff --git a/qcom/tcpc_config.dtsi b/qcom/tcpc_config.dtsi new file mode 100644 index 000000000000..8ae52d1ccc50 --- /dev/null +++ b/qcom/tcpc_config.dtsi @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2020 Richtek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License 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. + */ +&qupv3_se8_i2c { + rt1711h@4e { + compatible = "richtek,rt1711h"; + reg = <0x4e>; + status = "okay"; + tcpc-dual,supported_modes = <0>; /* 0: dfp/ufp, */ + /* 1: dfp, 2: ufp */ + rt-tcpc,name = "type_c_port0"; /* tcpc_device's name */ + rt-tcpc,role_def = <4>; /* 0: SNK Only, 1: SRC Only, 2: DRP, */ + /* 3: Try.SRC, 4: Try.SNK */ + rt-tcpc,rp_level = <0>; /* 0: Default, 1: 1.5, 2: 3.0 */ + rt-tcpc,vconn_supply = <1>; /* 0: Never, 1: Always, */ + /* 2: EMarkOnly, 3: StartOnly */ + rt1711pd,intr_gpio = <&tlmm 11 0x0>; + rt1711pd,intr_gpio_num = <11>; + pinctrl-names = "default"; + pinctrl-0 = <&rt1711h_int_n>; + pd-data { + pd,vid = <0x29cf>; + pd,pid = <0x1711>; + pd,source-cap-ext = <0x171129cf 0x00000000 0x00000000 + 0x00000000 0x00000000 0x02000000>; + pd,mfrs = "RichtekTCPC"; + + /* + * VSAFE5V = 0, MAX_POWER = 1, CUSTOM = 2, + * MAX_POWER_LV = 0x21, MAX_POWER_LVIC = 0x31 + * MAX_POWER_HV = 0x41, MAX_POWER_HVIC = 0x51 + */ + pd,charging_policy= <0x31>; + + /* + * Fixed 5V, 500 mA <0x00019032> + * Fixed 5V, 1A <0x00019064> + * Fixed 5V, 2A <0x000190c8> + * Fixed 5V, 3A <0x0001912c> + * Fixed 9V, 500 mA <0x0002d032> + * Fixed 9V, 1A <0x0002d064> + * Fixed 9V, 2A <0x0002d0c8> + * Fixed 9V, 3A <0x0002d12c> + * Variable 5-9V, 1A <0x8642d064> + * Variable 5-9V, 2A <0x8642d0c8> + * Variable 5-9V, 3A <0x8642d12c> + * PPS 3V~5.9V, 3A <0xC0761E3C> + */ + pd,source-pdo-size = <1>; + pd,source-pdo-data = <0x00019032>; + pd,sink-pdo-size = <1>; + pd,sink-pdo-data = <0x000190c8>; + + /* + * No DP, host + device + * pd,id-vdo-size = <6>; + * pd,id-vdo-data = <0xd14029cf 0x0 0x17110000 + 0x41800000 0x0 0x21800000>; + * With DP + * pd,id-vdo-size = <6>; + * pd,id-vdo-data = <0xd54029cf 0x0 0x17110000 + 0x41800000 0x0 0x21800000>; + */ + + pd,id-vdo-size = <6>; + pd,id-vdo-data = <0xd14029cf 0x0 0x17110000 + 0x41800000 0x0 0x21800000>; + + bat,nr = <1>; + pd,country_nr = <0>; + + bat-info0 { + bat,vid = <0x29cf>; + bat,pid = <0x1711>; + bat,mfrs = "bat1"; + bat,design_cap = <3000>; + }; + + //bat-info1 { + // bat,vid = <0x8abc>; + // bat,pid = <0x5234>; + // bat,mfrs = "bat2"; + // bat,design_cap = <4000>; + //}; + + //country0 { + // pd,country_code = <0x5457>; + // pd,country_len = <2>; /* max len = 26 */ + // pd,country_data = <0xff 0xff>; + //}; + + //country1 { + // pd,country_code = <0x5553>; + // pd,country_len = <3>; /* max len = 26 */ + // pd,country_data = <0xf1 0xf2 0xf3>; + //}; + }; + dpm_caps { + local_dr_power; + local_dr_data; + //local_ext_power; + local_usb_comm; + //local_usb_suspend; + //local_high_cap; + //local_give_back; + local_no_suspend; + local_vconn_supply; + + //attemp_discover_cable_dfp; + attemp_enter_dp_mode; + attemp_discover_cable; + attemp_discover_id; + + /* 0: disable, 1: prefer_snk, 2: prefer_src */ + pr_check = <0>; + //pr_reject_as_source; + //pr_reject_as_sink; + //pr_check_gp_source; + //pr_check_gp_sink; + + /* 0: disable, 1: prefer_ufp, 2: prefer_dfp */ + dr_check = <0>; + //dr_reject_as_dfp; + //dr_reject_as_ufp; + }; + displayport { + /* connection type = "both", "ufp_d", "dfp_d" */ + 1st_connection = "dfp_d"; + 2nd_connection = "dfp_d"; + signal,dp_v13; + //signal,dp_gen2; + //usbr20_not_used; + typec,receptacle; + ufp_d { + //pin_assignment,mode_a; + //pin_assignment,mode_b; + //pin_assignment,mode_c; + //pin_assignment,mode_d; + //pin_assignment,mode_e; + }; + dfp_d { + //pin_assignment,mode_a; + //pin_assignment,mode_b; + pin_assignment,mode_c; + pin_assignment,mode_d; + pin_assignment,mode_e; + //pin_assignment,mode_f; + }; + }; + }; +}; + +&soc { + rpm: rt-pd-manager { + compatible = "richtek,rt-pd-manager"; + + #io-channel-cells = <1>; + io-channels = <&pm7250b_charger PSY_IIO_PD_ACTIVE>, + <&pm7250b_charger PSY_IIO_PD_USB_SUSPEND_SUPPORTED>, + <&pm7250b_charger PSY_IIO_PD_IN_HARD_RESET>, + <&pm7250b_charger PSY_IIO_PD_CURRENT_MAX>, + <&pm7250b_charger PSY_IIO_PD_VOLTAGE_MIN>, + <&pm7250b_charger PSY_IIO_PD_VOLTAGE_MAX>, + <&pm7250b_charger PSY_IIO_USB_REAL_TYPE>; + io-channel-names = "pd_active", + "pd_usb_suspend_supported", + "pd_in_hard_reset", + "pd_current_max", + "pd_voltage_min", + "pd_voltage_max", + "real_type"; + }; +}; + +&tlmm { + rt1711h_int_n: rt1711h_int_n { + mux { + pins = "gpio11"; + function = "gpio"; + }; + + config { + pins = "gpio11"; + drive-strength = <2>; + bias-pull-up; + }; + }; +}; +/* First not config ,this should cause phone could not power on +&usb0 { + extcon = <&eud>, <&rpm>; +}; +*/