Add support for ADIS16550 and ADIS16550W
Subsystems (6)
Robert Budai
maintainerv3 cover Add support for ADIS16550 and ADIS16550W
Add support for ADIS16550 and ADIS16550W
Robert Budai (7):
iio: imu: adis: Remove documented not used elements
iio: imu: adis: Add custom ops struct
iio: imu: adis: Add reset to custom ops
iio: imu: adis: Add DIAG_STAT register size
dt-bindings: iio: Add adis16550 bindings
iio: imu: adis16550: add adis16550 support
docs: iio: add documentation for adis16550 driver
.../bindings/iio/imu/adi,adis16550.yaml | 93 ++ Documentation/iio/adis16550.rst | 389 ++++++ Documentation/iio/index.rst | 1 + MAINTAINERS | 9 + drivers/iio/imu/Kconfig | 13 + drivers/iio/imu/Makefile | 1 + drivers/iio/imu/adis.c | 30 +- drivers/iio/imu/adis16550.c | 1222 +++++++++++++++++ include/linux/iio/imu/adis.h | 34 +- 9 files changed, 1777 insertions(+), 15 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml create mode 100644 Documentation/iio/adis16550.rst create mode 100644 drivers/iio/imu/adis16550.c
Signature · 1 line
2.34.1
Robert Budai
maintainerPATCH v3 1/7 iio: imu: adis: Remove documented not used elements
This patch removes elements from adis.h that are documented but not used anymore.
--- include/linux/iio/imu/adis.h | 1 - 1 file changed, 1 deletion(-)
include/linux/iio/imu/adis.h +0 -1
@@ -99,7 +99,6 @@ struct adis_data {* @spi: Reference to SPI device which owns this ADIS IIO device * @trig: IIO trigger object data * @data: ADIS chip variant specific data -* @burst: ADIS burst transfer information * @burst_extra_len: Burst extra length. Should only be used by devices that can * dynamically change their burst mode length. * @state_lock: Lock used by the device to protect state
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerRe: [PATCH v3 1/7] iio: imu: adis: Remove documented not used elements
Quoted 4 lines · On Mon, 16 Dec 2024 16:48:07 +0200 Robert Budai <[email protected]> wrote:
This patch removes elements from
adis.hthat are documented but not used anymore.Signed-off-by Robert Budai <[email protected]>
I already picked this one up. Don't included in any future versions as it will just confuse me :)
Thanks,
Jonathan
Quoted 16 lines
--- include/linux/iio/imu/adis.h | 1 - 1 file changed, 1 deletion(-)include/linux/iio/imu/adis.h +0
-1@@ -99,7 +99,6 @@ struct adis_data {* @spi: Reference to SPI device which owns this ADIS IIO device * @trig: IIO trigger object data * @data: ADIS chip variant specific data -* @burst: ADIS burst transfer information * @burst_extra_len: Burst extra length. Should only be used by devices that can * dynamically change their burst mode length. * @state_lock: Lock used by the device to protect state
Robert Budai
maintainerPATCH v3 2/7 iio: imu: adis: Add custom ops struct
In reply to Robert BudaiThis patch introduces a custom ops struct letting users define custom read and write functions. Some adis devices might define a completely different spi protocol from the one used in the default implementation.
---
v3:
- added back default ops allocation, in case none is defined, this way it should not break previous drivers
drivers/iio/imu/adis.c | 16 +++++++++++++--- include/linux/iio/imu/adis.h | 28 +++++++++++++++++++++------- 2 files changed, 34 insertions(+), 10 deletions(-)
drivers/iio/imu/adis.c +13 -3
@@ -223,13 +223,13 @@ int __adis_update_bits_base(struct adis *adis, unsigned int reg, const u32 mask,int ret;u32 __val; - ret =__adis_read_reg (adis, reg, &__val, size); + ret = adis->ops->read (adis, reg, &__val, size);if (ret)return ret; __val = (__val & ~mask) | (val & mask); -return __adis_write_reg (adis, reg, __val, size); +return adis->ops->write (adis, reg, __val, size); }EXPORT_SYMBOL_NS_GPL (__adis_update_bits_base,"IIO_ADISLIB" );
@@ -468,7 +468,7 @@ int adis_single_conversion(struct iio_dev *indio_dev,guard (mutex)(&adis->state_lock); - ret =__adis_read_reg (adis, chan->address, &uval, + ret = adis->ops->read (adis, chan->address, &uval, chan->scan_type.storagebits /8 );if (ret)return ret;
@@ -488,6 +488,11 @@ int adis_single_conversion(struct iio_dev *indio_dev, }EXPORT_SYMBOL_NS_GPL (adis_single_conversion,"IIO_ADISLIB" ); +static const struct adis_ops adis_default_ops = { + .read = __adis_read_reg, + .write = __adis_write_reg, +}; +/** * adis_init() - Initialize adis device structure * @adis: The adis device
@@ -517,6 +522,11 @@ int adis_init(struct adis *adis, struct iio_dev *indio_dev, adis->spi = spi; adis->data = data; +if (!adis->ops->write && !adis->ops->read) + adis->ops = &adis_default_ops; +else if (!adis->ops->write || !adis->ops->read) +return -EINVAL ; +iio_device_set_drvdata (indio_dev, adis);if (data->has_paging) {
include/linux/iio/imu/adis.h +21 -7
@@ -94,6 +94,18 @@ struct adis_data {unsigned int burst_max_speed_hz; }; +/** +* struct adis_ops: Custom ops for adis devices. +* @write: Custom spi write implementation. +* @read: Custom spi read implementation. +*/ +struct adis_ops { +int (*write)(struct adis *adis,unsigned int reg,unsigned int value, +unsigned int size); +int (*read)(struct adis *adis,unsigned int reg,unsigned int *value, +unsigned int size); +}; +/** * struct adis - ADIS device instance data * @spi: Reference to SPI device which owns this ADIS IIO device
@@ -101,6 +113,7 @@ struct adis_data {* @data: ADIS chip variant specific data * @burst_extra_len: Burst extra length. Should only be used by devices that can * dynamically change their burst mode length. +* @ops: ops struct for custom read and write functions * @state_lock: Lock used by the device to protect state * @msg: SPI message object * @xfer: SPI transfer objects to be used for a @msg
@@ -116,6 +129,7 @@ struct adis {const struct adis_data *data;unsigned int burst_extra_len; +const struct adis_ops *ops;/** * The state_lock is meant to be used during operations that require * a sequence of SPI R/W in order to protect the SPI transfer
@@ -168,7 +182,7 @@ int __adis_read_reg(struct adis *adis, unsigned int reg,static inline int __adis_write_reg_8 (struct adis *adis,unsigned int reg,u8 val) { -return __adis_write_reg (adis, reg, val,1 ); +return adis->ops->write (adis, reg, val,1 ); }/**
@@ -180,7 +194,7 @@ static inline int __adis_write_reg_8(struct adis *adis, unsigned int reg,static inline int __adis_write_reg_16 (struct adis *adis,unsigned int reg,u16 val) { -return __adis_write_reg (adis, reg, val,2 ); +return adis->ops->write (adis, reg, val,2 ); }/**
@@ -192,7 +206,7 @@ static inline int __adis_write_reg_16(struct adis *adis, unsigned int reg,static inline int __adis_write_reg_32 (struct adis *adis,unsigned int reg,u32 val) { -return __adis_write_reg (adis, reg, val,4 ); +return adis->ops->write (adis, reg, val,4 ); }/**
@@ -207,7 +221,7 @@ static inline int __adis_read_reg_16(struct adis *adis, unsigned int reg,unsigned int tmp;int ret; - ret =__adis_read_reg (adis, reg, &tmp,2 ); + ret = adis->ops->read (adis, reg, &tmp,2 );if (ret ==0 ) *val = tmp;
@@ -226,7 +240,7 @@ static inline int __adis_read_reg_32(struct adis *adis, unsigned int reg,unsigned int tmp;int ret; - ret =__adis_read_reg (adis, reg, &tmp,4 ); + ret = adis->ops->read (adis, reg, &tmp,4 );if (ret ==0 ) *val = tmp;
@@ -244,7 +258,7 @@ static inline int adis_write_reg(struct adis *adis, unsigned int reg, unsigned int val, unsigned int size) { guard(mutex)(&adis->state_lock); -return __adis_write_reg (adis, reg, val, size); +return adis->ops->write (adis, reg, val, size); }/**
@@ -258,7 +272,7 @@ static int adis_read_reg(struct adis *adis, unsigned int reg, unsigned int *val, unsigned int size) { guard(mutex)(&adis->state_lock); -return __adis_read_reg (adis, reg, val, size); +return adis->ops->read (adis, reg, val, size); }/**
Signature · 1 line
2.34.1
Robert Budai
maintainerPATCH v3 3/7 iio: imu: adis: Add reset to custom ops
In reply to Robert BudaiThis patch allows the custom definition of reset funcitonality for adis object. It is useful in cases where the reset does not need to sleep after the reset since it is handled by the library.
---
v3:
- added reset to default ops and used the allowed custom ops definition in case all read/write and reset are defined
drivers/iio/imu/adis.c | 7 ++++--- include/linux/iio/imu/adis.h | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/iio/imu/adis.c +4 -3
@@ -340,7 +340,7 @@ int __adis_reset(struct adis *adis)const struct adis_timeout *timeouts = adis->data->timeouts; ret =__adis_write_reg_8 (adis, adis->data->glob_cmd_reg, -ADIS_GLOB_CMD_SW_RESET ); +ADIS_GLOB_CMD_SW_RESET );if (ret) {dev_err (&adis->spi->dev,"Failed to reset device: %d\n" , ret);return ret;
@@ -491,6 +491,7 @@ EXPORT_SYMBOL_NS_GPL(adis_single_conversion, "IIO_ADISLIB");static const struct adis_ops adis_default_ops = { .read = __adis_read_reg, .write = __adis_write_reg, + .reset = __adis_reset, };/**
@@ -522,9 +523,9 @@ int adis_init(struct adis *adis, struct iio_dev *indio_dev, adis->spi = spi; adis->data = data; -if (!adis->ops->write && !adis->ops->read) +if (!adis->ops->write && !adis->ops->read && !adis->ops->reset) adis->ops = &adis_default_ops; -else if (!adis->ops->write || !adis->ops->read) +else if (!adis->ops->write || !adis->ops->read || !adis->ops->reset)return -EINVAL ;iio_device_set_drvdata (indio_dev, adis);
include/linux/iio/imu/adis.h +3 -0
@@ -98,12 +98,15 @@ struct adis_data {* struct adis_ops: Custom ops for adis devices. * @write: Custom spi write implementation. * @read: Custom spi read implementation. +* @reset: Custom sw reset implementation. The custom implementation does not +* need to sleep after the reset. It's done by the library already. */ struct adis_ops {int (*write)(struct adis *adis,unsigned int reg,unsigned int value,unsigned int size);int (*read)(struct adis *adis,unsigned int reg,unsigned int *value,unsigned int size); +int (*reset)(struct adis *adis); };/**
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerRe: [PATCH v3 3/7] iio: imu: adis: Add reset to custom ops
Quoted 1 line · On Mon, 16 Dec 2024 16:48:09 +0200 Robert Budai <[email protected]> wrote:
This patch allows the custom definition of reset funcitonality
functionality
Quoted 2 lines
for adis object. It is useful in cases where the reset does not need to sleep after the reset since it is handled by the library.
reset does not need to sleep? Driver I assume?
Quoted 69 lines
Co-developed-by Ramona Gradinariu <[email protected]>Signed-off-by Ramona Gradinariu <[email protected]>Co-developed-by Antoniu Miclaus <[email protected]>Signed-off-by Antoniu Miclaus <[email protected]>Signed-off-by Nuno Sá <[email protected]>Signed-off-by Robert Budai <[email protected]>---
v3:
- added reset to default ops and used the allowed custom ops definition in case all read/write and reset are defineddrivers/iio/imu/adis.c | 7 ++++--- include/linux/iio/imu/adis.h | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-)drivers/iio/imu/adis.c +4
-3@@ -340,7 +340,7 @@ int __adis_reset(struct adis *adis)const struct adis_timeout *timeouts = adis->data->timeouts; ret =__adis_write_reg_8 (adis, adis->data->glob_cmd_reg, -ADIS_GLOB_CMD_SW_RESET ); +ADIS_GLOB_CMD_SW_RESET );if (ret) {dev_err (&adis->spi->dev,"Failed to reset device: %d\n" , ret);return ret;@@ -491,6 +491,7 @@ EXPORT_SYMBOL_NS_GPL(adis_single_conversion, "IIO_ADISLIB");static const struct adis_ops adis_default_ops = { .read = __adis_read_reg, .write = __adis_write_reg, + .reset = __adis_reset, };/** @@ -522,9 +523,9 @@ int adis_init(struct adis *adis, struct iio_dev *indio_dev, adis->spi = spi; adis->data = data; -if (!adis->ops->write && !adis->ops->read) +if (!adis->ops->write && !adis->ops->read && !adis->ops->reset) adis->ops = &adis_default_ops; -else if (!adis->ops->write || !adis->ops->read) +else if (!adis->ops->write || !adis->ops->read || !adis->ops->reset)return -EINVAL ;iio_device_set_drvdata (indio_dev, adis);include/linux/iio/imu/adis.h +3
-0@@ -98,12 +98,15 @@ struct adis_data {* struct adis_ops: Custom ops for adis devices. * @write: Custom spi write implementation. * @read: Custom spi read implementation. +* @reset: Custom sw reset implementation. The custom implementation does not +* need to sleep after the reset. It's done by the library already. */ struct adis_ops {int (*write)(struct adis *adis,unsigned int reg,unsigned int value,unsigned int size);int (*read)(struct adis *adis,unsigned int reg,unsigned int *value,unsigned int size); +int (*reset)(struct adis *adis); };/**
Robert Budai
maintainerPATCH v3 4/7 iio: imu: adis: Add DIAG_STAT register size
In reply to Robert BudaiSome devices may have more than 16 bits of status. This patch allows the user to specify the size of the DIAG_STAT register. It defaults to 2 if not specified. This is mainly for backward compatibility.
--- drivers/iio/imu/adis.c | 11 ++++++++--- include/linux/iio/imu/adis.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/iio/imu/adis.c +8 -3
@@ -304,11 +304,15 @@ EXPORT_SYMBOL_NS(__adis_enable_irq, "IIO_ADISLIB");*/ int __adis_check_status (struct adis *adis) { -u16 status; +unsigned int status;int ret;int i; - ret =__adis_read_reg_16 (adis, adis->data->diag_stat_reg, &status); +if (adis->data->diag_stat_size) + ret = adis->ops->read (adis, adis->data->diag_stat_reg, &status, + adis->data->diag_stat_size); +else + ret =__adis_read_reg_16 (adis, adis->data->diag_stat_reg, (u16 *)&status);if (ret)return ret;
@@ -317,7 +321,8 @@ int __adis_check_status(struct adis *adis)if (status ==0 )return 0 ; -for (i =0 ; i <16 ; ++i) { +for (i =0 ; i <BITS_PER_BYTE * ((adis->data->diag_stat_size) ? + adis->data->diag_stat_size :2 ); ++i) {if (status &BIT (i)) {dev_err (&adis->spi->dev,"%s.\n" , adis->data->status_error_msgs[i]);
include/linux/iio/imu/adis.h +2 -0
@@ -44,6 +44,7 @@ struct adis_timeout {* @glob_cmd_reg: Register address of the GLOB_CMD register * @msc_ctrl_reg: Register address of the MSC_CTRL register * @diag_stat_reg: Register address of the DIAG_STAT register +* @diag_stat_size: Length (in bytes) of the DIAG_STAT register. * @prod_id_reg: Register address of the PROD_ID register * @prod_id: Product ID code that should be expected when reading @prod_id_reg * @self_test_mask: Bitmask of supported self-test operations
@@ -70,6 +71,7 @@ struct adis_data {unsigned int glob_cmd_reg;unsigned int msc_ctrl_reg;unsigned int diag_stat_reg; +unsigned int diag_stat_size;unsigned int prod_id_reg;unsigned int prod_id;
Signature · 1 line
2.34.1
Robert Budai
maintainerPATCH v3 5/7 dt-bindings: iio: Add adis16550 bindings
In reply to Robert BudaiDocument the ADIS16550 device devicetree bindings.
---
v3:
- changed sync type to integer
- conditioned clock only on scaled-sync
- added: unevaluatedProperties false
.../bindings/iio/imu/adi,adis16550.yaml | 93 +++++++++++++++++++ MAINTAINERS | 9 ++ 2 files changed, 102 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml
Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml new file +93 -0
@@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/imu/adi,adis16550.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices ADIS16550 and similar IMUs + +maintainers: + - Nuno Sa <[email protected]> + - Ramona Gradinariu <[email protected]> + - Antoniu Miclaus <[email protected]> + +properties: + compatible: + enum: + - adi,adis16550 + - adi,adis16550w + + reg: + maxItems: 1 + + spi-cpha: true + + spi-cpol: true + + spi-max-frequency: + maximum: 15000000 + + vdd-supply: true + + interrupts: + maxItems: 1 + + reset-gpios: + description: + RESET active low pin. + maxItems: 1 + + clocks: + maxItems: 1 + description: If not provided, then the internal clock is used. + + adi,sync-mode: + description: + Configures the device SYNC pin. The following modes are supported + 0 - direct_sync + 1 - scaled_sync + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 1 + +required: + - compatible + - reg + - interrupts + - spi-cpha + - spi-cpol + - spi-max-frequency + - vdd-supply + +allOf: + - if: + properties: + adi,sync-mode: 1 + + then: + dependencies: + adi,sync-mode: [ clocks ] + + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + spi { + #address-cells = <1>; + #size-cells = <0>; + + imu@0 { + compatible = "adi,adis16550"; + reg = <0>; + spi-max-frequency = <15000000>; + spi-cpol; + spi-cpha; + vdd-supply = <&vdd>; + interrupts = <4 IRQ_TYPE_EDGE_FALLING>; + interrupt-parent = <&gpio>; + }; + }; +...
MAINTAINERS +9 -0
@@ -1453,6 +1453,15 @@ W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml F: drivers/iio/imu/adis16475.c +ANALOG DEVICES INC ADIS16550 DRIVER +M: Nuno Sa <[email protected]> +M: Ramona Gradinariu <[email protected]> +M: Antoniu Miclaus <[email protected]> +L: [email protected] +S: Supported +W: https://ez.analog.com/linux-software-drivers +F: Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml + ANALOG DEVICES INC ADM1177 DRIVER M: Michael Hennerich <[email protected]> L: [email protected]
Signature · 1 line
2.34.1
Rob Herring (Arm)
maintainerRe: [PATCH v3 5/7] dt-bindings: iio: Add adis16550 bindings
Quoted 13 lines · Robert Budai
Document the ADIS16550 device devicetree bindings.
Co-developed-by Antoniu Miclaus <[email protected]>Signed-off-by Antoniu Miclaus <[email protected]>Signed-off-by Ramona Gradinariu <[email protected]>Signed-off-by Robert Budai <[email protected]>---
v3:
- changed sync type to integer
- conditioned clock only on scaled-sync
- added: unevaluatedProperties false
Quoted 5 lines
.../bindings/iio/imu/adi,adis16550.yaml | 93 +++++++++++++++++++ MAINTAINERS | 9 ++ 2 files changed, 102 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:./Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml:45:9: [warning] wrong indentation: expected 6 but found 8 (indentation)
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml: ignoring, error in schema: allOf: 0: if: properties: adi,sync-mode
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml: allOf:0:if:properties:adi,sync-mode: 1 is not of type 'object', 'boolean'
from schema $id: http://json-schema.org/draft-07/schema#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml: allOf:0:if:properties:adi,sync-mode: 1 is not of type 'object', 'boolean'
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml: properties:clocks: 'anyOf' conditional failed, one must be fixed:
'adi,sync-mode' is not one of ['$ref', 'additionalItems', 'additionalProperties', 'allOf', 'anyOf', 'const', 'contains', 'default', 'dependencies', 'dependentRequired', 'dependentSchemas', 'deprecated', 'description', 'else', 'enum', 'exclusiveMaximum', 'exclusiveMinimum', 'items', 'if', 'minItems', 'minimum', 'maxItems', 'maximum', 'multipleOf', 'not', 'oneOf', 'pattern', 'patternProperties', 'properties', 'required', 'then', 'typeSize', 'unevaluatedProperties', 'uniqueItems'] 'type' was expected
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml: properties:clocks: 'oneOf' conditional failed, one must be fixed:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml: properties:clocks: 'anyOf' conditional failed, one must be fixed:
'adi,sync-mode' is not one of ['maxItems', 'description', 'deprecated']
hint: Only "maxItems" is required for a single entry if there are no constraints defined for the values.
Additional properties are not allowed ('adi,sync-mode' was unexpected)
hint: Arrays must be described with a combination of minItems/maxItems/items
'maxItems' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf']
'adi,sync-mode' is not one of ['description', 'deprecated', 'const', 'enum', 'minimum', 'maximum', 'multipleOf', 'default', '$ref', 'oneOf']
1 is less than the minimum of 2
hint: Arrays must be described with a combination of minItems/maxItems/items
hint: cell array properties must define how many entries and what the entries are when there is more than one entry.
from schema $id: http://devicetree.org/meta-schemas/clocks.yaml#
'maxItems' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
'adi,sync-mode' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
'type' is a required property
hint: DT nodes ("object" type in schemas) can only use a subset of json-schema keywords
from schema $id: http://devicetree.org/meta-schemas/clocks.yaml#Documentation/devicetree/bindings/iio/imu/adi,adis16550.example.dtb: /example-0/spi/imu@0: failed to match any schema with compatible: ['adi,adis16550']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Jonathan Cameron
maintainerRe: [PATCH v3 5/7] dt-bindings: iio: Add adis16550 bindings
In reply to Robert BudaiQuoted 58 lines · On Mon, 16 Dec 2024 16:48:11 +0200 Robert Budai <[email protected]> wrote:
Document the ADIS16550 device devicetree bindings.
Co-developed-by Antoniu Miclaus <[email protected]>Signed-off-by Antoniu Miclaus <[email protected]>Signed-off-by Ramona Gradinariu <[email protected]>Signed-off-by Robert Budai <[email protected]>---
v3:
- changed sync type to integer
- conditioned clock only on scaled-sync
- added: unevaluatedProperties false.../bindings/iio/imu/adi,adis16550.yaml | 93 +++++++++++++++++++ MAINTAINERS | 9 ++ 2 files changed, 102 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16550.yamlDocumentation/devicetree/bindings/iio/imu/adi,adis16550.yaml new file +34
-0@@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/imu/adi,adis16550.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices ADIS16550 and similar IMUs + +maintainers: + - Nuno Sa <[email protected]> + - Ramona Gradinariu <[email protected]> + - Antoniu Miclaus <[email protected]> + +properties: + compatible: + enum: + - adi,adis16550 + - adi,adis16550w + + reg: + maxItems: 1 + + spi-cpha: true + + spi-cpol: true + + spi-max-frequency: + maximum: 15000000 + + vdd-supply: true + + interrupts: + maxItems: 1 +
Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml new file +10
-0+ reset-gpios: + description: + RESET active low pin. + maxItems: 1 + + clocks: + maxItems: 1 + description: If not provided, then the internal clock is used. + + adi,sync-mode:
This is at least one of the things the bot is complaining about. Too deep on the indent.
Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml line 48
Quoted 4 lines
Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml new file +4
-0+ description: + Configures the device SYNC pin. The following modes are supported + 0 - direct_sync + 1 - scaled_sync
Ah. I see this is lined up with some existing binding.
you should keep the values the same as well given direct and scaled are already in the adis16475 binding. Just use an enum to constrain the values 1 and 2
Quoted 12 lines
Documentation/devicetree/bindings/iio/imu/adi,adis16550.yaml new file +12
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 1 + +required: + - compatible + - reg + - interrupts + - spi-cpha + - spi-cpol + - spi-max-frequency + - vdd-supply
Robert Budai
maintainerPATCH v3 6/7 iio: imu: adis16550: add adis16550 support
In reply to Robert BudaiThe ADIS16550 is a complete inertial system that includes a triaxis gyroscope and a triaxis accelerometer. Each inertial sensor in the ADIS16550 combines industry leading MEMS only technology with signal conditioning that optimizes dynamic performance. The factory calibration characterizes each sensor for sensitivity, bias, and alignment. As a result, each sensor has its own dynamic com- pensation formulas that provide accurate sensor measurements
---
v3:
- freed xbuf
- fixed code styling related issues
- removed the sensor type enum and used separate structures for providing chip info data
drivers/iio/imu/Kconfig | 13 + drivers/iio/imu/Makefile | 1 + drivers/iio/imu/adis16550.c | 1222 +++++++++++++++++++++++++++++++++++ 3 files changed, 1236 insertions(+) create mode 100644 drivers/iio/imu/adis16550.c
drivers/iio/imu/Kconfig +13 -0
@@ -52,6 +52,19 @@ config ADIS16480 Say yes here to build support for Analog Devices ADIS16375, ADIS16480, ADIS16485, ADIS16488 inertial sensors. +config ADIS16550 + tristate "Analog Devices ADIS16550 and similar IMU driver" + depends on SPI + select IIO_ADIS_LIB + select IIO_ADIS_LIB_BUFFER if IIO_BUFFER + select CRC32 + help + Say yes here to build support for Analog Devices ADIS16550 inertial + sensor. + + To compile this driver as a module, choose M here: the module will be + called adis16550. + source "drivers/iio/imu/bmi160/Kconfig" source "drivers/iio/imu/bmi270/Kconfig" source "drivers/iio/imu/bmi323/Kconfig"
drivers/iio/imu/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_ADIS16400) += adis16400.o obj-$(CONFIG_ADIS16460) += adis16460.o obj-$(CONFIG_ADIS16475) += adis16475.o obj-$(CONFIG_ADIS16480) += adis16480.o +obj-$(CONFIG_ADIS16550) += adis16550.o adis_lib-y += adis.o adis_lib-$(CONFIG_IIO_ADIS_LIB_BUFFER) += adis_trigger.o
drivers/iio/imu/adis16550.c new file +1222 -0
1,222 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v3 6/7] iio: imu: adis16550: add adis16550 support
Hi Robert,
Some comments from my side...
Quoted 23 lines · Robert Budai
The ADIS16550 is a complete inertial system that includes a triaxis gyroscope and a triaxis accelerometer. Each inertial sensor in the ADIS16550 combines industry leading MEMS only technology with signal conditioning that optimizes dynamic performance. The factory calibration characterizes each sensor for sensitivity, bias, and alignment. As a result, each sensor has its own dynamic com- pensation formulas that provide accurate sensor measurements
Co-developed-by Ramona Gradinariu <[email protected]>Signed-off-by Ramona Gradinariu <[email protected]>Co-developed-by Antoniu Miclaus <[email protected]>Signed-off-by Antoniu Miclaus <[email protected]>Signed-off-by Nuno Sá <[email protected]>Signed-off-by Robert Budai <[email protected]>---
v3:
- freed xbuf
- fixed code styling related issues
- removed the sensor type enum and used separate structures for providing chip info data
...
Quoted 49 lines
drivers/iio/imu/adis16550.c new file +37
-0+ +static irqreturn_t adis16550_trigger_handler (int irq,void *p) +{ +u32 crc; +u16 dummy; +bool valid; +int ret, i =0 ; +u8 data_offset =4 ; +struct iio_poll_func *pf = p; +__be32 data[ADIS16550_MAX_SCAN_DATA ]; +struct iio_dev *indio_dev = pf->indio_dev; +struct adis16550 *st =iio_priv (indio_dev); +struct adis *adis =iio_device_get_drvdata (indio_dev); +__be32 *buffer = adis->buffer; + + ret =spi_sync (adis->spi, &adis->msg); +if (ret) + goto done; +/* +* Validate the header. The header is a normal spi reply with state +* vector and crc4. +*/ + ret =adis16550_spi_validate (&st->adis, buffer[0 ], &dummy); +if (ret) + goto done; + + crc =be32_to_cpu (buffer[ADIS16550_BURST_N_ELEM -1 ]); +/* the header is not included in the crc */ + valid =adis16550_validate_crc ((u32 *)&buffer[1 ], + ADIS16550_BURST_N_ELEM - 2, crc); +if (!valid) { +dev_err (&adis->spi->dev,"Burst Invalid crc!\n" ); + goto done; + } + +if (*indio_dev->active_scan_mask &BIT (ADIS16550_SCAN_GYRO_X )) { + memcpy(&data[i], &buffer[data_offset],(
ADIS16550_SCAN_ACCEL_Z-drivers/iio/imu/adis16550.c new file +9
-0+ ADIS16550_SCAN_GYRO_X + 1) * + sizeof(__be32)); + i +=ADIS16550_SCAN_ACCEL_Z -ADIS16550_SCAN_GYRO_X +1 ; + } +if (*indio_dev->active_scan_mask &BIT (ADIS16550_SCAN_TEMP )) + data[i++] = buffer[data_offset -1 ]; +if (*indio_dev->active_scan_mask &BIT (ADIS16550_SCAN_DELTANG_X )) + memcpy(&data[i], &buffer[data_offset], + (ADIS16550_SCAN_DELTVEL_Z - ADIS16550_SCAN_DELTANG_X +1) *
Review
Quoted 1 line
(quoted diff) +1
-0+ sizeof(__be32));
Can't we just reorder the channels in adis16550_channels so that we have a plain memcpy()? Like having the temperature before the accel + gyro or the delta stuff? Then you should only need to care about the initial offset (to account for DATA_CNT and STATUS). Right?
Quoted 19 lines
drivers/iio/imu/adis16550.c new file +18
-0+iio_push_to_buffers_with_timestamp (indio_dev, data, pf->timestamp); +done: +iio_trigger_notify_done (indio_dev->trig); +return IRQ_HANDLED ; +} + +static const unsigned long adis16550_channel_masks[] = { +ADIS16550_BURST_DATA_GYRO_ACCEL_MASK |BIT (ADIS16550_SCAN_TEMP ), +ADIS16550_BURST_DATA_DELTA_ANG_VEL_MASK |BIT (ADIS16550_SCAN_TEMP ), +}; + +static int adis16550_update_scan_mode (struct iio_dev *indio_dev, + const unsigned long *scan_mask) +{ +struct adis *adis =iio_device_get_drvdata (indio_dev); +u16 burst_length =ADIS16550_BURST_DATA_LEN ; +u8 burst_cmd; +u8 *tx;
drivers/iio/imu/adis16550.c line 927
Quoted 10 lines
drivers/iio/imu/adis16550.c new file +10
-0+ +if (*scan_mask &ADIS16550_BURST_DATA_GYRO_ACCEL_MASK ) + burst_cmd =ADIS16550_REG_BURST_GYRO_ACCEL ; +else + burst_cmd =ADIS16550_REG_BURST_DELTA_ANG_VEL ; + +if (adis->xfer) +memset (adis->xfer,0 ,2 *sizeof (*adis->xfer)); +if (adis->buffer) +memset (adis->buffer,0 , burst_length +sizeof (u32));
The above checks should be removed. Likely from a previous version...
Quoted 29 lines
drivers/iio/imu/adis16550.c new file +28
-0+ tx = adis->buffer + burst_length; + tx[0 ] =0x00 ; + tx[1 ] =0x00 ; + tx[2 ] = burst_cmd; +/* crc4 is 0 on burst command */ + tx[3 ] =spi_crc4 (get_unaligned_le32 (tx)); + + adis->xfer[0 ].tx_buf = tx; + adis->xfer[0 ].len =4 ; + adis->xfer[0 ].cs_change =1 ; + adis->xfer[0 ].delay.value =8 ; + adis->xfer[0 ].delay.unit =SPI_DELAY_UNIT_USECS ; + adis->xfer[1 ].rx_buf = adis->buffer; + adis->xfer[1 ].len = burst_length; + +spi_message_init_with_transfers (&adis->msg, adis->xfer,2 ); + +return 0 ; +} + +static int adis16550_reset (struct adis *adis) +{ +return __adis_write_reg_16 (adis,ADIS16550_REG_COMMAND ,BIT (15 )); +} + +static int adis16550_config_sync (struct adis16550 *st) +{ +struct device *dev = &st->adis.spi->dev;
drivers/iio/imu/adis16550.c line 966
Quoted 10 lines
drivers/iio/imu/adis16550.c new file +10
-0+const struct adis16550_sync *sync; +struct clk *clk; +u32 sync_mode; +u16 mode; +int ret; + +if (!device_property_present (dev,"adi,sync-mode" )) { + st->clk_freq_hz = st->info->int_clk *1000 ; +return 0 ; + }
I would do it in another way...
ret = device_property_read_u32(dev, "adi,sync-mode", &sync_mode);
if (ret) {
st->clk_freq_hz = st->info->int_clk * 1000;
return 0;
}/* then proceed */
Quoted 178 lines
drivers/iio/imu/adis16550.c new file +19
-0+ ret =device_property_read_u32 (dev,"adi,sync-mode" , &sync_mode); +if (ret) +return 0 ; + +if (sync_mode >= st->info->num_sync) { +dev_err (dev,"Invalid sync mode: %u for %s\n" , sync_mode, + st->info->name); +return -EINVAL ; + } + + sync = &st->info->sync_mode[sync_mode]; + st->sync_mode = sync->sync_mode; + + clk =devm_clk_get_enabled (dev,NULL ); +if (IS_ERR (clk)) +return PTR_ERR (clk); + + st->clk_freq_hz =clk_get_rate (clk); + if (st->clk_freq_hz > sync->max_rate || st->clk_freq_hz < sync-Quoted 1 line
min_rate)(quoted diff) +2
-0+ return dev_err_probe(dev, -EINVAL, + "Clk rate: %lu not in a valid range:[%u%u]\n",
(quoted diff) +1
-0+ st->clk_freq_hz, sync->min_rate, sync-Quoted 1 line
max_rate);drivers/iio/imu/adis16550.c new file +6
-0+ +if (sync->sync_mode ==ADIS16550_SYNC_MODE_SCALED ) { +u16 sync_scale; +u32 scaled_freq =0 ; +/* +* In pps scaled sync we must scale the input clock to a range
drivers/iio/imu/adis16550.c new file +7
-0+* of [3000 45000]. +*/ + ret =device_property_read_u32 (dev,"adi,scaled-output-hz" , + &scaled_freq); +if (ret) + return dev_err_probe(dev, ret, + "adi,scaled-output-hz propertynot found");
drivers/iio/imu/adis16550.c new file +4
-0+ +if (scaled_freq <3000 || scaled_freq >4500 ) + return dev_err_probe(dev, -EINVAL, + "Invalid value:%u foradi,scaled-output-hz",
drivers/iio/imu/adis16550.c new file +49
-0+ scaled_freq); + + sync_scale =DIV_ROUND_CLOSEST (scaled_freq, st->clk_freq_hz); + + ret =adis_write_reg_16 (&st->adis,ADIS16550_REG_SYNC_SCALE , + sync_scale); +if (ret) +return ret; + + st->clk_freq_hz = scaled_freq; + } + + st->clk_freq_hz *=1000 ; + + mode =FIELD_PREP (ADIS16550_SYNC_MODE_MASK , sync->sync_mode) | + FIELD_PREP(ADIS16550_SYNC_EN_MASK, true); + +return __adis_update_bits (&st->adis,ADIS16550_REG_CONFIG , + ADIS16550_SYNC_MASK, mode); +} + +static const struct iio_info adis16550_info = { + .read_raw = &adis16550_read_raw, + .write_raw = &adis16550_write_raw, + .update_scan_mode = adis16550_update_scan_mode, + .debugfs_reg_access = adis_debugfs_reg_access, +}; + +enum { +ADIS16550_STATUS_CRC_CODE , +ADIS16550_STATUS_CRC_CONFIG , +ADIS16550_STATUS_FLASH_UPDATE , +ADIS16550_STATUS_INERIAL , +ADIS16550_STATUS_SENSOR , +ADIS16550_STATUS_TEMPERATURE , +ADIS16550_STATUS_SPI , +ADIS16550_STATUS_PROCESSING , +ADIS16550_STATUS_POWER , +ADIS16550_STATUS_BOOT , +ADIS16550_STATUS_WATCHDOG =15 , +ADIS16550_STATUS_REGULATOR =28 , +ADIS16550_STATUS_SENSOR_SUPPLY , +ADIS16550_STATUS_CPU_SUPPLY , +ADIS16550_STATUS_5V_SUPPLY +}; + +static const char *const adis16550_status_error_msgs[] = { + [ADIS16550_STATUS_CRC_CODE ] ="Code CRC Error" , + [ADIS16550_STATUS_CRC_CONFIG] = "Configuration/Calibration CRCError",
drivers/iio/imu/adis16550.c new file +82
-0+ [ADIS16550_STATUS_FLASH_UPDATE] = "Flash Update Error", + [ADIS16550_STATUS_INERIAL] = "Overrange for Inertial Signals", + [ADIS16550_STATUS_SENSOR] = "Sensor failure", + [ADIS16550_STATUS_TEMPERATURE] = "Temperature Error", + [ADIS16550_STATUS_SPI] = "SPI Communication Error", + [ADIS16550_STATUS_PROCESSING] = "Processing Overrun Error", + [ADIS16550_STATUS_POWER] = "Power Supply Failure", + [ADIS16550_STATUS_BOOT] = "Boot Memory Failure", + [ADIS16550_STATUS_WATCHDOG] = "Watchdog timer flag", + [ADIS16550_STATUS_REGULATOR] = "Internal Regulator Error", + [ADIS16550_STATUS_SENSOR_SUPPLY] = "Internal Sensor Supply Error.", + [ADIS16550_STATUS_CPU_SUPPLY] = "Internal Processor Supply Error.", + [ADIS16550_STATUS_5V_SUPPLY] = "External 5V Supply Error", +}; + +static const struct adis_timeout adis16550_timeouts = { + .reset_ms =1000 , + .sw_reset_ms =1000 , + .self_test_ms =1000 , +}; + +static const struct adis_data adis16550_data = { + .diag_stat_reg =ADIS16550_REG_STATUS , + .diag_stat_size =4 , + .prod_id_reg =ADIS16550_REG_PROD_ID , + .prod_id =16550 , + .self_test_mask =BIT (1 ), + .self_test_reg =ADIS16550_REG_COMMAND , + .cs_change_delay =5 , + .unmasked_drdy = true, + .status_error_msgs = adis16550_status_error_msgs, + .status_error_mask =BIT (ADIS16550_STATUS_CRC_CODE ) | +BIT (ADIS16550_STATUS_CRC_CONFIG ) | +BIT (ADIS16550_STATUS_FLASH_UPDATE ) | +BIT (ADIS16550_STATUS_INERIAL ) | +BIT (ADIS16550_STATUS_SENSOR ) | +BIT (ADIS16550_STATUS_TEMPERATURE ) | +BIT (ADIS16550_STATUS_SPI ) | +BIT (ADIS16550_STATUS_PROCESSING ) | +BIT (ADIS16550_STATUS_POWER ) | +BIT (ADIS16550_STATUS_BOOT ) | +BIT (ADIS16550_STATUS_WATCHDOG ) | +BIT (ADIS16550_STATUS_REGULATOR ) | +BIT (ADIS16550_STATUS_SENSOR_SUPPLY ) | +BIT (ADIS16550_STATUS_CPU_SUPPLY ) | +BIT (ADIS16550_STATUS_5V_SUPPLY ) | +BIT (ADIS16550_STATUS_CRC_CODE ), + .timeouts = &adis16550_timeouts, +}; + +static const struct adis_ops adis16550_ops = { + .write = adis16550_spi_write, + .read = adis16550_spi_read, + .reset = adis16550_reset, +}; + +static int adis16550_probe (struct spi_device *spi) +{ +struct device *dev = &spi->dev; +struct iio_dev *indio_dev; +struct adis16550 *st; +int ret; + + indio_dev =devm_iio_device_alloc (dev,sizeof (*st)); +if (!indio_dev) +return -ENOMEM ; + + st =iio_priv (indio_dev); + st->info =spi_get_device_match_data (spi); +if (!st->info) +return -EINVAL ; + + indio_dev->name = st->info->name; + indio_dev->channels = st->info->channels; + indio_dev->num_channels = st->info->num_channels; + indio_dev->available_scan_masks = adis16550_channel_masks; + indio_dev->info = &adis16550_info; + indio_dev->modes =INDIO_DIRECT_MODE ; + + st->adis.ops = &adis16550_ops; + + struct spi_transfer *xfer_tmp = kcalloc(2, sizeof(*st->adis.xfer),
GFP_KERNEL);
drivers/iio/imu/adis16550.c line 1143
Quoted 6 lines
drivers/iio/imu/adis16550.c new file +6
-0+ +if (!xfer_tmp) +return -ENOMEM ; + +void *buffer_tmp =kzalloc (ADIS16550_BURST_DATA_LEN +sizeof (u32), + GFP_KERNEL);
I'm bit a puzzeled... Why do we have it like this? I guess we are missing __free(kfree) in here? But I would not go with this trouble in here. Why not devm_kzalloc()? should be safe to be used in here...
Quoted 34 lines
drivers/iio/imu/adis16550.c new file +33
-0+if (!buffer_tmp) { +kfree (st->adis.xfer); +return -ENOMEM ; + } + + ret =devm_regulator_get_enable (dev,"vdd" ); +if (ret) { +dev_err_probe (dev, ret, + "Failed to get vdd regulator\n"); + goto free_on_error; + } + + ret =adis_init (&st->adis, indio_dev, spi, &adis16550_data); +if (ret) + goto free_on_error; + + ret =__adis_initial_startup (&st->adis); +if (ret) + goto free_on_error; + + ret =adis16550_config_sync (st); +if (ret) + goto free_on_error; + + ret =devm_adis_setup_buffer_and_trigger (&st->adis, indio_dev, + adis16550_trigger_handler); +if (ret) + goto free_on_error; + + ret =devm_iio_device_register (dev, indio_dev); +if (ret) + goto free_on_error; +
drivers/iio/imu/adis16550.c line 1186
Quoted 10 lines
drivers/iio/imu/adis16550.c new file +10
-0+adis16550_debugfs_init (indio_dev); + + st->adis.xfer =no_free_ptr (xfer_tmp); + st->adis.buffer =no_free_ptr (buffer_tmp); + +return 0 ; + +free_on_error: +kfree (xfer_tmp); +kfree (buffer_tmp);
The above should not be needed...
Quoted 35 lines
drivers/iio/imu/adis16550.c new file +35
-0+return ret; +} + +static const struct spi_device_id adis16550_id[] = { + { "adis16550", (kernel_ulong_t)&adis16550_chip_info}, + {"adis16550w" , (kernel_ulong_t)&adis16550w_chip_info}, + { } +}; +MODULE_DEVICE_TABLE (spi, adis16550_id); + +static const struct of_device_id adis16550_of_match[] = { + { .compatible ="adi,adis16550" , + .data = &adis16550_chip_info }, + { .compatible ="adi,adis16550w" , + .data = &adis16550w_chip_info }, + { } +}; +MODULE_DEVICE_TABLE (of, adis16550_of_match); + +static struct spi_driver adis16550_driver = { + .driver = { + .name ="adis16550" , + .of_match_table = adis16550_of_match, + }, + .probe = adis16550_probe, + .id_table = adis16550_id, +}; +module_spi_driver (adis16550_driver); + +MODULE_AUTHOR ("Nuno Sa <[email protected]>" ); +MODULE_AUTHOR ("Ramona Gradinariu <[email protected]>" ); +MODULE_AUTHOR ("Antoniu Miclaus <[email protected]>" ); +MODULE_DESCRIPTION ("Analog Devices ADIS16550 IMU driver" ); +MODULE_LICENSE ("GPL" ); +MODULE_IMPORT_NS (IIO_ADISLIB );
Jonathan Cameron
maintainerRe: [PATCH v3 6/7] iio: imu: adis16550: add adis16550 support
In reply to Robert BudaiQuoted 14 lines · On Mon, 16 Dec 2024 16:48:12 +0200 Robert Budai <[email protected]> wrote:
The ADIS16550 is a complete inertial system that includes a triaxis gyroscope and a triaxis accelerometer. Each inertial sensor in the ADIS16550 combines industry leading MEMS only technology with signal conditioning that optimizes dynamic performance. The factory calibration characterizes each sensor for sensitivity, bias, and alignment. As a result, each sensor has its own dynamic com- pensation formulas that provide accurate sensor measurements
Co-developed-by Ramona Gradinariu <[email protected]>Signed-off-by Ramona Gradinariu <[email protected]>Co-developed-by Antoniu Miclaus <[email protected]>Signed-off-by Antoniu Miclaus <[email protected]>Signed-off-by Nuno Sá <[email protected]>Signed-off-by Robert Budai <[email protected]>
Quoted 6 lines
---
v3:
- freed xbuf
- fixed code styling related issues
- removed the sensor type enum and used separate structures for providing chip info data
Hi
A few comments inline to add to what Nuno noted.
Thanks
Jonathan
Quoted 14 lines
adis_lib-$(CONFIG_IIO_ADIS_LIB_BUFFER) += adis_trigger.o
drivers/iio/imu/adis16550.c new file +4
-0+static int adis16550_update_scan_mode (struct iio_dev *indio_dev, +const unsigned long *scan_mask) +{ +struct adis *adis =iio_device_get_drvdata (indio_dev);
drivers/iio/imu/adis16550.c line 924
Quoted 10 lines
drivers/iio/imu/adis16550.c new file +10
-0+u16 burst_length =ADIS16550_BURST_DATA_LEN ; +u8 burst_cmd; +u8 *tx; + +if (*scan_mask &ADIS16550_BURST_DATA_GYRO_ACCEL_MASK ) + burst_cmd =ADIS16550_REG_BURST_GYRO_ACCEL ; +else + burst_cmd =ADIS16550_REG_BURST_DELTA_ANG_VEL ; + +if (adis->xfer)
How would we be getting here if these weren't set? Should be fine to assume they are.
Quoted 23 lines
drivers/iio/imu/adis16550.c new file +23
-0+memset (adis->xfer,0 ,2 *sizeof (*adis->xfer)); +if (adis->buffer) +memset (adis->buffer,0 , burst_length +sizeof (u32)); + + tx = adis->buffer + burst_length; + tx[0 ] =0x00 ; + tx[1 ] =0x00 ; + tx[2 ] = burst_cmd; +/* crc4 is 0 on burst command */ + tx[3 ] =spi_crc4 (get_unaligned_le32 (tx)); + + adis->xfer[0 ].tx_buf = tx; + adis->xfer[0 ].len =4 ; + adis->xfer[0 ].cs_change =1 ; + adis->xfer[0 ].delay.value =8 ; + adis->xfer[0 ].delay.unit =SPI_DELAY_UNIT_USECS ; + adis->xfer[1 ].rx_buf = adis->buffer; + adis->xfer[1 ].len = burst_length; + +spi_message_init_with_transfers (&adis->msg, adis->xfer,2 ); + +return 0 ; +}
...
Quoted 59 lines
drivers/iio/imu/adis16550.c new file +59
-0+static int adis16550_probe (struct spi_device *spi) +{ +struct device *dev = &spi->dev; +struct iio_dev *indio_dev; +struct adis16550 *st; +int ret; + + indio_dev =devm_iio_device_alloc (dev,sizeof (*st)); +if (!indio_dev) +return -ENOMEM ; + + st =iio_priv (indio_dev); + st->info =spi_get_device_match_data (spi); +if (!st->info) +return -EINVAL ; + + indio_dev->name = st->info->name; + indio_dev->channels = st->info->channels; + indio_dev->num_channels = st->info->num_channels; + indio_dev->available_scan_masks = adis16550_channel_masks; + indio_dev->info = &adis16550_info; + indio_dev->modes =INDIO_DIRECT_MODE ; + + st->adis.ops = &adis16550_ops; + +struct spi_transfer *xfer_tmp =kcalloc (2 ,sizeof (*st->adis.xfer),GFP_KERNEL ); + +if (!xfer_tmp) +return -ENOMEM ; + +void *buffer_tmp =kzalloc (ADIS16550_BURST_DATA_LEN +sizeof (u32), +GFP_KERNEL ); +if (!buffer_tmp) { +kfree (st->adis.xfer); +return -ENOMEM ; + } + + ret =devm_regulator_get_enable (dev,"vdd" ); +if (ret) { +dev_err_probe (dev, ret, +"Failed to get vdd regulator\n" ); + goto free_on_error; + } + + ret =adis_init (&st->adis, indio_dev, spi, &adis16550_data); +if (ret) + goto free_on_error; + + ret =__adis_initial_startup (&st->adis); +if (ret) + goto free_on_error; + + ret =adis16550_config_sync (st); +if (ret) + goto free_on_error; + + ret =devm_adis_setup_buffer_and_trigger (&st->adis, indio_dev, + adis16550_trigger_handler); +if (ret)
drivers/iio/imu/adis16550.c line 1180
Quoted 10 lines
drivers/iio/imu/adis16550.c new file +10
-0+ goto free_on_error; + + ret =devm_iio_device_register (dev, indio_dev); +if (ret) + goto free_on_error; + +adis16550_debugfs_init (indio_dev); + + st->adis.xfer =no_free_ptr (xfer_tmp); + st->adis.buffer =no_free_ptr (buffer_tmp);
I guess this was me explaining something badly.
You need to look at all the infrastructure in cleanup.h. This only makes sense if you are using auto freeing of the variables That is
void *buffer_tmp __free(kfree) = kzalloc(ADIS16550_BURST_DATA_LEN + sizeof(u32), GFP_KERNEL);
etc
Then get rid of the kfree below as they will be freed on exiting scope if no_free_ptr() hasn't been called on them (which sets the pointer to NULL). Then you can avoid the goto's.
However as Nuno pointed out, devm_kzalloc() may well be a better choice. We need alignement for DMA, but dma_kzalloc does guarantee that so it is all fine.
That would also fix actually freeing these on driver remove which is currently missing.
Quoted 9 lines
drivers/iio/imu/adis16550.c new file +9
-0+ +return 0 ; + +free_on_error: +kfree (xfer_tmp); +kfree (buffer_tmp); + +return ret; +}
Robert Budai
maintainerPATCH v3 7/7 docs: iio: add documentation for adis16550 driver
In reply to Robert BudaiAdd documentation for adis16550 driver which describes the driver device files and shows how the user may use the ABI for various scenarios (configuration, measurement, etc.).
--- Documentation/iio/adis16550.rst | 389 ++++++++++++++++++++++++++++++++ Documentation/iio/index.rst | 1 + 2 files changed, 390 insertions(+) create mode 100644 Documentation/iio/adis16550.rst
Documentation/iio/adis16550.rst new file +389 -0
@@ -0,0 +1,389 @@ +.. SPDX-License-Identifier: GPL-2.0 + +================ +ADIS16550 driver +================ + +This driver supports Analog Device's IMUs on SPI bus. + +1. Supported devices +==================== + +* `ADIS16550 <https://www.analog.com/ADIS16550>`_ + +The ADIS16550 is a complete inertial system that includes a triaxis gyroscope +and a triaxis accelerometer. Each inertial sensor in the ADIS16550 combines +industry leading MEMS only technology with signal conditioning that optimizes +dynamic performance. The factory calibration characterizes each sensor for +sensitivity, bias, and alignment. As a result, each sensor has its own dynamic +compensation formulas that provide accurate sensor measurements. + +The ADIS16550 provides a simple, cost-effective method for integrating accurate, +multiaxis inertial sensing into industrial systems, especially when compared +with the complexity and investment associated with discrete designs. All +necessary motion testing and calibration are part of the production process at +the factory, greatly reducing system integration time. Tight orthogonal +alignment simplifies inertial frame alignment in navigation systems. The serial +peripheral interface (SPI) and register structure provide a simple interface for +data collection and configuration control. + +2. Device attributes +==================== + +Accelerometer, gyroscope measurements are always provided. Furthermore, the +driver offers the capability to retrieve the delta angle and the delta velocity +measurements computed by the device. + +The delta angle measurements represent a calculation of angular displacement +between each sample update, while the delta velocity measurements represent a +calculation of linear velocity change between each sample update. + +Finally, temperature data are provided which show a coarse measurement of +the temperature inside of the IMU device. This data is most useful for +monitoring relative changes in the thermal environment. + +Each IIO device, has a device folder under ``/sys/bus/iio/devices/iio:deviceX``, +where X is the IIO index of the device. Under these folders reside a set of +device files, depending on the characteristics and features of the hardware +device in questions. These files are consistently generalized and documented in +the IIO ABI documentation. + +The following tables show the adis16550 related device files, found in the +specific device folder path ``/sys/bus/iio/devices/iio:deviceX``. + ++-------------------------------------------+----------------------------------------------------------+ +| 3-Axis Accelerometer related device files | Description | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_scale | Scale for the accelerometer channels. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_filter_low_pass_3db_frequency | Bandwidth for the accelerometer channels. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_x_calibbias | Calibration offset for the X-axis accelerometer channel. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_x_calibscale | Calibration scale for the X-axis accelerometer channel. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_x_raw | Raw X-axis accelerometer channel value. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_y_calibbias | Calibration offset for the Y-axis accelerometer channel. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_y_calibscale | Calibration scale for the Y-axis accelerometer channel. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_y_raw | Raw Y-axis accelerometer channel value. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_z_calibbias | Calibration offset for the Z-axis accelerometer channel. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_z_calibscale | Calibration scale for the Z-axis accelerometer channel. | ++-------------------------------------------+----------------------------------------------------------+ +| in_accel_z_raw | Raw Z-axis accelerometer channel value. | ++-------------------------------------------+----------------------------------------------------------+ +| in_deltavelocity_scale | Scale for delta velocity channels. | ++-------------------------------------------+----------------------------------------------------------+ +| in_deltavelocity_x_raw | Raw X-axis delta velocity channel value. | ++-------------------------------------------+----------------------------------------------------------+ +| in_deltavelocity_y_raw | Raw Y-axis delta velocity channel value. | ++-------------------------------------------+----------------------------------------------------------+ +| in_deltavelocity_z_raw | Raw Z-axis delta velocity channel value. | ++-------------------------------------------+----------------------------------------------------------+ + ++--------------------------------------------+------------------------------------------------------+ +| 3-Axis Gyroscope related device files | Description | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_scale | Scale for the gyroscope channels. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_filter_low_pass_3db_frequency | Scale for the gyroscope channels. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_x_calibbias | Calibration offset for the X-axis gyroscope channel. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_x_calibscale | Calibration scale for the X-axis gyroscope channel. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_x_raw | Raw X-axis gyroscope channel value. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_y_calibbias | Calibration offset for the Y-axis gyroscope channel. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_y_calibscale | Calibration scale for the Y-axis gyroscope channel. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_y_raw | Raw Y-axis gyroscope channel value. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_z_calibbias | Calibration offset for the Z-axis gyroscope channel. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_z_calibscale | Calibration scale for the Z-axis gyroscope channel. | ++--------------------------------------------+------------------------------------------------------+ +| in_anglvel_z_raw | Raw Z-axis gyroscope channel value. | ++--------------------------------------------+------------------------------------------------------+ +| in_deltaangl_scale | Scale for delta angle channels. | ++--------------------------------------------+------------------------------------------------------+ +| in_deltaangl_x_raw | Raw X-axis delta angle channel value. | ++--------------------------------------------+------------------------------------------------------+ +| in_deltaangl_y_raw | Raw Y-axis delta angle channel value. | ++--------------------------------------------+------------------------------------------------------+ +| in_deltaangl_z_raw | Raw Z-axis delta angle channel value. | ++--------------------------------------------+------------------------------------------------------+ + ++----------------------------------+-------------------------------------------+ +| Temperature sensor related files | Description | ++----------------------------------+-------------------------------------------+ +| in_temp0_raw | Raw temperature channel value. | ++----------------------------------+-------------------------------------------+ +| in_temp0_offset | Offset for the temperature sensor channel.| ++----------------------------------+-------------------------------------------+ +| in_temp0_scale | Scale for the temperature sensor channel. | ++----------------------------------+-------------------------------------------+ + ++----------------------------+--------------------------------------------------------------------------------+ +| Miscellaneous device files | Description | ++----------------------------+--------------------------------------------------------------------------------+ +| name | Name of the IIO device. | ++----------------------------+--------------------------------------------------------------------------------+ +| sampling_frequency | Currently selected sample rate. | ++----------------------------+--------------------------------------------------------------------------------+ +| write_lock_enable | Lock the device from further configuration. Only a reset will remove the lock. | ++----------------------------+--------------------------------------------------------------------------------+ + +The following table shows the adis16550 related device debug files, found in the +specific device debug folder path ``/sys/kernel/debug/iio/iio:deviceX``. + ++----------------------+-------------------------------------------------------------------------+ +| Debugfs device files | Description | ++----------------------+-------------------------------------------------------------------------+ +| serial_number | The serial number of the chip in hexadecimal format. | ++----------------------+-------------------------------------------------------------------------+ +| product_id | Chip specific product id (16550). | ++----------------------+-------------------------------------------------------------------------+ +| flash_count | The number of flash writes performed on the device. | ++----------------------+-------------------------------------------------------------------------+ +| firmware_revision | String containing the firmware revision in the following format ##.##. | ++----------------------+-------------------------------------------------------------------------+ +| firmware_date | String containing the firmware date in the following format mm-dd-yyyy. | ++----------------------+-------------------------------------------------------------------------+ + +Channels processed values +------------------------- + +A channel value can be read from its _raw attribute. The value returned is the +raw value as reported by the devices. To get the processed value of the channel, +apply the following formula: + +.. code-block:: bash + + processed value = (_raw + _offset) * _scale + +Where _offset and _scale are device attributes. If no _offset attribute is +present, simply assume its value is 0. + +The adis16550 driver offers data for 5 types of channels, the table below shows +the measurement units for the processed value, which are defined by the IIO +framework: + ++--------------------------------------+---------------------------+ +| Channel type | Measurement unit | ++--------------------------------------+---------------------------+ +| Acceleration on X, Y, and Z axis | Meters per Second squared | ++--------------------------------------+---------------------------+ +| Angular velocity on X, Y and Z axis | Radians per second | ++--------------------------------------+---------------------------+ +| Delta velocity on X. Y, and Z axis | Meters per Second | ++--------------------------------------+---------------------------+ +| Delta angle on X, Y, and Z axis | Radians | ++--------------------------------------+---------------------------+ +| Temperature | Millidegrees Celsius | ++--------------------------------------+---------------------------+ + +Usage examples +-------------- + +Show device name: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat name + adis16550 + +Show accelerometer channels value: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_raw + 6903851 + root:/sys/bus/iio/devices/iio:device0> cat in_accel_y_raw + 5650550 + root:/sys/bus/iio/devices/iio:device0> cat in_accel_z_raw + 104873530 + root:/sys/bus/iio/devices/iio:device0> cat in_accel_scale + 0.000000095 + +- X-axis acceleration = in_accel_x_raw * in_accel_scale = 0.655865845 m/s^2 +- Y-axis acceleration = in_accel_y_raw * in_accel_scale = 0.53680225 m/s^2 +- Z-axis acceleration = in_accel_z_raw * in_accel_scale = 9.96298535 m/s^2 + +Show gyroscope channels value: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_x_raw + 193309 + root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_y_raw + -763676 + root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_z_raw + -358108 + root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_scale + 0.000000003 + +- X-axis angular velocity = in_anglvel_x_raw * in_anglvel_scale = 0.000579927 rad/s +- Y-axis angular velocity = in_anglvel_y_raw * in_anglvel_scale = −0.002291028 rad/s +- Z-axis angular velocity = in_anglvel_z_raw * in_anglvel_scale = −0.001074324 rad/s + +Set calibration offset for accelerometer channels: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_calibbias + 0 + + root:/sys/bus/iio/devices/iio:device0> echo 5000 > in_accel_x_calibbias + root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_calibbias + 5000 + +Set calibration offset for gyroscope channels: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_y_calibbias + 0 + + root:/sys/bus/iio/devices/iio:device0> echo -5000 > in_anglvel_y_calibbias + root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_y_calibbias + -5000 + +Set sampling frequency: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat sampling_frequency + 4000.000000 + + root:/sys/bus/iio/devices/iio:device0> echo 1000 > sampling_frequency + 1000.000000 + +Set bandwidth for accelerometer channels: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat in_accel_filter_low_pass_3db_frequency + 0 + + root:/sys/bus/iio/devices/iio:device0> echo 100 > in_accel_filter_low_pass_3db_frequency + root:/sys/bus/iio/devices/iio:device0> cat in_accel_filter_low_pass_3db_frequency + 100 + +Show serial number: + +.. code-block:: bash + + root:/sys/kernel/debug/iio/iio:device0> cat serial_number + 0x000000b6 + +Show product id: + +.. code-block:: bash + + root:/sys/kernel/debug/iio/iio:device0> cat product_id + 16550 + +Show flash count: + +.. code-block:: bash + + root:/sys/kernel/debug/iio/iio:device0> cat flash_count + 13 + +Show firmware revision: + +.. code-block:: bash + + root:/sys/kernel/debug/iio/iio:device0> cat firmware_revision + 1.5 + +Show firmware date: + +.. code-block:: bash + + root:/sys/kernel/debug/iio/iio:device0> cat firmware_date + 28-04-2021 + +3. Device buffers +================= + +This driver supports IIO buffers. + +The device supports retrieving the raw acceleration, gyroscope, delta velocity, +delta angle and temperature measurements using buffers. + +However, when retrieving acceleration or gyroscope data using buffers, delta +readings will not be available and vice versa. This is because the device only +allows to read either acceleration and gyroscope data or delta velocity and +delta angle data at a time and switching between these two burst data selection +modes is time consuming. + +Usage examples +-------------- + +Set device trigger in current_trigger, if not already set: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> cat trigger/current_trigger + + root:/sys/bus/iio/devices/iio:device0> echo adis16550-dev0 > trigger/current_trigger + root:/sys/bus/iio/devices/iio:device0> cat trigger/current_trigger + adis16550-dev0 + +Select channels for buffer read: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_deltavelocity_x_en + root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_deltavelocity_y_en + root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_deltavelocity_z_en + root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_temp0_en + +Set the number of samples to be stored in the buffer: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> echo 10 > buffer/length + +Enable buffer readings: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> echo 1 > buffer/enable + +Obtain buffered data: + +.. code-block:: bash + + root:/sys/bus/iio/devices/iio:device0> hexdump -C /dev/iio\:device0 + ... + 0000cdf0 00 00 0d 2f 00 00 08 43 00 00 09 09 00 00 a4 5f |.../...C......._| + 0000ce00 00 00 0d 2f 00 00 07 de 00 00 08 db 00 00 a4 4b |.../...........K| + 0000ce10 00 00 0d 2f 00 00 07 58 00 00 08 a3 00 00 a4 55 |.../...X.......U| + 0000ce20 00 00 0d 2f 00 00 06 d6 00 00 08 5c 00 00 a4 62 |.../.......\...b| + 0000ce30 00 00 0d 2f 00 00 06 45 00 00 08 37 00 00 a4 47 |.../...E...7...G| + 0000ce40 00 00 0d 2f 00 00 05 d4 00 00 08 30 00 00 a3 fa |.../.......0....| + 0000ce50 00 00 0d 2f 00 00 05 d0 00 00 08 12 00 00 a3 d3 |.../............| + 0000ce60 00 00 0d 2f 00 00 05 dd 00 00 08 2e 00 00 a3 e9 |.../............| + 0000ce70 00 00 0d 2f 00 00 05 cc 00 00 08 51 00 00 a3 d5 |.../.......Q....| + 0000ce80 00 00 0d 2f 00 00 05 ba 00 00 08 22 00 00 a3 9a |.../......."....| + 0000ce90 00 00 0d 2f 00 00 05 9c 00 00 07 d9 00 00 a3 40 |.../...........@| + 0000cea0 00 00 0d 2f 00 00 05 68 00 00 07 94 00 00 a2 e4 |.../...h........| + 0000ceb0 00 00 0d 2f 00 00 05 25 00 00 07 8d 00 00 a2 ce |.../...%........| + ... + +See ``Documentation/iio/iio_devbuf.rst`` for more information about how buffered +data is structured. + +4. IIO Interfacing Tools +======================== + +See ``Documentation/iio/iio_tools.rst`` for the description of the available IIO +interfacing tools.
Documentation/iio/index.rst +1 -0
@@ -26,6 +26,7 @@ Industrial I/O Kernel Drivers ad7944 adis16475 adis16480 + adis16550 adxl380 bno055 ep93xx_adc
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerRe: [PATCH v3 7/7] docs: iio: add documentation for adis16550 driver
Quoted 26 lines · On Mon, 16 Dec 2024 16:48:13 +0200 Robert Budai <[email protected]> wrote:
Add documentation for adis16550 driver which describes the driver device files and shows how the user may use the ABI for various scenarios (configuration, measurement, etc.).
Co-developed-by Antoniu Miclaus <[email protected]>Signed-off-by Antoniu Miclaus <[email protected]>Signed-off-by Ramona Gradinariu <[email protected]>Signed-off-by Robert Budai <[email protected]>--- Documentation/iio/adis16550.rst | 389 ++++++++++++++++++++++++++++++++ Documentation/iio/index.rst | 1 + 2 files changed, 390 insertions(+) create mode 100644 Documentation/iio/adis16550.rstDocumentation/iio/adis16550.rst new file +6
-0@@ -0,0 +1,389 @@ +.. SPDX-License-Identifier: GPL-2.0 + +================ +ADIS16550 driver +================ +
Documentation/iio/adis16550.rst line 16
Quoted 10 lines
Documentation/iio/adis16550.rst new file +10
-0+This driver supports Analog Device's IMUs on SPI bus. + +1. Supported devices +==================== + +* `ADIS16550 <https://www.analog.com/ADIS16550>`_ + +The ADIS16550 is a complete inertial system that includes a triaxis gyroscope +and a triaxis accelerometer. Each inertial sensor in the ADIS16550 combines +industry leading MEMS only technology with signal conditioning that optimizes
Trim out the marketing bits. So just loose this sentence.
Documentation/iio/adis16550.rst line 28
Quoted 12 lines
Documentation/iio/adis16550.rst new file +12
-0+dynamic performance. The factory calibration characterizes each sensor for +sensitivity, bias, and alignment. As a result, each sensor has its own dynamic +compensation formulas that provide accurate sensor measurements. + +The ADIS16550 provides a simple, cost-effective method for integrating accurate, +multiaxis inertial sensing into industrial systems, especially when compared +with the complexity and investment associated with discrete designs. All +necessary motion testing and calibration are part of the production process at +the factory, greatly reducing system integration time. Tight orthogonal +alignment simplifies inertial frame alignment in navigation systems. The serial +peripheral interface (SPI) and register structure provide a simple interface for +data collection and configuration control.
Drop this whole paragraph for similar reasons.
Otherwise LGTM
Thanks,
Jonathan