ET7303 dts configuration quick guide

ET7303 dts configuration quick guide

ET7303 device tree has 3 parts.

Main body is for ET7303 hardware. "pd-data" for charging power data configuration, inculde source power data and sink power data. "dpm caps" for Device Policy Manager.

Main body

        compatible = "etek,et7303";
        reg = <0x4e>;
        rt-tcpc,name = "type_c_port0"; /* tcpc_device's name */
        et7303,irq_pin = <&gpio1 RK_PB2 IRQ_TYPE_LEVEL_LOW>;
​
        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  = <0>;  /* 0: Never, 1: Always, 2: EMarkOnly, 3: StartOnly */
​
        rt-tcpc,notifier_supply_num = <1>; /* the number of notifier supply */
        rt-dual,supported_modes = <0>; /* 0: dfp/ufp, 1: dfp, 2: ufp */

notifier_supply_num: the power drivers can register callback func to PD notifier chain, and this value to told PD probe process to enable et7303 irq after all power drivers initialization.

supported_modes: export properties to tcpc, more details in drivers/usb/pd/tcpci_dual_role.c

pd-data

            pd,charging_policy = <0x31>;
            pd,source-pdo-size = <1>;
            pd,source-pdo-data = <0x00019032>;
​
            pd,sink-pdo-size = <2>;
            pd,sink-pdo-data = <0x001912c 0x0002d0c8>;
​
            pd,id-vdo-size = <3>;
            pd,id-vdo-data = <0xd8006dcf 0x0 0x00010000>;

pd,charging_policy = <0x31>: this value has 2 parts, policy:sub_policy, "policy" is 0 for VSAFE5V, no matter pdos, select first safety 5V. 1 for max power, select the pdo can't over max power. Under max power, choose higher voltage as much as possible if sub_policy bit2 is 1, and choose lower voltage as much as possible if sub_policy bit1 is 1. and sub_policy bit0 for IGONRE_CURRENT. The detail can see function dpm_select_pdo_from_max_power. 2 for custom policy, this for custom define, and now, it return with VSAFE5V. We can fill the dpm_select_pdo_from_custom.

dpm caps

            local_dr_power;
            local_dr_data;
​
            pr_check = <0>;
            dr_check = <0>;

local_dr_power/data: local can accept power/data swap cmd. pr/dr_check: local can send pr/dr swap for prefer role. 0: disable, 1: prefer_ufp, 2: prefer_dfp

et charger:

This part show a simple power drivers for PD. custom should re-write it depends on hardware.

你可能感兴趣的:(ANDROID11驱动开发,linux)