linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FXOS8700 Accelerometer/Magnetometer Support
@ 2019-07-03 22:48 Bobby Jones
  2019-07-14 15:16 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Bobby Jones @ 2019-07-03 22:48 UTC (permalink / raw)
  To: linux-iio

Hello linux-iio,

I'm interested in adding support for the FXOS8700 accel/mag device. I
was curious if there had already been an effort in mainline to add
support and could not find anything in the latest pulled version of
the testing branch. However looking at the list archive I saw an email
back in 2015 from Utkarsh who asked about implementing a driver for
the same device [https://marc.info/?l=linux-iio&m=142920413702776]. My
question for Utkarsh (if you're still reading this, I get a bounce on
your address) and the greater linux-iio mailing list is if there had
been any further effort since then that I can help finish?

Otherwise as someone new to driver development in general, I'm looking
for any advice to get me started. I did see a NXP aka Freescale driver
[https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/misc/fxos8700.c?h=imx_4.19.35_1.0.0]
for the device but it doesn't appear to follow the iio api from what I
can tell. Is it worth taking that driver and trying to get it to fit
into the IMU api or should I start from scratch?

Thanks,
Bobby Jones

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FXOS8700 Accelerometer/Magnetometer Support
  2019-07-03 22:48 FXOS8700 Accelerometer/Magnetometer Support Bobby Jones
@ 2019-07-14 15:16 ` Jonathan Cameron
  2019-09-10 21:36   ` Bobby Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2019-07-14 15:16 UTC (permalink / raw)
  To: Bobby Jones; +Cc: linux-iio

On Wed, 3 Jul 2019 15:48:29 -0700
Bobby Jones <rjones@gateworks.com> wrote:

> Hello linux-iio,
> 
> I'm interested in adding support for the FXOS8700 accel/mag device. I
> was curious if there had already been an effort in mainline to add
> support and could not find anything in the latest pulled version of
> the testing branch. However looking at the list archive I saw an email
> back in 2015 from Utkarsh who asked about implementing a driver for
> the same device [https://marc.info/?l=linux-iio&m=142920413702776]. My
> question for Utkarsh (if you're still reading this, I get a bounce on
> your address) and the greater linux-iio mailing list is if there had
> been any further effort since then that I can help finish?
> 
> Otherwise as someone new to driver development in general, I'm looking
> for any advice to get me started. I did see a NXP aka Freescale driver
> [https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/misc/fxos8700.c?h=imx_4.19.35_1.0.0]
> for the device but it doesn't appear to follow the iio api from what I
> can tell. Is it worth taking that driver and trying to get it to fit
> into the IMU api or should I start from scratch?
I would certainly start by seeing if that driver works to at least
some extent as it can be extremely handy to have a working reference.

Then it's up to you on how you prefer to work. Either you can take that
code and modify it step by step until you get something you are happy
with, or start from scratch keeping that as an additional source of
information only.

It's a fair way away from where it needs to end up, so starting from
scratch might be more efficient in this case.  Start simple and build
up the fancy features later.  From the reply I sent to that original
thread you reference I gather this is a complex device, so we may want
to have a reasonably feature complete driver to figure out if the
overall structure will work before we merge it.

Good luck and looking forward to seeing the code!

Thanks,

Jonathan

> 
> Thanks,
> Bobby Jones


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FXOS8700 Accelerometer/Magnetometer Support
  2019-07-14 15:16 ` Jonathan Cameron
@ 2019-09-10 21:36   ` Bobby Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Bobby Jones @ 2019-09-10 21:36 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio

Hello Jonathan and iio,

I've finally been able to circle back to this effort. I've spent some
time last week referencing the misc driver I linked to originally
while refactoring the BMI160 imu driver as a starting point (it
honestly just seemed like the simplest 2-sensor device) and am a
little stuck with the implementation.

When defining the iio_chan_spec structs that will be assigned to the
iio_dev.channels array, everything makes sense when the fxos8700 only
has 1 sensor enabled. It is my understanding that the
iio_info.read_raw function will be called with the type/channel and
the proper regmap calls I've set up will be made. Now my confusion
begins when considering how to support both devices enabled. According
to the datasheet this means that "hybrid" mode is enabled, which
halves the data rate and requires a single burst transaction to read
all of the output data registers. If any data output register is not
read, that data will be lost. So when the IIO subsystem calls on a
single channel for data and the unit is in hybrid mode I don't see how
I can avoid loss of data.

I'm assuming there is a different way I should be setting up the
iio_info and iio_chan_spec structs but I'm not sure how to go about
it. I believe this may have something to do with the
iio_info.read_raw_multi function and the
iio_chan_spec.info_mask_shared* fields. Can anyone provide input? If
it helps I've posted my wip at
https://github.com/Bobby-Soliis-Jones/iio_imu_fxos8700.

Thanks in advance!
Bobby Jones

^ permalink raw reply	[flat|nested] 4+ messages in thread

* FXOS8700 Accelerometer/Magnetometer Support
@ 2019-07-03 22:39 Bobby Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Bobby Jones @ 2019-07-03 22:39 UTC (permalink / raw)
  To: linux-iio, utkarsh.gupta

Hello Utkarsh and linux-iio,

I'm interested in adding support for the FXOS8700 accel/mag device. I
was curious if there had already been an effort in mainline to add
support and could not find anything in the latest pulled version of
the testing branch. However looking at the list archive I saw an email
back in 2015 from Utkarsh who asked about implementing a driver for
the same device [https://marc.info/?l=linux-iio&m=142920413702776]. My
question for Utkarsh and/or the greater linux-iio mailing list is if
there had been any further effort since then that I can help finish?

Otherwise as someone new to driver development in general, I'm looking
for any advice to get me started. I did see a NXP aka Freescale driver
[https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/misc/fxos8700.c?h=imx_4.19.35_1.0.0]
for the device but it doesn't appear to follow the iio api from what I
can tell. Is it worth taking that driver and trying to get it to fit
into the IMU api or should I start from scratch?

Thanks,
Bobby Jones

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-10 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 22:48 FXOS8700 Accelerometer/Magnetometer Support Bobby Jones
2019-07-14 15:16 ` Jonathan Cameron
2019-09-10 21:36   ` Bobby Jones
  -- strict thread matches above, loose matches on Subject: below --
2019-07-03 22:39 Bobby Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).