Touch Panel DTS analysis (msm8994 platform, Atmel chip)
On msm8994, the DTs node of touch panel is written in/kernel/ARCH/ARM/boot/DTS/qcom/msm8994-mtp.dtsi file. The Code is as follows:
& Soc {[email protected] {[email protected] {compatible = "Atmel, atmel_mxt_ts"; Reg = <0x4a>; interrupt-parent = <& msm_gpio>; interrupts = <61 0x2008>; avdd-supply = <& pm8994_l22>; vdd_io-supply = <& pm8994_l14> ;.........};};
In DTS nodes, we mainly look at avdd-supply and vdd_io-supply two attributes. The usage of these two attributes in C code is as follows:
/Kernel/Drivers/input/touchscreen/atmel_mxt_ts.cmxt_probe_regulators (struct mxt_data * Data ){........ data-> reg_vdd_io = regulator_get (Dev, "vdd_io ");........ data-> reg_avdd = regulator_get (Dev, "avdd ");........}
/Kernel/Drivers/regulator/CORE. cstruct regulator * regulator_get (struct device * Dev, const char * ID) {return _ regulator_get (Dev, ID, 0 );}
Static struct regulator * _ regulator_get (struct device * Dev, const char * ID, int exclusive ){....... rdev = regulator_dev_lookup (Dev, ID, & RET); If (rdev) goto found ;......}
Static struct regulator_dev * regulator_dev_lookup (struct Devic * Dev, const char * supply, int * RET) {struct regulator_dev * r; struct device_node * node ;........ /* First do a DT based lookup */If (Dev & Dev-> of_node) {node = of_get_regulator (Dev, supply) if (node) {list_for_each_entry (r, & regulator_list, list) if (R-> Dev. parent & node = r-> Dev. of_node) return r ;........}}}
Static struct device_node * of_get_regulator (struct device * Dev, const char * supply) {struct device_node * regnode = NULL; char prop_name [32]; ...... snprintf (prop_name, 32, "% s-supply", supply); regnode = of_parse_phandle (Dev-> of_node, prop_name, 0 );........}
From the above code, we can see how the vdd_io-supply and avdd-supply attribute in DTS is parsed and used. In the mxt_probe () function, transmit the "avdd" and "vdd_io" strings to the regulator_get () function. After calling them step by step () the function combines the string into the required string attribute in DTS, and then finds the corresponding regulator_dev struct through the attribute value!
Touch Panel DTS analysis (msm8994 platform, Atmel chip)