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

/*
 * Copyright (C) 2017 Jernej Skrabec <[email protected]>
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#ifndef _SUN8I_VI_SCALER_H_
#define _SUN8I_VI_SCALER_H_

#include <drm/drm_fourcc.h>
#include "sun8i_mixer.h"

#define DE2_VI_SCALER_UNIT_BASE
#define DE2_VI_SCALER_UNIT_SIZE

#define DE3_VI_SCALER_UNIT_BASE
#define DE3_VI_SCALER_UNIT_SIZE

/* this two macros assumes 16 fractional bits which is standard in DRM */
#define SUN8I_VI_SCALER_SCALE_MIN
#define SUN8I_VI_SCALER_SCALE_MAX

#define SUN8I_VI_SCALER_SCALE_FRAC
#define SUN8I_VI_SCALER_PHASE_FRAC
#define SUN8I_VI_SCALER_COEFF_COUNT
#define SUN8I_VI_SCALER_SIZE(w, h)

#define SUN8I_SCALER_VSU_CTRL(base)
#define SUN50I_SCALER_VSU_SCALE_MODE(base)
#define SUN50I_SCALER_VSU_DIR_THR(base)
#define SUN50I_SCALER_VSU_EDGE_THR(base)
#define SUN50I_SCALER_VSU_EDSCL_CTRL(base)
#define SUN50I_SCALER_VSU_ANGLE_THR(base)
#define SUN8I_SCALER_VSU_OUTSIZE(base)
#define SUN8I_SCALER_VSU_YINSIZE(base)
#define SUN8I_SCALER_VSU_YHSTEP(base)
#define SUN8I_SCALER_VSU_YVSTEP(base)
#define SUN8I_SCALER_VSU_YHPHASE(base)
#define SUN8I_SCALER_VSU_YVPHASE(base)
#define SUN8I_SCALER_VSU_CINSIZE(base)
#define SUN8I_SCALER_VSU_CHSTEP(base)
#define SUN8I_SCALER_VSU_CVSTEP(base)
#define SUN8I_SCALER_VSU_CHPHASE(base)
#define SUN8I_SCALER_VSU_CVPHASE(base)
#define SUN8I_SCALER_VSU_YHCOEFF0(base, i)
#define SUN8I_SCALER_VSU_YHCOEFF1(base, i)
#define SUN8I_SCALER_VSU_YVCOEFF(base, i)
#define SUN8I_SCALER_VSU_CHCOEFF0(base, i)
#define SUN8I_SCALER_VSU_CHCOEFF1(base, i)
#define SUN8I_SCALER_VSU_CVCOEFF(base, i)

#define SUN8I_SCALER_VSU_CTRL_EN
#define SUN8I_SCALER_VSU_CTRL_COEFF_RDY

#define SUN50I_SCALER_VSU_SUB_ZERO_DIR_THR(x)
#define SUN50I_SCALER_VSU_ZERO_DIR_THR(x)
#define SUN50I_SCALER_VSU_HORZ_DIR_THR(x)
#define SUN50I_SCALER_VSU_VERT_DIR_THR(x)

#define SUN50I_SCALER_VSU_SCALE_MODE_UI
#define SUN50I_SCALER_VSU_SCALE_MODE_NORMAL
#define SUN50I_SCALER_VSU_SCALE_MODE_ED_SCALE

#define SUN50I_SCALER_VSU_EDGE_SHIFT(x)
#define SUN50I_SCALER_VSU_EDGE_OFFSET(x)

#define SUN50I_SCALER_VSU_ANGLE_SHIFT(x)
#define SUN50I_SCALER_VSU_ANGLE_OFFSET(x)

void sun8i_vi_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable);
void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer,
			   u32 src_w, u32 src_h, u32 dst_w, u32 dst_h,
			   u32 hscale, u32 vscale, u32 hphase, u32 vphase,
			   const struct drm_format_info *format);

#endif