Please refer to the schematic, the HiKey 960 expands 2 i2c ports, it’s i2c0 and i2c7.
We should configure the i2c0 at aosp\hikey-linaro\arch\arm64\boot\dts\hisilicon\hi3660.dtsi
i2c0: i2c@FFD71000 {
compatible = "snps,designware-i2c";
reg = <0x0 0xFFD71000 0x0 0x1000>;
interrupts = <0 118 4>;
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <400000>;
clocks = <&crg_ctrl HI3660_CLK_GATE_i2c0>;
resets = <&iomcu_rst HI3660_RST_i2c0>;
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pmx_func &i2c0_cfg_func>;
status = "ok";
TSL2561_i2c: TSL2561_i2c@29 {
compatible = "tsl,TSL2561_i2c";
reg = <0x29>;
status = "ok";
};
};
Copy the source code to aosp\hikey-linaro\drivers, then configure the kconfig and Makefile.
Add source “drivers/sl2561_hikey/Kconfig” to kconfig.
Add obj-$(CONFIG_TSL2561) += tsl2561_hikey/ to Makefile
At last, add CONFIG_TSL2561=y to aosp\hikey-linaro\arch\arm64\configs\hikey960_defconfig
After flashing the image, you will find the TSL2561_attr node. Cat the node, you will see the data.
Source code link:https://github.com/archermind666/tsl2561_on_hikey