drivers/iio/dummy/iio_simple_dummy_events.c
Source file repositories/reference/linux-study-clean/drivers/iio/dummy/iio_simple_dummy_events.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/dummy/iio_simple_dummy_events.c- Extension
.c- Size
- 7797 bytes
- Lines
- 275
- 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.
- 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/kernel.hlinux/slab.hlinux/interrupt.hlinux/irq.hlinux/iio/iio.hlinux/iio/sysfs.hlinux/iio/events.hiio_simple_dummy.hiio_dummy_evgen.h
Detected Declarations
function Copyrightfunction iio_simple_dummy_write_event_configfunction iio_simple_dummy_read_event_valuefunction iio_simple_dummy_write_event_valuefunction iio_simple_dummy_get_timestampfunction iio_simple_dummy_event_handlerfunction iio_simple_dummy_events_registerfunction iio_simple_dummy_events_unregister
Annotated Snippet
switch (type) {
case IIO_EV_TYPE_THRESH:
if (dir == IIO_EV_DIR_RISING)
st->event_en = state;
else
return -EINVAL;
break;
default:
return -EINVAL;
}
break;
case IIO_ACTIVITY:
switch (type) {
case IIO_EV_TYPE_THRESH:
st->event_en = state;
break;
default:
return -EINVAL;
}
break;
case IIO_STEPS:
switch (type) {
case IIO_EV_TYPE_CHANGE:
st->event_en = state;
break;
default:
return -EINVAL;
}
break;
default:
return -EINVAL;
}
return 0;
}
/**
* iio_simple_dummy_read_event_value() - get value associated with event
* @indio_dev: device instance specific data
* @chan: channel for the event whose value is being read
* @type: type of the event whose value is being read
* @dir: direction of the vent whose value is being read
* @info: info type of the event whose value is being read
* @val: value for the event code.
* @val2: unused
*
* Many devices provide a large set of events of which only a subset may
* be enabled at a time, with value registers whose meaning changes depending
* on the event enabled. This often means that the driver must cache the values
* associated with each possible events so that the right value is in place when
* the enabled event is changed.
*/
int iio_simple_dummy_read_event_value(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int *val, int *val2)
{
struct iio_dummy_state *st = iio_priv(indio_dev);
*val = st->event_val;
return IIO_VAL_INT;
}
/**
* iio_simple_dummy_write_event_value() - set value associate with event
* @indio_dev: device instance specific data
* @chan: channel for the event whose value is being set
* @type: type of the event whose value is being set
* @dir: direction of the vent whose value is being set
* @info: info type of the event whose value is being set
* @val: the value to be set.
* @val2: unused
*/
int iio_simple_dummy_write_event_value(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int val, int val2)
{
struct iio_dummy_state *st = iio_priv(indio_dev);
st->event_val = val;
return 0;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/iio/iio.h`, `linux/iio/sysfs.h`, `linux/iio/events.h`, `iio_simple_dummy.h`.
- Detected declarations: `function Copyright`, `function iio_simple_dummy_write_event_config`, `function iio_simple_dummy_read_event_value`, `function iio_simple_dummy_write_event_value`, `function iio_simple_dummy_get_timestamp`, `function iio_simple_dummy_event_handler`, `function iio_simple_dummy_events_register`, `function iio_simple_dummy_events_unregister`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: source implementation candidate.
- 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.