linux/drivers/gpu/drm/sun4i/sun4i_frontend.h

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2017 Free Electrons
 * Maxime Ripard <[email protected]>
 */

#ifndef _SUN4I_FRONTEND_H_
#define _SUN4I_FRONTEND_H_

#include <linux/list.h>
#include <linux/mod_devicetable.h>

#define SUN4I_FRONTEND_EN_REG
#define SUN4I_FRONTEND_EN_EN

#define SUN4I_FRONTEND_FRM_CTRL_REG
#define SUN4I_FRONTEND_FRM_CTRL_COEF_ACCESS_CTRL
#define SUN4I_FRONTEND_FRM_CTRL_FRM_START
#define SUN4I_FRONTEND_FRM_CTRL_COEF_RDY
#define SUN4I_FRONTEND_FRM_CTRL_REG_RDY

#define SUN4I_FRONTEND_BYPASS_REG
#define SUN4I_FRONTEND_BYPASS_CSC_EN

#define SUN4I_FRONTEND_BUF_ADDR0_REG
#define SUN4I_FRONTEND_BUF_ADDR1_REG
#define SUN4I_FRONTEND_BUF_ADDR2_REG

#define SUN4I_FRONTEND_TB_OFF0_REG
#define SUN4I_FRONTEND_TB_OFF1_REG
#define SUN4I_FRONTEND_TB_OFF2_REG
#define SUN4I_FRONTEND_TB_OFF_X1(x1)
#define SUN4I_FRONTEND_TB_OFF_Y0(y0)
#define SUN4I_FRONTEND_TB_OFF_X0(x0)

#define SUN4I_FRONTEND_LINESTRD0_REG
#define SUN4I_FRONTEND_LINESTRD1_REG
#define SUN4I_FRONTEND_LINESTRD2_REG

/*
 * In tiled mode, the stride is defined as the distance between the start of the
 * end line of the current tile and the start of the first line in the next
 * vertical tile.
 *
 * Tiles are represented in row-major order, thus the end line of current tile
 * starts at: 31 * 32 (31 lines of 32 cols), the next vertical tile starts at:
 * 32-bit-aligned-width * 32 and the distance is:
 * 32 * (32-bit-aligned-width - 31).
 */
#define SUN4I_FRONTEND_LINESTRD_TILED(stride)

#define SUN4I_FRONTEND_INPUT_FMT_REG
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_PLANAR
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_SEMIPLANAR
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV444
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV420
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV411
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UYVY
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_YUYV
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_VYUY
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_YVYU
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UV
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_VU
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX
#define SUN4I_FRONTEND_INPUT_FMT_DATA_PS_XRGB

#define SUN4I_FRONTEND_OUTPUT_FMT_REG
#define SUN4I_FRONTEND_OUTPUT_FMT_DATA_FMT_BGRX8888
#define SUN4I_FRONTEND_OUTPUT_FMT_DATA_FMT_XRGB8888

#define SUN4I_FRONTEND_CSC_COEF_REG(c)

#define SUN4I_FRONTEND_CH0_INSIZE_REG
#define SUN4I_FRONTEND_INSIZE(h, w)

#define SUN4I_FRONTEND_CH0_OUTSIZE_REG
#define SUN4I_FRONTEND_OUTSIZE(h, w)

#define SUN4I_FRONTEND_CH0_HORZFACT_REG
#define SUN4I_FRONTEND_HORZFACT(i, f)

#define SUN4I_FRONTEND_CH0_VERTFACT_REG
#define SUN4I_FRONTEND_VERTFACT(i, f)

#define SUN4I_FRONTEND_CH0_HORZPHASE_REG
#define SUN4I_FRONTEND_CH0_VERTPHASE0_REG
#define SUN4I_FRONTEND_CH0_VERTPHASE1_REG

#define SUN4I_FRONTEND_CH1_INSIZE_REG
#define SUN4I_FRONTEND_CH1_OUTSIZE_REG
#define SUN4I_FRONTEND_CH1_HORZFACT_REG
#define SUN4I_FRONTEND_CH1_VERTFACT_REG

#define SUN4I_FRONTEND_CH1_HORZPHASE_REG
#define SUN4I_FRONTEND_CH1_VERTPHASE0_REG
#define SUN4I_FRONTEND_CH1_VERTPHASE1_REG

#define SUN4I_FRONTEND_CH0_HORZCOEF0_REG(i)
#define SUN4I_FRONTEND_CH0_HORZCOEF1_REG(i)
#define SUN4I_FRONTEND_CH0_VERTCOEF_REG(i)
#define SUN4I_FRONTEND_CH1_HORZCOEF0_REG(i)
#define SUN4I_FRONTEND_CH1_HORZCOEF1_REG(i)
#define SUN4I_FRONTEND_CH1_VERTCOEF_REG(i)

struct clk;
struct device_node;
struct drm_plane;
struct regmap;
struct reset_control;

struct sun4i_frontend_data {};

struct sun4i_frontend {};

extern const struct of_device_id sun4i_frontend_of_table[];
extern const u32 sunxi_bt601_yuv2rgb_coef[12];

int sun4i_frontend_init(struct sun4i_frontend *frontend);
void sun4i_frontend_exit(struct sun4i_frontend *frontend);
int sun4i_frontend_enable(struct sun4i_frontend *frontend);

void sun4i_frontend_update_buffer(struct sun4i_frontend *frontend,
				  struct drm_plane *plane);
void sun4i_frontend_update_coord(struct sun4i_frontend *frontend,
				 struct drm_plane *plane);
int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
				  struct drm_plane *plane, uint32_t out_fmt);
bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier);

#endif /* _SUN4I_FRONTEND_H_ */