Skip to content

Commit d0d9894

Browse files
XenuIsWatchingdanieldegrasse
authored andcommitted
drivers: sensor: bmm350: expose magnetic reset
This exposes a driver specific function to perform a magentic reset by the application. Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
1 parent 8cdaf1d commit d0d9894

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

drivers/sensor/bosch/bmm350/bmm350.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int bmm350_set_powermode(const struct device *dev, enum bmm350_power_mode
349349
* used to perform the magnetic reset of the sensor
350350
* which is necessary after a field shock ( 400mT field applied to sensor )
351351
*/
352-
static int bmm350_magnetic_reset_and_wait(const struct device *dev)
352+
int bmm350_magnetic_reset(const struct device *dev)
353353
{
354354
/* Variable to store the function result */
355355
int ret = 0;
@@ -1005,7 +1005,7 @@ static int bmm350_init_chip(const struct device *dev)
10051005
goto err_poweroff;
10061006
}
10071007

1008-
ret = bmm350_magnetic_reset_and_wait(dev);
1008+
ret = bmm350_magnetic_reset(dev);
10091009
if (ret != 0) {
10101010
LOG_ERR("failed to perform magnetic reset");
10111011
goto err_poweroff;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) 2025 Meta Platforms
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* @brief Performs a magnetic reset.
9+
*
10+
* The BMM350 has measures to recover from excessively strong
11+
* magnetic fields. A magnetic reset is trigged after reset by
12+
* the device itself, but if excessive field exposure has occurred
13+
* in suspend mode, the sensor can not detect that event. If a
14+
* large offset or sensitvity drift indicates that such an event
15+
* has occurred, then this function can be called by the
16+
* application.
17+
*
18+
* "Enhanced" Magnetic Reset supported by later BMM350 Revisions
19+
* is not yet implemented.
20+
*
21+
* @param dev Pointer to the sensor device
22+
*
23+
* @return 0 if successful, negative errno code if failure.
24+
*/
25+
int bmm350_magnetic_reset(const struct device *dev);

0 commit comments

Comments
 (0)