1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (C) 2017 Jernej Skrabec <jernej.skrabec@siol.net> 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * This file is licensed under the terms of the GNU General Public 5*4882a593Smuzhiyun * License version 2. This program is licensed "as is" without any 6*4882a593Smuzhiyun * warranty of any kind, whether express or implied. 7*4882a593Smuzhiyun */ 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun #ifndef _SUN8I_UI_SCALER_H_ 10*4882a593Smuzhiyun #define _SUN8I_UI_SCALER_H_ 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun #include "sun8i_mixer.h" 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun #define DE2_UI_SCALER_UNIT_SIZE 0x10000 15*4882a593Smuzhiyun #define DE3_UI_SCALER_UNIT_SIZE 0x08000 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun /* this two macros assumes 16 fractional bits which is standard in DRM */ 18*4882a593Smuzhiyun #define SUN8I_UI_SCALER_SCALE_MIN 1 19*4882a593Smuzhiyun #define SUN8I_UI_SCALER_SCALE_MAX ((1UL << 20) - 1) 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun #define SUN8I_UI_SCALER_SCALE_FRAC 20 22*4882a593Smuzhiyun #define SUN8I_UI_SCALER_PHASE_FRAC 20 23*4882a593Smuzhiyun #define SUN8I_UI_SCALER_COEFF_COUNT 16 24*4882a593Smuzhiyun #define SUN8I_UI_SCALER_SIZE(w, h) (((h) - 1) << 16 | ((w) - 1)) 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_CTRL(base) ((base) + 0x0) 27*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_OUTSIZE(base) ((base) + 0x40) 28*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_INSIZE(base) ((base) + 0x80) 29*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_HSTEP(base) ((base) + 0x88) 30*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_VSTEP(base) ((base) + 0x8c) 31*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_HPHASE(base) ((base) + 0x90) 32*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_VPHASE(base) ((base) + 0x98) 33*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_HCOEFF(base, index) ((base) + 0x200 + 0x4 * (index)) 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_CTRL_EN BIT(0) 36*4882a593Smuzhiyun #define SUN8I_SCALER_GSU_CTRL_COEFF_RDY BIT(4) 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun void sun8i_ui_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable); 39*4882a593Smuzhiyun void sun8i_ui_scaler_setup(struct sun8i_mixer *mixer, int layer, 40*4882a593Smuzhiyun u32 src_w, u32 src_h, u32 dst_w, u32 dst_h, 41*4882a593Smuzhiyun u32 hscale, u32 vscale, u32 hphase, u32 vphase); 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun #endif 44