I succeeded in building and loading the BMI160 kernel module on Mangoh Red but cannot find it under /sys/bus/i2c/devices/…
Steps followed:
I copied the bmi160 kernel module from the Mangoh project: https://github.com/mangOH/mangOH/tree/master/linux_kernel_modules/bmi160 to my project
I created a .sdef file in my project to point to the kernel modules copied
I exported the sdef file using the SDEF_TO_USE variable
make wp77xx; created a system.wp77xx.update file under $LEGATO_ROOT/build/wp77xx/
update system.wp77xx.update 192.168.2.2
On the Mangoh terminal: lsmod shows the bmi160_I2C and bmi160 loaded
no devices found under /sys/bus/i2c/devices/…
Any ideas whats going on?
dfrey
July 17, 2019, 10:13pm
2
The driver just provides the capability of supporting a device. Linux still doesn’t know that you actually have a bmi160 on your board. In Linux, this is typically achieved either through devicetree or platform code. Our platform code is in the mangoh_red_board.c
file.
See:
.irq_base = -1,
.reset_during_probe = true,
};
static const struct i2c_board_info mangoh_red_gpio_expander_devinfo = {
I2C_BOARD_INFO("sx1509q", 0x3e),
.platform_data = &mangoh_red_gpio_expander_platform_data,
.irq = 0,
};
static struct i2c_board_info mangoh_red_bmi160_devinfo = {
I2C_BOARD_INFO("bmi160", 0x68),
};
static struct i2c_board_info mangoh_red_pressure_devinfo = {
I2C_BOARD_INFO("bmp280", 0x76),
};
static struct ltc294x_platform_data ltc2942_battery_gauge_platform_data = {
.r_sense = 18,
.prescaler_exp = 32,
/* Map the LED */
mangoh_red_led_pdata.gpio = gpio_expander->base + 8;
ret = platform_device_register(&mangoh_red_led);
if (ret != 0) {
dev_err(&pdev->dev, "Failed to register LED device\n");
goto cleanup;
}
mangoh_red_driver_data.led_registered = true;
/* Map the accelerometer */
dev_dbg(&pdev->dev, "mapping accelerometer\n");
/*
* Pins 11 and 12 of the gpio expander are connected to bmi160's INT1
* and INT2 pins respectively. It does not appear that the bmi160 driver
* makes use of these interrupt pins.
*/
mangoh_red_driver_data.accelerometer =
i2c_new_device(i2c_adapter_primary, &mangoh_red_bmi160_devinfo);
if (!mangoh_red_driver_data.accelerometer) {
dev_err(&pdev->dev, "Accelerometer is missing\n");
1 Like
Please can you explain how to add code for bmi160 drivers loading without using mangoh_yellow_board.c
Thanks.