1/* SPDX-License-Identifier: GPL-2.0+ */ 2/* 3 * Copyright 2021-2022 Bootlin 4 * Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com> 5 */ 6 7#ifndef _SUN6I_ISP_PROC_H_ 8#define _SUN6I_ISP_PROC_H_ 9 10#include <media/v4l2-device.h> 11#include <media/v4l2-fwnode.h> 12 13#define SUN6I_ISP_PROC_NAME "sun6i-isp-proc" 14 15enum sun6i_isp_proc_pad { 16 SUN6I_ISP_PROC_PAD_SINK_CSI = 0, 17 SUN6I_ISP_PROC_PAD_SINK_PARAMS = 1, 18 SUN6I_ISP_PROC_PAD_SOURCE = 2, 19 SUN6I_ISP_PROC_PAD_COUNT = 3, 20}; 21 22struct sun6i_isp_device; 23 24struct sun6i_isp_proc_format { 25 u32 mbus_code; 26 u8 input_format; 27 u8 input_yuv_seq; 28}; 29 30struct sun6i_isp_proc_source { 31 struct v4l2_subdev *subdev; 32 struct v4l2_fwnode_endpoint endpoint; 33 bool expected; 34}; 35 36struct sun6i_isp_proc_async_subdev { 37 struct v4l2_async_connection async_subdev; 38 struct sun6i_isp_proc_source *source; 39}; 40 41struct sun6i_isp_proc { 42 struct v4l2_subdev subdev; 43 struct media_pad pads[3]; 44 struct v4l2_async_notifier notifier; 45 struct v4l2_mbus_framefmt mbus_format; 46 struct mutex lock; /* Mbus format lock. */ 47 48 struct sun6i_isp_proc_source source_csi0; 49 struct sun6i_isp_proc_source source_csi1; 50}; 51 52/* Helpers */ 53 54void sun6i_isp_proc_dimensions(struct sun6i_isp_device *isp_dev, 55 unsigned int *width, unsigned int *height); 56 57/* Format */ 58 59const struct sun6i_isp_proc_format *sun6i_isp_proc_format_find(u32 mbus_code); 60 61/* Proc */ 62 63int sun6i_isp_proc_setup(struct sun6i_isp_device *isp_dev); 64void sun6i_isp_proc_cleanup(struct sun6i_isp_device *isp_dev); 65 66#endif 67