TSL2561 light-to-digital converter demo for HiKey 960

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

1 Like

Wow! Another success_story… I’ll try and keep an eye out for these so I can tag them (I added a couple of tags to this post).