Skip to content

Conversation

@avisconti
Copy link
Contributor

@avisconti avisconti commented Mar 21, 2021

Make this driver multi-instance and use the new API.

This commit makes use of some DT macro helpers
In particular:
- get bus devices with DEVICE_DT_GET
- get SPI information with SPI_CONFIG_DT_INST
- get drdy gpios with GPIO_DT_SPEC_GET

The int-pin information has been moved from Kconfig to DT. All the boards/shield using the lsm6dso driver has been updated accordingly. But I have a doubt on file ./scripts/ci/check_compliance.py which is still including a reference to the non-existent symbol LSM6DSO_INT_PIN. Should I remove it as well?

Moreover the driver is now using the stmemsc common routines as requested in issue #33440.

Please note that the common stmemsc routines introduced in #33506 are not carrying the fix required by Nordic platforms yet. This has to be done as a separate PR later on.

@avisconti avisconti added bug The issue is a bug, or the PR is fixing a bug area: Drivers area: Sensors Sensors area: Devicetree DNM This PR should not be merged (Do Not Merge) area: Devicetree Binding PR modifies or adds a Device Tree binding labels Mar 21, 2021
@avisconti avisconti self-assigned this Mar 21, 2021
@github-actions github-actions bot added area: Boards area: Samples Samples area: Shields Shields (add-on boards) labels Mar 21, 2021
@richardbarlow
Copy link
Contributor

I have just verified that this works on the nRF5340 with the patch in #19901 manually applied. I'll create a PR with this additional patch once this change has been merged.

@richardbarlow
Copy link
Contributor

@avisconti I'm not well versed in the Zephyr pull request workflow, so I may have missed something, but is there a reason why this PR is currently labelled DNM?

@avisconti
Copy link
Contributor Author

@avisconti I'm not well versed in the Zephyr pull request workflow, so I may have missed something, but is there a reason why this PR is currently labelled DNM?

@richardbarlow
It is just because it depends on #33506. As soon as that PR will get merged, I will rebase this on it, and remove the DNM.

Create a common properties file that will be included by all bindings
(as i2c and spi) handled by lsm6dso driver.

Signed-off-by: Armando Visconti <[email protected]>
Take the int-pin information (i.e. what pin between INT1
and INT2 the drdy is attached to) directly from DT.

Signed-off-by: Armando Visconti <[email protected]>
Make this driver multi-instance and use the new API.

This commit makes use of some DT macro helpers
In particular:
    - get bus devices with DEVICE_DT_GET
    - get SPI information with SPI_CONFIG_DT_INST
    - get drdy gpios with GPIO_DT_SPEC_GET

Moreover the driver is now using the stmemsc common
routines as requested in issue zephyrproject-rtos#33440 and it avoids
the unnecessary declaration of both ctx_i2c and ctx_spi
in the data structure.

Signed-off-by: Armando Visconti <[email protected]>
@avisconti avisconti force-pushed the add-lsm6dso-multi branch from 415b629 to dbccc40 Compare April 2, 2021 09:39
@avisconti avisconti removed the DNM This PR should not be merged (Do Not Merge) label Apr 2, 2021
@avisconti
Copy link
Contributor Author

Rebased after #33506 was merged. I encorporated all suggestions that have been discussed there in a single commit. I will later create a common PR to align all other drivers to same implementation.

@avisconti
Copy link
Contributor Author

@richardbarlow
Once that this PR will be approved and merged can you possibly prepare a new PR with the changes required by Nordic platforms? Thanks!

Copy link
Contributor

@mbolivar-nordic mbolivar-nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I just gave this a quick skim since it's following the lines already discussed in detail in the PR which introduced the stmemsc helpers.

@carlescufi carlescufi merged commit c4b35c1 into zephyrproject-rtos:master Apr 6, 2021
@avisconti avisconti deleted the add-lsm6dso-multi branch April 7, 2021 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Drivers area: Samples Samples area: Sensors Sensors area: Shields Shields (add-on boards) bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants