drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
Source file repositories/reference/linux-study-clean/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c- Extension
.c- Size
- 8746 bytes
- Lines
- 333
- Domain
- Driver Families
- Bucket
- drivers/iio
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pm_runtime.hlinux/iio/common/inv_sensors_timestamp.hlinux/iio/events.hinv_mpu_iio.h
Detected Declarations
function Copyrightfunction inv_scan_query_mpu9x50function inv_scan_queryfunction inv_compute_skip_samplesfunction inv_mpu6050_prepare_fifofunction inv_mpu6050_set_enablefunction inv_mpu_data_rdy_trigger_set_statefunction inv_mpu6050_interrupt_timestampfunction inv_mpu6050_interrupt_handlefunction scoped_guardfunction inv_mpu6050_probe_trigger
Annotated Snippet
if (result) {
dev_err(regmap_get_device(st->map), "failed to ack interrupt\n");
return IRQ_HANDLED;
}
/* handle WoM event */
if (st->chip_config.wom_en && (int_status & wom_bits)) {
ev_code = IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, IIO_MOD_X_OR_Y_OR_Z,
IIO_EV_TYPE_ROC, IIO_EV_DIR_RISING);
iio_push_event(indio_dev, ev_code, st->it_timestamp);
}
}
data_ready_interrupt:
/* handle raw data interrupt */
if (int_status & INV_MPU6050_BIT_RAW_DATA_RDY_INT) {
indio_dev->pollfunc->timestamp = st->it_timestamp;
iio_trigger_poll_nested(st->trig);
}
return IRQ_HANDLED;
}
int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev, int irq_type)
{
int ret;
struct inv_mpu6050_state *st = iio_priv(indio_dev);
st->trig = devm_iio_trigger_alloc(&indio_dev->dev,
"%s-dev%d",
indio_dev->name,
iio_device_id(indio_dev));
if (!st->trig)
return -ENOMEM;
irq_type |= IRQF_ONESHOT;
ret = devm_request_threaded_irq(&indio_dev->dev, st->irq,
&inv_mpu6050_interrupt_timestamp,
&inv_mpu6050_interrupt_handle,
irq_type, "inv_mpu", indio_dev);
if (ret)
return ret;
st->trig->dev.parent = regmap_get_device(st->map);
st->trig->ops = &inv_mpu_trigger_ops;
iio_trigger_set_drvdata(st->trig, indio_dev);
ret = devm_iio_trigger_register(&indio_dev->dev, st->trig);
if (ret)
return ret;
indio_dev->trig = iio_trigger_get(st->trig);
return 0;
}
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `linux/iio/common/inv_sensors_timestamp.h`, `linux/iio/events.h`, `inv_mpu_iio.h`.
- Detected declarations: `function Copyright`, `function inv_scan_query_mpu9x50`, `function inv_scan_query`, `function inv_compute_skip_samples`, `function inv_mpu6050_prepare_fifo`, `function inv_mpu6050_set_enable`, `function inv_mpu_data_rdy_trigger_set_state`, `function inv_mpu6050_interrupt_timestamp`, `function inv_mpu6050_interrupt_handle`, `function scoped_guard`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.