Skip to content

Conversation

@avisconti
Copy link
Contributor

@avisconti avisconti commented Oct 21, 2024

lis2dux12 and lis2duxs12 are belonging to the same device family and are registers compatible. Hence they can be handled by the same driver. This work is done on the same basis as lps2xdf driver (#65416).

In particular:

  1. Introduce the lis2dux12_chip_api structure filled with device specific APIs. At the moment define following callback:
        - api_lis2dux12_set_odr_raw()
        - api_lis2dux12_set_range()
        - api_lis2dux12_sample_fetch_accel()
        - api_lis2dux12_sample_fetch_temp()
        - api_lis2dux12_handle_interrupt()
        - api_lis2dux12_init_interrupt()
  1. Prepare specific APIs for st_lis2dux12 device.

  2. Make DT instantiation on inst + name basis, and not only by inst. This commit only use "name = DT_DRV_COMPAT = st_lis2dux12".

@avisconti avisconti added area: Drivers area: Sensors Sensors area: Devicetree Binding PR modifies or adds a Device Tree binding labels Oct 21, 2024
@avisconti avisconti requested a review from ubieda October 21, 2024 11:57
@avisconti avisconti self-assigned this Oct 21, 2024
@zephyrbot zephyrbot added area: Shields Shields (add-on boards) area: Samples Samples labels Oct 21, 2024
@jfischer-no jfischer-no removed their request for review October 21, 2024 13:25
@avisconti avisconti requested a review from jonas-rem October 23, 2024 14:30
@avisconti
Copy link
Contributor Author

@jonas-rem as you can see I re-used your work also for the lis2dux12/lis2duxs12 driver. Here the naming is a bit confusing. Would you mind give a quick review to it? Thx

Copy link

@jonas-rem jonas-rem left a comment

Choose a reason for hiding this comment

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

The separation via api looks good to me. Few minor points and questions for clarification.

  • Add the lis2duxs12 variant to testss/driverss/build_all/sensor/i2C
  • The currently used feature- and register-set of both variants is identical. The s variant supports analog hub and qvar sensing, so this separation allows to implement those features in the future?
  • I3C would be supported by both devices, I guess it's just ouf-of-scope for this PR?

@avisconti
Copy link
Contributor Author

The separation via api looks good to me. Few minor points and questions for clarification.

  • Add the lis2duxs12 variant to testss/driverss/build_all/sensor/i2C

ok, I will

  • The currently used feature- and register-set of both variants is identical. The s variant supports analog hub and qvar sensing, so this separation allows to implement those features in the future?

Yes, that's my idea. Not planned yet though.

  • I3C would be supported by both devices, I guess it's just ouf-of-scope for this PR?

Well, I can add a commit in this PR itself. I'm not sure I'm in a position to test it though. Thanks for suggesting it.

@avisconti avisconti force-pushed the add-single-driver-dux branch from 15713e1 to 87d3886 Compare October 28, 2024 14:21
@avisconti avisconti requested a review from jonas-rem October 28, 2024 14:22
@avisconti
Copy link
Contributor Author

@jonas-rem I think I forgot to add I3C part... I think I would do a separate PR

@avisconti
Copy link
Contributor Author

@jonas-rem I think I forgot to add I3C part... I think I would do a separate PR

@jonas-rem would it be acceptable the PR as it is at the moment?

@jonas-rem
Copy link

@jonas-rem I think I forgot to add I3C part... I think I would do a separate PR

@jonas-rem would it be acceptable the PR as it is at the moment?

There is one open comment, could you have a look at that? Apart from that the PR looks good. #80142 (comment)

@avisconti
Copy link
Contributor Author

@jonas-rem I think I forgot to add I3C part... I think I would do a separate PR

@jonas-rem would it be acceptable the PR as it is at the moment?

There is one open comment, could you have a look at that? Apart from that the PR looks good. #80142 (comment)

Yes sure. I missed it.

@avisconti avisconti force-pushed the add-single-driver-dux branch 3 times, most recently from d87c792 to 1963f79 Compare November 20, 2024 14:24
@avisconti avisconti force-pushed the add-single-driver-dux branch from 1963f79 to cf1d06d Compare November 20, 2024 14:34
@avisconti
Copy link
Contributor Author

@jonas-rem Is it fine now Jonas?

jonas-rem
jonas-rem previously approved these changes Nov 22, 2024
jonas-rem
jonas-rem previously approved these changes Dec 19, 2024
erwango
erwango previously approved these changes Dec 20, 2024
@kartben
Copy link
Contributor

kartben commented Dec 20, 2024

@avisconti unfortunately, this needs rebasing

Prepare the driver to be able to handle other DUX software compatible
devices. Currently the driver handles the st_lis2dux12 compatible only.

Do following major changes:

1. Introduce the lis2dux12_chip_api structure filled with device specific
   APIs. At the moment define following callback:

    - api_lis2dux12_set_odr_raw()
    - api_lis2dux12_set_range()
    - api_lis2dux12_sample_fetch_accel()
    - api_lis2dux12_sample_fetch_temp()
    - api_lis2dux12_handle_interrupt()
    - api_lis2dux12_init_interrupt()

2. Prepare specific APIs for st_lis2dux12 device.

3. Make DT instantiation on inst + name basis, and not only by inst. This
   commit only use "name = DT_DRV_COMPAT = st_lis2dux12".

Signed-off-by: Armando Visconti <[email protected]>
The LIS2DUXS12 is a smart, digital, 3-axis linear accelerometer whose
MEMS and ASIC have been expressly designed to combine the lowest current
consumption possible with features such as always-on antialiasing
filtering, a finite state machine (FSM) and machine learning core (MLC)
with adaptive self-configuration (ASC), and an analog hub / Qvar sensing
channel.

(https://www.st.com/en/mems-and-sensors/lis2duxs12.html)

Signed-off-by: Armando Visconti <[email protected]>
Add 3-axis linear accelerometer LIS2DUXS12.

Signed-off-by: Armando Visconti <[email protected]>
Add sample display for lis2duxs12 accel and temp sensors.

Signed-off-by: Armando Visconti <[email protected]>
@avisconti avisconti dismissed stale reviews from erwango and jonas-rem via 5bd6586 December 27, 2024 15:30
@avisconti avisconti force-pushed the add-single-driver-dux branch from 75ca45d to 5bd6586 Compare December 27, 2024 15:30
@avisconti
Copy link
Contributor Author

@avisconti unfortunately, this needs rebasing

Yes, the usual i2c.dtsi file...

@avisconti
Copy link
Contributor Author

Thanks @jonas-rem and @erwango for you review. Unfortunately I had to rebase the work and push it again...

@kartben kartben merged commit 02fa47f into zephyrproject-rtos:main Dec 27, 2024
24 checks passed
@avisconti avisconti deleted the add-single-driver-dux branch December 29, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Devicetree Binding PR modifies or adds a Device Tree binding area: Drivers area: Samples Samples area: Sensors Sensors area: Shields Shields (add-on boards)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants