-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
drivers: sensor: Fix TMAG5273/TMAG3001 by adding a TMAG3001 compatible #79955
drivers: sensor: Fix TMAG5273/TMAG3001 by adding a TMAG3001 compatible #79955
Conversation
There's some whitespace changes in tmag5273.h file. Seems like clang-format changed tabs to spaces in alignment spaces for the defines. Not sure if that's expected or my clang-format is somehow misconfigured (it does use leading tabs for indentation). |
6dcfac1
to
d2b91ef
Compare
d2b91ef
to
0740ae0
Compare
The file was previously not correctly formatted. But you should try to keep the old wrong formatting, so that the change is not that big and one can see what has changed in your commit. Maybe add a second pull request for the formatting. But thanks for the pull request. It was on my plate for a long time and I never came around to actually doing it. |
0740ae0
to
a3f0580
Compare
Reverted formatting changes. |
a3f0580
to
78ec440
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the new compatible to tests/drivers/build_all/sensor/i2c.dtsi
8940ac2
to
89f3efd
Compare
Added the sensor to the build test. Also, that test is quite the merge conflict factory with all sensors being added at the end... might be cool if it's not one giant hand-edited file, like if the example declaration can be in a dtsi for each sensor driver, and some script comes and collects them all. |
PRs are welcome |
@yiding can you please rebase again? Thanks |
89f3efd
to
2489ed4
Compare
@@ -1185,3 +1185,13 @@ test_i2c_lsm6dso32: lsm6dso32@a5 { | |||
gyro-range = <LSM6DSO_DT_FS_2000DPS>; | |||
gyro-odr = <LSM6DSO_DT_ODR_6667Hz>; | |||
}; | |||
|
|||
test_i2c_tmag3001: tmag3001@9d { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_i2c_tmag3001: tmag3001@9d { | |
test_i2c_tmag3001: tmag3001@a6 { |
2489ed4
to
1e5f6d4
Compare
Fixes issue introduced in zephyrproject-rtos#76460 The previous code attempted to detect whether TMAG5273 or TMAG3001 was connected based on DEVICE ID register. This doesn't work as the bits that denote the version on one part are undefined on the other part, and cannot be relied on to be zero. This commit adds a TMAG3001 compatible which (for now) is just derived from the TMAG5273 compatible. This allows TMAG3001 to be specified directly in the DT. The driver code is updated to support both compatibles. Signed-off-by: Yiding Jia <yiding.jia@gmail.com>
1e5f6d4
to
ffe9857
Compare
Feels like we are stuck in an endless loop here of fix merge and wait for accept. |
TMAG5273 and TMAG3001 share much of the similar functionality.
The previous code attempted to detect whether TMAG5273 or TMAG3001 was connected based on DEVICE ID register. This doesn't work as the bits that denote the version on one part are undefined on the other part, and cannot be relied on to be zero.
This commit adds a TMAG3001 compatible which (for now) is just derived from the TMAG5273 compatible. This allows TMAG3001 to be specified directly in the DT. The driver code is updated to support both compatibles.
I thought about moving the common properties to a
ti,tmagxxxx.yaml
, however there's other parts (namely, tmag5170) which is SPI and have different properties, so I did not do this. We might still want to pull out some common properties, as TMAG5273 does have functionality that doesn't exist in TMAG3001, which currently can't be reflected in the device tree yaml.Test plan
I tested this with TMAG5273, but do not have a TMAG3001. However, this code shouldn't change any of that functionality. I did try the tmag3001 compatible to see that it builds.