linux/drivers/gpu/drm/rockchip/rockchip_drm_vop.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
 * Author:Mark Yao <[email protected]>
 */

#include <linux/clk.h>
#include <linux/component.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/log2.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/overflow.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>

#include <drm/drm.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_uapi.h>
#include <drm/drm_blend.h>
#include <drm/drm_crtc.h>
#include <drm/drm_flip_work.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_self_refresh_helper.h>
#include <drm/drm_vblank.h>

#ifdef CONFIG_DRM_ANALOGIX_DP
#include <drm/bridge/analogix_dp.h>
#endif

#include "rockchip_drm_drv.h"
#include "rockchip_drm_gem.h"
#include "rockchip_drm_fb.h"
#include "rockchip_drm_vop.h"
#include "rockchip_rgb.h"

#define VOP_WIN_SET(vop, win, name, v)
#define VOP_SCL_SET(vop, win, name, v)
#define VOP_SCL_SET_EXT(vop, win, name, v)

#define VOP_WIN_YUV2YUV_SET(vop, win_yuv2yuv, name, v)

#define VOP_WIN_YUV2YUV_COEFFICIENT_SET(vop, win_yuv2yuv, name, v)

#define VOP_INTR_SET_MASK(vop, name, mask, v)

#define VOP_REG_SET(vop, group, name, v)

#define VOP_HAS_REG(vop, group, name)

#define VOP_INTR_SET_TYPE(vop, name, type, v)
#define VOP_INTR_GET_TYPE(vop, name, type)

#define VOP_WIN_GET(vop, win, name)

#define VOP_WIN_HAS_REG(win, name)

#define VOP_WIN_GET_YRGBADDR(vop, win)

#define VOP_WIN_TO_INDEX(vop_win)

#define VOP_AFBC_SET(vop, name, v)

#define to_vop(x)
#define to_vop_win(x)

#define AFBC_FMT_RGB565
#define AFBC_FMT_U8U8U8U8
#define AFBC_FMT_U8U8U8

#define AFBC_TILE_16x16

/*
 * The coefficients of the following matrix are all fixed points.
 * The format is S2.10 for the 3x3 part of the matrix, and S9.12 for the offsets.
 * They are all represented in two's complement.
 */
static const uint32_t bt601_yuv2rgb[] =;

enum vop_pending {};

struct vop_win {};

struct rockchip_rgb;
struct vop {};

static inline uint32_t vop_readl(struct vop *vop, uint32_t offset)
{}

static inline uint32_t vop_read_reg(struct vop *vop, uint32_t base,
				    const struct vop_reg *reg)
{}

static void vop_reg_set(struct vop *vop, const struct vop_reg *reg,
			uint32_t _offset, uint32_t _mask, uint32_t v,
			const char *reg_name)
{}

static inline uint32_t vop_get_intr_type(struct vop *vop,
					 const struct vop_reg *reg, int type)
{}

static inline void vop_cfg_done(struct vop *vop)
{}

static bool has_rb_swapped(uint32_t version, uint32_t format)
{}

static bool has_uv_swapped(uint32_t format)
{}

static bool is_fmt_10(uint32_t format)
{}

static enum vop_data_format vop_convert_format(uint32_t format)
{}

static int vop_convert_afbc_format(uint32_t format)
{}

static uint16_t scl_vop_cal_scale(enum scale_mode mode, uint32_t src,
				  uint32_t dst, bool is_horizontal,
				  int vsu_mode, int *vskiplines)
{}

static void scl_vop_cal_scl_fac(struct vop *vop, const struct vop_win_data *win,
			     uint32_t src_w, uint32_t src_h, uint32_t dst_w,
			     uint32_t dst_h, const struct drm_format_info *info)
{}

static void vop_dsp_hold_valid_irq_enable(struct vop *vop)
{}

static void vop_dsp_hold_valid_irq_disable(struct vop *vop)
{}

/*
 * (1) each frame starts at the start of the Vsync pulse which is signaled by
 *     the "FRAME_SYNC" interrupt.
 * (2) the active data region of each frame ends at dsp_vact_end
 * (3) we should program this same number (dsp_vact_end) into dsp_line_frag_num,
 *      to get "LINE_FLAG" interrupt at the end of the active on screen data.
 *
 * VOP_INTR_CTRL0.dsp_line_frag_num = VOP_DSP_VACT_ST_END.dsp_vact_end
 * Interrupts
 * LINE_FLAG -------------------------------+
 * FRAME_SYNC ----+                         |
 *                |                         |
 *                v                         v
 *                | Vsync | Vbp |  Vactive  | Vfp |
 *                        ^     ^           ^     ^
 *                        |     |           |     |
 *                        |     |           |     |
 * dsp_vs_end ------------+     |           |     |   VOP_DSP_VTOTAL_VS_END
 * dsp_vact_start --------------+           |     |   VOP_DSP_VACT_ST_END
 * dsp_vact_end ----------------------------+     |   VOP_DSP_VACT_ST_END
 * dsp_total -------------------------------------+   VOP_DSP_VTOTAL_VS_END
 */
static bool vop_line_flag_irq_is_enabled(struct vop *vop)
{}

static void vop_line_flag_irq_enable(struct vop *vop)
{}

static void vop_line_flag_irq_disable(struct vop *vop)
{}

static int vop_core_clks_enable(struct vop *vop)
{}

static void vop_core_clks_disable(struct vop *vop)
{}

static void vop_win_disable(struct vop *vop, const struct vop_win *vop_win)
{}

static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
{}

static void rockchip_drm_set_win_enabled(struct drm_crtc *crtc, bool enabled)
{}

static void vop_crtc_atomic_disable(struct drm_crtc *crtc,
				    struct drm_atomic_state *state)
{}

static inline bool rockchip_afbc(u64 modifier)
{}

static bool rockchip_mod_supported(struct drm_plane *plane,
				   u32 format, u64 modifier)
{}

static int vop_plane_atomic_check(struct drm_plane *plane,
			   struct drm_atomic_state *state)
{}

static void vop_plane_atomic_disable(struct drm_plane *plane,
				     struct drm_atomic_state *state)
{}

static void vop_plane_atomic_update(struct drm_plane *plane,
		struct drm_atomic_state *state)
{}

static int vop_plane_atomic_async_check(struct drm_plane *plane,
					struct drm_atomic_state *state)
{}

static void vop_plane_atomic_async_update(struct drm_plane *plane,
					  struct drm_atomic_state *state)
{}

static const struct drm_plane_helper_funcs plane_helper_funcs =;

static const struct drm_plane_funcs vop_plane_funcs =;

static int vop_crtc_enable_vblank(struct drm_crtc *crtc)
{}

static void vop_crtc_disable_vblank(struct drm_crtc *crtc)
{}

static enum drm_mode_status vop_crtc_mode_valid(struct drm_crtc *crtc,
						const struct drm_display_mode *mode)
{}

static bool vop_crtc_mode_fixup(struct drm_crtc *crtc,
				const struct drm_display_mode *mode,
				struct drm_display_mode *adjusted_mode)
{}

static bool vop_dsp_lut_is_enabled(struct vop *vop)
{}

static u32 vop_lut_buffer_index(struct vop *vop)
{}

static void vop_crtc_write_gamma_lut(struct vop *vop, struct drm_crtc *crtc)
{}

static void vop_crtc_gamma_set(struct vop *vop, struct drm_crtc *crtc,
			       struct drm_crtc_state *old_state)
{}

static void vop_crtc_atomic_begin(struct drm_crtc *crtc,
				  struct drm_atomic_state *state)
{}

static void vop_crtc_atomic_enable(struct drm_crtc *crtc,
				   struct drm_atomic_state *state)
{}

static bool vop_fs_irq_is_pending(struct vop *vop)
{}

static void vop_wait_for_irq_handler(struct vop *vop)
{}

static int vop_crtc_atomic_check(struct drm_crtc *crtc,
				 struct drm_atomic_state *state)
{}

static void vop_crtc_atomic_flush(struct drm_crtc *crtc,
				  struct drm_atomic_state *state)
{}

static const struct drm_crtc_helper_funcs vop_crtc_helper_funcs =;

static struct drm_crtc_state *vop_crtc_duplicate_state(struct drm_crtc *crtc)
{}

static void vop_crtc_destroy_state(struct drm_crtc *crtc,
				   struct drm_crtc_state *state)
{}

static void vop_crtc_reset(struct drm_crtc *crtc)
{}

#ifdef CONFIG_DRM_ANALOGIX_DP
static struct drm_connector *vop_get_edp_connector(struct vop *vop)
{}

static int vop_crtc_set_crc_source(struct drm_crtc *crtc,
				   const char *source_name)
{}

static int
vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
			   size_t *values_cnt)
{}

#else
static int vop_crtc_set_crc_source(struct drm_crtc *crtc,
				   const char *source_name)
{
	return -ENODEV;
}

static int
vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name,
			   size_t *values_cnt)
{
	return -ENODEV;
}
#endif

static const struct drm_crtc_funcs vop_crtc_funcs =;

static void vop_fb_unref_worker(struct drm_flip_work *work, void *val)
{}

static void vop_handle_vblank(struct vop *vop)
{}

static irqreturn_t vop_isr(int irq, void *data)
{}

static void vop_plane_add_properties(struct drm_plane *plane,
				     const struct vop_win_data *win_data)
{}

static int vop_create_crtc(struct vop *vop)
{}

static void vop_destroy_crtc(struct vop *vop)
{}

static int vop_initial(struct vop *vop)
{}

/*
 * Initialize the vop->win array elements.
 */
static void vop_win_init(struct vop *vop)
{}

/**
 * rockchip_drm_wait_vact_end
 * @crtc: CRTC to enable line flag
 * @mstimeout: millisecond for timeout
 *
 * Wait for vact_end line flag irq or timeout.
 *
 * Returns:
 * Zero on success, negative errno on failure.
 */
int rockchip_drm_wait_vact_end(struct drm_crtc *crtc, unsigned int mstimeout)
{}
EXPORT_SYMBOL();

static int vop_bind(struct device *dev, struct device *master, void *data)
{}

static void vop_unbind(struct device *dev, struct device *master, void *data)
{}

const struct component_ops vop_component_ops =;
EXPORT_SYMBOL_GPL();