sun8i_vi_scaler.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2017 Jernej Skrabec <jernej.skrabec@siol.net>
  3. *
  4. * This file is licensed under the terms of the GNU General Public
  5. * License version 2. This program is licensed "as is" without any
  6. * warranty of any kind, whether express or implied.
  7. */
  8. #ifndef _SUN8I_VI_SCALER_H_
  9. #define _SUN8I_VI_SCALER_H_
  10. #include <drm/drm_fourcc.h>
  11. #include "sun8i_mixer.h"
  12. /* this two macros assumes 16 fractional bits which is standard in DRM */
  13. #define SUN8I_VI_SCALER_SCALE_MIN 1
  14. #define SUN8I_VI_SCALER_SCALE_MAX ((1UL << 20) - 1)
  15. #define SUN8I_VI_SCALER_SCALE_FRAC 20
  16. #define SUN8I_VI_SCALER_PHASE_FRAC 20
  17. #define SUN8I_VI_SCALER_COEFF_COUNT 32
  18. #define SUN8I_VI_SCALER_SIZE(w, h) (((h) - 1) << 16 | ((w) - 1))
  19. #define SUN8I_SCALER_VSU_CTRL(ch) (0x20000 + 0x20000 * (ch) + 0x0)
  20. #define SUN8I_SCALER_VSU_OUTSIZE(ch) (0x20000 + 0x20000 * (ch) + 0x40)
  21. #define SUN8I_SCALER_VSU_YINSIZE(ch) (0x20000 + 0x20000 * (ch) + 0x80)
  22. #define SUN8I_SCALER_VSU_YHSTEP(ch) (0x20000 + 0x20000 * (ch) + 0x88)
  23. #define SUN8I_SCALER_VSU_YVSTEP(ch) (0x20000 + 0x20000 * (ch) + 0x8c)
  24. #define SUN8I_SCALER_VSU_YHPHASE(ch) (0x20000 + 0x20000 * (ch) + 0x90)
  25. #define SUN8I_SCALER_VSU_YVPHASE(ch) (0x20000 + 0x20000 * (ch) + 0x98)
  26. #define SUN8I_SCALER_VSU_CINSIZE(ch) (0x20000 + 0x20000 * (ch) + 0xc0)
  27. #define SUN8I_SCALER_VSU_CHSTEP(ch) (0x20000 + 0x20000 * (ch) + 0xc8)
  28. #define SUN8I_SCALER_VSU_CVSTEP(ch) (0x20000 + 0x20000 * (ch) + 0xcc)
  29. #define SUN8I_SCALER_VSU_CHPHASE(ch) (0x20000 + 0x20000 * (ch) + 0xd0)
  30. #define SUN8I_SCALER_VSU_CVPHASE(ch) (0x20000 + 0x20000 * (ch) + 0xd8)
  31. #define SUN8I_SCALER_VSU_YHCOEFF0(ch, i) \
  32. (0x20000 + 0x20000 * (ch) + 0x200 + 0x4 * (i))
  33. #define SUN8I_SCALER_VSU_YHCOEFF1(ch, i) \
  34. (0x20000 + 0x20000 * (ch) + 0x300 + 0x4 * (i))
  35. #define SUN8I_SCALER_VSU_YVCOEFF(ch, i) \
  36. (0x20000 + 0x20000 * (ch) + 0x400 + 0x4 * (i))
  37. #define SUN8I_SCALER_VSU_CHCOEFF0(ch, i) \
  38. (0x20000 + 0x20000 * (ch) + 0x600 + 0x4 * (i))
  39. #define SUN8I_SCALER_VSU_CHCOEFF1(ch, i) \
  40. (0x20000 + 0x20000 * (ch) + 0x700 + 0x4 * (i))
  41. #define SUN8I_SCALER_VSU_CVCOEFF(ch, i) \
  42. (0x20000 + 0x20000 * (ch) + 0x800 + 0x4 * (i))
  43. #define SUN8I_SCALER_VSU_CTRL_EN BIT(0)
  44. #define SUN8I_SCALER_VSU_CTRL_COEFF_RDY BIT(4)
  45. void sun8i_vi_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable);
  46. void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer,
  47. u32 src_w, u32 src_h, u32 dst_w, u32 dst_h,
  48. u32 hscale, u32 vscale, u32 hphase, u32 vphase,
  49. const struct drm_format_info *format);
  50. #endif