Skip to contentSkip to conversation

Adding support for QMC5883L magnetometer to IIO subsystem

DISCUSSION Brajesh Patil 2 participants 3 messages Apr 8, 2025 – Apr 11, 2025 1 message not in the archive IIO

lore
Share & tools
lore
#0 lore raw

I have a QMC5883L magnetometer module that I’ve been trying to integrate with my Raspberry Pi using a kernel-space driver. While checking the mainline kernel, I found that there is a driver for the HMC5883L (under the hmc5843 driver), but nothing for QMC5883L.

I compared the datasheets for both devices and confirmed that they are not register-compatible — the QMC5883L has a different I2C address and an entirely different register map from the HMC5883L.

Given that this sensor is widely used (often as a drop-in replacement for the now-discontinued HMC5883L), I was thinking of writing a new driver for it under the IIO subsystem.

Would it make sense to move forward with this? If so, I’d appreciate any guidance or suggestions from the community.

Thanks,
Brajesh

reviewer
#1 lore raw
Quoted 13 lines · Brajesh Patil

I have a QMC5883L magnetometer module that I’ve been trying to integrate with my Raspberry Pi using a kernel-space driver. While checking the mainline kernel, I found that there is a driver for the HMC5883L (under the hmc5843 driver), but nothing for QMC5883L.

I compared the datasheets for both devices and confirmed that they are not register-compatible — the QMC5883L has a different I2C address and an entirely different register map from the HMC5883L.

Given that this sensor is widely used (often as a drop-in replacement for the now-discontinued HMC5883L), I was thinking of writing a new driver for it under the IIO subsystem.

Quoted 7 lines

Would it make sense to move forward with this? If so, I’d appreciate any guidance or suggestions from the community.

Thanks,
Brajesh

Go for it. :-)

My advice for writing a new driver: Don't try to implement every feature in one patch (or even one patch series). Just start with the most basic functionality. Then add more features in separate patches as they are needed. (Devicetree bindings are an exception and should be as complete as possible in the first patch.)

A message that is not in the archive (sent off-list or not yet received): CALJe6R3YfhdLKDVBZ=NgO+m64wHHqvFf5tt1T-2pWnr29wE94Q@mail.gmail.com

reviewer
#3 lore raw
Quoted 7 lines · Brajesh Patil

Thanks a lot for the response and suggestions.

I'll take your advice and start with a minimal implementation focused on basic functionality. I will first get the driver working reliably with raw data readings via the IIO subsystem. Once that’s done, I’ll gradually build on it with additional features in future patches.

I’ll make sure the devicetree bindings are complete and properly documented in the first patch, as you suggested. I’ll also look at similar existing bindings to maintain consistency.

I’ll begin development and testing shortly and will share the patches once I have a working version.

Be sure to read https://www.kernel.org/doc/html/latest/process/submitting-patches.html
too. Then you will know that the mailing lists will ignore html email like your last reply and other important things that are expected when submitting patches. ;-)