Skip to content

drivers: sensor: ad2s1210: implementation of driver #88919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025

Conversation

nono313
Copy link
Contributor

@nono313 nono313 commented Apr 22, 2025

Implement driver for ad2s1210 rotational resolver

Based on datasheet here : https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf

@nono313 nono313 marked this pull request as draft April 22, 2025 17:12
@github-actions github-actions bot added area: Sensors Sensors platform: ADI Analog Devices, Inc. labels Apr 22, 2025
@nono313 nono313 force-pushed the implement-ad2s1210-driver branch 7 times, most recently from f618bbe to 5e3204a Compare April 23, 2025 13:59
@nono313 nono313 changed the title draft: drivers: sensor: ad2s1210: start implementation of driver drivers: sensor: ad2s1210: start implementation of driver Apr 23, 2025
@nono313 nono313 marked this pull request as ready for review April 23, 2025 15:08
Copy link
Collaborator

@jeppenodgaard jeppenodgaard left a comment

Choose a reason for hiding this comment

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

Thank you for opening this PR!

There's comments that are redundant other are fine. See https://kernel.org/doc/html/latest/process/coding-style.html#commenting

@nono313 nono313 force-pushed the implement-ad2s1210-driver branch 2 times, most recently from 8a07504 to 7deabf2 Compare May 9, 2025 08:50
@nono313 nono313 requested a review from jeppenodgaard May 9, 2025 10:17
@nono313 nono313 changed the title drivers: sensor: ad2s1210: start implementation of driver drivers: sensor: ad2s1210: implementation of driver May 19, 2025
Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

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

A couple of small nits, but otherwise looks great. Thanks for the PR!


compatible: "adi,ad2s1210"

include: spi-device.yaml
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
include: spi-device.yaml
include: [spi-device.yaml, sensor-device.yaml]

.have_resolution_pins = (DT_INST_NODE_HAS_PROP(i, resolution_gpios)), \
}; \
\
DEVICE_DT_INST_DEFINE(i, ad2s1210_init, NULL, &ad2s1210_data_##i, &ad2s1210_config_##i, \
Copy link
Member

Choose a reason for hiding this comment

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

Use SENSOR_DEVICE_DT_INST_DEFINE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I have updated the INST_DEFINE macro


assigned-resolution-bits:
type: int
default: 16
Copy link
Member

Choose a reason for hiding this comment

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

Need to explain in the description why the default value was selected
https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html#dt-bindings-default-rules

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at the datasheet, it seems default at power up (without configuration) is 12-bits so I am changing to 12 bits and adding explanation in description.

@nono313 nono313 force-pushed the implement-ad2s1210-driver branch from 7deabf2 to f4cf010 Compare May 20, 2025 09:34
@nono313 nono313 requested a review from MaureenHelm May 21, 2025 08:42
@ttmut
Copy link
Collaborator

ttmut commented May 21, 2025

Could you update the title of this commit drivers: sensor: ad2s1210: start implementation of driver. Something like drivers: sensor: adi: Add ad2s1210 resolver support maybe.

nono313 added 2 commits May 21, 2025 17:34
implement driver for ad2s1210 resolver

Signed-off-by: Nathan Olff <[email protected]>
add ad2s1210 to build_all test in spi.dtsi

Signed-off-by: Nathan Olff <[email protected]>
@nono313 nono313 force-pushed the implement-ad2s1210-driver branch from f4cf010 to bdcf517 Compare May 21, 2025 15:35
Copy link

@MaureenHelm
Copy link
Member

@jeppenodgaard can you take another look?

@kartben kartben merged commit 2ac3164 into zephyrproject-rtos:main May 27, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Sensors Sensors platform: ADI Analog Devices, Inc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants