Re: [PATCH 06/10] media: Keem Bay Camera: Add ISP sub-device
From: Sakari Ailus <sakari.ailus@linux.intel.com>
Date: 2021-04-09 08:33:20
Also in:
linux-media
Hi Martina, On Fri, Mar 19, 2021 at 06:06:28PM +0000, Martina Krasteva wrote: ...
+/**
+ * kmb_cam_xlink_alloc_channel - Allocate xlink camera channel id
+ * @xlink_cam: Pointer to xlink camera handle
+ *
+ * Each xlink channel (except main control) should have unieque id
+ *
+ * Return: Channel id, negative error otherwise
+ */
+int kmb_cam_xlink_alloc_channel(struct kmb_xlink_cam *xlink_cam)
+{
+ int chan_id;
+
+ chan_id = ida_alloc_range(&xlink_cam->channel_ids,
+ KMB_CAM_XLINK_CHAN_ID_BASE,
+ U16_MAX, GFP_KERNEL);return ida_alloc_range(...);
+ + return chan_id; +}
...
+ +/** + * struct kmb_video_fh - KMB video file handler + * @fh: V4L2 file handler + * @kmb_vid: Pointer to KMB video device + * @lock: Mutex serializing access to fh + * @vb2_lock: Mutex serializing access to vb2 queue + * @vb2_q: Video buffer queue + * @active_fmt: Active format + @pix: Mplane active pixel format + @info: Active kmb format info
@active_fmt.info: ... etc.
+ * @contiguous_memory: Flag to enable contiguous memory allocation
+ * @dma_queue: DMA buffers queue
+ * @thread: Pointer to worker thread data
+ */
+struct kmb_video_fh {
+ struct v4l2_fh fh;
+ struct kmb_video *kmb_vid;
+ struct mutex lock; /* Lock protecting fh operations */
+ struct mutex vb2_lock; /* Lock protecting video buffer queue */
+ struct vb2_queue vb2_q;
+ struct {
+ struct v4l2_pix_format_mplane pix;
+ const struct kmb_video_fmt_info *info;
+ } active_fmt;
+ bool contiguous_memory;
+ struct list_head dma_queue;
+ struct task_struct *thread;
+};
+
+int kmb_video_init(struct kmb_video *kmb_vid, const char *name);
+void kmb_video_cleanup(struct kmb_video *kmb_vid);
+
+int kmb_video_register(struct kmb_video *kmb_vid,
+ struct v4l2_device *v4l2_dev);
+void kmb_video_unregister(struct kmb_video *kmb_vid);
+
+#endif /* KEEMBAY_VIDEO_H */-- Kind regards, Sakari Ailus