drivers/staging/media/atomisp/pci/atomisp_ioctl.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/atomisp_ioctl.c- Extension
.c- Size
- 41389 bytes
- Lines
- 1581
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/pci.hmedia/v4l2-ioctl.hmedia/v4l2-event.hatomisp_cmd.hatomisp_common.hatomisp_fops.hatomisp_internal.hatomisp_ioctl.hatomisp-regs.hatomisp_compat.hsh_css_hrt.hgp_device.hdevice_access.hirq.h
Detected Declarations
function atomisp_get_format_bridgefunction atomisp_get_format_bridge_from_mbusfunction atomisp_pipe_checkfunction atomisp_querycapfunction atomisp_enum_inputfunction atomisp_g_inputfunction atomisp_s_fmt_capfunction atomisp_s_inputfunction atomisp_enum_framesizes_crop_innerfunction atomisp_enum_framesizes_cropfunction atomisp_enum_framesizesfunction atomisp_enum_frameintervalsfunction atomisp_enum_fmt_capfunction atomisp_try_fmt_capfunction atomisp_g_fmt_capfunction atomisp_alloc_css_stat_bufsfunction list_for_each_entry_safefunction list_for_each_entry_safefunction list_for_each_entry_safefunction atomisp_qbuf_wrapperfunction atomisp_dqbuf_wrapperfunction atomisp_dma_burst_len_cfgfunction atomisp_stop_streamfunction atomisp_start_streamingfunction atomisp_stop_streamingfunction atomisp_g_ctrlfunction atomisp_s_ctrlfunction atomisp_query_ext_ctrlfunction atomisp_camera_g_ext_ctrlsfunction atomisp_g_ext_ctrlsfunction atomisp_camera_s_ext_ctrlsfunction atomisp_s_ext_ctrlsfunction atomisp_g_parmfunction atomisp_s_parmfunction atomisp_vidioc_default
Annotated Snippet
if (*valid_sizes == fsize->index) {
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsize->discrete = frame_sizes[i];
return 0;
}
(*valid_sizes)++;
}
return -EINVAL;
}
static int atomisp_enum_framesizes_crop(struct atomisp_device *isp,
struct v4l2_frmsizeenum *fsize)
{
struct atomisp_input_subdev *input = &isp->inputs[isp->asd.input_curr];
struct v4l2_rect active = input->active_rect;
struct v4l2_rect native = input->native_rect;
int ret, valid_sizes = 0;
ret = atomisp_enum_framesizes_crop_inner(isp, fsize, &active, &native, &valid_sizes);
if (ret == 0)
return 0;
if (!input->binning_support)
return -EINVAL;
active.width /= 2;
active.height /= 2;
native.width /= 2;
native.height /= 2;
return atomisp_enum_framesizes_crop_inner(isp, fsize, &active, &native, &valid_sizes);
}
static int atomisp_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *fsize)
{
struct video_device *vdev = video_devdata(file);
struct atomisp_device *isp = video_get_drvdata(vdev);
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
struct atomisp_input_subdev *input = &isp->inputs[asd->input_curr];
struct v4l2_subdev_frame_size_enum fse = {
.index = fsize->index,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
.code = input->code,
};
struct v4l2_subdev_state *act_sd_state;
int ret;
if (!input->sensor)
return -EINVAL;
if (input->crop_support)
return atomisp_enum_framesizes_crop(isp, fsize);
act_sd_state = v4l2_subdev_lock_and_get_active_state(input->sensor);
ret = v4l2_subdev_call(input->sensor, pad, enum_frame_size,
act_sd_state, &fse);
if (act_sd_state)
v4l2_subdev_unlock_state(act_sd_state);
if (ret)
return ret;
fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
fsize->discrete.width = fse.max_width - pad_w;
fsize->discrete.height = fse.max_height - pad_h;
return 0;
}
static int atomisp_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *fival)
{
struct video_device *vdev = video_devdata(file);
struct atomisp_device *isp = video_get_drvdata(vdev);
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
struct atomisp_input_subdev *input = &isp->inputs[asd->input_curr];
struct v4l2_subdev_frame_interval_enum fie = {
.code = atomisp_in_fmt_conv[0].code,
.index = fival->index,
.width = fival->width,
.height = fival->height,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev_state *act_sd_state;
int ret;
if (!input->sensor)
return -EINVAL;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/pci.h`, `media/v4l2-ioctl.h`, `media/v4l2-event.h`, `atomisp_cmd.h`, `atomisp_common.h`, `atomisp_fops.h`, `atomisp_internal.h`.
- Detected declarations: `function atomisp_get_format_bridge`, `function atomisp_get_format_bridge_from_mbus`, `function atomisp_pipe_check`, `function atomisp_querycap`, `function atomisp_enum_input`, `function atomisp_g_input`, `function atomisp_s_fmt_cap`, `function atomisp_s_input`, `function atomisp_enum_framesizes_crop_inner`, `function atomisp_enum_framesizes_crop`.
- Atlas domain: Driver Families / drivers/staging.
- 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.