Skip to content
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

iio: gyro: adxrs290: Add triggered buffer support #1131

Merged

Conversation

layman-n-ish
Copy link
Contributor

Provide a way for continuous data capture by setting up buffer support. The
data ready signal exposed at the SYNC pin of the ADXRS290 is exploited as
a hardware interrupt which triggers to fill the buffer.

Triggered buffer setup was tested with both hardware trigger (DATA_RDY) and
software triggers (sysfs-trig & hrtimer).

Also, extend support to read/write byte data from/to the device using
debugfs interface.

Signed-off-by: Nishant Malpani nish.malpani25@gmail.com

@layman-n-ish layman-n-ish force-pushed the rpi-4.19.y_adxrs290 branch 2 times, most recently from 5651375 to c1864e2 Compare August 19, 2020 18:41
@commodo
Copy link
Contributor

commodo commented Aug 20, 2020

rest looks good

Insert a missing mutex_init() call during the probe that initializes
the driver's local lock to unlocked state.

Fixes: ac98be7 ("iio: gyro: Update ADXRS290 driver for channels support")
Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Provide a way for continuous data capture by setting up buffer support. The
data ready signal exposed at the SYNC pin of the ADXRS290 is exploited as
a hardware interrupt which triggers to fill the buffer.

Triggered buffer setup was tested with both hardware trigger (DATA_RDY) and
software triggers (sysfs-trig & hrtimer).

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Configure ADXRS290 to use a GPIO interrupt line as a DATA_RDY trigger
signal.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Append 'interrupts' as a required property and provide a suitable example
for using a GPIO interrupt line.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Extend support to read/write byte data from/to the device using
debugfs iio interface.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
@layman-n-ish
Copy link
Contributor Author

Changelog v2:

  • rewrite adxrs290_set_mode() with switch-case statements
  • separate out commit for debufs reg access
  • rewrite return path in adxrs290_data_rdy_trigger_set_state()
  • include devm_add_action_or_reset() hook to switch the device into STANDBY mode which gets executed as part of standard resource unwinding; this also removes the need of a explicit CHIP_remove() hook
  • rework adxrs290_probe_trigger() - early exit if no irq line
  • separate out commit (as a bug-fix) for the missing mutex_init() call during the probe

@@ -385,6 +385,8 @@ static int adxrs290_probe(struct spi_device *spi)
indio_dev->num_channels = ARRAY_SIZE(adxrs290_channels);
indio_dev->info = &adxrs290_info;

mutex_init(&st->lock);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when sending this upstream, the commit has for the Fixes tag should be the one in the upstream tree;
otherwise this is perfect as-is

@commodo commodo merged commit 9ea3817 into analogdevicesinc:gsoc2020-gyro Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants