Help me set up the AK8975 compass sensor connected via the I2C bus on a single-board computer with an RK3588 chip with Android12
The AK8975 compass does not transmit data via the I2C bus, the drivers for which are located at: kernel-5.10/drivers/input/sensors/compass/ak8975.c
1) Added it to the device tree in the file
`&i2c2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c2m4_xfer>;
ak8975_compass: ak8975@d {
status = "okay";
compatible = "ak8975";
reg = <0x0d>;
irq_enable = <0>;
poll_delay_ms = <30>;
type = <SENSOR_TYPE_COMPASS>;
layout = <0>;
};
};`
2) Checked in kernel config
CONFIG_SENSOR_DEVICE=y
CONFIG_COMPASS_DEVICE=y
CONFIG_COMPASS_AK8975=y
3) BoardConfig.mk
BOARD_SENSOR_ST ?= true
BOARD_SENSOR_COMPASS_AK8975 := true
BOARD_COMPASS_SENSOR_SUPPORT := true
4) ueventd.rockchip.rc
/dev/akm8975_dev 0660 system system
/dev/compass 0660 system system
5) I also check the compass with the command: adb shell dmesg | grep -i akm
I get the answer:
[ 6.556308] compass_akm8975 2-000d: sensor_register_device: akm8975, id = 38
[ 6.556774] compass_akm8975 2-000d: sensor_chip_init:ak8975:devid=0x48,ops=0x000000003d2201ef
[ 6.557589] sensor_init: AK8975-driver Misc device registered successfully: akm8975_dev
[ 6.557674] compass_akm8975 2-000d: sensor_irq_init:use polling,delay=30 ms
[ 6.557708] compass_akm8975 2-000d: sensor_misc_device_register:miscdevice: compass
[ 6.557711] compass_akm8975 2-000d: sensor_probe:initialized ok,sensor name:akm8975,type:3,id=38\x0a
[ 199.652741] compass_akm8975 2-000d: set sensor poll time to 5ms
[ 200.086721] compass_akm8975 2-000d: set sensor poll time to 10ms
[ 222.654669] compass_akm8975 2-000d: set sensor poll time to 5ms
[ 991.704449] compass_akm8975 2-000d: set sensor poll time to 5ms
[ 998.886466] compass_akm8975 2-000d: set sensor poll time to 10ms
But when I check the compass in the app, I get the message: THIS SENSOR DOES NOT REPORT ANY READINGS, YOU SEEMS TO HAVE AN ERROR IN THE INTERACTION OF THE SENSOR SERVICE IN THE DEVICE FIRMWARE