[PATCH v2 0/2] iio: imu: Add driver and dt-bindings for BMI323
From: Jagath Jog J
Date: Thu Oct 12 2023 - 23:48:18 EST
Add dt-bindings and IIO driver for Bosch BMI323 a 6 axis IMU.
Complete list of device sysfs files
.
├── buffer
│ ├── data_available
│ ├── direction
│ ├── enable
│ ├── hwfifo_enabled
│ ├── hwfifo_watermark
│ ├── length
│ └── watermark
├── buffer0
│ ├── data_available
│ ├── direction
│ ├── enable
│ ├── hwfifo_enabled
│ ├── hwfifo_watermark
│ ├── in_accel_x_en
│ ├── in_accel_x_index
│ ├── in_accel_x_type
│ ├── in_accel_y_en
│ ├── in_accel_y_index
│ ├── in_accel_y_type
│ ├── in_accel_z_en
│ ├── in_accel_z_index
│ ├── in_accel_z_type
│ ├── in_anglvel_x_en
│ ├── in_anglvel_x_index
│ ├── in_anglvel_x_type
│ ├── in_anglvel_y_en
│ ├── in_anglvel_y_index
│ ├── in_anglvel_y_type
│ ├── in_anglvel_z_en
│ ├── in_anglvel_z_index
│ ├── in_anglvel_z_type
│ ├── in_timestamp_en
│ ├── in_timestamp_index
│ ├── in_timestamp_type
│ ├── length
│ └── watermark
├── current_timestamp_clock
├── dev
├── events
│ ├── in_accel_gesture_doubletap_en
│ ├── in_accel_gesture_doubletap_reset_timeout
│ ├── in_accel_gesture_doubletap_tap2_min_delay
│ ├── in_accel_gesture_doubletap_tap2_min_delay_available
│ ├── in_accel_gesture_doubletap_value
│ ├── in_accel_gesture_singletap_en
│ ├── in_accel_gesture_singletap_reset_timeout
│ ├── in_accel_gesture_singletap_value
│ ├── in_accel_gesture_tap_reset_timeout_available
│ ├── in_accel_gesture_tap_value_available
│ ├── in_accel_gesture_tap_wait_dur
│ ├── in_accel_gesture_tap_wait_dur_available
│ ├── in_accel_gesture_tap_wait_timeout
│ ├── in_accel_mag_falling_en
│ ├── in_accel_mag_falling_hysteresis
│ ├── in_accel_mag_falling_period
│ ├── in_accel_mag_falling_value
│ ├── in_accel_mag_hysteresis_available
│ ├── in_accel_mag_period_available
│ ├── in_accel_mag_rising_en
│ ├── in_accel_mag_rising_hysteresis
│ ├── in_accel_mag_rising_period
│ ├── in_accel_mag_rising_value
│ ├── in_accel_mag_value_available
│ ├── in_steps_change_en
│ └── in_steps_change_value
├── in_accel_mount_matrix
├── in_accel_oversampling_ratio
├── in_accel_oversampling_ratio_available
├── in_accel_sampling_frequency
├── in_accel_sampling_frequency_available
├── in_accel_scale
├── in_accel_scale_available
├── in_accel_x_raw
├── in_accel_y_raw
├── in_accel_z_raw
├── in_anglvel_mount_matrix
├── in_anglvel_oversampling_ratio
├── in_anglvel_oversampling_ratio_available
├── in_anglvel_sampling_frequency
├── in_anglvel_sampling_frequency_available
├── in_anglvel_scale
├── in_anglvel_scale_available
├── in_anglvel_x_raw
├── in_anglvel_y_raw
├── in_anglvel_z_raw
├── in_steps_en
├── in_steps_input
├── in_temp_offset
├── in_temp_raw
├── in_temp_scale
├── name
├── of_node -> ../../../../../../../firmware/devicetree/base/soc/i2c@7e804000/i2c_bmi323@68
├── power
│ ├── autosuspend_delay_ms
│ ├── control
│ ├── runtime_active_time
│ ├── runtime_status
│ └── runtime_suspended_time
├── scan_elements
│ ├── in_accel_x_en
│ ├── in_accel_x_index
│ ├── in_accel_x_type
│ ├── in_accel_y_en
│ ├── in_accel_y_index
│ ├── in_accel_y_type
│ ├── in_accel_z_en
│ ├── in_accel_z_index
│ ├── in_accel_z_type
│ ├── in_anglvel_x_en
│ ├── in_anglvel_x_index
│ ├── in_anglvel_x_type
│ ├── in_anglvel_y_en
│ ├── in_anglvel_y_index
│ ├── in_anglvel_y_type
│ ├── in_anglvel_z_en
│ ├── in_anglvel_z_index
│ ├── in_anglvel_z_type
│ ├── in_timestamp_en
│ ├── in_timestamp_index
│ └── in_timestamp_type
├── subsystem -> ../../../../../../../bus/iio
├── trigger
│ └── current_trigger
├── uevent
└── waiting_for_supplier
Changes from RFC to v2
Review by Andy:
- Sorted header files and added unit.h
- Splitting macro
- Defined new macros and enums to use in place of magic numbers.
- Used KILO instead of large number
- Used guard and scoped_guard from cleanup.h
- Used ARRAY_SIZE() instead of value
- Replaced kstrtoint with kstrtobool
- Used min() and in_range() from minmax.h
- Used GENMASK instead of magic number
- Remove error print from interrupt handler
- Removed casting and le16_to_cpup, used sign_extend32 for getting final value
- Used while loop instead of for
- Remove the check for the return value of 0 from fwnode_irq_get_byname()
- Used dev_err_probe() in all probe paths
- Removed 0 from i2c_ids[]
- Used read_flag_mask for spi regmap configuration
- Dropped blank line
- Used regmap_read_poll_timeout() function instead of while loop
- Applied fixes as per review
Review by Jonathan
- Used oversampling instead of averaging
- Reverse the order of avail_scan_masks
- Use FIELD_PREP() directly in place of set_mask_bits
- Remove irq_type from devm_request_threaded_irq
- Use FIELD_GET() with mask
- Added comment for delay used for feature engine enable
- Use dev_err_probe in all probe paths
- For I2C regmap, allocated memory in device private data
- Use pad_bits=16 for spi regmap_configuration
- Added both interrupts in the dt-bindings
Review by Krzysztof Kozlowski
- Removed duplicated words from subject
- Removed '|'
- Added supplies
- Used generic node name "imu"
- Removed spi example node
Review by Uwe Kleine-König
- Use probe instead of probe_new
- Placed datasheet in driver
Jagath Jog J (2):
dt-bindings: iio: imu: Add Bosch BMI323
iio: imu: Add driver for BMI323 IMU
Documentation/ABI/testing/sysfs-bus-iio | 18 +
.../bindings/iio/imu/bosch,bmi323.yaml | 77 +
MAINTAINERS | 7 +
drivers/iio/imu/Kconfig | 1 +
drivers/iio/imu/Makefile | 1 +
drivers/iio/imu/bmi323/Kconfig | 33 +
drivers/iio/imu/bmi323/Makefile | 7 +
drivers/iio/imu/bmi323/bmi323.h | 209 ++
drivers/iio/imu/bmi323/bmi323_core.c | 2139 +++++++++++++++++
drivers/iio/imu/bmi323/bmi323_i2c.c | 121 +
drivers/iio/imu/bmi323/bmi323_spi.c | 92 +
11 files changed, 2705 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/imu/bosch,bmi323.yaml
create mode 100644 drivers/iio/imu/bmi323/Kconfig
create mode 100644 drivers/iio/imu/bmi323/Makefile
create mode 100644 drivers/iio/imu/bmi323/bmi323.h
create mode 100644 drivers/iio/imu/bmi323/bmi323_core.c
create mode 100644 drivers/iio/imu/bmi323/bmi323_i2c.c
create mode 100644 drivers/iio/imu/bmi323/bmi323_spi.c
--
2.20.1