Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (C) 2017 Jernej Skrabec <jernej.skrabec@siol.net>
0003  *
0004  * This file is licensed under the terms of the GNU General Public
0005  * License version 2.  This program is licensed "as is" without any
0006  * warranty of any kind, whether express or implied.
0007  */
0008 
0009 #ifndef _SUN8I_UI_SCALER_H_
0010 #define _SUN8I_UI_SCALER_H_
0011 
0012 #include "sun8i_mixer.h"
0013 
0014 #define DE2_UI_SCALER_UNIT_SIZE 0x10000
0015 #define DE3_UI_SCALER_UNIT_SIZE 0x08000
0016 
0017 /* this two macros assumes 16 fractional bits which is standard in DRM */
0018 #define SUN8I_UI_SCALER_SCALE_MIN       1
0019 #define SUN8I_UI_SCALER_SCALE_MAX       ((1UL << 20) - 1)
0020 
0021 #define SUN8I_UI_SCALER_SCALE_FRAC      20
0022 #define SUN8I_UI_SCALER_PHASE_FRAC      20
0023 #define SUN8I_UI_SCALER_COEFF_COUNT     16
0024 #define SUN8I_UI_SCALER_SIZE(w, h)      (((h) - 1) << 16 | ((w) - 1))
0025 
0026 #define SUN8I_SCALER_GSU_CTRL(base)     ((base) + 0x0)
0027 #define SUN8I_SCALER_GSU_OUTSIZE(base)      ((base) + 0x40)
0028 #define SUN8I_SCALER_GSU_INSIZE(base)       ((base) + 0x80)
0029 #define SUN8I_SCALER_GSU_HSTEP(base)        ((base) + 0x88)
0030 #define SUN8I_SCALER_GSU_VSTEP(base)        ((base) + 0x8c)
0031 #define SUN8I_SCALER_GSU_HPHASE(base)       ((base) + 0x90)
0032 #define SUN8I_SCALER_GSU_VPHASE(base)       ((base) + 0x98)
0033 #define SUN8I_SCALER_GSU_HCOEFF(base, index)    ((base) + 0x200 + 0x4 * (index))
0034 
0035 #define SUN8I_SCALER_GSU_CTRL_EN        BIT(0)
0036 #define SUN8I_SCALER_GSU_CTRL_COEFF_RDY     BIT(4)
0037 
0038 void sun8i_ui_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable);
0039 void sun8i_ui_scaler_setup(struct sun8i_mixer *mixer, int layer,
0040                u32 src_w, u32 src_h, u32 dst_w, u32 dst_h,
0041                u32 hscale, u32 vscale, u32 hphase, u32 vphase);
0042 
0043 #endif