drivers/media/platform/qcom/iris/iris_state.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/iris/iris_state.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/iris/iris_state.c- Extension
.c- Size
- 7557 bytes
- Lines
- 278
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
media/v4l2-mem2mem.hiris_instance.h
Detected Declarations
function Copyrightfunction iris_inst_change_statefunction iris_inst_state_change_streamonfunction iris_inst_state_change_streamofffunction iris_inst_allow_sub_statefunction iris_inst_change_sub_statefunction iris_inst_sub_state_change_drcfunction iris_inst_sub_state_change_drain_lastfunction iris_inst_sub_state_change_drc_lastfunction iris_inst_sub_state_change_pausefunction iris_drc_pendingfunction iris_drain_pendingfunction iris_allow_cmd
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <media/v4l2-mem2mem.h>
#include "iris_instance.h"
static bool iris_allow_inst_state_change(struct iris_inst *inst,
enum iris_inst_state req_state)
{
switch (inst->state) {
case IRIS_INST_INIT:
if (req_state == IRIS_INST_INPUT_STREAMING ||
req_state == IRIS_INST_OUTPUT_STREAMING ||
req_state == IRIS_INST_DEINIT)
return true;
return false;
case IRIS_INST_INPUT_STREAMING:
if (req_state == IRIS_INST_INIT ||
req_state == IRIS_INST_STREAMING ||
req_state == IRIS_INST_DEINIT)
return true;
return false;
case IRIS_INST_OUTPUT_STREAMING:
if (req_state == IRIS_INST_INIT ||
req_state == IRIS_INST_STREAMING ||
req_state == IRIS_INST_DEINIT)
return true;
return false;
case IRIS_INST_STREAMING:
if (req_state == IRIS_INST_INPUT_STREAMING ||
req_state == IRIS_INST_OUTPUT_STREAMING ||
req_state == IRIS_INST_DEINIT)
return true;
return false;
case IRIS_INST_DEINIT:
if (req_state == IRIS_INST_INIT)
return true;
return false;
default:
return false;
}
}
int iris_inst_change_state(struct iris_inst *inst,
enum iris_inst_state request_state)
{
if (inst->state == IRIS_INST_ERROR)
return 0;
if (inst->state == request_state)
return 0;
if (request_state == IRIS_INST_ERROR)
goto change_state;
if (!iris_allow_inst_state_change(inst, request_state))
return -EINVAL;
change_state:
inst->state = request_state;
dev_dbg(inst->core->dev, "state changed from %x to %x\n",
inst->state, request_state);
return 0;
}
int iris_inst_state_change_streamon(struct iris_inst *inst, u32 plane)
{
enum iris_inst_state new_state = IRIS_INST_ERROR;
if (V4L2_TYPE_IS_OUTPUT(plane)) {
if (inst->state == IRIS_INST_INIT)
new_state = IRIS_INST_INPUT_STREAMING;
else if (inst->state == IRIS_INST_OUTPUT_STREAMING)
new_state = IRIS_INST_STREAMING;
} else if (V4L2_TYPE_IS_CAPTURE(plane)) {
if (inst->state == IRIS_INST_INIT)
new_state = IRIS_INST_OUTPUT_STREAMING;
else if (inst->state == IRIS_INST_INPUT_STREAMING)
new_state = IRIS_INST_STREAMING;
}
return iris_inst_change_state(inst, new_state);
}
int iris_inst_state_change_streamoff(struct iris_inst *inst, u32 plane)
{
Annotation
- Immediate include surface: `media/v4l2-mem2mem.h`, `iris_instance.h`.
- Detected declarations: `function Copyright`, `function iris_inst_change_state`, `function iris_inst_state_change_streamon`, `function iris_inst_state_change_streamoff`, `function iris_inst_allow_sub_state`, `function iris_inst_change_sub_state`, `function iris_inst_sub_state_change_drc`, `function iris_inst_sub_state_change_drain_last`, `function iris_inst_sub_state_change_drc_last`, `function iris_inst_sub_state_change_pause`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.