linux/drivers/staging/media/ipu3/ipu3-css.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2018 Intel Corporation */

#ifndef __IPU3_CSS_H
#define __IPU3_CSS_H

#include <linux/videodev2.h>
#include <linux/types.h>

#include "ipu3-abi.h"
#include "ipu3-css-pool.h"

/* 2 stages for split isp pipeline, 1 for scaling */
#define IMGU_NUM_SP
#define IMGU_MAX_PIPELINE_NUM
#define IMGU_MAX_PIPE_NUM

/* For DVS etc., format FRAME_FMT_YUV420_16 */
#define IPU3_CSS_AUX_FRAME_REF
/* For temporal noise reduction DVS etc., format FRAME_FMT_YUV_LINE */
#define IPU3_CSS_AUX_FRAME_TNR
#define IPU3_CSS_AUX_FRAME_TYPES
#define IPU3_CSS_AUX_FRAMES

#define IPU3_CSS_QUEUE_IN
#define IPU3_CSS_QUEUE_PARAMS
#define IPU3_CSS_QUEUE_OUT
#define IPU3_CSS_QUEUE_VF
#define IPU3_CSS_QUEUE_STAT_3A
#define IPU3_CSS_QUEUES

#define IPU3_CSS_RECT_EFFECTIVE
#define IPU3_CSS_RECT_BDS
#define IPU3_CSS_RECT_ENVELOPE
#define IPU3_CSS_RECT_GDC
#define IPU3_CSS_RECTS

#define IA_CSS_BINARY_MODE_PRIMARY
#define IA_CSS_BINARY_MODE_VIDEO
#define IPU3_CSS_DEFAULT_BINARY

/*
 * The pipe id type, distinguishes the kind of pipes that
 * can be run in parallel.
 */
enum imgu_css_pipe_id {};

struct imgu_css_resolution {};

enum imgu_css_buffer_state {};

struct imgu_css_buffer {};

struct imgu_css_format {};

struct imgu_css_queue {};

struct imgu_css_pipe {};

/* IPU3 Camera Sub System structure */
struct imgu_css {};

/******************* css v4l *******************/
int imgu_css_init(struct device *dev, struct imgu_css *css,
		  void __iomem *base, int length);
void imgu_css_cleanup(struct imgu_css *css);
int imgu_css_fmt_try(struct imgu_css *css,
		     struct v4l2_pix_format_mplane *fmts[IPU3_CSS_QUEUES],
		     struct v4l2_rect *rects[IPU3_CSS_RECTS],
		     unsigned int pipe);
int imgu_css_fmt_set(struct imgu_css *css,
		     struct v4l2_pix_format_mplane *fmts[IPU3_CSS_QUEUES],
		     struct v4l2_rect *rects[IPU3_CSS_RECTS],
		     unsigned int pipe);
int imgu_css_meta_fmt_set(struct v4l2_meta_format *fmt);
int imgu_css_buf_queue(struct imgu_css *css, unsigned int pipe,
		       struct imgu_css_buffer *b);
struct imgu_css_buffer *imgu_css_buf_dequeue(struct imgu_css *css);
int imgu_css_start_streaming(struct imgu_css *css);
void imgu_css_stop_streaming(struct imgu_css *css);
bool imgu_css_queue_empty(struct imgu_css *css);
bool imgu_css_is_streaming(struct imgu_css *css);
bool imgu_css_pipe_queue_empty(struct imgu_css *css, unsigned int pipe);

/******************* css hw *******************/
int imgu_css_set_powerup(struct device *dev, void __iomem *base,
			 unsigned int freq);
void imgu_css_set_powerdown(struct device *dev, void __iomem *base);
int imgu_css_irq_ack(struct imgu_css *css);

/******************* set parameters ************/
int imgu_css_set_parameters(struct imgu_css *css, unsigned int pipe,
			    struct ipu3_uapi_params *set_params);

/******************* auxiliary helpers *******************/
static inline enum imgu_css_buffer_state
imgu_css_buf_state(struct imgu_css_buffer *b)
{}

/* Initialize given buffer. May be called several times. */
static inline void imgu_css_buf_init(struct imgu_css_buffer *b,
				     unsigned int queue, dma_addr_t daddr)
{}
#endif