-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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: mlx90394: added driver #79637
base: main
Are you sure you want to change the base?
drivers: sensor: mlx90394: added driver #79637
Conversation
e28a695
to
7912e89
Compare
7912e89
to
0eb6c44
Compare
0eb6c44
to
afa7d97
Compare
216c2d3
to
4fffe4e
Compare
a66c895
to
c869ee4
Compare
By going through the review, I have seen that there are some things missing and not tested very well. |
41856ff
to
c7c040c
Compare
c7c040c
to
6eff34e
Compare
fe1f6b8
to
51239c6
Compare
51239c6
to
51f5abd
Compare
@pdgendt all your comments should be adressed - can you please revisit this PR? |
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.
Thanks, some comments still.
51f5abd
to
5f28ce9
Compare
78b9c90
to
5d6cab9
Compare
i have added a flag for the case that the initialization of the device fails. |
drivers/sensor/melexis/Kconfig
Outdated
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# zephyr-keep-sorted-start | ||
source "drivers/sensor/melexis/MLX90394/Kconfig" |
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.
Convention is to use lower case for directory names
source "drivers/sensor/melexis/MLX90394/Kconfig" | |
source "drivers/sensor/melexis/mlx90394/Kconfig" |
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.
done
static void mlx90394_update_measurement_Time_us(struct mlx90394_data *data) | ||
{ | ||
int32_t enX = FIELD_GET(MLX90394_CTRL1_X_EN, data->ctrl_reg_values.ctrl1); | ||
int32_t enY = FIELD_GET(MLX90394_CTRL1_Y_EN, data->ctrl_reg_values.ctrl1); | ||
int32_t enZ = FIELD_GET(MLX90394_CTRL1_Z_EN, data->ctrl_reg_values.ctrl1); | ||
int32_t enTemp = FIELD_GET(MLX90394_CTRL4_T_EN, data->ctrl_reg_values.ctrl4); | ||
int32_t filterHallXY = | ||
FIELD_GET(MLX90394_CTRL3_DIG_FILT_HALL_XY, data->ctrl_reg_values.ctrl3); | ||
int32_t filterHallZ = | ||
FIELD_GET(MLX90394_CTRL4_DIG_FILT_HALL_Z, data->ctrl_reg_values.ctrl4); | ||
int32_t filterTemp = FIELD_GET(MLX90394_CTRL3_DIG_FILT_TEMP, data->ctrl_reg_values.ctrl3); | ||
int32_t osrTemp = FIELD_GET(MLX90394_CTRL3_OSR_TEMP, data->ctrl_reg_values.ctrl3); | ||
int32_t osrHall = FIELD_GET(MLX90394_CTRL3_OSR_HALL, data->ctrl_reg_values.ctrl3); | ||
|
||
int32_t conversion_time_us = | ||
(osrHall + 1) * ((enX + enY) * MLX90394_CONVERSION_TIME_US_AXIS[filterHallXY] + | ||
enZ * MLX90394_CONVERSION_TIME_US_AXIS[filterHallZ]) + | ||
(osrTemp + 1) * enTemp * MLX90394_CONVERSION_TIME_US_AXIS[filterTemp]; | ||
int32_t dsp_time_us = MLX90394_DSP_TIME_US[enTemp][enX + enY + enZ]; | ||
|
||
/* | ||
* adding 5% tolerance from datasheet | ||
*/ | ||
data->measurement_time_us = (conversion_time_us + dsp_time_us) * 105 / 100; | ||
} |
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.
please no camel case
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.
done
static void mlx90394_convert_temp(struct sensor_value *val, uint8_t sample_l, uint8_t sample_h) | ||
{ | ||
int64_t conv_val = | ||
sys_le16_to_cpu(sample_l | (sample_h << 8)) * MLX90394_MICRO_CELSIUS_PER_BIT; |
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.
sys_le16_to_cpu
isn't necessary here
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.
that happens when starting by deriving an existing driver in tree.
Sorry for that - done. Its not just not necessary it´s wrong because it swaps the bytes on BE.
edata = (struct mlx90394_encoded_data *)buf; | ||
|
||
/* buffered from submit */ | ||
edata->header.timestamp = data->work_ctx.timestamp; |
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.
Please use the new sensor clock API introduced in #80189
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.
done
5d6cab9
to
d229c1d
Compare
Added driver for Melexis MLX90394 magnetometer. Signed-off-by: Florian Weber <[email protected]>
added mlx90394 to the testcase so that it is in build. Signed-off-by: Florian Weber <[email protected]>
d229c1d
to
e51664c
Compare
@MaureenHelm everything you have noted should be addressed now - please revisit |
Added driver for Melexis MLX90394 magnetometer.